From python-checkins at python.org Thu Dec 1 03:27:42 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 01 Dec 2016 08:27:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzExMTQ1?= =?utf-8?q?=3A_Fixed_miscellaneous_issues_with_C-style_formatting_of_types?= Message-ID: <20161201082742.100015.45299.ADB01D42@psf.io> https://hg.python.org/cpython/rev/adb296e4bcaa changeset: 105401:adb296e4bcaa branch: 2.7 user: Serhiy Storchaka date: Thu Dec 01 10:27:11 2016 +0200 summary: Issue #11145: Fixed miscellaneous issues with C-style formatting of types with custom __oct__ and __hex__. files: Lib/test/test_format.py | 38 ++++++ Misc/NEWS | 3 + Objects/stringobject.c | 154 +++++++++++++++------------ 3 files changed, 126 insertions(+), 69 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -300,6 +300,44 @@ else: raise TestFailed, '"%*d"%(maxsize, -127) should fail' + def test_invalid_special_methods(self): + tests = [] + for f in 'sriduoxXfge': + tests.append(('%' + f, 1, TypeError)) + tests.append(('%#' + f, 1, TypeError)) + for r in ['', '-', 'L', '-L']: + for f in 'iduoxX': + tests.append(('%' + f, r, ValueError)) + tests.append(('%#' + f, r, ValueError)) + tests.append(('%o', 'abc', ValueError)) + for r in ('abc', '0abc', '0x', '0xL'): + for f in 'xX': + tests.append(('%' + f, r, ValueError)) + for r in ('0x', '0xL'): + for f in 'xX': + tests.append(('%#' + f, r, ValueError)) + + class X(long): + def __repr__(self): + return result + def __str__(self): + return result + def __oct__(self): + return result + def __hex__(self): + return result + def __float__(self): + return result + for fmt, result, exc in tests: + try: + fmt % X() + except exc: + pass + else: + self.fail('%s not raised for %r format of %r' % + (exc.__name__, fmt, result)) + + def test_main(): test_support.run_unittest(FormatTest) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #11145: Fixed miscellaneous issues with C-style formatting of types + with custom __oct__ and __hex__. + - Issue #24469: Fixed memory leak caused by int subclasses without overridden tp_free (e.g. C-inherited Cython classes). diff --git a/Objects/stringobject.c b/Objects/stringobject.c --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -4006,26 +4006,30 @@ _PyString_FormatLong(PyObject *val, int flags, int prec, int type, char **pbuf, int *plen) { - PyObject *result = NULL; + PyObject *result = NULL, *r1; + const char *s; char *buf; Py_ssize_t i; int sign; /* 1 if '-', else 0 */ int len; /* number of characters */ Py_ssize_t llen; - int numdigits; /* len == numnondigits + numdigits */ - int numnondigits = 0; + int numdigits; /* len == numnondigits + skipped + numdigits */ + int numnondigits, skipped, filled; + const char *method; switch (type) { case 'd': case 'u': + method = "str"; result = Py_TYPE(val)->tp_str(val); break; case 'o': + method = "oct"; result = Py_TYPE(val)->tp_as_number->nb_oct(val); break; case 'x': case 'X': - numnondigits = 2; + method = "hex"; result = Py_TYPE(val)->tp_as_number->nb_hex(val); break; default: @@ -4034,97 +4038,109 @@ if (!result) return NULL; - buf = PyString_AsString(result); - if (!buf) { + if (PyString_AsStringAndSize(result, (char **)&s, &llen) < 0) { Py_DECREF(result); return NULL; } - - /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { - PyErr_BadInternalCall(); - return NULL; - } - llen = PyString_Size(result); if (llen > INT_MAX) { PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); + Py_DECREF(result); return NULL; } len = (int)llen; - if (buf[len-1] == 'L') { + if (len > 0 && s[len-1] == 'L') { --len; - buf[len] = '\0'; + if (len == 0) + goto error; } - sign = buf[0] == '-'; - numnondigits += sign; - numdigits = len - numnondigits; - assert(numdigits > 0); - - /* Get rid of base marker unless F_ALT */ - if ((flags & F_ALT) == 0) { - /* Need to skip 0x, 0X or 0. */ - int skipped = 0; - switch (type) { - case 'o': - assert(buf[sign] == '0'); - /* If 0 is only digit, leave it alone. */ - if (numdigits > 1) { - skipped = 1; - --numdigits; - } - break; - case 'x': - case 'X': - assert(buf[sign] == '0'); - assert(buf[sign + 1] == 'x'); + sign = s[0] == '-'; + numnondigits = sign; + + /* Need to skip 0x, 0X or 0. */ + skipped = 0; + switch (type) { + case 'o': + if (s[sign] != '0') + goto error; + /* If 0 is only digit, leave it alone. */ + if ((flags & F_ALT) == 0 && len - sign > 1) + skipped = 1; + break; + case 'x': + case 'X': + if (s[sign] != '0' || (s[sign + 1] != 'x' && s[sign + 1] != 'X')) + goto error; + if ((flags & F_ALT) == 0) skipped = 2; - numnondigits -= 2; - break; - } - if (skipped) { - buf += skipped; - len -= skipped; - if (sign) - buf[0] = '-'; - } - assert(len == numnondigits + numdigits); - assert(numdigits > 0); + else + numnondigits += 2; + break; } - - /* Fill with leading zeroes to meet minimum width. */ - if (prec > numdigits) { - PyObject *r1 = PyString_FromStringAndSize(NULL, - numnondigits + prec); - char *b1; - if (!r1) { - Py_DECREF(result); + numdigits = len - numnondigits - skipped; + if (numdigits <= 0) + goto error; + + filled = prec - numdigits; + if (filled < 0) + filled = 0; + len = numnondigits + filled + numdigits; + + /* To modify the string in-place, there can only be one reference. */ + if (skipped >= filled && + PyString_CheckExact(result) && + Py_REFCNT(result) == 1 && + !PyString_CHECK_INTERNED(result)) + { + r1 = NULL; + buf = (char *)s + skipped - filled; + } + else { + r1 = result; + result = PyString_FromStringAndSize(NULL, len); + if (!result) { + Py_DECREF(r1); return NULL; } - b1 = PyString_AS_STRING(r1); - for (i = 0; i < numnondigits; ++i) - *b1++ = *buf++; - for (i = 0; i < prec - numdigits; i++) - *b1++ = '0'; + buf = PyString_AS_STRING(result); + } + + for (i = numnondigits; --i >= 0;) + buf[i] = s[i]; + buf += numnondigits; + s += numnondigits + skipped; + for (i = 0; i < filled; i++) + *buf++ = '0'; + if (r1 == NULL) { + assert(buf == s); + buf += numdigits; + } + else { for (i = 0; i < numdigits; i++) - *b1++ = *buf++; - *b1 = '\0'; - Py_DECREF(result); - result = r1; - buf = PyString_AS_STRING(result); - len = numnondigits + prec; + *buf++ = *s++; } + *buf = '\0'; + buf -= len; + Py_XDECREF(r1); /* Fix up case for hex conversions. */ if (type == 'X') { /* Need to convert all lower case letters to upper case. and need to convert 0x to 0X (and -0x to -0X). */ - for (i = 0; i < len; i++) - if (buf[i] >= 'a' && buf[i] <= 'x') + for (i = 0; i < len; i++) { + if (buf[i] >= 'a' && buf[i] <= 'z') buf[i] -= 'a'-'A'; + } } *pbuf = buf; *plen = len; return result; + +error: + PyErr_Format(PyExc_ValueError, + "%%%c format: invalid result of __%s__ (type=%.200s)", + type, method, Py_TYPE(val)->tp_name); + Py_DECREF(result); + return NULL; } Py_LOCAL_INLINE(int) -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Dec 1 04:04:59 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 01 Dec 2016 09:04:59 +0000 Subject: [Python-checkins] Daily reference leaks (20bb8babc505): sum=-2 Message-ID: <20161201090459.30611.61817.FF8610B1@psf.io> results for 20bb8babc505 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/reflogaMmChF', '--timeout', '7200'] From python-checkins at python.org Thu Dec 1 09:09:47 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 01 Dec 2016 14:09:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_WITH=5FCLEANUP=5FSTART_use?= =?utf-8?q?s_fastcall?= Message-ID: <20161201140944.105919.80820.03E4561E@psf.io> https://hg.python.org/cpython/rev/bcffa53f3453 changeset: 105403:bcffa53f3453 user: Victor Stinner date: Thu Dec 01 14:45:31 2016 +0100 summary: WITH_CLEANUP_START uses fastcall Modify WITH_CLEANUP_START bytecode: replace PyObject_CallFunctionObjArgs() with _PyObject_FastCall(). files: Python/ceval.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3135,8 +3135,12 @@ gotos should still be resumed.) */ + PyObject* stack[3]; PyObject *exit_func; - PyObject *exc = TOP(), *val = Py_None, *tb = Py_None, *res; + PyObject *exc, *val, *tb, *res; + + val = tb = Py_None; + exc = TOP(); if (exc == Py_None) { (void)POP(); exit_func = TOP(); @@ -3180,8 +3184,11 @@ assert(block->b_type == EXCEPT_HANDLER); block->b_level--; } - /* XXX Not the fastest way to call it... */ - res = PyObject_CallFunctionObjArgs(exit_func, exc, val, tb, NULL); + + stack[0] = exc; + stack[1] = val; + stack[2] = tb; + res = _PyObject_FastCall(exit_func, stack, 3); Py_DECREF(exit_func); if (res == NULL) goto error; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 09:09:47 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 01 Dec 2016 14:09:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Replace_PyObject=5FCallFun?= =?utf-8?q?ction=28=29_with_fastcall?= Message-ID: <20161201140944.100172.24555.6BC1283D@psf.io> https://hg.python.org/cpython/rev/8f258245c391 changeset: 105404:8f258245c391 user: Victor Stinner date: Thu Dec 01 14:51:04 2016 +0100 summary: Replace PyObject_CallFunction() with fastcall Replace PyObject_CallFunction(func, "O", arg) and PyObject_CallFunction(func, "O", arg, NULL) with _PyObject_CallArg1(func, arg) Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func) _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. files: Modules/_collectionsmodule.c | 2 +- Modules/_elementtree.c | 10 +++++----- Modules/pyexpat.c | 2 +- Modules/readline.c | 2 +- Objects/genobject.c | 2 +- Python/_warnings.c | 2 +- Python/codecs.c | 4 ++-- Python/marshal.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -538,7 +538,7 @@ return NULL; } if (old_deque->maxlen < 0) - return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "O", deque, NULL); + return _PyObject_CallArg1((PyObject *)(Py_TYPE(deque)), deque); else return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi", deque, old_deque->maxlen, NULL); diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2831,7 +2831,7 @@ if (errmsg == NULL) return; - error = PyObject_CallFunction(st->parseerror_obj, "O", errmsg); + error = _PyObject_CallArg1(st->parseerror_obj, errmsg); Py_DECREF(errmsg); if (!error) return; @@ -2894,7 +2894,7 @@ (TreeBuilderObject*) self->target, value ); else if (self->handle_data) - res = PyObject_CallFunction(self->handle_data, "O", value); + res = _PyObject_CallArg1(self->handle_data, value); else res = NULL; Py_XDECREF(res); @@ -3004,7 +3004,7 @@ /* shortcut */ res = treebuilder_handle_data((TreeBuilderObject*) self->target, data); else if (self->handle_data) - res = PyObject_CallFunction(self->handle_data, "O", data); + res = _PyObject_CallArg1(self->handle_data, data); else res = NULL; @@ -3031,7 +3031,7 @@ else if (self->handle_end) { tag = makeuniversal(self, tag_in); if (tag) { - res = PyObject_CallFunction(self->handle_end, "O", tag); + res = _PyObject_CallArg1(self->handle_end, tag); Py_DECREF(tag); } } @@ -3090,7 +3090,7 @@ if (self->handle_comment) { comment = PyUnicode_DecodeUTF8(comment_in, strlen(comment_in), "strict"); if (comment) { - res = PyObject_CallFunction(self->handle_comment, "O", comment); + res = _PyObject_CallArg1(self->handle_comment, comment); Py_XDECREF(res); Py_DECREF(comment); } diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -119,7 +119,7 @@ XML_ErrorString(code), lineno, column); if (buffer == NULL) return NULL; - err = PyObject_CallFunction(ErrorObject, "O", buffer); + err = _PyObject_CallArg1(ErrorObject, buffer); Py_DECREF(buffer); if ( err != NULL && set_error_attr(err, "code", code) diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -868,7 +868,7 @@ int result = 0; if (func != NULL) { PyObject *r; - r = PyObject_CallFunction(func, NULL); + r = _PyObject_CallNoArg(func); if (r == NULL) goto error; if (r == Py_None) diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1341,7 +1341,7 @@ PyObject *res; Py_INCREF(firstiter); - res = PyObject_CallFunction(firstiter, "O", o); + res = _PyObject_CallArg1(firstiter, o); Py_DECREF(firstiter); if (res == NULL) { return 1; diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -476,7 +476,7 @@ } else { text = message; - message = PyObject_CallFunction(category, "O", message); + message = _PyObject_CallArg1(category, message); if (message == NULL) goto cleanup; } diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -284,7 +284,7 @@ if (errors) ret = PyObject_CallFunction(inccodec, "s", errors); else - ret = PyObject_CallFunction(inccodec, NULL); + ret = _PyObject_CallNoArg(inccodec); Py_DECREF(inccodec); return ret; } @@ -322,7 +322,7 @@ if (errors != NULL) streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors); else - streamcodec = PyObject_CallFunction(codeccls, "O", stream); + streamcodec = _PyObject_CallArg1(codeccls, stream); Py_DECREF(codecs); return streamcodec; } diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1274,7 +1274,7 @@ if (n == 0 && type == TYPE_FROZENSET) { /* call frozenset() to get the empty frozenset singleton */ - v = PyObject_CallFunction((PyObject*)&PyFrozenSet_Type, NULL); + v = _PyObject_CallNoArg((PyObject*)&PyFrozenSet_Type); if (v == NULL) break; R_REF(v); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 09:09:47 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 01 Dec 2016 14:09:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Replace_PyObject=5FCallFun?= =?utf-8?q?ctionObjArgs=28=29_with_fastcall?= Message-ID: <20161201140944.42016.15915.ACEAB01E@psf.io> https://hg.python.org/cpython/rev/b9c9691c72c5 changeset: 105402:b9c9691c72c5 parent: 105399:20bb8babc505 user: Victor Stinner date: Thu Dec 01 14:43:22 2016 +0100 summary: Replace PyObject_CallFunctionObjArgs() with fastcall * PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507. files: Modules/_asynciomodule.c | 12 +++++------- Modules/_csv.c | 2 +- Modules/_elementtree.c | 2 +- Modules/_json.c | 12 ++++++------ Modules/_ssl.c | 2 +- Modules/_struct.c | 2 +- Modules/_testbuffer.c | 10 +++++----- Modules/gcmodule.c | 2 +- Modules/itertoolsmodule.c | 10 +++++----- Modules/mathmodule.c | 6 +++--- Modules/posixmodule.c | 4 ++-- Objects/abstract.c | 8 ++++---- Objects/bytearrayobject.c | 6 ++---- Objects/bytesobject.c | 7 +++---- Objects/complexobject.c | 2 +- Objects/descrobject.c | 2 +- Objects/dictobject.c | 3 +-- Objects/enumobject.c | 2 +- Objects/floatobject.c | 2 +- Objects/genobject.c | 4 ++-- Objects/listobject.c | 3 +-- Objects/longobject.c | 3 +-- Objects/memoryobject.c | 4 ++-- Objects/object.c | 4 ++-- Objects/odictobject.c | 2 +- Objects/typeobject.c | 6 ++---- Objects/unicodeobject.c | 10 ++++------ Objects/weakrefobject.c | 2 +- Python/_warnings.c | 2 +- Python/bltinmodule.c | 8 ++++---- Python/ceval.c | 6 +++--- Python/import.c | 2 +- Python/sysmodule.c | 2 +- 33 files changed, 71 insertions(+), 83 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -721,8 +721,7 @@ _asyncio_Future__repr_info_impl(FutureObj *self) /*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/ { - return PyObject_CallFunctionObjArgs( - asyncio_future_repr_info_func, self, NULL); + return _PyObject_CallArg1(asyncio_future_repr_info_func, self); } /*[clinic input] @@ -1535,8 +1534,7 @@ _asyncio_Task__repr_info_impl(TaskObj *self) /*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/ { - return PyObject_CallFunctionObjArgs( - asyncio_task_repr_info_func, self, NULL); + return _PyObject_CallArg1(asyncio_task_repr_info_func, self); } /*[clinic input] @@ -1896,7 +1894,7 @@ return NULL; } - PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL); + PyObject *e = _PyObject_CallArg1(et, msg); Py_DECREF(msg); if (e == NULL) { return NULL; @@ -1946,7 +1944,7 @@ if (!exc) { /* exc was not a CancelledError */ - exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL); + exc = _PyObject_CallNoArg(asyncio_CancelledError); if (!exc) { goto fail; } @@ -2176,7 +2174,7 @@ } /* Check if `result` is a generator */ - o = PyObject_CallFunctionObjArgs(inspect_isgenerator, result, NULL); + o = _PyObject_CallArg1(inspect_isgenerator, result); if (o == NULL) { /* An exception in inspect.isgenerator */ goto fail; diff --git a/Modules/_csv.c b/Modules/_csv.c --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -1259,7 +1259,7 @@ (void *) self->rec, self->rec_len); if (line == NULL) return NULL; - result = PyObject_CallFunctionObjArgs(self->writeline, line, NULL); + result = _PyObject_CallArg1(self->writeline, line); Py_DECREF(line); return result; } diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2457,7 +2457,7 @@ PyObject *event = PyTuple_Pack(2, action, node); if (event == NULL) return -1; - res = PyObject_CallFunctionObjArgs(self->events_append, event, NULL); + res = _PyObject_CallArg1(self->events_append, event); Py_DECREF(event); if (res == NULL) return -1; diff --git a/Modules/_json.c b/Modules/_json.c --- a/Modules/_json.c +++ b/Modules/_json.c @@ -813,14 +813,14 @@ *next_idx_ptr = idx + 1; if (has_pairs_hook) { - val = PyObject_CallFunctionObjArgs(s->object_pairs_hook, rval, NULL); + val = _PyObject_CallArg1(s->object_pairs_hook, rval); Py_DECREF(rval); return val; } /* if object_hook is not None: rval = object_hook(rval) */ if (s->object_hook != Py_None) { - val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL); + val = _PyObject_CallArg1(s->object_hook, rval); Py_DECREF(rval); return val; } @@ -924,7 +924,7 @@ return NULL; /* rval = parse_constant(constant) */ - rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL); + rval = _PyObject_CallArg1(s->parse_constant, cstr); idx += PyUnicode_GET_LENGTH(cstr); Py_DECREF(cstr); *next_idx_ptr = idx; @@ -1023,7 +1023,7 @@ idx - start); if (numstr == NULL) return NULL; - rval = PyObject_CallFunctionObjArgs(custom_func, numstr, NULL); + rval = _PyObject_CallArg1(custom_func, numstr); } else { Py_ssize_t i, n; @@ -1475,7 +1475,7 @@ if (s->fast_encode) return s->fast_encode(NULL, obj); else - return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL); + return _PyObject_CallArg1(s->encoder, obj); } static int @@ -1553,7 +1553,7 @@ return -1; } } - newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL); + newobj = _PyObject_CallArg1(s->defaultfn, obj); if (newobj == NULL) { Py_XDECREF(ident); return -1; diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3197,7 +3197,7 @@ PySSL_END_ALLOW_THREADS_S(pw_info->thread_state); if (pw_info->callable) { - fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL); + fn_ret = _PyObject_CallNoArg(pw_info->callable); if (!fn_ret) { /* TODO: It would be nice to move _ctypes_add_traceback() into the core python API, so we could use it to add a frame here */ diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2046,7 +2046,7 @@ return s_object; } - s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); + s_object = _PyObject_CallArg1((PyObject *)(&PyStructType), fmt); if (s_object != NULL) { if (PyDict_Size(cache) >= MAXCACHE) PyDict_Clear(cache); diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -312,7 +312,7 @@ assert(PyObject_CheckBuffer(obj)); assert(PyList_Check(items) || PyTuple_Check(items)); - structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); + structobj = _PyObject_CallArg1(Struct, format); if (structobj == NULL) return -1; @@ -406,7 +406,7 @@ if (format == NULL) goto out; - structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); + structobj = _PyObject_CallArg1(Struct, format); if (structobj == NULL) goto out; @@ -620,7 +620,7 @@ if (ndim == 0) { memcpy(item, ptr, itemsize); - x = PyObject_CallFunctionObjArgs(unpack_from, mview, NULL); + x = _PyObject_CallArg1(unpack_from, mview); if (x == NULL) return NULL; if (PyTuple_GET_SIZE(x) == 1) { @@ -696,7 +696,7 @@ if (format == NULL) goto out; - structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); + structobj = _PyObject_CallArg1(Struct, format); Py_DECREF(format); if (structobj == NULL) goto out; @@ -788,7 +788,7 @@ PyObject *tmp; Py_ssize_t itemsize; - tmp = PyObject_CallFunctionObjArgs(calcsize, format, NULL); + tmp = _PyObject_CallArg1(calcsize, format); if (tmp == NULL) return -1; itemsize = PyLong_AsSsize_t(tmp); diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -709,7 +709,7 @@ assert(callback != NULL); /* copy-paste of weakrefobject.c's handle_callback() */ - temp = PyObject_CallFunctionObjArgs(callback, wr, NULL); + temp = _PyObject_CallArg1(callback, wr); if (temp == NULL) PyErr_WriteUnraisable(callback); else diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -101,7 +101,7 @@ newkey = newvalue; Py_INCREF(newvalue); } else { - newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); + newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue); if (newkey == NULL) { Py_DECREF(newvalue); return NULL; @@ -293,7 +293,7 @@ newkey = newvalue; Py_INCREF(newvalue); } else { - newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); + newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue); if (newkey == NULL) { Py_DECREF(newvalue); return NULL; @@ -1130,7 +1130,7 @@ if (lz->start == 1) return item; - good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); + good = _PyObject_CallArg1(lz->func, item); if (good == NULL) { Py_DECREF(item); return NULL; @@ -1296,7 +1296,7 @@ if (item == NULL) return NULL; - good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); + good = _PyObject_CallArg1(lz->func, item); if (good == NULL) { Py_DECREF(item); return NULL; @@ -3824,7 +3824,7 @@ ok = PyObject_IsTrue(item); } else { PyObject *good; - good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); + good = _PyObject_CallArg1(lz->func, item); if (good == NULL) { Py_DECREF(item); return NULL; diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -951,7 +951,7 @@ return NULL; return math_1_to_int(number, ceil, 0); } - result = PyObject_CallFunctionObjArgs(method, NULL); + result = _PyObject_CallNoArg(method); Py_DECREF(method); return result; } @@ -991,7 +991,7 @@ return NULL; return math_1_to_int(number, floor, 0); } - result = PyObject_CallFunctionObjArgs(method, NULL); + result = _PyObject_CallNoArg(method); Py_DECREF(method); return result; } @@ -1542,7 +1542,7 @@ Py_TYPE(number)->tp_name); return NULL; } - result = PyObject_CallFunctionObjArgs(trunc, NULL); + result = _PyObject_CallNoArg(trunc); Py_DECREF(trunc); return result; } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -902,7 +902,7 @@ goto error_exit; } - o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL); + o = to_cleanup = _PyObject_CallNoArg(func); Py_DECREF(func); if (NULL == o) { goto error_exit; @@ -12041,7 +12041,7 @@ Py_TYPE(path)->tp_name); } - path_repr = PyObject_CallFunctionObjArgs(func, NULL); + path_repr = _PyObject_CallNoArg(func); Py_DECREF(func); if (NULL == path_repr) { return NULL; diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -103,7 +103,7 @@ } return defaultvalue; } - result = PyObject_CallFunctionObjArgs(hint, NULL); + result = _PyObject_CallNoArg(hint); Py_DECREF(hint); if (result == NULL) { if (PyErr_ExceptionMatches(PyExc_TypeError)) { @@ -716,7 +716,7 @@ } /* And call it. */ - result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL); + result = _PyObject_CallArg1(meth, format_spec); Py_DECREF(meth); if (result && !PyUnicode_Check(result)) { @@ -3011,7 +3011,7 @@ Py_DECREF(checker); return ok; } - res = PyObject_CallFunctionObjArgs(checker, inst, NULL); + res = _PyObject_CallArg1(checker, inst); Py_LeaveRecursiveCall(); Py_DECREF(checker); if (res != NULL) { @@ -3085,7 +3085,7 @@ Py_DECREF(checker); return ok; } - res = PyObject_CallFunctionObjArgs(checker, derived, NULL); + res = _PyObject_CallArg1(checker, derived); Py_LeaveRecursiveCall(); Py_DECREF(checker); if (res != NULL) { diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -98,8 +98,7 @@ PyObject * PyByteArray_FromObject(PyObject *input) { - return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type, - input, NULL); + return _PyObject_CallArg1((PyObject *)&PyByteArray_Type, input); } PyObject * @@ -1985,8 +1984,7 @@ { PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type); if (type != &PyByteArray_Type && result != NULL) { - Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, - result, NULL)); + Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result)); } return result; } diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -549,7 +549,7 @@ /* does it support __bytes__? */ func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { - result = PyObject_CallFunctionObjArgs(func, NULL); + result = _PyObject_CallNoArg(func); Py_DECREF(func); if (result == NULL) return NULL; @@ -2331,8 +2331,7 @@ { PyObject *result = _PyBytes_FromHex(string, 0); if (type != &PyBytes_Type && result != NULL) { - Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, - result, NULL)); + Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result)); } return result; } @@ -2569,7 +2568,7 @@ PyObject_Bytes doesn't do. */ func = _PyObject_LookupSpecial(x, &PyId___bytes__); if (func != NULL) { - new = PyObject_CallFunctionObjArgs(func, NULL); + new = _PyObject_CallNoArg(func); Py_DECREF(func); if (new == NULL) return NULL; diff --git a/Objects/complexobject.c b/Objects/complexobject.c --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -273,7 +273,7 @@ f = _PyObject_LookupSpecial(op, &PyId___complex__); if (f) { - PyObject *res = PyObject_CallFunctionObjArgs(f, NULL); + PyObject *res = _PyObject_CallNoArg(f); Py_DECREF(f); if (res != NULL && !PyComplex_Check(res)) { PyErr_SetString(PyExc_TypeError, diff --git a/Objects/descrobject.c b/Objects/descrobject.c --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1414,7 +1414,7 @@ return -1; } if (value == NULL) - res = PyObject_CallFunctionObjArgs(func, obj, NULL); + res = _PyObject_CallArg1(func, obj); else res = PyObject_CallFunctionObjArgs(func, obj, value, NULL); if (res == NULL) diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2066,8 +2066,7 @@ _Py_IDENTIFIER(__missing__); missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__); if (missing != NULL) { - res = PyObject_CallFunctionObjArgs(missing, - key, NULL); + res = _PyObject_CallArg1(missing, key); Py_DECREF(missing); return res; } diff --git a/Objects/enumobject.c b/Objects/enumobject.c --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -258,7 +258,7 @@ return NULL; } if (reversed_meth != NULL) { - PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL); + PyObject *res = _PyObject_CallNoArg(reversed_meth); Py_DECREF(reversed_meth); return res; } diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1439,7 +1439,7 @@ goto parse_error; result = PyFloat_FromDouble(negate ? -x : x); if (cls != (PyObject *)&PyFloat_Type && result != NULL) { - Py_SETREF(result, PyObject_CallFunctionObjArgs(cls, result, NULL)); + Py_SETREF(result, _PyObject_CallArg1(cls, result)); } return result; diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -43,7 +43,7 @@ /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); - res = PyObject_CallFunctionObjArgs(finalizer, self, NULL); + res = _PyObject_CallArg1(finalizer, self); if (res == NULL) { PyErr_WriteUnraisable(self); @@ -591,7 +591,7 @@ * * (See PyErr_SetObject/_PyErr_CreateException code for details.) */ - e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL); + e = _PyObject_CallArg1(PyExc_StopIteration, value); if (e == NULL) { return -1; } diff --git a/Objects/listobject.c b/Objects/listobject.c --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1970,8 +1970,7 @@ } for (i = 0; i < saved_ob_size ; i++) { - keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i], - NULL); + keys[i] = _PyObject_CallArg1(keyfunc, saved_ob_item[i]); if (keys[i] == NULL) { for (i=i-1 ; i>=0 ; i--) Py_DECREF(keys[i]); diff --git a/Objects/longobject.c b/Objects/longobject.c --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -5282,8 +5282,7 @@ Py_DECREF(bytes); if (type != &PyLong_Type) { - Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type, - long_obj, NULL)); + Py_SETREF(long_obj, _PyObject_CallArg1((PyObject *)type, long_obj)); } return long_obj; diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -1939,7 +1939,7 @@ if (format == NULL) goto error; - structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); + structobj = _PyObject_CallArg1(Struct, format); if (structobj == NULL) goto error; @@ -1978,7 +1978,7 @@ PyObject *v; memcpy(x->item, ptr, x->itemsize); - v = PyObject_CallFunctionObjArgs(x->unpack_from, x->mview, NULL); + v = _PyObject_CallArg1(x->unpack_from, x->mview); if (v == NULL) return NULL; diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -596,7 +596,7 @@ func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { - result = PyObject_CallFunctionObjArgs(func, NULL); + result = _PyObject_CallNoArg(func); Py_DECREF(func); if (result == NULL) return NULL; @@ -1314,7 +1314,7 @@ return NULL; } /* use __dir__ */ - result = PyObject_CallFunctionObjArgs(dirfunc, NULL); + result = _PyObject_CallNoArg(dirfunc); Py_DECREF(dirfunc); if (result == NULL) return NULL; diff --git a/Objects/odictobject.c b/Objects/odictobject.c --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1256,7 +1256,7 @@ if (PyODict_CheckExact(od)) od_copy = PyODict_New(); else - od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL); + od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od)); if (od_copy == NULL) return NULL; diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3487,9 +3487,7 @@ sorted = _PyDict_GetItemId(builtins, &PyId_sorted); if (sorted == NULL) goto error; - sorted_methods = PyObject_CallFunctionObjArgs(sorted, - abstract_methods, - NULL); + sorted_methods = _PyObject_CallArg1(sorted, abstract_methods); if (sorted_methods == NULL) goto error; comma = _PyUnicode_FromId(&comma_id); @@ -6193,7 +6191,7 @@ else attr = descr; } - res = PyObject_CallFunctionObjArgs(attr, name, NULL); + res = _PyObject_CallArg1(attr, name); Py_XDECREF(descr); return res; } diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4269,7 +4269,7 @@ if (*exceptionObject == NULL) goto onError; - restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL); + restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); if (restuple == NULL) goto onError; if (!PyTuple_Check(restuple)) { @@ -4368,7 +4368,7 @@ if (*exceptionObject == NULL) goto onError; - restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL); + restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); if (restuple == NULL) goto onError; if (!PyTuple_Check(restuple)) { @@ -6649,8 +6649,7 @@ if (*exceptionObject == NULL) return NULL; - restuple = PyObject_CallFunctionObjArgs( - *errorHandler, *exceptionObject, NULL); + restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); if (restuple == NULL) return NULL; if (!PyTuple_Check(restuple)) { @@ -8644,8 +8643,7 @@ if (*exceptionObject == NULL) return NULL; - restuple = PyObject_CallFunctionObjArgs( - *errorHandler, *exceptionObject, NULL); + restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); if (restuple == NULL) return NULL; if (!PyTuple_Check(restuple)) { diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -867,7 +867,7 @@ static void handle_callback(PyWeakReference *ref, PyObject *callback) { - PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL); + PyObject *cbresult = _PyObject_CallArg1(callback, ref); if (cbresult == NULL) PyErr_WriteUnraisable(callback); diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -415,7 +415,7 @@ if (msg == NULL) goto error; - res = PyObject_CallFunctionObjArgs(show_fn, msg, NULL); + res = _PyObject_CallArg1(show_fn, msg); Py_DECREF(show_fn); Py_DECREF(msg); diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -469,7 +469,7 @@ ok = PyObject_IsTrue(item); } else { PyObject *good; - good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); + good = _PyObject_CallArg1(lz->func, item); if (good == NULL) { Py_DECREF(item); return NULL; @@ -1519,7 +1519,7 @@ while (( item = PyIter_Next(it) )) { /* get the value from the key function */ if (keyfunc != NULL) { - val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); + val = _PyObject_CallArg1(keyfunc, item); if (val == NULL) goto Fail_it_item; } @@ -2044,9 +2044,9 @@ } if (ndigits == NULL || ndigits == Py_None) - result = PyObject_CallFunctionObjArgs(round, NULL); + result = _PyObject_CallNoArg(round); else - result = PyObject_CallFunctionObjArgs(round, ndigits, NULL); + result = _PyObject_CallArg1(round, ndigits); Py_DECREF(round); return result; } diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1756,7 +1756,7 @@ Py_DECREF(value); goto error; } - res = PyObject_CallFunctionObjArgs(hook, value, NULL); + res = _PyObject_CallArg1(hook, value); Py_DECREF(value); if (res == NULL) goto error; @@ -3062,7 +3062,7 @@ Py_DECREF(mgr); if (enter == NULL) goto error; - res = PyObject_CallFunctionObjArgs(enter, NULL); + res = _PyObject_CallNoArg(enter); Py_DECREF(enter); if (res == NULL) goto error; @@ -3096,7 +3096,7 @@ } SET_TOP(exit); Py_DECREF(mgr); - res = PyObject_CallFunctionObjArgs(enter, NULL); + res = _PyObject_CallNoArg(enter); Py_DECREF(enter); if (res == NULL) goto error; diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -985,7 +985,7 @@ PyObject *hook = PyList_GetItem(path_hooks, j); if (hook == NULL) return NULL; - importer = PyObject_CallFunctionObjArgs(hook, p, NULL); + importer = _PyObject_CallArg1(hook, p); if (importer != NULL) break; diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1098,7 +1098,7 @@ Py_TYPE(o)->tp_name); } else { - res = PyObject_CallFunctionObjArgs(method, NULL); + res = _PyObject_CallNoArg(method); Py_DECREF(method); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 11:38:02 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 01 Dec 2016 16:38:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODQz?= =?utf-8?q?=3A_Fix_asyncio_C_Task_to_handle_exceptions_=5F=5Ftraceback=5F?= =?utf-8?b?Xy4=?= Message-ID: <20161201163801.30829.19049.9716E1FE@psf.io> https://hg.python.org/cpython/rev/c9f68150cf90 changeset: 105405:c9f68150cf90 branch: 3.6 parent: 105393:2dd08b5b5ee6 user: Yury Selivanov date: Thu Dec 01 11:36:22 2016 -0500 summary: Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. files: Lib/test/test_asyncio/test_tasks.py | 15 +++++++++++++++ Misc/NEWS | 2 ++ Modules/_asynciomodule.c | 5 +++++ 3 files changed, 22 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -1952,6 +1952,21 @@ self.assertFalse(gather_task.cancelled()) self.assertEqual(gather_task.result(), [42]) + def test_exception_traceback(self): + # See http://bugs.python.org/issue28843 + + @asyncio.coroutine + def foo(): + 1 / 0 + + @asyncio.coroutine + def main(): + task = self.new_task(self.loop, foo()) + yield # skip one loop iteration + self.assertIsNotNone(task.exception().__traceback__) + + self.loop.run_until_complete(main()) + @mock.patch('asyncio.base_events.logger') def test_error_in_call_soon(self, m_log): def call_soon(callback, *args): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,6 +24,8 @@ - Issue #24142: Reading a corrupt config file left configparser in an invalid state. Original patch by Florian H?ch. +- Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. + Tools/Demos ----------- diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1042,6 +1042,8 @@ if (PyExceptionClass_Check(type)) { PyErr_NormalizeException(&type, &val, &tb); + /* No need to call PyException_SetTraceback since we'll be calling + PyErr_Restore for `type`, `val`, and `tb`. */ } else if (PyExceptionInstance_Check(type)) { if (val) { PyErr_SetString(PyExc_TypeError, @@ -2003,6 +2005,9 @@ if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) { PyErr_NormalizeException(&et, &ev, &tb); } + if (tb != NULL) { + PyException_SetTraceback(ev, tb); + } o = future_set_exception((FutureObj*)task, ev); if (!o) { /* An exception in Task.set_exception() */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 11:38:02 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 01 Dec 2016 16:38:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Merge_3=2E6_=28issue_=2328?= =?utf-8?q?843=29?= Message-ID: <20161201163801.41710.14427.0E34CCA9@psf.io> https://hg.python.org/cpython/rev/a21a8943c59e changeset: 105406:a21a8943c59e parent: 105404:8f258245c391 user: Yury Selivanov date: Thu Dec 01 11:37:47 2016 -0500 summary: Merge 3.6 (issue #28843) files: Lib/test/test_asyncio/test_tasks.py | 15 +++++++++++++++ Modules/_asynciomodule.c | 5 +++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -1952,6 +1952,21 @@ self.assertFalse(gather_task.cancelled()) self.assertEqual(gather_task.result(), [42]) + def test_exception_traceback(self): + # See http://bugs.python.org/issue28843 + + @asyncio.coroutine + def foo(): + 1 / 0 + + @asyncio.coroutine + def main(): + task = self.new_task(self.loop, foo()) + yield # skip one loop iteration + self.assertIsNotNone(task.exception().__traceback__) + + self.loop.run_until_complete(main()) + @mock.patch('asyncio.base_events.logger') def test_error_in_call_soon(self, m_log): def call_soon(callback, *args): diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1041,6 +1041,8 @@ if (PyExceptionClass_Check(type)) { PyErr_NormalizeException(&type, &val, &tb); + /* No need to call PyException_SetTraceback since we'll be calling + PyErr_Restore for `type`, `val`, and `tb`. */ } else if (PyExceptionInstance_Check(type)) { if (val) { PyErr_SetString(PyExc_TypeError, @@ -2001,6 +2003,9 @@ if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject *) et)) { PyErr_NormalizeException(&et, &ev, &tb); } + if (tb != NULL) { + PyException_SetTraceback(ev, tb); + } o = future_set_exception((FutureObj*)task, ev); if (!o) { /* An exception in Task.set_exception() */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 15:42:36 2016 From: python-checkins at python.org (matthias.klose) Date: Thu, 01 Dec 2016 20:42:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A__-_Import_late?= =?utf-8?q?st_config=2Esub_config=2Eguess_files?= Message-ID: <20161201204235.41865.73285.69CCEC2E@psf.io> https://hg.python.org/cpython/rev/7d9f1e455972 changeset: 105407:7d9f1e455972 branch: 2.7 parent: 105401:adb296e4bcaa user: doko at ubuntu.com date: Thu Dec 01 21:42:15 2016 +0100 summary: - Import latest config.sub config.guess files files: config.guess | 174 ++++++++++++++++++++++++-------------- config.sub | 75 +++++++++++---- 2 files changed, 161 insertions(+), 88 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches at gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-05-01' +timestamp='2016-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,10 +301,12 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -312,6 +314,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -326,6 +329,9 @@ c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -371,12 +377,13 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -422,13 +429,15 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -436,6 +445,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -512,6 +522,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -632,6 +645,14 @@ basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -773,6 +794,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -828,6 +852,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1004,7 +1032,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1014,7 +1042,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1360,27 +1388,28 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1512,6 +1541,8 @@ ;; -nacl*) ;; + -ios) + ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 15:43:21 2016 From: python-checkins at python.org (matthias.klose) Date: Thu, 01 Dec 2016 20:43:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A__-_Import_late?= =?utf-8?q?st_config=2Esub_config=2Eguess_files?= Message-ID: <20161201204321.123422.89602.E0D20F22@psf.io> https://hg.python.org/cpython/rev/14c80065c36e changeset: 105408:14c80065c36e branch: 3.5 parent: 105392:0bbd29405c9d user: doko at ubuntu.com date: Thu Dec 01 21:42:56 2016 +0100 summary: - Import latest config.sub config.guess files files: config.guess | 174 ++++++++++++++++++++++++-------------- config.sub | 75 +++++++++++---- 2 files changed, 161 insertions(+), 88 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches at gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-05-01' +timestamp='2016-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,10 +301,12 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -312,6 +314,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -326,6 +329,9 @@ c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -371,12 +377,13 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -422,13 +429,15 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -436,6 +445,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -512,6 +522,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -632,6 +645,14 @@ basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -773,6 +794,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -828,6 +852,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1004,7 +1032,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1014,7 +1042,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1360,27 +1388,28 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1512,6 +1541,8 @@ ;; -nacl*) ;; + -ios) + ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 1 19:15:02 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 02 Dec 2016 00:15:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_sys=2Egetandroidapilev?= =?utf-8?q?el=28=29?= Message-ID: <20161202001501.30849.10313.7469D1E7@psf.io> https://hg.python.org/cpython/rev/be70d64bbf88 changeset: 105409:be70d64bbf88 parent: 105406:a21a8943c59e user: Victor Stinner date: Fri Dec 02 01:13:46 2016 +0100 summary: Add sys.getandroidapilevel() Issue #28740: Add sys.getandroidapilevel(): return the build time API version of Android as an integer. Function only available on Android. files: Doc/library/sys.rst | 9 +++++++++ Lib/test/support/__init__.py | 9 +++++++-- Lib/test/test_sys.py | 7 +++++++ Misc/NEWS | 3 +++ Python/sysmodule.c | 18 ++++++++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -404,6 +404,15 @@ .. versionadded:: 3.4 +.. function:: getandroidapilevel() + + Return the build time API version of Android as an integer. + + Availability: Android. + + .. versionadded:: 3.7 + + .. function:: getcheckinterval() Return the interpreter's "check interval"; see :func:`setcheckinterval`. 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 @@ -766,8 +766,13 @@ is_jython = sys.platform.startswith('java') -_ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL') -is_android = (_ANDROID_API_LEVEL is not None and _ANDROID_API_LEVEL > 0) +try: + # constant used by requires_android_level() + _ANDROID_API_LEVEL = sys.getandroidapilevel() + is_android = True +except AttributeError: + # sys.getandroidapilevel() is only available on Android + is_android = False if sys.platform != 'win32': unix_shell = '/system/bin/sh' if is_android else '/bin/sh' 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 @@ -826,6 +826,13 @@ rc, stdout, stderr = assert_python_ok('-c', code) self.assertEqual(stdout.rstrip(), b'True') + @unittest.skipUnless(hasattr(sys, 'getandroidapilevel'), + 'need sys.getandroidapilevel()') + def test_getandroidapilevel(self): + level = sys.getandroidapilevel() + self.assertIsInstance(level, int) + self.assertGreater(level, 0) + @test.support.cpython_only class SizeofTest(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -160,6 +160,9 @@ Library ------- +- Issue #28740: Add sys.getandroidapilevel(): return the build time API version + of Android as an integer. Function only available on Android. + - Issue #26273: Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and :data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by Omar Sandoval. diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1363,6 +1363,20 @@ Return True if Python is exiting."); +#ifdef ANDROID_API_LEVEL +PyDoc_STRVAR(getandroidapilevel_doc, +"getandroidapilevel()\n\ +\n\ +Return the build time API version of Android as an integer."); + +static PyObject * +sys_getandroidapilevel(PyObject *self) +{ + return PyLong_FromLong(ANDROID_API_LEVEL); +} +#endif /* ANDROID_API_LEVEL */ + + static PyMethodDef sys_methods[] = { /* Might as well keep this in alphabetic order */ {"callstats", (PyCFunction)sys_callstats, METH_NOARGS, @@ -1447,6 +1461,10 @@ METH_VARARGS | METH_KEYWORDS, set_asyncgen_hooks_doc}, {"get_asyncgen_hooks", sys_get_asyncgen_hooks, METH_NOARGS, get_asyncgen_hooks_doc}, +#ifdef ANDROID_API_LEVEL + {"getandroidapilevel", (PyCFunction)sys_getandroidapilevel, METH_NOARGS, + getandroidapilevel_doc}, +#endif {NULL, NULL} /* sentinel */ }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 00:59:05 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 05:59:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4ODQ3?= =?utf-8?q?=3A_dubmdbm_no_longer_writes_the_index_file_in_when_it_is_not?= Message-ID: <20161202055905.28450.58888.9D021C30@psf.io> https://hg.python.org/cpython/rev/0516f54491cb changeset: 105410:0516f54491cb branch: 2.7 parent: 105407:7d9f1e455972 user: Serhiy Storchaka date: Fri Dec 02 07:58:42 2016 +0200 summary: Issue #28847: dubmdbm no longer writes the index file in when it is not changed and supports reading read-only files. files: Lib/dumbdbm.py | 12 ++++++++---- Lib/test/test_dumbdbm.py | 21 +++++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/Lib/dumbdbm.py b/Lib/dumbdbm.py --- a/Lib/dumbdbm.py +++ b/Lib/dumbdbm.py @@ -45,8 +45,9 @@ _os = _os # for _commit() _open = _open # for _commit() - def __init__(self, filebasename, mode): + def __init__(self, filebasename, mode, flag='c'): self._mode = mode + self._readonly = (flag == 'r') # The directory file is a text file. Each line looks like # "%r, (%d, %d)\n" % (key, pos, siz) @@ -81,8 +82,9 @@ try: f = _open(self._dirfile) except IOError: - pass + self._modified = not self._readonly else: + self._modified = False with f: for line in f: line = line.rstrip() @@ -96,7 +98,7 @@ # CAUTION: It's vital that _commit() succeed, and _commit() can # be called from __del__(). Therefore we must never reference a # global in this routine. - if self._index is None: + if self._index is None or not self._modified: return # nothing to do try: @@ -159,6 +161,7 @@ def __setitem__(self, key, val): if not type(key) == type('') == type(val): raise TypeError, "keys and values must be strings" + self._modified = True if key not in self._index: self._addkey(key, self._addval(val)) else: @@ -184,6 +187,7 @@ # (so that _commit() never gets called). def __delitem__(self, key): + self._modified = True # The blocks used by the associated value are lost. del self._index[key] # XXX It's unclear why we do a _commit() here (the code always @@ -246,4 +250,4 @@ # Turn off any bits that are set in the umask mode = mode & (~um) - return _Database(file, mode) + return _Database(file, mode, flag) diff --git a/Lib/test/test_dumbdbm.py b/Lib/test/test_dumbdbm.py --- a/Lib/test/test_dumbdbm.py +++ b/Lib/test/test_dumbdbm.py @@ -3,6 +3,7 @@ """ import os +import stat import unittest import dumbdbm from test import test_support @@ -168,6 +169,26 @@ dumbdbm.open(_fname).close() self.assertEqual(stdout.getvalue(), '') + @unittest.skipUnless(hasattr(os, 'chmod'), 'test needs os.chmod()') + def test_readonly_files(self): + dir = _fname + os.mkdir(dir) + try: + fname = os.path.join(dir, 'db') + f = dumbdbm.open(fname, 'n') + self.assertEqual(list(f.keys()), []) + for key in self._dict: + f[key] = self._dict[key] + f.close() + os.chmod(fname + ".dir", stat.S_IRUSR) + os.chmod(fname + ".dat", stat.S_IRUSR) + os.chmod(dir, stat.S_IRUSR|stat.S_IXUSR) + f = dumbdbm.open(fname, 'r') + self.assertEqual(sorted(f.keys()), sorted(self._dict)) + f.close() # don't write + finally: + test_support.rmtree(dir) + def tearDown(self): _delete_files() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28847: dubmdbm no longer writes the index file in when it is not + changed and supports reading read-only files. + - Issue #11145: Fixed miscellaneous issues with C-style formatting of types with custom __oct__ and __hex__. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 01:01:38 2016 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 02 Dec 2016 06:01:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_fix_=5FPyObject=5FCallArg1?= =?utf-8?q?_compiler_warnings_=28closes_=2328855=29?= Message-ID: <20161202060138.28774.24264.921EBDE3@psf.io> https://hg.python.org/cpython/rev/96245d4af0ca changeset: 105411:96245d4af0ca parent: 105409:be70d64bbf88 user: Benjamin Peterson date: Thu Dec 01 22:01:32 2016 -0800 summary: fix _PyObject_CallArg1 compiler warnings (closes #28855) files: Include/abstract.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -341,7 +341,7 @@ _PyObject_FastCall((func), NULL, 0) #define _PyObject_CallArg1(func, arg) \ - _PyObject_FastCall((func), &(arg), 1) + _PyObject_FastCall((func), (PyObject **)&(arg), 1) PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 01:43:03 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 06:43:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzUzMjI6?= =?utf-8?q?_Fixed_setting_=5F=5Fnew=5F=5F_to_a_PyCFunction_inside_Python_c?= =?utf-8?q?ode=2E?= Message-ID: <20161202064303.21396.81075.AB125F84@psf.io> https://hg.python.org/cpython/rev/a37cc3d926ec changeset: 105412:a37cc3d926ec branch: 2.7 parent: 105410:0516f54491cb user: Serhiy Storchaka date: Fri Dec 02 08:42:43 2016 +0200 summary: Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. files: Lib/test/test_descr.py | 97 ++++++++++++++++++++++++++++++ Misc/NEWS | 3 + Objects/typeobject.c | 28 ++++++++- 3 files changed, 127 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3,6 +3,7 @@ import sys import types import unittest +import warnings import weakref from copy import deepcopy @@ -1550,6 +1551,84 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + def test_bad_new(self): + self.assertRaises(TypeError, object.__new__) + self.assertRaises(TypeError, object.__new__, '') + self.assertRaises(TypeError, list.__new__, object) + self.assertRaises(TypeError, object.__new__, list) + class C(object): + __new__ = list.__new__ + self.assertRaises(TypeError, C) + class C(list): + __new__ = object.__new__ + self.assertRaises(TypeError, C) + + def test_object_new(self): + class A(object): + pass + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A()) + self.assertRaises(TypeError, object.__init__, A(), 5) + + class A(object): + def __init__(self, foo): + self.foo = foo + object.__new__(A) + object.__new__(A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + object.__init__(A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + def __init__(self, foo): + self.foo = foo + object.__new__(A) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always', DeprecationWarning) + a = object.__new__(A, 5) + self.assertEqual(type(a), A) + self.assertEqual(len(w), 1) + object.__init__(A(3)) + a = A(3) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always', DeprecationWarning) + object.__init__(a, 5) + self.assertEqual(a.foo, 3) + self.assertEqual(len(w), 1) + + def test_restored_object_new(self): + class A(object): + def __new__(cls, *args, **kwargs): + raise AssertionError + self.assertRaises(AssertionError, A) + class B(A): + __new__ = object.__new__ + def __init__(self, foo): + self.foo = foo + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + del B.__new__ + self.assertRaises(AssertionError, B) + del A.__new__ + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3756,6 +3835,24 @@ self.assertEqual(isinstance(d, D), True) self.assertEqual(d.foo, 1) + class C(object): + @staticmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, 1, 2)) + + class C(object): + @classmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, D, 1, 2)) + def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. + Original patch by Andreas St?hrk. + - Issue #28847: dubmdbm no longer writes the index file in when it is not changed and supports reading read-only files. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6304,7 +6304,33 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - specific = (void *)type->tp_new; + PyObject *self = PyCFunction_GET_SELF(descr); + if (!self || !PyType_Check(self)) { + /* This should never happen because + tp_new_wrapper expects a type for self. + Use slot_tp_new which will call + tp_new_wrapper which will raise an + exception. */ + specific = (void *)slot_tp_new; + } + else { + specific = ((PyTypeObject *)self)->tp_new; + /* Check that the user does not do anything + silly and unsafe like object.__new__(dict). + To do this, we check that the most derived + base that's not a heap type is this type. */ + PyTypeObject *staticbase = type->tp_base; + while (staticbase && + (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) + staticbase = staticbase->tp_base; + if (staticbase && + staticbase->tp_new != specific) + /* Seems to be unsafe, better use + slot_tp_new which will call + tp_new_wrapper which will raise an + exception if it is unsafe. */ + specific = (void *)slot_tp_new; + } /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 03:00:02 2016 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 02 Dec 2016 08:00:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_increase_test?= =?utf-8?q?=5Fsmtplib_timeouts?= Message-ID: <20161202075956.13451.89408.774C9423@psf.io> https://hg.python.org/cpython/rev/45e8454eb9bc changeset: 105413:45e8454eb9bc branch: 2.7 user: Benjamin Peterson date: Thu Dec 01 23:58:38 2016 -0800 summary: increase test_smtplib timeouts files: Lib/test/test_smtplib.py | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_smtplib.py b/Lib/test/test_smtplib.py --- a/Lib/test/test_smtplib.py +++ b/Lib/test/test_smtplib.py @@ -179,31 +179,31 @@ def testBasic(self): # connect - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) smtp.quit() def testNOOP(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) expected = (250, 'Ok') self.assertEqual(smtp.noop(), expected) smtp.quit() def testRSET(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) expected = (250, 'Ok') self.assertEqual(smtp.rset(), expected) smtp.quit() def testNotImplemented(self): # EHLO isn't implemented in DebuggingServer - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) expected = (502, 'Error: command "EHLO" not implemented') self.assertEqual(smtp.ehlo(), expected) smtp.quit() def testVRFY(self): # VRFY isn't implemented in DebuggingServer - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) expected = (502, 'Error: command "VRFY" not implemented') self.assertEqual(smtp.vrfy('nobody at nowhere.com'), expected) self.assertEqual(smtp.verify('nobody at nowhere.com'), expected) @@ -212,21 +212,21 @@ def testSecondHELO(self): # check that a second HELO returns a message that it's a duplicate # (this behavior is specific to smtpd.SMTPChannel) - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) smtp.helo() expected = (503, 'Duplicate HELO/EHLO') self.assertEqual(smtp.helo(), expected) smtp.quit() def testHELP(self): - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) self.assertEqual(smtp.help(), 'Error: command "HELP" not implemented') smtp.quit() def testSend(self): # connect and send mail m = 'A test message' - smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=3) + smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost', timeout=15) smtp.sendmail('John', 'Sally', m) # XXX(nnorwitz): this test is flaky and dies with a bad file descriptor # in asyncore. This sleep might help, but should really be fixed -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 03:02:30 2016 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 02 Dec 2016 08:02:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_declarations_t?= =?utf-8?q?o_the_top_of_the_block?= Message-ID: <20161202080229.22090.97711.9C206013@psf.io> https://hg.python.org/cpython/rev/ea904d4b3634 changeset: 105414:ea904d4b3634 branch: 2.7 user: Benjamin Peterson date: Fri Dec 02 00:02:24 2016 -0800 summary: declarations to the top of the block files: Objects/typeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6314,12 +6314,12 @@ specific = (void *)slot_tp_new; } else { + PyTypeObject *staticbase = type->tp_base; specific = ((PyTypeObject *)self)->tp_new; /* Check that the user does not do anything silly and unsafe like object.__new__(dict). To do this, we check that the most derived base that's not a heap type is this type. */ - PyTypeObject *staticbase = type->tp_base; while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) staticbase = staticbase->tp_base; -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Dec 2 04:06:07 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 02 Dec 2016 09:06:07 +0000 Subject: [Python-checkins] Daily reference leaks (be70d64bbf88): sum=4 Message-ID: <20161202090607.21590.10058.724F0DDD@psf.io> results for be70d64bbf88 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/reflogzfG8TA', '--timeout', '7200'] From python-checkins at python.org Fri Dec 2 05:35:11 2016 From: python-checkins at python.org (nick.coghlan) Date: Fri, 02 Dec 2016 10:35:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI3MTcy?= =?utf-8?q?=3A_Undeprecate_inspect=2Egetfullargspec=28=29?= Message-ID: <20161202103511.21752.89089.CB2C40D2@psf.io> https://hg.python.org/cpython/rev/14c2d93ffcb3 changeset: 105415:14c2d93ffcb3 branch: 3.6 parent: 105405:c9f68150cf90 user: Nick Coghlan date: Fri Dec 02 20:29:57 2016 +1000 summary: Issue #27172: Undeprecate inspect.getfullargspec() This is still useful for single source Python 2/3 code migrating away from inspect.getargspec(), but that wasn't clear with the documented deprecation in place. files: Doc/library/inspect.rst | 54 +++++++++++++++++++--------- Doc/whatsnew/3.6.rst | 7 +++ Lib/inspect.py | 46 ++++++++++++++---------- Misc/NEWS | 5 ++ 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -815,45 +815,65 @@ .. function:: getargspec(func) - Get the names and default values of a Python function's arguments. A + Get the names and default values of a Python function's parameters. A :term:`named tuple` ``ArgSpec(args, varargs, keywords, defaults)`` is - returned. *args* is a list of the argument names. *varargs* and *keywords* - are the names of the ``*`` and ``**`` arguments or ``None``. *defaults* is a + returned. *args* is a list of the parameter names. *varargs* and *keywords* + are the names of the ``*`` and ``**`` parameters or ``None``. *defaults* is a tuple of default argument values or ``None`` if there are no default arguments; if this tuple has *n* elements, they correspond to the last *n* elements listed in *args*. .. deprecated:: 3.0 - Use :func:`signature` and + Use :func:`getfullargspec` for an updated API that is usually a drop-in + replacement, but also correctly handles function annotations and + keyword-only parameters. + + Alternatively, use :func:`signature` and :ref:`Signature Object `, which provide a - better introspecting API for callables. + more structured introspection API for callables. .. function:: getfullargspec(func) - Get the names and default values of a Python function's arguments. A + Get the names and default values of a Python function's parameters. A :term:`named tuple` is returned: ``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)`` - *args* is a list of the argument names. *varargs* and *varkw* are the names - of the ``*`` and ``**`` arguments or ``None``. *defaults* is an *n*-tuple - of the default values of the last *n* arguments, or ``None`` if there are no - default arguments. *kwonlyargs* is a list of - keyword-only argument names. *kwonlydefaults* is a dictionary mapping names - from kwonlyargs to defaults. *annotations* is a dictionary mapping argument - names to annotations. + *args* is a list of the positional parameter names. + *varargs* is the name of the ``*`` parameter or ``None`` if arbitrary + positional arguments are not accepted. + *varkw* is the name of the ``**`` parameter or ``None`` if arbitrary + keyword arguments are not accepted. + *defaults* is an *n*-tuple of default argument values corresponding to the + last *n* positional parameters, or ``None`` if there are no such defaults + defined. + *kwonlyargs* is a list of keyword-only parameter names. + *kwonlydefaults* is a dictionary mapping parameter names from *kwonlyargs* + to the default values used if no argument is supplied. + *annotations* is a dictionary mapping parameter names to annotations. + The special key ``"return"`` is used to report the function return value + annotation (if any). + + Note that :func:`signature` and + :ref:`Signature Object ` provide the recommended + API for callable introspection, and support additional behaviours (like + positional-only arguments) that are sometimes encountered in extension module + APIs. This function is retained primarily for use in code that needs to + maintain compatibility with the Python 2 ``inspect`` module API. .. versionchanged:: 3.4 This function is now based on :func:`signature`, but still ignores ``__wrapped__`` attributes and includes the already bound first parameter in the signature output for bound methods. - .. deprecated:: 3.5 - Use :func:`signature` and - :ref:`Signature Object `, which provide a - better introspecting API for callables. + .. versionchanged:: 3.6 + This method was previously documented as deprecated in favour of + :func:`signature` in Python 3.5, but that decision has been reversed + in order to restore a clearly supported standard interface for + single-source Python 2/3 code migrating away from the legacy + :func:`getargspec` API. .. function:: getargvalues(frame) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -1155,6 +1155,13 @@ generator expression scopes as if they were positional-only parameters called ``implicit0``. (Contributed by Jelle Zijlstra in :issue:`19611`.) +To reduce code churn when upgrading from Python 2.7 and the legacy +:func:`inspect.getargspec` API, the previously documented deprecation of +:func:`inspect.getfullargspec` has been reversed. While this function is +convenient for single/source Python 2/3 code bases, the richer +:func:`inspect.signature` interface remains the recommended approach for new +code. (Contributed by Nick Coghlan in :issue:`27172`) + json ---- diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1019,24 +1019,30 @@ ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults') def getargspec(func): - """Get the names and default values of a function's arguments. + """Get the names and default values of a function's parameters. A tuple of four things is returned: (args, varargs, keywords, defaults). 'args' is a list of the argument names, including keyword-only argument names. - 'varargs' and 'keywords' are the names of the * and ** arguments or None. - 'defaults' is an n-tuple of the default values of the last n arguments. - - Use the getfullargspec() API for Python 3 code, as annotations - and keyword arguments are supported. getargspec() will raise ValueError - if the func has either annotations or keyword arguments. + 'varargs' and 'keywords' are the names of the * and ** parameters or None. + 'defaults' is an n-tuple of the default values of the last n parameters. + + This function is deprecated, as it does not support annotations or + keyword-only parameters and will raise ValueError if either is present + on the supplied callable. + + For a more structured introspection API, use inspect.signature() instead. + + Alternatively, use getfullargspec() for an API with a similar namedtuple + based interface, but full support for annotations and keyword-only + parameters. """ warnings.warn("inspect.getargspec() is deprecated, " - "use inspect.signature() instead", DeprecationWarning, - stacklevel=2) + "use inspect.signature() or inspect.getfullargspec()", + DeprecationWarning, stacklevel=2) args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, ann = \ getfullargspec(func) if kwonlyargs or ann: - raise ValueError("Function has keyword-only arguments or annotations" + raise ValueError("Function has keyword-only parameters or annotations" ", use getfullargspec() API which can support them") return ArgSpec(args, varargs, varkw, defaults) @@ -1044,18 +1050,20 @@ 'args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations') def getfullargspec(func): - """Get the names and default values of a callable object's arguments. + """Get the names and default values of a callable object's parameters. A tuple of seven things is returned: - (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults annotations). - 'args' is a list of the argument names. - 'varargs' and 'varkw' are the names of the * and ** arguments or None. - 'defaults' is an n-tuple of the default values of the last n arguments. - 'kwonlyargs' is a list of keyword-only argument names. + (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations). + 'args' is a list of the parameter names. + 'varargs' and 'varkw' are the names of the * and ** parameters or None. + 'defaults' is an n-tuple of the default values of the last n parameters. + 'kwonlyargs' is a list of keyword-only parameter names. 'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults. - 'annotations' is a dictionary mapping argument names to annotations. - - This function is deprecated, use inspect.signature() instead. + 'annotations' is a dictionary mapping parameter names to annotations. + + Notable differences from inspect.signature(): + - the "self" parameter is always reported, even for bound methods + - wrapper chains defined by __wrapped__ *not* unwrapped automatically """ try: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,11 @@ Library ------- +- Issue #27172: To assist with upgrades from 2.7, the previously documented + deprecation of ``inspect.getfullargspec()`` has been reversed. This decision + may be revisited again after the Python 2.7 branch is no longer officially + supported. + - Issue #24142: Reading a corrupt config file left configparser in an invalid state. Original patch by Florian H?ch. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 14:39:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 19:39:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20161202193902.28103.5684.4A896214@psf.io> https://hg.python.org/cpython/rev/8e1f7bc92392 changeset: 105416:8e1f7bc92392 parent: 105411:96245d4af0ca parent: 105405:c9f68150cf90 user: Serhiy Storchaka date: Fri Dec 02 21:33:05 2016 +0200 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 14:39:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 19:39:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgZnJvbSAzLjYu?= Message-ID: <20161202193902.28245.492.96A2B625@psf.io> https://hg.python.org/cpython/rev/dd4c420b8e66 changeset: 105417:dd4c420b8e66 parent: 105416:8e1f7bc92392 parent: 105415:14c2d93ffcb3 user: Serhiy Storchaka date: Fri Dec 02 21:38:46 2016 +0200 summary: Merge from 3.6. files: Doc/library/inspect.rst | 54 +++++++++++++++++++--------- Doc/whatsnew/3.6.rst | 7 +++ Lib/inspect.py | 46 ++++++++++++++---------- Misc/NEWS | 5 ++ 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -815,45 +815,65 @@ .. function:: getargspec(func) - Get the names and default values of a Python function's arguments. A + Get the names and default values of a Python function's parameters. A :term:`named tuple` ``ArgSpec(args, varargs, keywords, defaults)`` is - returned. *args* is a list of the argument names. *varargs* and *keywords* - are the names of the ``*`` and ``**`` arguments or ``None``. *defaults* is a + returned. *args* is a list of the parameter names. *varargs* and *keywords* + are the names of the ``*`` and ``**`` parameters or ``None``. *defaults* is a tuple of default argument values or ``None`` if there are no default arguments; if this tuple has *n* elements, they correspond to the last *n* elements listed in *args*. .. deprecated:: 3.0 - Use :func:`signature` and + Use :func:`getfullargspec` for an updated API that is usually a drop-in + replacement, but also correctly handles function annotations and + keyword-only parameters. + + Alternatively, use :func:`signature` and :ref:`Signature Object `, which provide a - better introspecting API for callables. + more structured introspection API for callables. .. function:: getfullargspec(func) - Get the names and default values of a Python function's arguments. A + Get the names and default values of a Python function's parameters. A :term:`named tuple` is returned: ``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)`` - *args* is a list of the argument names. *varargs* and *varkw* are the names - of the ``*`` and ``**`` arguments or ``None``. *defaults* is an *n*-tuple - of the default values of the last *n* arguments, or ``None`` if there are no - default arguments. *kwonlyargs* is a list of - keyword-only argument names. *kwonlydefaults* is a dictionary mapping names - from kwonlyargs to defaults. *annotations* is a dictionary mapping argument - names to annotations. + *args* is a list of the positional parameter names. + *varargs* is the name of the ``*`` parameter or ``None`` if arbitrary + positional arguments are not accepted. + *varkw* is the name of the ``**`` parameter or ``None`` if arbitrary + keyword arguments are not accepted. + *defaults* is an *n*-tuple of default argument values corresponding to the + last *n* positional parameters, or ``None`` if there are no such defaults + defined. + *kwonlyargs* is a list of keyword-only parameter names. + *kwonlydefaults* is a dictionary mapping parameter names from *kwonlyargs* + to the default values used if no argument is supplied. + *annotations* is a dictionary mapping parameter names to annotations. + The special key ``"return"`` is used to report the function return value + annotation (if any). + + Note that :func:`signature` and + :ref:`Signature Object ` provide the recommended + API for callable introspection, and support additional behaviours (like + positional-only arguments) that are sometimes encountered in extension module + APIs. This function is retained primarily for use in code that needs to + maintain compatibility with the Python 2 ``inspect`` module API. .. versionchanged:: 3.4 This function is now based on :func:`signature`, but still ignores ``__wrapped__`` attributes and includes the already bound first parameter in the signature output for bound methods. - .. deprecated:: 3.5 - Use :func:`signature` and - :ref:`Signature Object `, which provide a - better introspecting API for callables. + .. versionchanged:: 3.6 + This method was previously documented as deprecated in favour of + :func:`signature` in Python 3.5, but that decision has been reversed + in order to restore a clearly supported standard interface for + single-source Python 2/3 code migrating away from the legacy + :func:`getargspec` API. .. function:: getargvalues(frame) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -1155,6 +1155,13 @@ generator expression scopes as if they were positional-only parameters called ``implicit0``. (Contributed by Jelle Zijlstra in :issue:`19611`.) +To reduce code churn when upgrading from Python 2.7 and the legacy +:func:`inspect.getargspec` API, the previously documented deprecation of +:func:`inspect.getfullargspec` has been reversed. While this function is +convenient for single/source Python 2/3 code bases, the richer +:func:`inspect.signature` interface remains the recommended approach for new +code. (Contributed by Nick Coghlan in :issue:`27172`) + json ---- diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1019,24 +1019,30 @@ ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults') def getargspec(func): - """Get the names and default values of a function's arguments. + """Get the names and default values of a function's parameters. A tuple of four things is returned: (args, varargs, keywords, defaults). 'args' is a list of the argument names, including keyword-only argument names. - 'varargs' and 'keywords' are the names of the * and ** arguments or None. - 'defaults' is an n-tuple of the default values of the last n arguments. - - Use the getfullargspec() API for Python 3 code, as annotations - and keyword arguments are supported. getargspec() will raise ValueError - if the func has either annotations or keyword arguments. + 'varargs' and 'keywords' are the names of the * and ** parameters or None. + 'defaults' is an n-tuple of the default values of the last n parameters. + + This function is deprecated, as it does not support annotations or + keyword-only parameters and will raise ValueError if either is present + on the supplied callable. + + For a more structured introspection API, use inspect.signature() instead. + + Alternatively, use getfullargspec() for an API with a similar namedtuple + based interface, but full support for annotations and keyword-only + parameters. """ warnings.warn("inspect.getargspec() is deprecated, " - "use inspect.signature() instead", DeprecationWarning, - stacklevel=2) + "use inspect.signature() or inspect.getfullargspec()", + DeprecationWarning, stacklevel=2) args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, ann = \ getfullargspec(func) if kwonlyargs or ann: - raise ValueError("Function has keyword-only arguments or annotations" + raise ValueError("Function has keyword-only parameters or annotations" ", use getfullargspec() API which can support them") return ArgSpec(args, varargs, varkw, defaults) @@ -1044,18 +1050,20 @@ 'args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations') def getfullargspec(func): - """Get the names and default values of a callable object's arguments. + """Get the names and default values of a callable object's parameters. A tuple of seven things is returned: - (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults annotations). - 'args' is a list of the argument names. - 'varargs' and 'varkw' are the names of the * and ** arguments or None. - 'defaults' is an n-tuple of the default values of the last n arguments. - 'kwonlyargs' is a list of keyword-only argument names. + (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations). + 'args' is a list of the parameter names. + 'varargs' and 'varkw' are the names of the * and ** parameters or None. + 'defaults' is an n-tuple of the default values of the last n parameters. + 'kwonlyargs' is a list of keyword-only parameter names. 'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults. - 'annotations' is a dictionary mapping argument names to annotations. - - This function is deprecated, use inspect.signature() instead. + 'annotations' is a dictionary mapping parameter names to annotations. + + Notable differences from inspect.signature(): + - the "self" parameter is always reported, even for bound methods + - wrapper chains defined by __wrapped__ *not* unwrapped automatically """ try: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -160,6 +160,11 @@ Library ------- +- Issue #27172: To assist with upgrades from 2.7, the previously documented + deprecation of ``inspect.getfullargspec()`` has been reversed. This decision + may be revisited again after the Python 2.7 branch is no longer officially + supported. + - Issue #28740: Add sys.getandroidapilevel(): return the build time API version of Android as an integer. Function only available on Android. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 16:34:52 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 21:34:52 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxODE4?= =?utf-8?q?=3A_Fixed_references_to_classes_that_have_names_matching_with_m?= =?utf-8?q?odule?= Message-ID: <20161202213452.30564.79746.0B75ED3F@psf.io> https://hg.python.org/cpython/rev/d64e37b9204e changeset: 105419:d64e37b9204e branch: 3.5 parent: 105392:0bbd29405c9d user: Serhiy Storchaka date: Fri Dec 02 23:13:53 2016 +0200 summary: Issue #21818: Fixed references to classes that have names matching with module names. files: Doc/library/array.rst | 2 +- Doc/library/datetime.rst | 6 +++--- Doc/library/mmap.rst | 8 ++++---- Doc/library/netrc.rst | 10 +++++----- Doc/library/socket.rst | 2 +- Doc/whatsnew/2.3.rst | 12 ++++++------ Doc/whatsnew/2.4.rst | 2 +- Doc/whatsnew/2.5.rst | 6 +++--- Doc/whatsnew/2.6.rst | 12 ++++++------ 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -254,7 +254,7 @@ empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a list of numbers. The string is guaranteed to be able to be converted back to an array with the same type and value using :func:`eval`, so long as the -:func:`array` function has been imported using ``from array import array``. +:class:`~array.array` class has been imported using ``from array import array``. Examples:: array('l') diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1296,8 +1296,8 @@ .. _datetime-time: -:class:`time` Objects ---------------------- +:class:`.time` Objects +---------------------- A time object represents a (local) time of day, independent of any particular day, and subject to adjustment via a :class:`tzinfo` object. @@ -1382,7 +1382,7 @@ ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. .. versionchanged:: 3.3 - Equality comparisons between naive and aware :class:`time` instances + Equality comparisons between naive and aware :class:`~datetime.time` instances don't raise :exc:`TypeError`. * hash, use as dict key diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -14,7 +14,7 @@ slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at the current file position, and :meth:`seek` through the file to different positions. -A memory-mapped file is created by the :class:`mmap` constructor, which is +A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is different on Unix and on Windows. In either case you must provide a file descriptor for a file opened for update. If you wish to map an existing Python file object, use its :meth:`fileno` method to obtain the correct value for the @@ -70,7 +70,7 @@ **(Unix version)** Maps *length* bytes from the file specified by the file descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the maximum length of the map will be the current size of the file when - :class:`mmap` is called. + :class:`~mmap.mmap` is called. *flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a private copy-on-write mapping, so changes to the contents of the mmap @@ -97,7 +97,7 @@ by the descriptor *fileno* is internally automatically synchronized with physical backing store on Mac OS X and OpenVMS. - This example shows a simple way of using :class:`mmap`:: + This example shows a simple way of using :class:`~mmap.mmap`:: import mmap @@ -122,7 +122,7 @@ mm.close() - :class:`mmap` can also be used as a context manager in a :keyword:`with` + :class:`~mmap.mmap` can also be used as a context manager in a :keyword:`with` statement.:: import mmap diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -12,13 +12,13 @@ -------------- -The :class:`netrc` class parses and encapsulates the netrc file format used by +The :class:`~netrc.netrc` class parses and encapsulates the netrc file format used by the Unix :program:`ftp` program and other FTP clients. .. class:: netrc([file]) - A :class:`netrc` instance or subclass instance encapsulates data from a netrc + A :class:`~netrc.netrc` instance or subclass instance encapsulates data from a netrc file. The initialization argument, if present, specifies the file to parse. If no argument is given, the file :file:`.netrc` in the user's home directory will be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic @@ -35,7 +35,7 @@ .. exception:: NetrcParseError - Exception raised by the :class:`netrc` class when syntactical errors are + Exception raised by the :class:`~netrc.netrc` class when syntactical errors are encountered in source text. Instances of this exception provide three interesting attributes: :attr:`msg` is a textual explanation of the error, :attr:`filename` is the name of the source file, and :attr:`lineno` gives the @@ -47,7 +47,7 @@ netrc Objects ------------- -A :class:`netrc` instance has the following methods: +A :class:`~netrc.netrc` instance has the following methods: .. method:: netrc.authenticators(host) @@ -63,7 +63,7 @@ Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.) -Instances of :class:`netrc` have public instance variables: +Instances of :class:`~netrc.netrc` have public instance variables: .. attribute:: netrc.hosts diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1367,7 +1367,7 @@ :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead. Socket objects also have these (read-only) attributes that correspond to the -values given to the :class:`socket` constructor. +values given to the :class:`~socket.socket` constructor. .. attribute:: socket.family diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1683,13 +1683,13 @@ fancy features, and just stick to the basics of representing time. The three primary types are: :class:`date`, representing a day, month, and year; -:class:`time`, consisting of hour, minute, and second; and :class:`datetime`, -which contains all the attributes of both :class:`date` and :class:`time`. +:class:`~datetime.time`, consisting of hour, minute, and second; and :class:`~datetime.datetime`, +which contains all the attributes of both :class:`date` and :class:`~datetime.time`. There's also a :class:`timedelta` class representing differences between two points in time, and time zone logic is implemented by classes inheriting from the abstract :class:`tzinfo` class. -You can create instances of :class:`date` and :class:`time` by either supplying +You can create instances of :class:`date` and :class:`~datetime.time` by either supplying keyword arguments to the appropriate constructor, e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a number of class methods. For example, the :meth:`date.today` class method returns the @@ -1708,7 +1708,7 @@ '2002 30 Dec' The :meth:`replace` method allows modifying one or more fields of a -:class:`date` or :class:`datetime` instance, returning a new instance:: +:class:`date` or :class:`~datetime.datetime` instance, returning a new instance:: >>> d = datetime.datetime.now() >>> d @@ -1718,11 +1718,11 @@ >>> Instances can be compared, hashed, and converted to strings (the result is the -same as that of :meth:`isoformat`). :class:`date` and :class:`datetime` +same as that of :meth:`isoformat`). :class:`date` and :class:`~datetime.datetime` instances can be subtracted from each other, and added to :class:`timedelta` instances. The largest missing feature is that there's no standard library support for parsing strings and getting back a :class:`date` or -:class:`datetime`. +:class:`~datetime.datetime`. For more information, refer to the module's reference documentation. (Contributed by Tim Peters.) diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1523,7 +1523,7 @@ empty list instead of raising a :exc:`TypeError` exception if called with no arguments. -* You can no longer compare the :class:`date` and :class:`datetime` instances +* You can no longer compare the :class:`date` and :class:`~datetime.datetime` instances provided by the :mod:`datetime` module. Two instances of different classes will now always be unequal, and relative comparisons (``<``, ``>``) will raise a :exc:`TypeError`. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1307,7 +1307,7 @@ (Contributed by Skip Montanaro and Andrew McNamara.) -* The :class:`datetime` class in the :mod:`datetime` module now has a +* The :class:`~datetime.datetime` class in the :mod:`datetime` module now has a ``strptime(string, format)`` method for parsing date strings, contributed by Josh Spoerri. It uses the same format characters as :func:`time.strptime` and :func:`time.strftime`:: @@ -1497,7 +1497,7 @@ * The :mod:`pyexpat` module now uses version 2.0 of the Expat parser. (Contributed by Trent Mick.) -* The :class:`Queue` class provided by the :mod:`Queue` module gained two new +* The :class:`~queue.Queue` class provided by the :mod:`Queue` module gained two new methods. :meth:`join` blocks until all items in the queue have been retrieved and all processing work on the items have been completed. Worker threads call the other new method, :meth:`task_done`, to signal that processing for an item @@ -1649,7 +1649,7 @@ .. Patch #754022 -* The :mod:`xmlrpclib` module now supports returning :class:`datetime` objects +* The :mod:`xmlrpclib` module now supports returning :class:`~datetime.datetime` objects for the XML-RPC date type. Supply ``use_datetime=True`` to the :func:`loads` function or the :class:`Unmarshaller` class to enable this feature. (Contributed by Skip Montanaro.) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -613,10 +613,10 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the result of the factorial. -The :class:`Queue` object is stored in a global variable. +A :class:`~queue.Queue` is used to communicate the result of the factorial. +The :class:`~queue.Queue` object is stored in a global variable. The child process will use the value of the variable when the child -was created; because it's a :class:`Queue`, parent and child can use +was created; because it's a :class:`~queue.Queue`, parent and child can use the object to communicate. (If the parent were to change the value of the global variable, the child's value would be unaffected, and vice versa.) @@ -2131,7 +2131,7 @@ (Contributed by Christian Heimes and Mark Dickinson.) -* :class:`mmap` objects now have a :meth:`rfind` method that searches for a +* :class:`~mmap.mmap` objects now have a :meth:`rfind` method that searches for a substring beginning at the end of the string and searching backwards. The :meth:`find` method also gained an *end* parameter giving an index at which to stop searching. @@ -2630,7 +2630,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented by using ```` in XML-RPC responses @@ -3283,7 +3283,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) * (3.0-warning mode) The :class:`Exception` class now warns -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 16:34:52 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 21:34:52 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2321818=3A_Fixed_references_to_classes_that_have_names_?= =?utf-8?q?matching_with_module?= Message-ID: <20161202213452.28124.44720.C4114E9E@psf.io> https://hg.python.org/cpython/rev/62c9a89a2103 changeset: 105420:62c9a89a2103 branch: 3.6 parent: 105415:14c2d93ffcb3 parent: 105419:d64e37b9204e user: Serhiy Storchaka date: Fri Dec 02 23:15:22 2016 +0200 summary: Issue #21818: Fixed references to classes that have names matching with module names. files: Doc/library/array.rst | 2 +- Doc/library/datetime.rst | 6 +++--- Doc/library/mmap.rst | 8 ++++---- Doc/library/netrc.rst | 10 +++++----- Doc/library/socket.rst | 2 +- Doc/whatsnew/2.3.rst | 12 ++++++------ Doc/whatsnew/2.4.rst | 2 +- Doc/whatsnew/2.5.rst | 6 +++--- Doc/whatsnew/2.6.rst | 12 ++++++------ 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -254,7 +254,7 @@ empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a list of numbers. The string is guaranteed to be able to be converted back to an array with the same type and value using :func:`eval`, so long as the -:func:`array` function has been imported using ``from array import array``. +:class:`~array.array` class has been imported using ``from array import array``. Examples:: array('l') diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1368,8 +1368,8 @@ .. _datetime-time: -:class:`time` Objects ---------------------- +:class:`.time` Objects +---------------------- A time object represents a (local) time of day, independent of any particular day, and subject to adjustment via a :class:`tzinfo` object. @@ -1466,7 +1466,7 @@ ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. .. versionchanged:: 3.3 - Equality comparisons between naive and aware :class:`time` instances + Equality comparisons between naive and aware :class:`~datetime.time` instances don't raise :exc:`TypeError`. * hash, use as dict key diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -14,7 +14,7 @@ slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at the current file position, and :meth:`seek` through the file to different positions. -A memory-mapped file is created by the :class:`mmap` constructor, which is +A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is different on Unix and on Windows. In either case you must provide a file descriptor for a file opened for update. If you wish to map an existing Python file object, use its :meth:`fileno` method to obtain the correct value for the @@ -70,7 +70,7 @@ **(Unix version)** Maps *length* bytes from the file specified by the file descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the maximum length of the map will be the current size of the file when - :class:`mmap` is called. + :class:`~mmap.mmap` is called. *flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a private copy-on-write mapping, so changes to the contents of the mmap @@ -97,7 +97,7 @@ by the descriptor *fileno* is internally automatically synchronized with physical backing store on Mac OS X and OpenVMS. - This example shows a simple way of using :class:`mmap`:: + This example shows a simple way of using :class:`~mmap.mmap`:: import mmap @@ -122,7 +122,7 @@ mm.close() - :class:`mmap` can also be used as a context manager in a :keyword:`with` + :class:`~mmap.mmap` can also be used as a context manager in a :keyword:`with` statement.:: import mmap diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -12,13 +12,13 @@ -------------- -The :class:`netrc` class parses and encapsulates the netrc file format used by +The :class:`~netrc.netrc` class parses and encapsulates the netrc file format used by the Unix :program:`ftp` program and other FTP clients. .. class:: netrc([file]) - A :class:`netrc` instance or subclass instance encapsulates data from a netrc + A :class:`~netrc.netrc` instance or subclass instance encapsulates data from a netrc file. The initialization argument, if present, specifies the file to parse. If no argument is given, the file :file:`.netrc` in the user's home directory will be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic @@ -35,7 +35,7 @@ .. exception:: NetrcParseError - Exception raised by the :class:`netrc` class when syntactical errors are + Exception raised by the :class:`~netrc.netrc` class when syntactical errors are encountered in source text. Instances of this exception provide three interesting attributes: :attr:`msg` is a textual explanation of the error, :attr:`filename` is the name of the source file, and :attr:`lineno` gives the @@ -47,7 +47,7 @@ netrc Objects ------------- -A :class:`netrc` instance has the following methods: +A :class:`~netrc.netrc` instance has the following methods: .. method:: netrc.authenticators(host) @@ -63,7 +63,7 @@ Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.) -Instances of :class:`netrc` have public instance variables: +Instances of :class:`~netrc.netrc` have public instance variables: .. attribute:: netrc.hosts diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1429,7 +1429,7 @@ :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead. Socket objects also have these (read-only) attributes that correspond to the -values given to the :class:`socket` constructor. +values given to the :class:`~socket.socket` constructor. .. attribute:: socket.family diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1683,13 +1683,13 @@ fancy features, and just stick to the basics of representing time. The three primary types are: :class:`date`, representing a day, month, and year; -:class:`time`, consisting of hour, minute, and second; and :class:`datetime`, -which contains all the attributes of both :class:`date` and :class:`time`. +:class:`~datetime.time`, consisting of hour, minute, and second; and :class:`~datetime.datetime`, +which contains all the attributes of both :class:`date` and :class:`~datetime.time`. There's also a :class:`timedelta` class representing differences between two points in time, and time zone logic is implemented by classes inheriting from the abstract :class:`tzinfo` class. -You can create instances of :class:`date` and :class:`time` by either supplying +You can create instances of :class:`date` and :class:`~datetime.time` by either supplying keyword arguments to the appropriate constructor, e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a number of class methods. For example, the :meth:`date.today` class method returns the @@ -1708,7 +1708,7 @@ '2002 30 Dec' The :meth:`replace` method allows modifying one or more fields of a -:class:`date` or :class:`datetime` instance, returning a new instance:: +:class:`date` or :class:`~datetime.datetime` instance, returning a new instance:: >>> d = datetime.datetime.now() >>> d @@ -1718,11 +1718,11 @@ >>> Instances can be compared, hashed, and converted to strings (the result is the -same as that of :meth:`isoformat`). :class:`date` and :class:`datetime` +same as that of :meth:`isoformat`). :class:`date` and :class:`~datetime.datetime` instances can be subtracted from each other, and added to :class:`timedelta` instances. The largest missing feature is that there's no standard library support for parsing strings and getting back a :class:`date` or -:class:`datetime`. +:class:`~datetime.datetime`. For more information, refer to the module's reference documentation. (Contributed by Tim Peters.) diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1523,7 +1523,7 @@ empty list instead of raising a :exc:`TypeError` exception if called with no arguments. -* You can no longer compare the :class:`date` and :class:`datetime` instances +* You can no longer compare the :class:`date` and :class:`~datetime.datetime` instances provided by the :mod:`datetime` module. Two instances of different classes will now always be unequal, and relative comparisons (``<``, ``>``) will raise a :exc:`TypeError`. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1307,7 +1307,7 @@ (Contributed by Skip Montanaro and Andrew McNamara.) -* The :class:`datetime` class in the :mod:`datetime` module now has a +* The :class:`~datetime.datetime` class in the :mod:`datetime` module now has a ``strptime(string, format)`` method for parsing date strings, contributed by Josh Spoerri. It uses the same format characters as :func:`time.strptime` and :func:`time.strftime`:: @@ -1497,7 +1497,7 @@ * The :mod:`pyexpat` module now uses version 2.0 of the Expat parser. (Contributed by Trent Mick.) -* The :class:`Queue` class provided by the :mod:`Queue` module gained two new +* The :class:`~queue.Queue` class provided by the :mod:`Queue` module gained two new methods. :meth:`join` blocks until all items in the queue have been retrieved and all processing work on the items have been completed. Worker threads call the other new method, :meth:`task_done`, to signal that processing for an item @@ -1649,7 +1649,7 @@ .. Patch #754022 -* The :mod:`xmlrpclib` module now supports returning :class:`datetime` objects +* The :mod:`xmlrpclib` module now supports returning :class:`~datetime.datetime` objects for the XML-RPC date type. Supply ``use_datetime=True`` to the :func:`loads` function or the :class:`Unmarshaller` class to enable this feature. (Contributed by Skip Montanaro.) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -613,10 +613,10 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the result of the factorial. -The :class:`Queue` object is stored in a global variable. +A :class:`~queue.Queue` is used to communicate the result of the factorial. +The :class:`~queue.Queue` object is stored in a global variable. The child process will use the value of the variable when the child -was created; because it's a :class:`Queue`, parent and child can use +was created; because it's a :class:`~queue.Queue`, parent and child can use the object to communicate. (If the parent were to change the value of the global variable, the child's value would be unaffected, and vice versa.) @@ -2131,7 +2131,7 @@ (Contributed by Christian Heimes and Mark Dickinson.) -* :class:`mmap` objects now have a :meth:`rfind` method that searches for a +* :class:`~mmap.mmap` objects now have a :meth:`rfind` method that searches for a substring beginning at the end of the string and searching backwards. The :meth:`find` method also gained an *end* parameter giving an index at which to stop searching. @@ -2630,7 +2630,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented by using ```` in XML-RPC responses @@ -3283,7 +3283,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) * (3.0-warning mode) The :class:`Exception` class now warns -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 16:34:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 21:34:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20161202213452.22212.86161.E69BF048@psf.io> https://hg.python.org/cpython/rev/555b32f418ce changeset: 105422:555b32f418ce branch: 3.5 parent: 105419:d64e37b9204e parent: 105408:14c80065c36e user: Serhiy Storchaka date: Fri Dec 02 23:34:24 2016 +0200 summary: Merge heads files: config.guess | 174 ++++++++++++++++++++++++-------------- config.sub | 75 +++++++++++---- 2 files changed, 161 insertions(+), 88 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches at gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-05-01' +timestamp='2016-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,10 +301,12 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -312,6 +314,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -326,6 +329,9 @@ c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -371,12 +377,13 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -422,13 +429,15 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -436,6 +445,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -512,6 +522,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -632,6 +645,14 @@ basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -773,6 +794,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -828,6 +852,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1004,7 +1032,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1014,7 +1042,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1360,27 +1388,28 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1512,6 +1541,8 @@ ;; -nacl*) ;; + -ios) + ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 16:34:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 21:34:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIxODE4?= =?utf-8?q?=3A_Fixed_references_to_classes_that_have_names_matching_with_m?= =?utf-8?q?odule?= Message-ID: <20161202213452.21305.33741.A07EBD6B@psf.io> https://hg.python.org/cpython/rev/5b40d81e8883 changeset: 105418:5b40d81e8883 branch: 2.7 parent: 105414:ea904d4b3634 user: Serhiy Storchaka date: Fri Dec 02 23:13:42 2016 +0200 summary: Issue #21818: Fixed references to classes that have names matching with module names. files: Doc/library/array.rst | 4 +- Doc/library/configparser.rst | 20 +++--- Doc/library/cookie.rst | 10 +- Doc/library/cookielib.rst | 20 +++--- Doc/library/datetime.rst | 4 +- Doc/library/docxmlrpcserver.rst | 6 +- Doc/library/dumbdbm.rst | 2 +- Doc/library/formatter.rst | 2 +- Doc/library/gzip.rst | 2 +- Doc/library/htmllib.rst | 12 ++-- Doc/library/io.rst | 12 ++-- Doc/library/mimewriter.rst | 10 +- Doc/library/mmap.rst | 6 +- Doc/library/mutex.rst | 2 +- Doc/library/netrc.rst | 10 +- Doc/library/queue.rst | 8 +- Doc/library/scrolledtext.rst | 4 +- Doc/library/simplexmlrpcserver.rst | 8 +- Doc/library/socket.rst | 2 +- Doc/library/stringio.rst | 14 ++-- Doc/library/userdict.rst | 48 +++++++++--------- Doc/whatsnew/2.1.rst | 2 +- Doc/whatsnew/2.2.rst | 2 +- Doc/whatsnew/2.3.rst | 12 ++-- Doc/whatsnew/2.4.rst | 2 +- Doc/whatsnew/2.5.rst | 6 +- Doc/whatsnew/2.6.rst | 18 +++--- 27 files changed, 124 insertions(+), 124 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -75,7 +75,7 @@ .. data:: ArrayType - Obsolete alias for :class:`array`. + Obsolete alias for :class:`~array.array`. Array objects support the ordinary sequence operations of indexing, slicing, concatenation, and multiplication. When using slice assignment, the assigned @@ -249,7 +249,7 @@ empty, otherwise it is a string if the *typecode* is ``'c'``, otherwise it is a list of numbers. The string is guaranteed to be able to be converted back to an array with the same type and value using :func:`eval`, so long as the -:func:`array` function has been imported using ``from array import array``. +:class:`~array.array` class has been imported using ``from array import array``. Examples:: array('l') diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -21,7 +21,7 @@ single: ini file single: Windows ini file -This module defines the class :class:`ConfigParser`. The :class:`ConfigParser` +This module defines the class :class:`~ConfigParser.ConfigParser`. The :class:`~ConfigParser.ConfigParser` class implements a basic configuration file parser language which provides a structure similar to what you would find on Microsoft Windows INI files. You can use this to write Python programs which can be customized by end users @@ -74,12 +74,12 @@ would resolve the ``%(dir)s`` to the value of ``dir`` (``frob`` in this case). All reference expansions are done on demand. -Default values can be specified by passing them into the :class:`ConfigParser` +Default values can be specified by passing them into the :class:`~ConfigParser.ConfigParser` constructor as a dictionary. Additional defaults may be passed into the :meth:`get` method which will override all others. Sections are normally stored in a built-in dictionary. An alternative dictionary -type can be passed to the :class:`ConfigParser` constructor. For example, if a +type can be passed to the :class:`~ConfigParser.ConfigParser` constructor. For example, if a dictionary type is passed that sorts its keys, the sections will be sorted on write-back, as will be the keys within each section. @@ -135,7 +135,7 @@ .. class:: SafeConfigParser([defaults[, dict_type[, allow_no_value]]]) - Derived class of :class:`ConfigParser` that implements a more-sane variant of + Derived class of :class:`~ConfigParser.ConfigParser` that implements a more-sane variant of the magical interpolation feature. This implementation is more predictable as well. New applications should prefer this version if they don't need to be compatible with older versions of Python. @@ -215,7 +215,7 @@ .. data:: MAX_INTERPOLATION_DEPTH The maximum depth for recursive interpolation for :meth:`get` when the *raw* - parameter is false. This is relevant only for the :class:`ConfigParser` class. + parameter is false. This is relevant only for the :class:`~ConfigParser.ConfigParser` class. .. seealso:: @@ -279,7 +279,7 @@ list of potential configuration file locations (for example, the current directory, the user's home directory, and some system-wide directory), and all existing configuration files in the list will be read. If none of the named - files exist, the :class:`ConfigParser` instance will contain an empty dataset. + files exist, the :class:`~ConfigParser.ConfigParser` instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using :meth:`readfp` before calling :meth:`read` for any optional files:: @@ -338,7 +338,7 @@ If the given section exists, set the given option to the specified value; otherwise raise :exc:`NoSectionError`. While it is possible to use - :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters set to + :class:`RawConfigParser` (or :class:`~ConfigParser.ConfigParser` with *raw* parameters set to true) for *internal* storage of non-string values, full functionality (including interpolation and output to files) can only be achieved using string values. @@ -394,7 +394,7 @@ ConfigParser Objects -------------------- -The :class:`ConfigParser` class extends some methods of the +The :class:`~ConfigParser.ConfigParser` class extends some methods of the :class:`RawConfigParser` interface, adding some optional arguments. @@ -422,7 +422,7 @@ ------------------------ The :class:`SafeConfigParser` class implements the same extended interface as -:class:`ConfigParser`, with the following addition: +:class:`~ConfigParser.ConfigParser`, with the following addition: .. method:: SafeConfigParser.set(section, option, value) @@ -480,7 +480,7 @@ if config.getboolean('Section1', 'a_bool'): print config.get('Section1', 'foo') -To get interpolation, you will need to use a :class:`ConfigParser` or +To get interpolation, you will need to use a :class:`~ConfigParser.ConfigParser` or :class:`SafeConfigParser`:: import ConfigParser diff --git a/Doc/library/cookie.rst b/Doc/library/cookie.rst --- a/Doc/library/cookie.rst +++ b/Doc/library/cookie.rst @@ -82,11 +82,11 @@ The same security warning from :class:`SerialCookie` applies here. A further security note is warranted. For backwards compatibility, the -:mod:`Cookie` module exports a class named :class:`Cookie` which is just an -alias for :class:`SmartCookie`. This is probably a mistake and will likely be -removed in a future version. You should not use the :class:`Cookie` class in -your applications, for the same reason why you should not use the -:class:`SerialCookie` class. +:mod:`Cookie` module exports a class named :class:`~Cookie.Cookie` which is +just an alias for :class:`SmartCookie`. This is probably a mistake and will +likely be removed in a future version. You should not use the +:class:`~Cookie.Cookie` class in your applications, for the same reason why +you should not use the :class:`SerialCookie` class. .. seealso:: diff --git a/Doc/library/cookielib.rst b/Doc/library/cookielib.rst --- a/Doc/library/cookielib.rst +++ b/Doc/library/cookielib.rst @@ -100,7 +100,7 @@ 1) are treated according to the RFC 2965 rules. However, if RFC 2965 handling is turned off or :attr:`rfc2109_as_netscape` is ``True``, RFC 2109 cookies are 'downgraded' by the :class:`CookieJar` instance to Netscape cookies, by - setting the :attr:`version` attribute of the :class:`Cookie` instance to 0. + setting the :attr:`version` attribute of the :class:`~cookielib.Cookie` instance to 0. :class:`DefaultCookiePolicy` also provides some parameters to allow some fine-tuning of policy. @@ -108,7 +108,7 @@ .. class:: Cookie() This class represents Netscape, RFC 2109 and RFC 2965 cookies. It is not - expected that users of :mod:`cookielib` construct their own :class:`Cookie` + expected that users of :mod:`cookielib` construct their own :class:`~cookielib.Cookie` instances. Instead, if necessary, call :meth:`make_cookies` on a :class:`CookieJar` instance. @@ -146,7 +146,7 @@ ----------------------------------- :class:`CookieJar` objects support the :term:`iterator` protocol for iterating over -contained :class:`Cookie` objects. +contained :class:`~cookielib.Cookie` objects. :class:`CookieJar` has the following methods: @@ -194,7 +194,7 @@ .. method:: CookieJar.make_cookies(response, request) - Return sequence of :class:`Cookie` objects extracted from *response* object. + Return sequence of :class:`~cookielib.Cookie` objects extracted from *response* object. See the documentation for :meth:`extract_cookies` for the interfaces required of the *response* and *request* arguments. @@ -202,12 +202,12 @@ .. method:: CookieJar.set_cookie_if_ok(cookie, request) - Set a :class:`Cookie` if policy says it's OK to do so. + Set a :class:`~cookielib.Cookie` if policy says it's OK to do so. .. method:: CookieJar.set_cookie(cookie) - Set a :class:`Cookie`, without checking with policy to see whether or not it + Set a :class:`~cookielib.Cookie`, without checking with policy to see whether or not it should be set. @@ -383,7 +383,7 @@ :meth:`path_return_ok` is called for the cookie path. Otherwise, :meth:`path_return_ok` and :meth:`return_ok` are never called for that cookie domain. If :meth:`path_return_ok` returns true, :meth:`return_ok` is called - with the :class:`Cookie` object itself for a full check. Otherwise, + with the :class:`~cookielib.Cookie` object itself for a full check. Otherwise, :meth:`return_ok` is never called for that cookie path. Note that :meth:`domain_return_ok` is called for every *cookie* domain, not just @@ -516,7 +516,7 @@ If true, request that the :class:`CookieJar` instance downgrade RFC 2109 cookies (ie. cookies received in a :mailheader:`Set-Cookie` header with a version cookie-attribute of 1) to Netscape cookies by setting the version attribute of - the :class:`Cookie` instance to 0. The default value is :const:`None`, in which + the :class:`~cookielib.Cookie` instance to 0. The default value is :const:`None`, in which case RFC 2109 cookies are downgraded if and only if RFC 2965 handling is turned off. Therefore, RFC 2109 cookies are downgraded by default. @@ -608,7 +608,7 @@ Cookie Objects -------------- -:class:`Cookie` instances have Python attributes roughly corresponding to the +:class:`~cookielib.Cookie` instances have Python attributes roughly corresponding to the standard cookie-attributes specified in the various cookie standards. The correspondence is not one-to-one, because there are complicated rules for assigning default values, because the ``max-age`` and ``expires`` @@ -724,7 +724,7 @@ Set the value of the named cookie-attribute. -The :class:`Cookie` class also defines the following method: +The :class:`~cookielib.Cookie` class also defines the following method: .. method:: Cookie.is_expired([now=None]) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1170,8 +1170,8 @@ .. _datetime-time: -:class:`time` Objects ---------------------- +:class:`.time` Objects +---------------------- A time object represents a (local) time of day, independent of any particular day, and subject to adjustment via a :class:`tzinfo` object. diff --git a/Doc/library/docxmlrpcserver.rst b/Doc/library/docxmlrpcserver.rst --- a/Doc/library/docxmlrpcserver.rst +++ b/Doc/library/docxmlrpcserver.rst @@ -16,7 +16,7 @@ The :mod:`DocXMLRPCServer` module extends the classes found in :mod:`SimpleXMLRPCServer` to serve HTML documentation in response to HTTP GET -requests. Servers can either be free standing, using :class:`DocXMLRPCServer`, +requests. Servers can either be free standing, using :class:`~DocXMLRPCServer.DocXMLRPCServer`, or embedded in a CGI environment, using :class:`DocCGIXMLRPCRequestHandler`. @@ -36,7 +36,7 @@ Create a new request handler instance. This request handler supports XML-RPC POST requests, documentation GET requests, and modifies logging so that the - *logRequests* parameter to the :class:`DocXMLRPCServer` constructor parameter is + *logRequests* parameter to the :class:`~DocXMLRPCServer.DocXMLRPCServer` constructor parameter is honored. @@ -45,7 +45,7 @@ DocXMLRPCServer Objects ----------------------- -The :class:`DocXMLRPCServer` class is derived from +The :class:`~DocXMLRPCServer.DocXMLRPCServer` class is derived from :class:`SimpleXMLRPCServer.SimpleXMLRPCServer` and provides a means of creating self-documenting, stand alone XML-RPC servers. HTTP POST requests are handled as XML-RPC method calls. HTTP GET requests are handled by generating pydoc-style diff --git a/Doc/library/dumbdbm.rst b/Doc/library/dumbdbm.rst --- a/Doc/library/dumbdbm.rst +++ b/Doc/library/dumbdbm.rst @@ -82,7 +82,7 @@ --------------- In addition to the methods provided by the :class:`UserDict.DictMixin` class, -:class:`dumbdbm` objects provide the following methods. +:class:`~dumbdbm.dumbdbm` objects provide the following methods. .. method:: dumbdbm.sync() diff --git a/Doc/library/formatter.rst b/Doc/library/formatter.rst --- a/Doc/library/formatter.rst +++ b/Doc/library/formatter.rst @@ -9,7 +9,7 @@ .. index:: single: HTMLParser (class in htmllib) This module supports two interface definitions, each with multiple -implementations. The *formatter* interface is used by the :class:`HTMLParser` +implementations. The *formatter* interface is used by the :class:`~HTMLParser.HTMLParser` class of the :mod:`htmllib` module, and the *writer* interface is required by the formatter interface. diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -67,7 +67,7 @@ *fileobj*, since you might wish to append more material after the compressed data. This also allows you to pass a :class:`~StringIO.StringIO` object opened for writing as *fileobj*, and retrieve the resulting memory buffer using the - :class:`StringIO` object's :meth:`~StringIO.StringIO.getvalue` method. + :class:`~StringIO.StringIO` object's :meth:`~StringIO.StringIO.getvalue` method. :class:`GzipFile` supports iteration and the :keyword:`with` statement. diff --git a/Doc/library/htmllib.rst b/Doc/library/htmllib.rst --- a/Doc/library/htmllib.rst +++ b/Doc/library/htmllib.rst @@ -24,11 +24,11 @@ formatted in the HyperText Mark-up Language (HTML). The class is not directly concerned with I/O --- it must be provided with input in string form via a method, and makes calls to methods of a "formatter" object in order to produce -output. The :class:`HTMLParser` class is designed to be used as a base class +output. The :class:`~HTMLParser.HTMLParser` class is designed to be used as a base class for other classes in order to add functionality, and allows most of its methods to be extended or overridden. In turn, this class is derived from and extends the :class:`SGMLParser` class defined in module :mod:`sgmllib`. The -:class:`HTMLParser` implementation supports the HTML 2.0 language as described +:class:`~HTMLParser.HTMLParser` implementation supports the HTML 2.0 language as described in :rfc:`1866`. Two implementations of formatter objects are provided in the :mod:`formatter` module; refer to the documentation for that module for information on the formatter interface. @@ -70,7 +70,7 @@ .. exception:: HTMLParseError - Exception raised by the :class:`HTMLParser` class when it encounters an error + Exception raised by the :class:`~HTMLParser.HTMLParser` class when it encounters an error while parsing. .. versionadded:: 2.4 @@ -91,7 +91,7 @@ Definition of replacement text for XHTML 1.0 entities. Module :mod:`sgmllib` - Base class for :class:`HTMLParser`. + Base class for :class:`~HTMLParser.HTMLParser`. .. _html-parser-objects: @@ -99,7 +99,7 @@ HTMLParser Objects ------------------ -In addition to tag methods, the :class:`HTMLParser` class provides some +In addition to tag methods, the :class:`~HTMLParser.HTMLParser` class provides some additional methods and instance variables for use within tag methods. @@ -173,7 +173,7 @@ This module defines three dictionaries, ``name2codepoint``, ``codepoint2name``, and ``entitydefs``. ``entitydefs`` is used by the :mod:`htmllib` module to -provide the :attr:`entitydefs` attribute of the :class:`HTMLParser` class. The +provide the :attr:`entitydefs` attribute of the :class:`~HTMLParser.HTMLParser` class. The definition provided here contains all the entities defined by XHTML 1.0 that can be handled using simple textual substitution in the Latin-1 character set (ISO-8859-1). diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -47,7 +47,7 @@ streams whose bytes represent text, and handles encoding and decoding from and to :class:`unicode` strings. :class:`TextIOWrapper`, which extends it, is a buffered text interface to a buffered raw stream -(:class:`BufferedIOBase`). Finally, :class:`StringIO` is an in-memory +(:class:`BufferedIOBase`). Finally, :class:`~io.StringIO` is an in-memory stream for unicode text. Argument names are not part of the specification, and only the arguments of @@ -180,7 +180,7 @@ It is also possible to use an :class:`unicode` or :class:`bytes` string as a file for both reading and writing. For :class:`unicode` strings - :class:`StringIO` can be used like a file opened in text mode, + :class:`~io.StringIO` can be used like a file opened in text mode, and for :class:`bytes` a :class:`BytesIO` can be used like a file opened in a binary mode. @@ -718,7 +718,7 @@ After the underlying buffer has been detached, the :class:`TextIOBase` is in an unusable state. - Some :class:`TextIOBase` implementations, like :class:`StringIO`, may not + Some :class:`TextIOBase` implementations, like :class:`~io.StringIO`, may not have the concept of an underlying buffer and calling this method will raise :exc:`UnsupportedOperation`. @@ -834,13 +834,13 @@ newlines are written as ``\n`` on all platforms, but universal newline decoding is still performed when reading. - :class:`StringIO` provides this method in addition to those from + :class:`~io.StringIO` provides this method in addition to those from :class:`TextIOWrapper` and its parents: .. method:: getvalue() Return a ``unicode`` containing the entire contents of the buffer at any - time before the :class:`StringIO` object's :meth:`close` method is + time before the :class:`~io.StringIO` object's :meth:`close` method is called. Newlines are decoded as if by :meth:`~TextIOBase.read`, although the stream position is not changed. @@ -902,7 +902,7 @@ Also, :meth:`TextIOWrapper.tell` and :meth:`TextIOWrapper.seek` are both quite slow due to the reconstruction algorithm used. -:class:`StringIO`, however, is a native in-memory unicode container and will +:class:`~io.StringIO`, however, is a native in-memory unicode container and will exhibit similar speed to :class:`BytesIO`. Multi-threading diff --git a/Doc/library/mimewriter.rst b/Doc/library/mimewriter.rst --- a/Doc/library/mimewriter.rst +++ b/Doc/library/mimewriter.rst @@ -12,17 +12,17 @@ The :mod:`email` package should be used in preference to the :mod:`MimeWriter` module. This module is present only to maintain backward compatibility. -This module defines the class :class:`MimeWriter`. The :class:`MimeWriter` +This module defines the class :class:`~MimeWriter.MimeWriter`. The :class:`~MimeWriter.MimeWriter` class implements a basic formatter for creating MIME multi-part files. It doesn't seek around the output file nor does it use large amounts of buffer space. You must write the parts out in the order that they should occur in the -final file. :class:`MimeWriter` does buffer the headers you add, allowing you +final file. :class:`~MimeWriter.MimeWriter` does buffer the headers you add, allowing you to rearrange their order. .. class:: MimeWriter(fp) - Return a new instance of the :class:`MimeWriter` class. The only argument + Return a new instance of the :class:`~MimeWriter.MimeWriter` class. The only argument passed, *fp*, is a file object to be used for writing. Note that a :class:`~StringIO.StringIO` object could also be used. @@ -32,7 +32,7 @@ MimeWriter Objects ------------------ -:class:`MimeWriter` instances have the following methods: +:class:`~MimeWriter.MimeWriter` instances have the following methods: .. method:: MimeWriter.addheader(key, value[, prefix]) @@ -72,7 +72,7 @@ .. method:: MimeWriter.nextpart() - Returns a new instance of :class:`MimeWriter` which represents an individual + Returns a new instance of :class:`~MimeWriter.MimeWriter` which represents an individual part in a multipart message. This may be used to write the part as well as used for creating recursively complex multipart messages. The message must first be initialized with :meth:`startmultipartbody` before using :meth:`nextpart`. diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -15,7 +15,7 @@ also read and write data starting at the current file position, and :meth:`seek` through the file to different positions. -A memory-mapped file is created by the :class:`mmap` constructor, which is +A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is different on Unix and on Windows. In either case you must provide a file descriptor for a file opened for update. If you wish to map an existing Python file object, use its :meth:`fileno` method to obtain the correct value for the @@ -77,7 +77,7 @@ **(Unix version)** Maps *length* bytes from the file specified by the file descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the maximum length of the map will be the current size of the file when - :class:`mmap` is called. + :class:`~mmap.mmap` is called. *flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a private copy-on-write mapping, so changes to the contents of the mmap @@ -104,7 +104,7 @@ by the descriptor *fileno* is internally automatically synchronized with physical backing store on Mac OS X and OpenVMS. - This example shows a simple way of using :class:`mmap`:: + This example shows a simple way of using :class:`~mmap.mmap`:: import mmap diff --git a/Doc/library/mutex.rst b/Doc/library/mutex.rst --- a/Doc/library/mutex.rst +++ b/Doc/library/mutex.rst @@ -40,7 +40,7 @@ Mutex Objects ------------- -:class:`mutex` objects have following methods: +:class:`~mutex.mutex` objects have following methods: .. method:: mutex.test() diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -14,13 +14,13 @@ -------------- -The :class:`netrc` class parses and encapsulates the netrc file format used by +The :class:`~netrc.netrc` class parses and encapsulates the netrc file format used by the Unix :program:`ftp` program and other FTP clients. .. class:: netrc([file]) - A :class:`netrc` instance or subclass instance encapsulates data from a netrc + A :class:`~netrc.netrc` instance or subclass instance encapsulates data from a netrc file. The initialization argument, if present, specifies the file to parse. If no argument is given, the file :file:`.netrc` in the user's home directory will be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic @@ -37,7 +37,7 @@ .. exception:: NetrcParseError - Exception raised by the :class:`netrc` class when syntactical errors are + Exception raised by the :class:`~netrc.netrc` class when syntactical errors are encountered in source text. Instances of this exception provide three interesting attributes: :attr:`msg` is a textual explanation of the error, :attr:`filename` is the name of the source file, and :attr:`lineno` gives the @@ -49,7 +49,7 @@ netrc Objects ------------- -A :class:`netrc` instance has the following methods: +A :class:`~netrc.netrc` instance has the following methods: .. method:: netrc.authenticators(host) @@ -65,7 +65,7 @@ Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.) -Instances of :class:`netrc` have public instance variables: +Instances of :class:`~netrc.netrc` have public instance variables: .. attribute:: netrc.hosts diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst --- a/Doc/library/queue.rst +++ b/Doc/library/queue.rst @@ -15,7 +15,7 @@ The :mod:`Queue` module implements multi-producer, multi-consumer queues. It is especially useful in threaded programming when information must be -exchanged safely between multiple threads. The :class:`Queue` class in this +exchanged safely between multiple threads. The :class:`~Queue.Queue` class in this module implements all the required locking semantics. It depends on the availability of thread support in Python; see the :mod:`threading` module. @@ -62,14 +62,14 @@ Exception raised when non-blocking :meth:`~Queue.get` (or :meth:`~Queue.get_nowait`) is called - on a :class:`Queue` object which is empty. + on a :class:`~Queue.Queue` object which is empty. .. exception:: Full Exception raised when non-blocking :meth:`~Queue.put` (or :meth:`~Queue.put_nowait`) is called - on a :class:`Queue` object which is full. + on a :class:`~Queue.Queue` object which is full. .. seealso:: @@ -83,7 +83,7 @@ Queue Objects ------------- -Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:`PriorityQueue`) +Queue objects (:class:`~Queue.Queue`, :class:`LifoQueue`, or :class:`PriorityQueue`) provide the public methods described below. diff --git a/Doc/library/scrolledtext.rst b/Doc/library/scrolledtext.rst --- a/Doc/library/scrolledtext.rst +++ b/Doc/library/scrolledtext.rst @@ -9,7 +9,7 @@ The :mod:`ScrolledText` module provides a class of the same name which implements a basic text widget which has a vertical scroll bar configured to do -the "right thing." Using the :class:`ScrolledText` class is a lot easier than +the "right thing." Using the :class:`~ScrolledText.ScrolledText` class is a lot easier than setting up a text widget and scroll bar directly. The constructor is the same as that of the :class:`Tkinter.Text` class. @@ -21,7 +21,7 @@ The text widget and scrollbar are packed together in a :class:`Frame`, and the methods of the :class:`Grid` and :class:`Pack` geometry managers are acquired -from the :class:`Frame` object. This allows the :class:`ScrolledText` widget to +from the :class:`Frame` object. This allows the :class:`~ScrolledText.ScrolledText` widget to be used directly to achieve most normal geometry management behavior. Should more specific control be necessary, the following attributes are diff --git a/Doc/library/simplexmlrpcserver.rst b/Doc/library/simplexmlrpcserver.rst --- a/Doc/library/simplexmlrpcserver.rst +++ b/Doc/library/simplexmlrpcserver.rst @@ -20,7 +20,7 @@ The :mod:`SimpleXMLRPCServer` module provides a basic server framework for XML-RPC servers written in Python. Servers can either be free standing, using -:class:`SimpleXMLRPCServer`, or embedded in a CGI environment, using +:class:`~SimpleXMLRPCServer.SimpleXMLRPCServer`, or embedded in a CGI environment, using :class:`CGIXMLRPCRequestHandler`. @@ -62,7 +62,7 @@ Create a new request handler instance. This request handler supports ``POST`` requests and modifies logging so that the *logRequests* parameter to the - :class:`SimpleXMLRPCServer` constructor parameter is honored. + :class:`~SimpleXMLRPCServer.SimpleXMLRPCServer` constructor parameter is honored. .. _simple-xmlrpc-servers: @@ -70,7 +70,7 @@ SimpleXMLRPCServer Objects -------------------------- -The :class:`SimpleXMLRPCServer` class is based on +The :class:`~SimpleXMLRPCServer.SimpleXMLRPCServer` class is based on :class:`SocketServer.TCPServer` and provides a means of creating simple, stand alone XML-RPC servers. @@ -197,7 +197,7 @@ # Print list of available methods print s.system.listMethods() -The following :class:`SimpleXMLRPCServer` example is included in the module +The following :class:`~SimpleXMLRPCServer.SimpleXMLRPCServer` example is included in the module `Lib/SimpleXMLRPCServer.py`:: server = SimpleXMLRPCServer(("localhost", 8000)) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -835,7 +835,7 @@ :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead. Socket objects also have these (read-only) attributes that correspond to the -values given to the :class:`socket` constructor. +values given to the :class:`~socket.socket` constructor. .. attribute:: socket.family diff --git a/Doc/library/stringio.rst b/Doc/library/stringio.rst --- a/Doc/library/stringio.rst +++ b/Doc/library/stringio.rst @@ -6,7 +6,7 @@ :synopsis: Read and write strings as if they were files. -This module implements a file-like class, :class:`StringIO`, that reads and +This module implements a file-like class, :class:`~StringIO.StringIO`, that reads and writes a string buffer (also known as *memory files*). See the description of file objects for operations (section :ref:`bltin-file-objects`). (For standard strings, see :class:`str` and :class:`unicode`.) @@ -14,23 +14,23 @@ .. class:: StringIO([buffer]) - When a :class:`StringIO` object is created, it can be initialized to an existing + When a :class:`~StringIO.StringIO` object is created, it can be initialized to an existing string by passing the string to the constructor. If no string is given, the - :class:`StringIO` will start empty. In both cases, the initial file position + :class:`~StringIO.StringIO` will start empty. In both cases, the initial file position starts at zero. - The :class:`StringIO` object can accept either Unicode or 8-bit strings, but + The :class:`~StringIO.StringIO` object can accept either Unicode or 8-bit strings, but mixing the two may take some care. If both are used, 8-bit strings that cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause a :exc:`UnicodeError` to be raised when :meth:`getvalue` is called. -The following methods of :class:`StringIO` objects require special mention: +The following methods of :class:`~StringIO.StringIO` objects require special mention: .. method:: StringIO.getvalue() Retrieve the entire contents of the "file" at any time before the - :class:`StringIO` object's :meth:`close` method is called. See the note above + :class:`~StringIO.StringIO` object's :meth:`close` method is called. See the note above for information about mixing Unicode and 8-bit strings; such mixing can cause this method to raise :exc:`UnicodeError`. @@ -38,7 +38,7 @@ .. method:: StringIO.close() Free the memory buffer. Attempting to do further operations with a closed - :class:`StringIO` object will raise a :exc:`ValueError`. + :class:`~StringIO.StringIO` object will raise a :exc:`ValueError`. Example usage:: diff --git a/Doc/library/userdict.rst b/Doc/library/userdict.rst --- a/Doc/library/userdict.rst +++ b/Doc/library/userdict.rst @@ -14,15 +14,15 @@ simplifies writing classes that need to be substitutable for dictionaries (such as the shelve module). -This module also defines a class, :class:`UserDict`, that acts as a wrapper +This module also defines a class, :class:`~UserDict.UserDict`, that acts as a wrapper around dictionary objects. The need for this class has been largely supplanted by the ability to subclass directly from :class:`dict` (a feature that became available starting with Python version 2.2). Prior to the introduction of -:class:`dict`, the :class:`UserDict` class was used to create dictionary-like +:class:`dict`, the :class:`~UserDict.UserDict` class was used to create dictionary-like sub-classes that obtained new behaviors by overriding existing methods or adding new ones. -The :mod:`UserDict` module defines the :class:`UserDict` class and +The :mod:`UserDict` module defines the :class:`~UserDict.UserDict` class and :class:`DictMixin`: @@ -30,28 +30,28 @@ Class that simulates a dictionary. The instance's contents are kept in a regular dictionary, which is accessible via the :attr:`data` attribute of - :class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is + :class:`~UserDict.UserDict` instances. If *initialdata* is provided, :attr:`data` is initialized with its contents; note that a reference to *initialdata* will not be kept, allowing it be used for other purposes. .. note:: - For backward compatibility, instances of :class:`UserDict` are not iterable. + For backward compatibility, instances of :class:`~UserDict.UserDict` are not iterable. .. class:: IterableUserDict([initialdata]) - Subclass of :class:`UserDict` that supports direct iteration (e.g. ``for key in + Subclass of :class:`~UserDict.UserDict` that supports direct iteration (e.g. ``for key in myDict``). In addition to supporting the methods and operations of mappings (see section -:ref:`typesmapping`), :class:`UserDict` and :class:`IterableUserDict` instances +:ref:`typesmapping`), :class:`~UserDict.UserDict` and :class:`IterableUserDict` instances provide the following attribute: .. attribute:: IterableUserDict.data - A real dictionary used to store the contents of the :class:`UserDict` class. + A real dictionary used to store the contents of the :class:`~UserDict.UserDict` class. .. class:: DictMixin() @@ -96,7 +96,7 @@ In addition, this class can be mixed-in with built-in classes using multiple inheritance. This can sometimes be useful. For example, you can inherit - from :class:`UserList` and :class:`str` at the same time. That would not be + from :class:`~UserList.UserList` and :class:`str` at the same time. That would not be possible with both a real :class:`list` and a real :class:`str`. This module defines a class that acts as a wrapper around list objects. It is a @@ -104,34 +104,34 @@ and override existing methods or add new ones. In this way one can add new behaviors to lists. -The :mod:`UserList` module defines the :class:`UserList` class: +The :mod:`UserList` module defines the :class:`~UserList.UserList` class: .. class:: UserList([list]) Class that simulates a list. The instance's contents are kept in a regular - list, which is accessible via the :attr:`data` attribute of :class:`UserList` + list, which is accessible via the :attr:`data` attribute of :class:`~UserList.UserList` instances. The instance's contents are initially set to a copy of *list*, defaulting to the empty list ``[]``. *list* can be any iterable, e.g. a - real Python list or a :class:`UserList` object. + real Python list or a :class:`~UserList.UserList` object. .. note:: - The :class:`UserList` class has been moved to the :mod:`collections` + The :class:`~UserList.UserList` class has been moved to the :mod:`collections` module in Python 3. The :term:`2to3` tool will automatically adapt imports when converting your sources to Python 3. In addition to supporting the methods and operations of mutable sequences (see -section :ref:`typesseq`), :class:`UserList` instances provide the following +section :ref:`typesseq`), :class:`~UserList.UserList` instances provide the following attribute: .. attribute:: UserList.data - A real Python list object used to store the contents of the :class:`UserList` + A real Python list object used to store the contents of the :class:`~UserList.UserList` class. -**Subclassing requirements:** Subclasses of :class:`UserList` are expected to +**Subclassing requirements:** Subclasses of :class:`~UserList.UserList` are expected to offer a constructor which can be called with either no arguments or one argument. List operations which return a new sequence attempt to create an instance of the actual implementation class. To do so, it assumes that the @@ -160,10 +160,10 @@ .. note:: - This :class:`UserString` class from this module is available for backward + This :class:`~UserString.UserString` class from this module is available for backward compatibility only. If you are writing code that does not need to work with versions of Python earlier than Python 2.2, please consider subclassing directly - from the built-in :class:`str` type instead of using :class:`UserString` (there + from the built-in :class:`str` type instead of using :class:`~UserString.UserString` (there is no built-in equivalent to :class:`MutableString`). This module defines a class that acts as a wrapper around string objects. It is @@ -182,14 +182,14 @@ Class that simulates a string or a Unicode string object. The instance's content is kept in a regular string or Unicode string object, which is - accessible via the :attr:`data` attribute of :class:`UserString` instances. The + accessible via the :attr:`data` attribute of :class:`~UserString.UserString` instances. The instance's contents are initially set to a copy of *sequence*. *sequence* can be either a regular Python string or Unicode string, an instance of - :class:`UserString` (or a subclass) or an arbitrary sequence which can be + :class:`~UserString.UserString` (or a subclass) or an arbitrary sequence which can be converted into a string using the built-in :func:`str` function. .. note:: - The :class:`UserString` class has been moved to the :mod:`collections` + The :class:`~UserString.UserString` class has been moved to the :mod:`collections` module in Python 3. The :term:`2to3` tool will automatically adapt imports when converting your sources to Python 3. @@ -197,7 +197,7 @@ .. class:: MutableString([sequence]) - This class is derived from the :class:`UserString` above and redefines strings + This class is derived from the :class:`~UserString.UserString` above and redefines strings to be *mutable*. Mutable strings can't be used as dictionary keys, because dictionaries require *immutable* objects as keys. The main intention of this class is to serve as an educational example for inheritance and necessity to @@ -209,12 +209,12 @@ The :class:`MutableString` class has been removed in Python 3. In addition to supporting the methods and operations of string and Unicode -objects (see section :ref:`string-methods`), :class:`UserString` instances +objects (see section :ref:`string-methods`), :class:`~UserString.UserString` instances provide the following attribute: .. attribute:: MutableString.data A real Python string or Unicode object used to store the content of the - :class:`UserString` class. + :class:`~UserString.UserString` class. diff --git a/Doc/whatsnew/2.1.rst b/Doc/whatsnew/2.1.rst --- a/Doc/whatsnew/2.1.rst +++ b/Doc/whatsnew/2.1.rst @@ -445,7 +445,7 @@ :attr:`~object.__dict__`. Unlike the :attr:`~object.__dict__` attribute of class instances, in functions you can actually assign a new dictionary to :attr:`~object.__dict__`, though the new value is restricted to a regular Python dictionary; you *can't* be -tricky and set it to a :class:`UserDict` instance, or any other random object +tricky and set it to a :class:`~UserDict.UserDict` instance, or any other random object that behaves like a mapping. diff --git a/Doc/whatsnew/2.2.rst b/Doc/whatsnew/2.2.rst --- a/Doc/whatsnew/2.2.rst +++ b/Doc/whatsnew/2.2.rst @@ -55,7 +55,7 @@ so you can't just subclass, say, lists in order to add a single useful method to them. The :mod:`UserList` module provides a class that supports all of the methods of lists and that can be subclassed further, but there's lots of C code -that expects a regular Python list and won't accept a :class:`UserList` +that expects a regular Python list and won't accept a :class:`~UserList.UserList` instance. Python 2.2 fixes this, and in the process adds some exciting new capabilities. diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1683,13 +1683,13 @@ fancy features, and just stick to the basics of representing time. The three primary types are: :class:`date`, representing a day, month, and year; -:class:`time`, consisting of hour, minute, and second; and :class:`datetime`, -which contains all the attributes of both :class:`date` and :class:`time`. +:class:`~datetime.time`, consisting of hour, minute, and second; and :class:`~datetime.datetime`, +which contains all the attributes of both :class:`date` and :class:`~datetime.time`. There's also a :class:`timedelta` class representing differences between two points in time, and time zone logic is implemented by classes inheriting from the abstract :class:`tzinfo` class. -You can create instances of :class:`date` and :class:`time` by either supplying +You can create instances of :class:`date` and :class:`~datetime.time` by either supplying keyword arguments to the appropriate constructor, e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a number of class methods. For example, the :meth:`date.today` class method returns the @@ -1708,7 +1708,7 @@ '2002 30 Dec' The :meth:`replace` method allows modifying one or more fields of a -:class:`date` or :class:`datetime` instance, returning a new instance:: +:class:`date` or :class:`~datetime.datetime` instance, returning a new instance:: >>> d = datetime.datetime.now() >>> d @@ -1718,11 +1718,11 @@ >>> Instances can be compared, hashed, and converted to strings (the result is the -same as that of :meth:`isoformat`). :class:`date` and :class:`datetime` +same as that of :meth:`isoformat`). :class:`date` and :class:`~datetime.datetime` instances can be subtracted from each other, and added to :class:`timedelta` instances. The largest missing feature is that there's no standard library support for parsing strings and getting back a :class:`date` or -:class:`datetime`. +:class:`~datetime.datetime`. For more information, refer to the module's reference documentation. (Contributed by Tim Peters.) diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1523,7 +1523,7 @@ empty list instead of raising a :exc:`TypeError` exception if called with no arguments. -* You can no longer compare the :class:`date` and :class:`datetime` instances +* You can no longer compare the :class:`date` and :class:`~datetime.datetime` instances provided by the :mod:`datetime` module. Two instances of different classes will now always be unequal, and relative comparisons (``<``, ``>``) will raise a :exc:`TypeError`. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1307,7 +1307,7 @@ (Contributed by Skip Montanaro and Andrew McNamara.) -* The :class:`datetime` class in the :mod:`datetime` module now has a +* The :class:`~datetime.datetime` class in the :mod:`datetime` module now has a :meth:`strptime(string, format)` method for parsing date strings, contributed by Josh Spoerri. It uses the same format characters as :func:`time.strptime` and :func:`time.strftime`:: @@ -1497,7 +1497,7 @@ * The :mod:`pyexpat` module now uses version 2.0 of the Expat parser. (Contributed by Trent Mick.) -* The :class:`Queue` class provided by the :mod:`Queue` module gained two new +* The :class:`~Queue.Queue` class provided by the :mod:`Queue` module gained two new methods. :meth:`join` blocks until all items in the queue have been retrieved and all processing work on the items have been completed. Worker threads call the other new method, :meth:`task_done`, to signal that processing for an item @@ -1649,7 +1649,7 @@ .. Patch #754022 -* The :mod:`xmlrpclib` module now supports returning :class:`datetime` objects +* The :mod:`xmlrpclib` module now supports returning :class:`~datetime.datetime` objects for the XML-RPC date type. Supply ``use_datetime=True`` to the :func:`loads` function or the :class:`Unmarshaller` class to enable this feature. (Contributed by Skip Montanaro.) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -609,10 +609,10 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the result of the factorial. -The :class:`Queue` object is stored in a global variable. +A :class:`~Queue.Queue` is used to communicate the result of the factorial. +The :class:`~Queue.Queue` object is stored in a global variable. The child process will use the value of the variable when the child -was created; because it's a :class:`Queue`, parent and child can use +was created; because it's a :class:`~Queue.Queue`, parent and child can use the object to communicate. (If the parent were to change the value of the global variable, the child's value would be unaffected, and vice versa.) @@ -1077,7 +1077,7 @@ There are two concrete implementations. :class:`TextIOWrapper` wraps a buffered I/O object, supporting all of the methods for text I/O and adding a :attr:`buffer` attribute for access - to the underlying object. :class:`StringIO` simply buffers + to the underlying object. :class:`~StringIO.StringIO` simply buffers everything in memory without ever writing anything to disk. (In Python 2.6, :class:`io.StringIO` is implemented in @@ -2127,7 +2127,7 @@ (Contributed by Christian Heimes and Mark Dickinson.) -* :class:`mmap` objects now have a :meth:`rfind` method that searches for a +* :class:`~mmap.mmap` objects now have a :meth:`rfind` method that searches for a substring beginning at the end of the string and searching backwards. The :meth:`find` method also gained an *end* parameter giving an index at which to stop searching. @@ -2605,7 +2605,7 @@ intended for testing purposes that lets you temporarily modify the warning filters and then restore their original values (:issue:`3781`). -* The XML-RPC :class:`SimpleXMLRPCServer` and :class:`DocXMLRPCServer` +* The XML-RPC :class:`~SimpleXMLRPCServer.SimpleXMLRPCServer` and :class:`~DocXMLRPCServer.DocXMLRPCServer` classes can now be prevented from immediately opening and binding to their socket by passing True as the ``bind_and_activate`` constructor parameter. This can be used to modify the instance's @@ -2614,7 +2614,7 @@ open the socket and begin listening for connections. (Contributed by Peter Parente; :issue:`1599845`.) - :class:`SimpleXMLRPCServer` also has a :attr:`_send_traceback_header` + :class:`~SimpleXMLRPCServer.SimpleXMLRPCServer` also has a :attr:`_send_traceback_header` attribute; if true, the exception and formatted traceback are returned as HTTP headers "X-Exception" and "X-Traceback". This feature is for debugging purposes only and should not be used on production servers @@ -2626,7 +2626,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented by using ```` in XML-RPC responses @@ -3279,7 +3279,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) * (3.0-warning mode) The :class:`Exception` class now warns -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 16:34:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 02 Dec 2016 21:34:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321818=3A_Fixed_references_to_classes_that_have_?= =?utf-8?q?names_matching_with_module?= Message-ID: <20161202213452.29039.60759.9542B428@psf.io> https://hg.python.org/cpython/rev/c642c597d05c changeset: 105421:c642c597d05c parent: 105417:dd4c420b8e66 parent: 105420:62c9a89a2103 user: Serhiy Storchaka date: Fri Dec 02 23:15:42 2016 +0200 summary: Issue #21818: Fixed references to classes that have names matching with module names. files: Doc/library/array.rst | 2 +- Doc/library/datetime.rst | 6 +++--- Doc/library/mmap.rst | 8 ++++---- Doc/library/netrc.rst | 10 +++++----- Doc/library/socket.rst | 2 +- Doc/whatsnew/2.3.rst | 12 ++++++------ Doc/whatsnew/2.4.rst | 2 +- Doc/whatsnew/2.5.rst | 6 +++--- Doc/whatsnew/2.6.rst | 12 ++++++------ 9 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -254,7 +254,7 @@ empty, otherwise it is a string if the *typecode* is ``'u'``, otherwise it is a list of numbers. The string is guaranteed to be able to be converted back to an array with the same type and value using :func:`eval`, so long as the -:func:`array` function has been imported using ``from array import array``. +:class:`~array.array` class has been imported using ``from array import array``. Examples:: array('l') diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1368,8 +1368,8 @@ .. _datetime-time: -:class:`time` Objects ---------------------- +:class:`.time` Objects +---------------------- A time object represents a (local) time of day, independent of any particular day, and subject to adjustment via a :class:`tzinfo` object. @@ -1466,7 +1466,7 @@ ``!=``. The latter cases return :const:`False` or :const:`True`, respectively. .. versionchanged:: 3.3 - Equality comparisons between naive and aware :class:`time` instances + Equality comparisons between naive and aware :class:`~datetime.time` instances don't raise :exc:`TypeError`. * hash, use as dict key diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -14,7 +14,7 @@ slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at the current file position, and :meth:`seek` through the file to different positions. -A memory-mapped file is created by the :class:`mmap` constructor, which is +A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is different on Unix and on Windows. In either case you must provide a file descriptor for a file opened for update. If you wish to map an existing Python file object, use its :meth:`fileno` method to obtain the correct value for the @@ -70,7 +70,7 @@ **(Unix version)** Maps *length* bytes from the file specified by the file descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the maximum length of the map will be the current size of the file when - :class:`mmap` is called. + :class:`~mmap.mmap` is called. *flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a private copy-on-write mapping, so changes to the contents of the mmap @@ -97,7 +97,7 @@ by the descriptor *fileno* is internally automatically synchronized with physical backing store on Mac OS X and OpenVMS. - This example shows a simple way of using :class:`mmap`:: + This example shows a simple way of using :class:`~mmap.mmap`:: import mmap @@ -122,7 +122,7 @@ mm.close() - :class:`mmap` can also be used as a context manager in a :keyword:`with` + :class:`~mmap.mmap` can also be used as a context manager in a :keyword:`with` statement.:: import mmap diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -12,13 +12,13 @@ -------------- -The :class:`netrc` class parses and encapsulates the netrc file format used by +The :class:`~netrc.netrc` class parses and encapsulates the netrc file format used by the Unix :program:`ftp` program and other FTP clients. .. class:: netrc([file]) - A :class:`netrc` instance or subclass instance encapsulates data from a netrc + A :class:`~netrc.netrc` instance or subclass instance encapsulates data from a netrc file. The initialization argument, if present, specifies the file to parse. If no argument is given, the file :file:`.netrc` in the user's home directory will be read. Parse errors will raise :exc:`NetrcParseError` with diagnostic @@ -35,7 +35,7 @@ .. exception:: NetrcParseError - Exception raised by the :class:`netrc` class when syntactical errors are + Exception raised by the :class:`~netrc.netrc` class when syntactical errors are encountered in source text. Instances of this exception provide three interesting attributes: :attr:`msg` is a textual explanation of the error, :attr:`filename` is the name of the source file, and :attr:`lineno` gives the @@ -47,7 +47,7 @@ netrc Objects ------------- -A :class:`netrc` instance has the following methods: +A :class:`~netrc.netrc` instance has the following methods: .. method:: netrc.authenticators(host) @@ -63,7 +63,7 @@ Dump the class data as a string in the format of a netrc file. (This discards comments and may reorder the entries.) -Instances of :class:`netrc` have public instance variables: +Instances of :class:`~netrc.netrc` have public instance variables: .. attribute:: netrc.hosts diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1441,7 +1441,7 @@ :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument instead. Socket objects also have these (read-only) attributes that correspond to the -values given to the :class:`socket` constructor. +values given to the :class:`~socket.socket` constructor. .. attribute:: socket.family diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -1683,13 +1683,13 @@ fancy features, and just stick to the basics of representing time. The three primary types are: :class:`date`, representing a day, month, and year; -:class:`time`, consisting of hour, minute, and second; and :class:`datetime`, -which contains all the attributes of both :class:`date` and :class:`time`. +:class:`~datetime.time`, consisting of hour, minute, and second; and :class:`~datetime.datetime`, +which contains all the attributes of both :class:`date` and :class:`~datetime.time`. There's also a :class:`timedelta` class representing differences between two points in time, and time zone logic is implemented by classes inheriting from the abstract :class:`tzinfo` class. -You can create instances of :class:`date` and :class:`time` by either supplying +You can create instances of :class:`date` and :class:`~datetime.time` by either supplying keyword arguments to the appropriate constructor, e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a number of class methods. For example, the :meth:`date.today` class method returns the @@ -1708,7 +1708,7 @@ '2002 30 Dec' The :meth:`replace` method allows modifying one or more fields of a -:class:`date` or :class:`datetime` instance, returning a new instance:: +:class:`date` or :class:`~datetime.datetime` instance, returning a new instance:: >>> d = datetime.datetime.now() >>> d @@ -1718,11 +1718,11 @@ >>> Instances can be compared, hashed, and converted to strings (the result is the -same as that of :meth:`isoformat`). :class:`date` and :class:`datetime` +same as that of :meth:`isoformat`). :class:`date` and :class:`~datetime.datetime` instances can be subtracted from each other, and added to :class:`timedelta` instances. The largest missing feature is that there's no standard library support for parsing strings and getting back a :class:`date` or -:class:`datetime`. +:class:`~datetime.datetime`. For more information, refer to the module's reference documentation. (Contributed by Tim Peters.) diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1523,7 +1523,7 @@ empty list instead of raising a :exc:`TypeError` exception if called with no arguments. -* You can no longer compare the :class:`date` and :class:`datetime` instances +* You can no longer compare the :class:`date` and :class:`~datetime.datetime` instances provided by the :mod:`datetime` module. Two instances of different classes will now always be unequal, and relative comparisons (``<``, ``>``) will raise a :exc:`TypeError`. diff --git a/Doc/whatsnew/2.5.rst b/Doc/whatsnew/2.5.rst --- a/Doc/whatsnew/2.5.rst +++ b/Doc/whatsnew/2.5.rst @@ -1307,7 +1307,7 @@ (Contributed by Skip Montanaro and Andrew McNamara.) -* The :class:`datetime` class in the :mod:`datetime` module now has a +* The :class:`~datetime.datetime` class in the :mod:`datetime` module now has a ``strptime(string, format)`` method for parsing date strings, contributed by Josh Spoerri. It uses the same format characters as :func:`time.strptime` and :func:`time.strftime`:: @@ -1497,7 +1497,7 @@ * The :mod:`pyexpat` module now uses version 2.0 of the Expat parser. (Contributed by Trent Mick.) -* The :class:`Queue` class provided by the :mod:`Queue` module gained two new +* The :class:`~queue.Queue` class provided by the :mod:`Queue` module gained two new methods. :meth:`join` blocks until all items in the queue have been retrieved and all processing work on the items have been completed. Worker threads call the other new method, :meth:`task_done`, to signal that processing for an item @@ -1649,7 +1649,7 @@ .. Patch #754022 -* The :mod:`xmlrpclib` module now supports returning :class:`datetime` objects +* The :mod:`xmlrpclib` module now supports returning :class:`~datetime.datetime` objects for the XML-RPC date type. Supply ``use_datetime=True`` to the :func:`loads` function or the :class:`Unmarshaller` class to enable this feature. (Contributed by Skip Montanaro.) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -613,10 +613,10 @@ result = queue.get() print 'Factorial', N, '=', result -A :class:`Queue` is used to communicate the result of the factorial. -The :class:`Queue` object is stored in a global variable. +A :class:`~queue.Queue` is used to communicate the result of the factorial. +The :class:`~queue.Queue` object is stored in a global variable. The child process will use the value of the variable when the child -was created; because it's a :class:`Queue`, parent and child can use +was created; because it's a :class:`~queue.Queue`, parent and child can use the object to communicate. (If the parent were to change the value of the global variable, the child's value would be unaffected, and vice versa.) @@ -2131,7 +2131,7 @@ (Contributed by Christian Heimes and Mark Dickinson.) -* :class:`mmap` objects now have a :meth:`rfind` method that searches for a +* :class:`~mmap.mmap` objects now have a :meth:`rfind` method that searches for a substring beginning at the end of the string and searching backwards. The :meth:`find` method also gained an *end* parameter giving an index at which to stop searching. @@ -2630,7 +2630,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented by using ```` in XML-RPC responses @@ -3283,7 +3283,7 @@ :class:`datetime.date` and :class:`datetime.time` to the :class:`xmlrpclib.DateTime` type; the conversion semantics were not necessarily correct for all applications. Code using - :mod:`xmlrpclib` should convert :class:`date` and :class:`time` + :mod:`xmlrpclib` should convert :class:`date` and :class:`~datetime.time` instances. (:issue:`1330538`) * (3.0-warning mode) The :class:`Exception` class now warns -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 2 23:05:10 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 03 Dec 2016 04:05:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4ODQ3?= =?utf-8?q?=3A_Fix_spelling?= Message-ID: <20161203040510.30812.67538.D0FFB0CF@psf.io> https://hg.python.org/cpython/rev/dc7c86de9e13 changeset: 105423:dc7c86de9e13 branch: 2.7 parent: 105418:5b40d81e8883 user: Martin Panter date: Sat Dec 03 03:44:16 2016 +0000 summary: Issue #28847: Fix spelling files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,7 +13,7 @@ - Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. -- Issue #28847: dubmdbm no longer writes the index file in when it is not +- Issue #28847: dumbdbm no longer writes the index file in when it is not changed and supports reading read-only files. - Issue #11145: Fixed miscellaneous issues with C-style formatting of types -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 00:58:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 03 Dec 2016 05:58:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Try_to_fix_tes?= =?utf-8?q?t=2Etest=5Fsupport=2Ermtree=28=29_on_Windows_for_fixing_issue28?= =?utf-8?q?847_tests=2E?= Message-ID: <20161203055815.13336.21541.669D5F91@psf.io> https://hg.python.org/cpython/rev/cb4a892e9b66 changeset: 105424:cb4a892e9b66 branch: 2.7 user: Serhiy Storchaka date: Sat Dec 03 07:57:54 2016 +0200 summary: Try to fix test.test_support.rmtree() on Windows for fixing issue28847 tests. files: Lib/test/test_support.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 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 @@ -239,9 +239,9 @@ fullname = os.path.join(path, name) if os.path.isdir(fullname): _waitfor(_rmtree_inner, fullname, waitall=True) - _force_run(path, os.rmdir, fullname) + _force_run(fullname, os.rmdir, fullname) else: - _force_run(path, os.unlink, fullname) + _force_run(fullname, os.unlink, fullname) _waitfor(_rmtree_inner, path, waitall=True) _waitfor(lambda p: _force_run(p, os.rmdir, p), path) else: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 02:15:12 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 03 Dec 2016 07:15:12 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4NDQw?= =?utf-8?q?=3A_No_longer_add_/Library/Python/site-packages=2C_the_Apple-su?= =?utf-8?q?pplied?= Message-ID: <20161203071512.92935.29195.33635D7F@psf.io> https://hg.python.org/cpython/rev/a8a342b3fbc7 changeset: 105425:a8a342b3fbc7 branch: 2.7 user: Ned Deily date: Sat Dec 03 02:14:09 2016 -0500 summary: Issue #28440: No longer add /Library/Python/site-packages, the Apple-supplied system Python site-packages directory, to sys.path for macOS framework builds. The coupling between the two Python instances often caused confusion and, as of macOS 10.12, changes to the site-packages layout can cause pip component installations to fail. This change reverts the effects introduced in 2.7.0 by Issue #4865. If you are using a package with both the Apple system Python 2.7 and a user-installed Python 2.7, you will need to ensure that copies of the package are installed with both Python instances. files: Doc/whatsnew/2.7.rst | 12 ++++ Lib/site.py | 9 --- Lib/test/test_site.py | 13 +---- Mac/BuildScript/resources/ReadMe.rtf | 47 +++++++++++---- Misc/NEWS | 13 ++++ 5 files changed, 59 insertions(+), 35 deletions(-) diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -2343,6 +2343,18 @@ installation and a user-installed copy of the same version. (Changed by Ronald Oussoren; :issue:`4865`.) + .. versionchanged:: 2.7.13 + + As of 2.7.13, this change was removed. + ``/Library/Python/2.7/site-packages``, the site-packages directory + used by the Apple-supplied system Python 2.7 is no longer appended to + ``sys.path`` for user-installed Pythons such as from the python.org + installers. As of macOS 10.12, Apple changed how the system + site-packages directory is configured, which could cause installation + of pip components, like setuptools, to fail. Packages installed for + the system Python will no longer be shared with user-installed + Pythons. (:issue:`28440`) + Port-Specific Changes: FreeBSD ----------------------------------- diff --git a/Lib/site.py b/Lib/site.py --- a/Lib/site.py +++ b/Lib/site.py @@ -295,15 +295,6 @@ else: sitepackages.append(prefix) sitepackages.append(os.path.join(prefix, "lib", "site-packages")) - if sys.platform == "darwin": - # for framework builds *only* we add the standard Apple - # locations. - from sysconfig import get_config_var - framework = get_config_var("PYTHONFRAMEWORK") - if framework: - sitepackages.append( - os.path.join("/Library", framework, - sys.version[:3], "site-packages")) return sitepackages def addsitepackages(known_paths): 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 @@ -233,19 +233,8 @@ self.assertEqual(len(dirs), 1) wanted = os.path.join('xoxo', 'Lib', 'site-packages') self.assertEqual(dirs[0], wanted) - elif (sys.platform == "darwin" and - sysconfig.get_config_var("PYTHONFRAMEWORK")): - # OS X framework builds - site.PREFIXES = ['Python.framework'] - dirs = site.getsitepackages() - self.assertEqual(len(dirs), 3) - wanted = os.path.join('/Library', - sysconfig.get_config_var("PYTHONFRAMEWORK"), - sys.version[:3], - 'site-packages') - self.assertEqual(dirs[2], wanted) elif os.sep == '/': - # OS X non-framwework builds, Linux, FreeBSD, etc + # OS X, Linux, FreeBSD, etc self.assertEqual(len(dirs), 2) wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3], 'site-packages') diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf --- a/Mac/BuildScript/resources/ReadMe.rtf +++ b/Mac/BuildScript/resources/ReadMe.rtf @@ -1,12 +1,13 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 +{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf750 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;} {\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} \margl1440\margr1440\vieww15240\viewh15540\viewkind0 -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \f0\fs24 \cf0 This package will install Python $FULL_VERSION for Mac OS X $MACOSX_DEPLOYMENT_TARGET for the following architecture(s): $ARCHITECTURES.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \b \cf0 \ul \ulc0 Which installer variant should I use? \b0 \ulnone \ @@ -36,8 +37,26 @@ \i0 for this version of Python and of Mac OS X.\ \b \ul \ -Installing on OS X 10.8 (Mountain Lion) or later systems\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 +\cf0 Packages installed with the system Python 2.7 are no longer searched for\ +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 +\cf0 \ulnone [CHANGED for Python 2.7.13] +\b0 \ +\ +As of Python 2.7.0, user-installed Python 2.7 versions from python.org installers added the system-wide site-packages directory for the Apple-supplied Python 2.7 to the end of their search path. This meant that packages installed with the system Python 2.7 could also be used by the user-installed Python 2.7. While sometimes convenient, this also often caused confusion with the implicit coupling between the two Python instances. Separately, as of macOS 10.12, Apple changed the layout of the system site-packages directory, +\f1 /Library/Python/2.7/site-packages +\f0 , in a way that can now cause installation of +\f1 pip +\f0 components to fail. To avoid the confusion and the installation failures, as of 2.7.13 user-installed Pythons no longer add +\f1 /Library/Python/2.7/site-packages +\f0 to +\f1 sys.path +\f0 . If you are using a package with both a user-installed Python 2.7 and the system Python 2.7, you will now need to ensure that separate copies of the package are installed for each instance.\ +\ +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 + +\b \cf0 \ul Installing on OS X 10.8 (Mountain Lion) or later systems\ +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ulnone [CHANGED for Python 2.7.9] \b0 \ \ @@ -45,10 +64,10 @@ \i Install Python \i0 installer window. Refer to Apple\'92s support pages for {\field{\*\fldinst{HYPERLINK "http://support.apple.com/kb/ht5290"}}{\fldrslt more information on Gatekeeper}}.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \b \cf0 \ul Simplified web-based installs\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ulnone [NEW for Python 2.7.9] \b0 \ \ @@ -58,10 +77,10 @@ \f1 .dmg \f0 ) container. If you download the Python installer through a web browser, the OS X installer application may open automatically to allow you to perform the install. If your browser settings do not allow automatic open, double click on the downloaded installer file.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \b \cf0 \ul New Installation Options and Defaults\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ulnone [NEW for Python 2.7.9] \b0 \ \ @@ -77,10 +96,10 @@ \i Release Notes \i0 link for this release at {\field{\*\fldinst{HYPERLINK "https://www.python.org/downloads/"}}{\fldrslt https://www.python.org/downloads/}}.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \b \cf0 \ul Certificate verification and OpenSSL\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ulnone [CHANGED for Python 2.7.9] \b0 \ \ @@ -132,17 +151,17 @@ The bundled \f1 pip \f0 included with 2.7.9 has its own default certificate store for verifying download connections.\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \b \cf0 \ul \ Binary installer support for OS X 10.4 and 10.3.9 discontinued\ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \cf0 \ulnone [CHANGED for Python 2.7.9] \b0 \ \ As previously announced, binary installers for Python 2.7.9 from python.org no longer support Mac OS X 10.3.9 (Panther) and 10.4.x (Tiger) systems. These systems were last updated by Apple in 2005 and 2007. As of 2.7.9, the 32-bit-only installer supports PPC and Intel Macs running OS X 10.5 (Leopard). 10.5 was the last OS X release for PPC machines (G4 and G5). The 64-/32-bit installer configuration remains unchanged and should normally be used on OS X 10.6 (Snow Leopard) and later systems. This aligns Python 2.7.x installer configurations with those currently provided with Python 3.x. If needed, it is still possible to build Python from source for 10.3.9 and 10.4.\ \ -\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural +\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 \b \cf0 \ul Python 3 and Python 2 Co-existence\ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -336,6 +336,19 @@ - Issue #27888: Prevent Windows installer from displaying console windows and failing when pip cannot be installed/uninstalled. +Mac OS X +-------- + +- Issue #28440: No longer add /Library/Python/site-packages, the Apple-supplied + system Python site-packages directory, to sys.path for macOS framework builds. + The coupling between the two Python instances often caused confusion and, as + of macOS 10.12, changes to the site-packages layout can cause pip component + installations to fail. This change reverts the effects introduced in 2.7.0 + by Issue #4865. If you are using a package with both the Apple system Python + 2.7 and a user-installed Python 2.7, you will need to ensure that copies of + the package are installed with both Python instances. + + What's New in Python 2.7.12? ============================ -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Dec 3 04:06:44 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 03 Dec 2016 09:06:44 +0000 Subject: [Python-checkins] Daily reference leaks (c642c597d05c): sum=11 Message-ID: <20161203090644.92935.78920.5D709634@psf.io> results for c642c597d05c on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] 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/reflogBKvTWY', '--timeout', '7200'] From python-checkins at python.org Sat Dec 3 14:04:00 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 19:04:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_refleak_in?= =?utf-8?q?_the_shift-by-zero_case_=28=2327870=29?= Message-ID: <20161203190400.21965.99800.919A00A1@psf.io> https://hg.python.org/cpython/rev/2b190bfd9ab4 changeset: 105426:2b190bfd9ab4 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 11:01:50 2016 -0800 summary: fix refleak in the shift-by-zero case (#27870) files: Objects/longobject.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3710,14 +3710,15 @@ shiftby = PyLong_AsSsize_t((PyObject *)b); if (shiftby == -1L && PyErr_Occurred()) - goto lshift_error; + goto out; if (shiftby < 0) { PyErr_SetString(PyExc_ValueError, "negative shift count"); - goto lshift_error; + goto out; } if (Py_SIZE(a) == 0) { - return PyLong_FromLong(0); + z = (PyLongObject *)PyLong_FromLong(0); + goto out; } /* wordshift, remshift = divmod(shiftby, PyLong_SHIFT) */ @@ -3730,7 +3731,7 @@ ++newsize; z = _PyLong_New(newsize); if (z == NULL) - goto lshift_error; + goto out; if (a->ob_size < 0) z->ob_size = -(z->ob_size); for (i = 0; i < wordshift; i++) @@ -3746,7 +3747,7 @@ else assert(!accum); z = long_normalize(z); - lshift_error: + out: Py_DECREF(a); Py_DECREF(b); return (PyObject *) z; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 14:14:00 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 19:14:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_refleak_in?= =?utf-8?q?_file_handle_creation_error_case?= Message-ID: <20161203191400.21422.60261.75AC1CD1@psf.io> https://hg.python.org/cpython/rev/30094adf4158 changeset: 105427:30094adf4158 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 11:12:51 2016 -0800 summary: fix refleak in file handle creation error case files: Modules/posixmodule.c | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6906,13 +6906,6 @@ } } #endif - /* The dummy filename used here must be kept in sync with the value - tested against in gzip.GzipFile.__init__() - see issue #13781. */ - f = PyFile_FromFile(NULL, "", orgmode, fclose); - if (f == NULL) { - PyMem_FREE(mode); - return NULL; - } Py_BEGIN_ALLOW_THREADS #if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H) if (mode[0] == 'a') { @@ -6935,6 +6928,11 @@ PyMem_FREE(mode); if (fp == NULL) return posix_error(); + /* The dummy filename used here must be kept in sync with the value + tested against in gzip.GzipFile.__init__() - see issue #13781. */ + f = PyFile_FromFile(NULL, "", orgmode, fclose); + if (f == NULL) + return NULL; /* We now know we will succeed, so initialize the file object. */ ((PyFileObject *)f)->f_fp = fp; PyFile_SetBufSize(f, bufsize); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 14:30:11 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 19:30:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_when_you_enter?= =?utf-8?q?_repr=2C_you_must_leave=2C_too_=28=2325455=29?= Message-ID: <20161203193011.92998.27735.6D244610@psf.io> https://hg.python.org/cpython/rev/ea1edf1bf362 changeset: 105428:ea1edf1bf362 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 11:30:04 2016 -0800 summary: when you enter repr, you must leave, too (#25455) files: Modules/_elementtree.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1236,6 +1236,7 @@ repr = PyString_FromFormat("", PyString_AS_STRING(tag), self); + Py_ReprLeave((PyObject *)self); Py_DECREF(tag); return repr; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:01:36 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 20:01:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_refleak_in?= =?utf-8?q?_null-containing_error_case_=28=2321147=29?= Message-ID: <20161203200135.14871.15070.121728AA@psf.io> https://hg.python.org/cpython/rev/e358aaf9563f changeset: 105429:e358aaf9563f branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 12:01:32 2016 -0800 summary: fix refleak in null-containing error case (#21147) files: Modules/_sqlite/statement.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c --- a/Modules/_sqlite/statement.c +++ b/Modules/_sqlite/statement.c @@ -74,8 +74,9 @@ rc = PYSQLITE_SQL_WRONG_TYPE; return rc; } - sql_cstr = PyString_AsString(sql_str); + sql_cstr = PyString_AS_STRING(sql_str); if (strlen(sql_cstr) != (size_t)PyString_GET_SIZE(sql_str)) { + Py_DECREF(sql_str); PyErr_SetString(PyExc_ValueError, "the query contains a null character"); return PYSQLITE_SQL_WRONG_TYPE; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:08:31 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 20:08:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_refleak_in?= =?utf-8?q?_reduce=5F2_error_case?= Message-ID: <20161203200831.30631.31799.B3741388@psf.io> https://hg.python.org/cpython/rev/6a3f50f1cfdb changeset: 105430:6a3f50f1cfdb branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 12:08:24 2016 -0800 summary: fix refleak in reduce_2 error case files: Objects/typeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3286,7 +3286,7 @@ PyErr_Format(PyExc_TypeError, "can't pickle %.200s objects", ((PyTypeObject *)cls)->tp_name); - return NULL; + goto end; } getnewargs = PyObject_GetAttrString(obj, "__getnewargs__"); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:13:11 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 20:13:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Ensures_intermediate_directory_is_created_before_using_it?= Message-ID: <20161203201311.93462.23432.FC1F277F@psf.io> https://hg.python.org/cpython/rev/d9879b12c627 changeset: 105434:d9879b12c627 branch: 3.6 parent: 105432:5171bd86a36f parent: 105433:f30d9af3e509 user: Steve Dower date: Sat Dec 03 11:56:44 2016 -0800 summary: Ensures intermediate directory is created before using it files: PCbuild/pythoncore.vcxproj | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -412,6 +412,7 @@ <_HG Condition="$(HG.Contains(` `))">"$(HG)" + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:13:11 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 20:13:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4ODQ2?= =?utf-8?q?=3A_Various_installer_fixes?= Message-ID: <20161203201311.92865.9131.403EBC50@psf.io> https://hg.python.org/cpython/rev/68530c0a1487 changeset: 105431:68530c0a1487 branch: 3.5 parent: 105422:555b32f418ce user: Steve Dower date: Sat Dec 03 11:18:53 2016 -0800 summary: Issue #28846: Various installer fixes files: PCbuild/build.bat | 4 ++++ PCbuild/pythoncore.vcxproj | 12 +++++++++--- Tools/msi/buildrelease.bat | 7 ++++--- Tools/msi/bundle/bundle.wxs | 6 ++++-- Tools/msi/make_zip.proj | 4 ++-- Tools/nuget/make_pkg.proj | 3 +-- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/PCbuild/build.bat b/PCbuild/build.bat --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -105,6 +105,9 @@ ) ) +if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" +if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 + rem Setup the environment call "%dir%env.bat" %vs_platf% >nul @@ -142,6 +145,7 @@ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ /p:UseTestMarker=%UseTestMarker%^ + /p:HG="%HG%"^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -399,9 +399,15 @@ - - - + + hg + <_HG>$(HG) + <_HG Condition="$(HG.Contains(` `))">"$(HG)" + + + + + $([System.IO.File]::ReadAllText('$(IntDir)hgbranch.txt').Trim()) $([System.IO.File]::ReadAllText('$(IntDir)hgversion.txt').Trim()) diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -64,6 +64,9 @@ if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) +if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" +if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 + call "%D%get_externals.bat" :builddoc @@ -77,8 +80,6 @@ if errorlevel 1 goto :eof :skipdoc -where hg /q || echo Cannot find Mercurial on PATH && exit /B 1 - where dlltool /q && goto skipdlltoolsearch set _DLLTOOL_PATH= where /R "%EXTERNALS%\" dlltool > "%TEMP%\dlltool.loc" 2> nul && set /P _DLLTOOL_PATH= < "%TEMP%\dlltool.loc" & del "%TEMP%\dlltool.loc" @@ -187,7 +188,7 @@ if errorlevel 1 exit /B if defined BUILDZIP ( - msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% + msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us" if errorlevel 1 exit /B ) diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs --- a/Tools/msi/bundle/bundle.wxs +++ b/Tools/msi/bundle/bundle.wxs @@ -1,6 +1,7 @@ ? + xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" + xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension"> + Compressed="no" + dep:ProviderKey="CPython-$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)"> diff --git a/Tools/msi/make_zip.proj b/Tools/msi/make_zip.proj --- a/Tools/msi/make_zip.proj +++ b/Tools/msi/make_zip.proj @@ -13,10 +13,10 @@ false python-$(PythonVersion)-embed-$(ArchName) .zip - $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(OutputPath)\$(TargetName)$(TargetExt) rmdir /q/s "$(IntermediateOutputPath)\zip_$(ArchName)" "$(PythonExe)" "$(MSBuildThisFileDirectory)\make_zip.py" - $(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -b "$(OutDir.TrimEnd('\'))" + $(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -b "$(BuildPath.TrimEnd('\'))" set DOC_FILENAME=python$(PythonVersion).chm set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -18,13 +18,12 @@ false $(OutputName).$(NuspecVersion) .nupkg - $(OutputPath)\$(TargetName)$(TargetExt) $(IntermediateOutputPath)\nuget_$(ArchName) rmdir /q/s "$(IntermediateOutputPath)" "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" - $(PythonArguments) -t "$(IntermediateOutputPath)" -b "$(OutDir.TrimEnd('\'))" + $(PythonArguments) -t "$(IntermediateOutputPath)" -b "$(BuildPath.TrimEnd('\'))" "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:13:11 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 20:13:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Ensures_interm?= =?utf-8?q?ediate_directory_is_created_before_accessing_it=2E?= Message-ID: <20161203201311.22212.56146.0E61F585@psf.io> https://hg.python.org/cpython/rev/f30d9af3e509 changeset: 105433:f30d9af3e509 branch: 3.5 parent: 105431:68530c0a1487 user: Steve Dower date: Sat Dec 03 11:56:20 2016 -0800 summary: Ensures intermediate directory is created before accessing it. files: PCbuild/pythoncore.vcxproj | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -405,6 +405,7 @@ <_HG Condition="$(HG.Contains(` `))">"$(HG)" + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:13:11 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 20:13:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328846=3A_Various_installer_fixes?= Message-ID: <20161203201311.21379.76526.104C9940@psf.io> https://hg.python.org/cpython/rev/5171bd86a36f changeset: 105432:5171bd86a36f branch: 3.6 parent: 105420:62c9a89a2103 parent: 105431:68530c0a1487 user: Steve Dower date: Sat Dec 03 11:24:02 2016 -0800 summary: Issue #28846: Various installer fixes files: PCbuild/build.bat | 4 + Tools/msi/buildrelease.bat | 8 +- Tools/msi/bundle/bundle.wxs | 6 +- Tools/msi/make_zip.proj | 2 +- Tools/nuget/make_pkg.proj | 1 - config.guess | 174 ++++++++++++++--------- config.sub | 75 +++++++--- 7 files changed, 174 insertions(+), 96 deletions(-) diff --git a/PCbuild/build.bat b/PCbuild/build.bat --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -105,6 +105,9 @@ ) ) +if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" +if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 + rem Setup the environment call "%dir%env.bat" %vs_platf% >nul @@ -142,6 +145,7 @@ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ /p:UseTestMarker=%UseTestMarker%^ + /p:HG="%HG%"^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -65,6 +65,9 @@ if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) +if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" +if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 + call "%D%get_externals.bat" :builddoc @@ -78,9 +81,6 @@ if errorlevel 1 goto :eof :skipdoc -where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 - where dlltool /q && goto skipdlltoolsearch set _DLLTOOL_PATH= where /R "%EXTERNALS%\" dlltool > "%TEMP%\dlltool.loc" 2> nul && set /P _DLLTOOL_PATH= < "%TEMP%\dlltool.loc" & del "%TEMP%\dlltool.loc" @@ -181,7 +181,7 @@ if errorlevel 1 exit /B if defined BUILDZIP ( - msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% + msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us" if errorlevel 1 exit /B ) diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs --- a/Tools/msi/bundle/bundle.wxs +++ b/Tools/msi/bundle/bundle.wxs @@ -1,6 +1,7 @@ ? + xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" + xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension"> + Compressed="no" + dep:ProviderKey="CPython-$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)"> diff --git a/Tools/msi/make_zip.proj b/Tools/msi/make_zip.proj --- a/Tools/msi/make_zip.proj +++ b/Tools/msi/make_zip.proj @@ -13,7 +13,7 @@ false python-$(PythonVersion)-embed-$(ArchName) .zip - $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(OutputPath)\$(TargetName)$(TargetExt) rmdir /q/s "$(IntermediateOutputPath)\zip_$(ArchName)" "$(PythonExe)" "$(MSBuildThisFileDirectory)\make_zip.py" $(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -a $(ArchName) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -18,7 +18,6 @@ false $(OutputName).$(NuspecVersion) .nupkg - $(OutputPath)\$(TargetName)$(TargetExt) $(IntermediateOutputPath)\nuget_$(ArchName) rmdir /q/s "$(IntermediateOutputPath)" diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches at gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-05-01' +timestamp='2016-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,10 +301,12 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -312,6 +314,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -326,6 +329,9 @@ c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -371,12 +377,13 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -422,13 +429,15 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -436,6 +445,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -512,6 +522,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -632,6 +645,14 @@ basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -773,6 +794,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -828,6 +852,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1004,7 +1032,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1014,7 +1042,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1360,27 +1388,28 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1512,6 +1541,8 @@ ;; -nacl*) ;; + -ios) + ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:13:12 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 20:13:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Revert_unintended_merge?= Message-ID: <20161203201312.21479.59202.71523E16@psf.io> https://hg.python.org/cpython/rev/a60767015bed changeset: 105436:a60767015bed user: Steve Dower date: Sat Dec 03 12:12:23 2016 -0800 summary: Revert unintended merge files: config.guess | 174 ++++++++++++++------------------------ config.sub | 75 ++++----------- 2 files changed, 88 insertions(+), 161 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2016-10-02' +timestamp='2014-03-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# Originally written by Per Bothner. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches at gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,29 +168,19 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ - echo unknown)` + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. + # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - earm*) - os=netbsdelf - ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -207,13 +197,6 @@ os=netbsd ;; esac - # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` - ;; - esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -224,13 +207,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -240,10 +223,6 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} - exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -256,9 +235,6 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; - *:Sortix:*:*) - echo ${UNAME_MACHINE}-unknown-sortix - exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -275,42 +251,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; + UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; + UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; + UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; + UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; + UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; + UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; + UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; + UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; + UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -383,16 +359,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH=i386 + SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH=x86_64 + SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -417,7 +393,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -603,9 +579,8 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -642,13 +617,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi @@ -687,11 +662,11 @@ exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = hppa2.0w ] + if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build @@ -704,12 +679,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH=hppa2.0w + HP_ARCH="hppa2.0w" else - HP_ARCH=hppa64 + HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -814,14 +789,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -903,7 +878,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -926,7 +901,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -957,9 +932,6 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; - e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -972,9 +944,6 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - k1om:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -1000,9 +969,6 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - mips64el:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1035,9 +1001,6 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1057,7 +1020,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1136,7 +1099,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that + # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1285,9 +1248,6 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; - SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux${UNAME_RELEASE} - exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1301,9 +1261,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1325,7 +1285,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then + if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1356,7 +1316,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = 386; then + if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1398,7 +1358,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1409,25 +1369,23 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; - amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; esac cat >&2 < in order to provide the needed +information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2016-11-19' +timestamp='2014-05-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,7 +53,8 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS Canonicalize a configuration name. @@ -67,7 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -116,8 +117,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -254,13 +255,12 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ - | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,12 +301,10 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ | pyramid \ - | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -314,7 +312,6 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -329,9 +326,6 @@ c6x) basic_machine=tic6x-unknown ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -377,13 +371,12 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ - | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ + | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -429,15 +422,13 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ | pyramid-* \ - | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -445,7 +436,6 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ - | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -522,9 +512,6 @@ basic_machine=i386-pc os=-aros ;; - asmjs) - basic_machine=asmjs-unknown - ;; aux) basic_machine=m68k-apple os=-aux @@ -645,14 +632,6 @@ basic_machine=m68k-bull os=-sysv3 ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - os=$os"spe" - ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -794,9 +773,6 @@ basic_machine=m68k-isi os=-sysv ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -852,10 +828,6 @@ basic_machine=powerpc-unknown os=-morphos ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; msdos) basic_machine=i386-pc os=-msdos @@ -1032,7 +1004,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle) + ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1042,7 +1014,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little) + ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1388,28 +1360,27 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1541,8 +1512,6 @@ ;; -nacl*) ;; - -ios) - ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:13:12 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 20:13:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328846=3A_Various_installer_fixes?= Message-ID: <20161203201311.29302.56658.68F5F991@psf.io> https://hg.python.org/cpython/rev/014f52fe1da1 changeset: 105435:014f52fe1da1 parent: 105421:c642c597d05c parent: 105434:d9879b12c627 user: Steve Dower date: Sat Dec 03 12:11:25 2016 -0800 summary: Issue #28846: Various installer fixes files: PCbuild/build.bat | 4 + PCbuild/pythoncore.vcxproj | 1 + Tools/msi/buildrelease.bat | 8 +- Tools/msi/bundle/bundle.wxs | 6 +- Tools/msi/make_zip.proj | 2 +- Tools/nuget/make_pkg.proj | 1 - config.guess | 174 ++++++++++++++--------- config.sub | 75 +++++++--- 8 files changed, 175 insertions(+), 96 deletions(-) diff --git a/PCbuild/build.bat b/PCbuild/build.bat --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -105,6 +105,9 @@ ) ) +if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" +if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 + rem Setup the environment call "%dir%env.bat" %vs_platf% >nul @@ -142,6 +145,7 @@ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ /p:UseTestMarker=%UseTestMarker%^ + /p:HG="%HG%"^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -412,6 +412,7 @@ <_HG Condition="$(HG.Contains(` `))">"$(HG)" + diff --git a/Tools/msi/buildrelease.bat b/Tools/msi/buildrelease.bat --- a/Tools/msi/buildrelease.bat +++ b/Tools/msi/buildrelease.bat @@ -65,6 +65,9 @@ if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) +if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" +if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 + call "%D%get_externals.bat" :builddoc @@ -78,9 +81,6 @@ if errorlevel 1 goto :eof :skipdoc -where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 - where dlltool /q && goto skipdlltoolsearch set _DLLTOOL_PATH= where /R "%EXTERNALS%\" dlltool > "%TEMP%\dlltool.loc" 2> nul && set /P _DLLTOOL_PATH= < "%TEMP%\dlltool.loc" & del "%TEMP%\dlltool.loc" @@ -181,7 +181,7 @@ if errorlevel 1 exit /B if defined BUILDZIP ( - msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% + msbuild "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us" if errorlevel 1 exit /B ) diff --git a/Tools/msi/bundle/bundle.wxs b/Tools/msi/bundle/bundle.wxs --- a/Tools/msi/bundle/bundle.wxs +++ b/Tools/msi/bundle/bundle.wxs @@ -1,6 +1,7 @@ ? + xmlns:bal="http://schemas.microsoft.com/wix/BalExtension" + xmlns:dep="http://schemas.microsoft.com/wix/DependencyExtension"> + Compressed="no" + dep:ProviderKey="CPython-$(var.MajorVersionNumber).$(var.MinorVersionNumber)$(var.PyArchExt)$(var.PyTestExt)"> diff --git a/Tools/msi/make_zip.proj b/Tools/msi/make_zip.proj --- a/Tools/msi/make_zip.proj +++ b/Tools/msi/make_zip.proj @@ -13,7 +13,7 @@ false python-$(PythonVersion)-embed-$(ArchName) .zip - $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(OutputPath)\$(TargetName)$(TargetExt) rmdir /q/s "$(IntermediateOutputPath)\zip_$(ArchName)" "$(PythonExe)" "$(MSBuildThisFileDirectory)\make_zip.py" $(Arguments) -e -o "$(TargetPath)" -t "$(IntermediateOutputPath)\zip_$(ArchName)" -a $(ArchName) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -18,7 +18,6 @@ false $(OutputName).$(NuspecVersion) .nupkg - $(OutputPath)\$(TargetName)$(TargetExt) $(IntermediateOutputPath)\nuget_$(ArchName) rmdir /q/s "$(IntermediateOutputPath)" diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-03-23' +timestamp='2016-10-02' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -579,8 +603,9 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -617,13 +642,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -662,11 +687,11 @@ exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -679,12 +704,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -789,14 +814,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -878,7 +903,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -901,7 +926,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -932,6 +957,9 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -944,6 +972,9 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -969,6 +1000,9 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1001,6 +1035,9 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1020,7 +1057,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1099,7 +1136,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1248,6 +1285,9 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1261,9 +1301,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1285,7 +1325,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1316,7 +1356,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1358,7 +1398,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1369,23 +1409,25 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches at gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2014-05-01' +timestamp='2016-11-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches with a ChangeLog entry to config-patches at gnu.org. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2014 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,8 +116,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -255,12 +254,13 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,10 +301,12 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -312,6 +314,7 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -326,6 +329,9 @@ c6x) basic_machine=tic6x-unknown ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -371,12 +377,13 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -422,13 +429,15 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -436,6 +445,7 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -512,6 +522,9 @@ basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -632,6 +645,14 @@ basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -773,6 +794,9 @@ basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -828,6 +852,10 @@ basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -1004,7 +1032,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1014,7 +1042,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1360,27 +1388,28 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1512,6 +1541,8 @@ ;; -nacl*) ;; + -ios) + ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:32:43 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 20:32:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_inline_constan?= =?utf-8?q?t_into_its_single_use?= Message-ID: <20161203203243.27977.9858.4B47188D@psf.io> https://hg.python.org/cpython/rev/191cfde40203 changeset: 105437:191cfde40203 branch: 2.7 parent: 105430:6a3f50f1cfdb user: Benjamin Peterson date: Sat Dec 03 12:32:38 2016 -0800 summary: inline constant into its single use files: Modules/_math.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Modules/_math.c b/Modules/_math.c --- a/Modules/_math.c +++ b/Modules/_math.c @@ -22,7 +22,6 @@ static const double ln2 = 6.93147180559945286227E-01; static const double two_pow_m28 = 3.7252902984619141E-09; /* 2**-28 */ static const double two_pow_p28 = 268435456.0; /* 2**28 */ -static const double zero = 0.0; /* acosh(x) * Method : @@ -143,7 +142,7 @@ #ifdef Py_NAN return Py_NAN; #else - return x/zero; + return x/0.0; #endif } if (absx < two_pow_m28) { /* |x| < 2**-28 */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:36:51 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 20:36:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_update_pydoc_t?= =?utf-8?q?opics?= Message-ID: <20161203203650.30504.71671.4B2738DB@psf.io> https://hg.python.org/cpython/rev/90ffb2d620ef changeset: 105438:90ffb2d620ef branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 12:36:45 2016 -0800 summary: update pydoc topics files: Lib/pydoc_data/topics.py | 13404 +------------------------ 1 files changed, 80 insertions(+), 13324 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,13325 +1,81 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sat Jun 11 14:41:12 2016 -topics = {'assert': '\n' - 'The "assert" statement\n' - '**********************\n' - '\n' - 'Assert statements are a convenient way to insert debugging ' - 'assertions\n' - 'into a program:\n' - '\n' - ' assert_stmt ::= "assert" expression ["," expression]\n' - '\n' - 'The simple form, "assert expression", is equivalent to\n' - '\n' - ' if __debug__:\n' - ' if not expression: raise AssertionError\n' - '\n' - 'The extended form, "assert expression1, expression2", is ' - 'equivalent to\n' - '\n' - ' if __debug__:\n' - ' if not expression1: raise AssertionError(expression2)\n' - '\n' - 'These equivalences assume that "__debug__" and "AssertionError" ' - 'refer\n' - 'to the built-in variables with those names. In the current\n' - 'implementation, the built-in variable "__debug__" is "True" under\n' - 'normal circumstances, "False" when optimization is requested ' - '(command\n' - 'line option -O). The current code generator emits no code for an\n' - 'assert statement when optimization is requested at compile time. ' - 'Note\n' - 'that it is unnecessary to include the source code for the ' - 'expression\n' - 'that failed in the error message; it will be displayed as part of ' - 'the\n' - 'stack trace.\n' - '\n' - 'Assignments to "__debug__" are illegal. The value for the ' - 'built-in\n' - 'variable is determined when the interpreter starts.\n', - 'assignment': '\n' - 'Assignment statements\n' - '*********************\n' - '\n' - 'Assignment statements are used to (re)bind names to values and ' - 'to\n' - 'modify attributes or items of mutable objects:\n' - '\n' - ' assignment_stmt ::= (target_list "=")+ (expression_list | ' - 'yield_expression)\n' - ' target_list ::= target ("," target)* [","]\n' - ' target ::= identifier\n' - ' | "(" target_list ")"\n' - ' | "[" [target_list] "]"\n' - ' | attributeref\n' - ' | subscription\n' - ' | slicing\n' - '\n' - '(See section Primaries for the syntax definitions for the last ' - 'three\n' - 'symbols.)\n' - '\n' - 'An assignment statement evaluates the expression list ' - '(remember that\n' - 'this can be a single expression or a comma-separated list, the ' - 'latter\n' - 'yielding a tuple) and assigns the single resulting object to ' - 'each of\n' - 'the target lists, from left to right.\n' - '\n' - 'Assignment is defined recursively depending on the form of the ' - 'target\n' - '(list). When a target is part of a mutable object (an ' - 'attribute\n' - 'reference, subscription or slicing), the mutable object must\n' - 'ultimately perform the assignment and decide about its ' - 'validity, and\n' - 'may raise an exception if the assignment is unacceptable. The ' - 'rules\n' - 'observed by various types and the exceptions raised are given ' - 'with the\n' - 'definition of the object types (see section The standard type\n' - 'hierarchy).\n' - '\n' - 'Assignment of an object to a target list is recursively ' - 'defined as\n' - 'follows.\n' - '\n' - '* If the target list is a single target: The object is ' - 'assigned to\n' - ' that target.\n' - '\n' - '* If the target list is a comma-separated list of targets: ' - 'The\n' - ' object must be an iterable with the same number of items as ' - 'there\n' - ' are targets in the target list, and the items are assigned, ' - 'from\n' - ' left to right, to the corresponding targets.\n' - '\n' - 'Assignment of an object to a single target is recursively ' - 'defined as\n' - 'follows.\n' - '\n' - '* If the target is an identifier (name):\n' - '\n' - ' * If the name does not occur in a "global" statement in the\n' - ' current code block: the name is bound to the object in the ' - 'current\n' - ' local namespace.\n' - '\n' - ' * Otherwise: the name is bound to the object in the current ' - 'global\n' - ' namespace.\n' - '\n' - ' The name is rebound if it was already bound. This may cause ' - 'the\n' - ' reference count for the object previously bound to the name ' - 'to reach\n' - ' zero, causing the object to be deallocated and its ' - 'destructor (if it\n' - ' has one) to be called.\n' - '\n' - '* If the target is a target list enclosed in parentheses or ' - 'in\n' - ' square brackets: The object must be an iterable with the ' - 'same number\n' - ' of items as there are targets in the target list, and its ' - 'items are\n' - ' assigned, from left to right, to the corresponding targets.\n' - '\n' - '* If the target is an attribute reference: The primary ' - 'expression in\n' - ' the reference is evaluated. It should yield an object with\n' - ' assignable attributes; if this is not the case, "TypeError" ' - 'is\n' - ' raised. That object is then asked to assign the assigned ' - 'object to\n' - ' the given attribute; if it cannot perform the assignment, it ' - 'raises\n' - ' an exception (usually but not necessarily ' - '"AttributeError").\n' - '\n' - ' Note: If the object is a class instance and the attribute ' - 'reference\n' - ' occurs on both sides of the assignment operator, the RHS ' - 'expression,\n' - ' "a.x" can access either an instance attribute or (if no ' - 'instance\n' - ' attribute exists) a class attribute. The LHS target "a.x" ' - 'is always\n' - ' set as an instance attribute, creating it if necessary. ' - 'Thus, the\n' - ' two occurrences of "a.x" do not necessarily refer to the ' - 'same\n' - ' attribute: if the RHS expression refers to a class ' - 'attribute, the\n' - ' LHS creates a new instance attribute as the target of the\n' - ' assignment:\n' - '\n' - ' class Cls:\n' - ' x = 3 # class variable\n' - ' inst = Cls()\n' - ' inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x ' - 'as 3\n' - '\n' - ' This description does not necessarily apply to descriptor\n' - ' attributes, such as properties created with "property()".\n' - '\n' - '* If the target is a subscription: The primary expression in ' - 'the\n' - ' reference is evaluated. It should yield either a mutable ' - 'sequence\n' - ' object (such as a list) or a mapping object (such as a ' - 'dictionary).\n' - ' Next, the subscript expression is evaluated.\n' - '\n' - ' If the primary is a mutable sequence object (such as a ' - 'list), the\n' - ' subscript must yield a plain integer. If it is negative, ' - 'the\n' - " sequence's length is added to it. The resulting value must " - 'be a\n' - " nonnegative integer less than the sequence's length, and " - 'the\n' - ' sequence is asked to assign the assigned object to its item ' - 'with\n' - ' that index. If the index is out of range, "IndexError" is ' - 'raised\n' - ' (assignment to a subscripted sequence cannot add new items ' - 'to a\n' - ' list).\n' - '\n' - ' If the primary is a mapping object (such as a dictionary), ' - 'the\n' - " subscript must have a type compatible with the mapping's key " - 'type,\n' - ' and the mapping is then asked to create a key/datum pair ' - 'which maps\n' - ' the subscript to the assigned object. This can either ' - 'replace an\n' - ' existing key/value pair with the same key value, or insert a ' - 'new\n' - ' key/value pair (if no key with the same value existed).\n' - '\n' - '* If the target is a slicing: The primary expression in the\n' - ' reference is evaluated. It should yield a mutable sequence ' - 'object\n' - ' (such as a list). The assigned object should be a sequence ' - 'object\n' - ' of the same type. Next, the lower and upper bound ' - 'expressions are\n' - ' evaluated, insofar they are present; defaults are zero and ' - 'the\n' - " sequence's length. The bounds should evaluate to (small) " - 'integers.\n' - " If either bound is negative, the sequence's length is added " - 'to it.\n' - ' The resulting bounds are clipped to lie between zero and ' - 'the\n' - " sequence's length, inclusive. Finally, the sequence object " - 'is asked\n' - ' to replace the slice with the items of the assigned ' - 'sequence. The\n' - ' length of the slice may be different from the length of the ' - 'assigned\n' - ' sequence, thus changing the length of the target sequence, ' - 'if the\n' - ' object allows it.\n' - '\n' - '**CPython implementation detail:** In the current ' - 'implementation, the\n' - 'syntax for targets is taken to be the same as for expressions, ' - 'and\n' - 'invalid syntax is rejected during the code generation phase, ' - 'causing\n' - 'less detailed error messages.\n' - '\n' - 'WARNING: Although the definition of assignment implies that ' - 'overlaps\n' - "between the left-hand side and the right-hand side are 'safe' " - '(for\n' - 'example "a, b = b, a" swaps two variables), overlaps *within* ' - 'the\n' - 'collection of assigned-to variables are not safe! For ' - 'instance, the\n' - 'following program prints "[0, 2]":\n' - '\n' - ' x = [0, 1]\n' - ' i = 0\n' - ' i, x[i] = 1, 2\n' - ' print x\n' - '\n' - '\n' - 'Augmented assignment statements\n' - '===============================\n' - '\n' - 'Augmented assignment is the combination, in a single ' - 'statement, of a\n' - 'binary operation and an assignment statement:\n' - '\n' - ' augmented_assignment_stmt ::= augtarget augop ' - '(expression_list | yield_expression)\n' - ' augtarget ::= identifier | attributeref | ' - 'subscription | slicing\n' - ' augop ::= "+=" | "-=" | "*=" | "/=" | ' - '"//=" | "%=" | "**="\n' - ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n' - '\n' - '(See section Primaries for the syntax definitions for the last ' - 'three\n' - 'symbols.)\n' - '\n' - 'An augmented assignment evaluates the target (which, unlike ' - 'normal\n' - 'assignment statements, cannot be an unpacking) and the ' - 'expression\n' - 'list, performs the binary operation specific to the type of ' - 'assignment\n' - 'on the two operands, and assigns the result to the original ' - 'target.\n' - 'The target is only evaluated once.\n' - '\n' - 'An augmented assignment expression like "x += 1" can be ' - 'rewritten as\n' - '"x = x + 1" to achieve a similar, but not exactly equal ' - 'effect. In the\n' - 'augmented version, "x" is only evaluated once. Also, when ' - 'possible,\n' - 'the actual operation is performed *in-place*, meaning that ' - 'rather than\n' - 'creating a new object and assigning that to the target, the ' - 'old object\n' - 'is modified instead.\n' - '\n' - 'With the exception of assigning to tuples and multiple targets ' - 'in a\n' - 'single statement, the assignment done by augmented assignment\n' - 'statements is handled the same way as normal assignments. ' - 'Similarly,\n' - 'with the exception of the possible *in-place* behavior, the ' - 'binary\n' - 'operation performed by augmented assignment is the same as the ' - 'normal\n' - 'binary operations.\n' - '\n' - 'For targets which are attribute references, the same caveat ' - 'about\n' - 'class and instance attributes applies as for regular ' - 'assignments.\n', - 'atom-identifiers': '\n' - 'Identifiers (Names)\n' - '*******************\n' - '\n' - 'An identifier occurring as an atom is a name. See ' - 'section Identifiers\n' - 'and keywords for lexical definition and section Naming ' - 'and binding for\n' - 'documentation of naming and binding.\n' - '\n' - 'When the name is bound to an object, evaluation of the ' - 'atom yields\n' - 'that object. When a name is not bound, an attempt to ' - 'evaluate it\n' - 'raises a "NameError" exception.\n' - '\n' - '**Private name mangling:** When an identifier that ' - 'textually occurs in\n' - 'a class definition begins with two or more underscore ' - 'characters and\n' - 'does not end in two or more underscores, it is ' - 'considered a *private\n' - 'name* of that class. Private names are transformed to a ' - 'longer form\n' - 'before code is generated for them. The transformation ' - 'inserts the\n' - 'class name, with leading underscores removed and a ' - 'single underscore\n' - 'inserted, in front of the name. For example, the ' - 'identifier "__spam"\n' - 'occurring in a class named "Ham" will be transformed to ' - '"_Ham__spam".\n' - 'This transformation is independent of the syntactical ' - 'context in which\n' - 'the identifier is used. If the transformed name is ' - 'extremely long\n' - '(longer than 255 characters), implementation defined ' - 'truncation may\n' - 'happen. If the class name consists only of underscores, ' - 'no\n' - 'transformation is done.\n', - 'atom-literals': '\n' - 'Literals\n' - '********\n' - '\n' - 'Python supports string literals and various numeric ' - 'literals:\n' - '\n' - ' literal ::= stringliteral | integer | longinteger\n' - ' | floatnumber | imagnumber\n' - '\n' - 'Evaluation of a literal yields an object of the given type ' - '(string,\n' - 'integer, long integer, floating point number, complex ' - 'number) with the\n' - 'given value. The value may be approximated in the case of ' - 'floating\n' - 'point and imaginary (complex) literals. See section ' - 'Literals for\n' - 'details.\n' - '\n' - 'All literals correspond to immutable data types, and hence ' - 'the\n' - "object's identity is less important than its value. " - 'Multiple\n' - 'evaluations of literals with the same value (either the ' - 'same\n' - 'occurrence in the program text or a different occurrence) ' - 'may obtain\n' - 'the same object or a different object with the same ' - 'value.\n', - 'attribute-access': '\n' - 'Customizing attribute access\n' - '****************************\n' - '\n' - 'The following methods can be defined to customize the ' - 'meaning of\n' - 'attribute access (use of, assignment to, or deletion of ' - '"x.name") for\n' - 'class instances.\n' - '\n' - 'object.__getattr__(self, name)\n' - '\n' - ' Called when an attribute lookup has not found the ' - 'attribute in the\n' - ' usual places (i.e. it is not an instance attribute ' - 'nor is it found\n' - ' in the class tree for "self"). "name" is the ' - 'attribute name. This\n' - ' method should return the (computed) attribute value ' - 'or raise an\n' - ' "AttributeError" exception.\n' - '\n' - ' Note that if the attribute is found through the ' - 'normal mechanism,\n' - ' "__getattr__()" is not called. (This is an ' - 'intentional asymmetry\n' - ' between "__getattr__()" and "__setattr__()".) This is ' - 'done both for\n' - ' efficiency reasons and because otherwise ' - '"__getattr__()" would have\n' - ' no way to access other attributes of the instance. ' - 'Note that at\n' - ' least for instance variables, you can fake total ' - 'control by not\n' - ' inserting any values in the instance attribute ' - 'dictionary (but\n' - ' instead inserting them in another object). See the\n' - ' "__getattribute__()" method below for a way to ' - 'actually get total\n' - ' control in new-style classes.\n' - '\n' - 'object.__setattr__(self, name, value)\n' - '\n' - ' Called when an attribute assignment is attempted. ' - 'This is called\n' - ' instead of the normal mechanism (i.e. store the value ' - 'in the\n' - ' instance dictionary). *name* is the attribute name, ' - '*value* is the\n' - ' value to be assigned to it.\n' - '\n' - ' If "__setattr__()" wants to assign to an instance ' - 'attribute, it\n' - ' should not simply execute "self.name = value" --- ' - 'this would cause\n' - ' a recursive call to itself. Instead, it should ' - 'insert the value in\n' - ' the dictionary of instance attributes, e.g., ' - '"self.__dict__[name] =\n' - ' value". For new-style classes, rather than accessing ' - 'the instance\n' - ' dictionary, it should call the base class method with ' - 'the same\n' - ' name, for example, "object.__setattr__(self, name, ' - 'value)".\n' - '\n' - 'object.__delattr__(self, name)\n' - '\n' - ' Like "__setattr__()" but for attribute deletion ' - 'instead of\n' - ' assignment. This should only be implemented if "del ' - 'obj.name" is\n' - ' meaningful for the object.\n' - '\n' - '\n' - 'More attribute access for new-style classes\n' - '===========================================\n' - '\n' - 'The following methods only apply to new-style classes.\n' - '\n' - 'object.__getattribute__(self, name)\n' - '\n' - ' Called unconditionally to implement attribute ' - 'accesses for\n' - ' instances of the class. If the class also defines ' - '"__getattr__()",\n' - ' the latter will not be called unless ' - '"__getattribute__()" either\n' - ' calls it explicitly or raises an "AttributeError". ' - 'This method\n' - ' should return the (computed) attribute value or raise ' - 'an\n' - ' "AttributeError" exception. In order to avoid ' - 'infinite recursion in\n' - ' this method, its implementation should always call ' - 'the base class\n' - ' method with the same name to access any attributes it ' - 'needs, for\n' - ' example, "object.__getattribute__(self, name)".\n' - '\n' - ' Note: This method may still be bypassed when looking ' - 'up special\n' - ' methods as the result of implicit invocation via ' - 'language syntax\n' - ' or built-in functions. See Special method lookup ' - 'for new-style\n' - ' classes.\n' - '\n' - '\n' - 'Implementing Descriptors\n' - '========================\n' - '\n' - 'The following methods only apply when an instance of the ' - 'class\n' - 'containing the method (a so-called *descriptor* class) ' - 'appears in an\n' - '*owner* class (the descriptor must be in either the ' - "owner's class\n" - 'dictionary or in the class dictionary for one of its ' - 'parents). In the\n' - 'examples below, "the attribute" refers to the attribute ' - 'whose name is\n' - "the key of the property in the owner class' " - '"__dict__".\n' - '\n' - 'object.__get__(self, instance, owner)\n' - '\n' - ' Called to get the attribute of the owner class (class ' - 'attribute\n' - ' access) or of an instance of that class (instance ' - 'attribute\n' - ' access). *owner* is always the owner class, while ' - '*instance* is the\n' - ' instance that the attribute was accessed through, or ' - '"None" when\n' - ' the attribute is accessed through the *owner*. This ' - 'method should\n' - ' return the (computed) attribute value or raise an ' - '"AttributeError"\n' - ' exception.\n' - '\n' - 'object.__set__(self, instance, value)\n' - '\n' - ' Called to set the attribute on an instance *instance* ' - 'of the owner\n' - ' class to a new value, *value*.\n' - '\n' - 'object.__delete__(self, instance)\n' - '\n' - ' Called to delete the attribute on an instance ' - '*instance* of the\n' - ' owner class.\n' - '\n' - '\n' - 'Invoking Descriptors\n' - '====================\n' - '\n' - 'In general, a descriptor is an object attribute with ' - '"binding\n' - 'behavior", one whose attribute access has been ' - 'overridden by methods\n' - 'in the descriptor protocol: "__get__()", "__set__()", ' - 'and\n' - '"__delete__()". If any of those methods are defined for ' - 'an object, it\n' - 'is said to be a descriptor.\n' - '\n' - 'The default behavior for attribute access is to get, ' - 'set, or delete\n' - "the attribute from an object's dictionary. For instance, " - '"a.x" has a\n' - 'lookup chain starting with "a.__dict__[\'x\']", then\n' - '"type(a).__dict__[\'x\']", and continuing through the ' - 'base classes of\n' - '"type(a)" excluding metaclasses.\n' - '\n' - 'However, if the looked-up value is an object defining ' - 'one of the\n' - 'descriptor methods, then Python may override the default ' - 'behavior and\n' - 'invoke the descriptor method instead. Where this occurs ' - 'in the\n' - 'precedence chain depends on which descriptor methods ' - 'were defined and\n' - 'how they were called. Note that descriptors are only ' - 'invoked for new\n' - 'style objects or classes (ones that subclass "object()" ' - 'or "type()").\n' - '\n' - 'The starting point for descriptor invocation is a ' - 'binding, "a.x". How\n' - 'the arguments are assembled depends on "a":\n' - '\n' - 'Direct Call\n' - ' The simplest and least common call is when user code ' - 'directly\n' - ' invokes a descriptor method: "x.__get__(a)".\n' - '\n' - 'Instance Binding\n' - ' If binding to a new-style object instance, "a.x" is ' - 'transformed\n' - ' into the call: "type(a).__dict__[\'x\'].__get__(a, ' - 'type(a))".\n' - '\n' - 'Class Binding\n' - ' If binding to a new-style class, "A.x" is transformed ' - 'into the\n' - ' call: "A.__dict__[\'x\'].__get__(None, A)".\n' - '\n' - 'Super Binding\n' - ' If "a" is an instance of "super", then the binding ' - '"super(B,\n' - ' obj).m()" searches "obj.__class__.__mro__" for the ' - 'base class "A"\n' - ' immediately preceding "B" and then invokes the ' - 'descriptor with the\n' - ' call: "A.__dict__[\'m\'].__get__(obj, ' - 'obj.__class__)".\n' - '\n' - 'For instance bindings, the precedence of descriptor ' - 'invocation depends\n' - 'on the which descriptor methods are defined. A ' - 'descriptor can define\n' - 'any combination of "__get__()", "__set__()" and ' - '"__delete__()". If it\n' - 'does not define "__get__()", then accessing the ' - 'attribute will return\n' - 'the descriptor object itself unless there is a value in ' - "the object's\n" - 'instance dictionary. If the descriptor defines ' - '"__set__()" and/or\n' - '"__delete__()", it is a data descriptor; if it defines ' - 'neither, it is\n' - 'a non-data descriptor. Normally, data descriptors ' - 'define both\n' - '"__get__()" and "__set__()", while non-data descriptors ' - 'have just the\n' - '"__get__()" method. Data descriptors with "__set__()" ' - 'and "__get__()"\n' - 'defined always override a redefinition in an instance ' - 'dictionary. In\n' - 'contrast, non-data descriptors can be overridden by ' - 'instances.\n' - '\n' - 'Python methods (including "staticmethod()" and ' - '"classmethod()") are\n' - 'implemented as non-data descriptors. Accordingly, ' - 'instances can\n' - 'redefine and override methods. This allows individual ' - 'instances to\n' - 'acquire behaviors that differ from other instances of ' - 'the same class.\n' - '\n' - 'The "property()" function is implemented as a data ' - 'descriptor.\n' - 'Accordingly, instances cannot override the behavior of a ' - 'property.\n' - '\n' - '\n' - '__slots__\n' - '=========\n' - '\n' - 'By default, instances of both old and new-style classes ' - 'have a\n' - 'dictionary for attribute storage. This wastes space for ' - 'objects\n' - 'having very few instance variables. The space ' - 'consumption can become\n' - 'acute when creating large numbers of instances.\n' - '\n' - 'The default can be overridden by defining *__slots__* in ' - 'a new-style\n' - 'class definition. The *__slots__* declaration takes a ' - 'sequence of\n' - 'instance variables and reserves just enough space in ' - 'each instance to\n' - 'hold a value for each variable. Space is saved because ' - '*__dict__* is\n' - 'not created for each instance.\n' - '\n' - '__slots__\n' - '\n' - ' This class variable can be assigned a string, ' - 'iterable, or sequence\n' - ' of strings with variable names used by instances. If ' - 'defined in a\n' - ' new-style class, *__slots__* reserves space for the ' - 'declared\n' - ' variables and prevents the automatic creation of ' - '*__dict__* and\n' - ' *__weakref__* for each instance.\n' - '\n' - ' New in version 2.2.\n' - '\n' - 'Notes on using *__slots__*\n' - '\n' - '* When inheriting from a class without *__slots__*, the ' - '*__dict__*\n' - ' attribute of that class will always be accessible, so ' - 'a *__slots__*\n' - ' definition in the subclass is meaningless.\n' - '\n' - '* Without a *__dict__* variable, instances cannot be ' - 'assigned new\n' - ' variables not listed in the *__slots__* definition. ' - 'Attempts to\n' - ' assign to an unlisted variable name raises ' - '"AttributeError". If\n' - ' dynamic assignment of new variables is desired, then ' - 'add\n' - ' "\'__dict__\'" to the sequence of strings in the ' - '*__slots__*\n' - ' declaration.\n' - '\n' - ' Changed in version 2.3: Previously, adding ' - '"\'__dict__\'" to the\n' - ' *__slots__* declaration would not enable the ' - 'assignment of new\n' - ' attributes not specifically listed in the sequence of ' - 'instance\n' - ' variable names.\n' - '\n' - '* Without a *__weakref__* variable for each instance, ' - 'classes\n' - ' defining *__slots__* do not support weak references to ' - 'its\n' - ' instances. If weak reference support is needed, then ' - 'add\n' - ' "\'__weakref__\'" to the sequence of strings in the ' - '*__slots__*\n' - ' declaration.\n' - '\n' - ' Changed in version 2.3: Previously, adding ' - '"\'__weakref__\'" to the\n' - ' *__slots__* declaration would not enable support for ' - 'weak\n' - ' references.\n' - '\n' - '* *__slots__* are implemented at the class level by ' - 'creating\n' - ' descriptors (Implementing Descriptors) for each ' - 'variable name. As a\n' - ' result, class attributes cannot be used to set default ' - 'values for\n' - ' instance variables defined by *__slots__*; otherwise, ' - 'the class\n' - ' attribute would overwrite the descriptor assignment.\n' - '\n' - '* The action of a *__slots__* declaration is limited to ' - 'the class\n' - ' where it is defined. As a result, subclasses will ' - 'have a *__dict__*\n' - ' unless they also define *__slots__* (which must only ' - 'contain names\n' - ' of any *additional* slots).\n' - '\n' - '* If a class defines a slot also defined in a base ' - 'class, the\n' - ' instance variable defined by the base class slot is ' - 'inaccessible\n' - ' (except by retrieving its descriptor directly from the ' - 'base class).\n' - ' This renders the meaning of the program undefined. In ' - 'the future, a\n' - ' check may be added to prevent this.\n' - '\n' - '* Nonempty *__slots__* does not work for classes derived ' - 'from\n' - ' "variable-length" built-in types such as "long", "str" ' - 'and "tuple".\n' - '\n' - '* Any non-string iterable may be assigned to ' - '*__slots__*. Mappings\n' - ' may also be used; however, in the future, special ' - 'meaning may be\n' - ' assigned to the values corresponding to each key.\n' - '\n' - '* *__class__* assignment works only if both classes have ' - 'the same\n' - ' *__slots__*.\n' - '\n' - ' Changed in version 2.6: Previously, *__class__* ' - 'assignment raised an\n' - ' error if either new or old class had *__slots__*.\n', - 'attribute-references': '\n' - 'Attribute references\n' - '********************\n' - '\n' - 'An attribute reference is a primary followed by a ' - 'period and a name:\n' - '\n' - ' attributeref ::= primary "." identifier\n' - '\n' - 'The primary must evaluate to an object of a type ' - 'that supports\n' - 'attribute references, e.g., a module, list, or an ' - 'instance. This\n' - 'object is then asked to produce the attribute whose ' - 'name is the\n' - 'identifier. If this attribute is not available, the ' - 'exception\n' - '"AttributeError" is raised. Otherwise, the type and ' - 'value of the\n' - 'object produced is determined by the object. ' - 'Multiple evaluations of\n' - 'the same attribute reference may yield different ' - 'objects.\n', - 'augassign': '\n' - 'Augmented assignment statements\n' - '*******************************\n' - '\n' - 'Augmented assignment is the combination, in a single statement, ' - 'of a\n' - 'binary operation and an assignment statement:\n' - '\n' - ' augmented_assignment_stmt ::= augtarget augop ' - '(expression_list | yield_expression)\n' - ' augtarget ::= identifier | attributeref | ' - 'subscription | slicing\n' - ' augop ::= "+=" | "-=" | "*=" | "/=" | ' - '"//=" | "%=" | "**="\n' - ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n' - '\n' - '(See section Primaries for the syntax definitions for the last ' - 'three\n' - 'symbols.)\n' - '\n' - 'An augmented assignment evaluates the target (which, unlike ' - 'normal\n' - 'assignment statements, cannot be an unpacking) and the ' - 'expression\n' - 'list, performs the binary operation specific to the type of ' - 'assignment\n' - 'on the two operands, and assigns the result to the original ' - 'target.\n' - 'The target is only evaluated once.\n' - '\n' - 'An augmented assignment expression like "x += 1" can be ' - 'rewritten as\n' - '"x = x + 1" to achieve a similar, but not exactly equal effect. ' - 'In the\n' - 'augmented version, "x" is only evaluated once. Also, when ' - 'possible,\n' - 'the actual operation is performed *in-place*, meaning that ' - 'rather than\n' - 'creating a new object and assigning that to the target, the old ' - 'object\n' - 'is modified instead.\n' - '\n' - 'With the exception of assigning to tuples and multiple targets ' - 'in a\n' - 'single statement, the assignment done by augmented assignment\n' - 'statements is handled the same way as normal assignments. ' - 'Similarly,\n' - 'with the exception of the possible *in-place* behavior, the ' - 'binary\n' - 'operation performed by augmented assignment is the same as the ' - 'normal\n' - 'binary operations.\n' - '\n' - 'For targets which are attribute references, the same caveat ' - 'about\n' - 'class and instance attributes applies as for regular ' - 'assignments.\n', - 'binary': '\n' - 'Binary arithmetic operations\n' - '****************************\n' - '\n' - 'The binary arithmetic operations have the conventional priority\n' - 'levels. Note that some of these operations also apply to certain ' - 'non-\n' - 'numeric types. Apart from the power operator, there are only two\n' - 'levels, one for multiplicative operators and one for additive\n' - 'operators:\n' - '\n' - ' m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | ' - 'm_expr "/" u_expr\n' - ' | m_expr "%" u_expr\n' - ' a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n' - '\n' - 'The "*" (multiplication) operator yields the product of its ' - 'arguments.\n' - 'The arguments must either both be numbers, or one argument must be ' - 'an\n' - 'integer (plain or long) and the other must be a sequence. In the\n' - 'former case, the numbers are converted to a common type and then\n' - 'multiplied together. In the latter case, sequence repetition is\n' - 'performed; a negative repetition factor yields an empty sequence.\n' - '\n' - 'The "/" (division) and "//" (floor division) operators yield the\n' - 'quotient of their arguments. The numeric arguments are first\n' - 'converted to a common type. Plain or long integer division yields ' - 'an\n' - 'integer of the same type; the result is that of mathematical ' - 'division\n' - "with the 'floor' function applied to the result. Division by zero\n" - 'raises the "ZeroDivisionError" exception.\n' - '\n' - 'The "%" (modulo) operator yields the remainder from the division ' - 'of\n' - 'the first argument by the second. The numeric arguments are ' - 'first\n' - 'converted to a common type. A zero right argument raises the\n' - '"ZeroDivisionError" exception. The arguments may be floating ' - 'point\n' - 'numbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals ' - '"4*0.7 +\n' - '0.34".) The modulo operator always yields a result with the same ' - 'sign\n' - 'as its second operand (or zero); the absolute value of the result ' - 'is\n' - 'strictly smaller than the absolute value of the second operand ' - '[2].\n' - '\n' - 'The integer division and modulo operators are connected by the\n' - 'following identity: "x == (x/y)*y + (x%y)". Integer division and\n' - 'modulo are also connected with the built-in function "divmod()":\n' - '"divmod(x, y) == (x/y, x%y)". These identities don\'t hold for\n' - 'floating point numbers; there similar identities hold ' - 'approximately\n' - 'where "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n' - '\n' - 'In addition to performing the modulo operation on numbers, the ' - '"%"\n' - 'operator is also overloaded by string and unicode objects to ' - 'perform\n' - 'string formatting (also known as interpolation). The syntax for ' - 'string\n' - 'formatting is described in the Python Library Reference, section\n' - 'String Formatting Operations.\n' - '\n' - 'Deprecated since version 2.3: The floor division operator, the ' - 'modulo\n' - 'operator, and the "divmod()" function are no longer defined for\n' - 'complex numbers. Instead, convert to a floating point number ' - 'using\n' - 'the "abs()" function if appropriate.\n' - '\n' - 'The "+" (addition) operator yields the sum of its arguments. The\n' - 'arguments must either both be numbers or both sequences of the ' - 'same\n' - 'type. In the former case, the numbers are converted to a common ' - 'type\n' - 'and then added together. In the latter case, the sequences are\n' - 'concatenated.\n' - '\n' - 'The "-" (subtraction) operator yields the difference of its ' - 'arguments.\n' - 'The numeric arguments are first converted to a common type.\n', - 'bitwise': '\n' - 'Binary bitwise operations\n' - '*************************\n' - '\n' - 'Each of the three bitwise operations has a different priority ' - 'level:\n' - '\n' - ' and_expr ::= shift_expr | and_expr "&" shift_expr\n' - ' xor_expr ::= and_expr | xor_expr "^" and_expr\n' - ' or_expr ::= xor_expr | or_expr "|" xor_expr\n' - '\n' - 'The "&" operator yields the bitwise AND of its arguments, which ' - 'must\n' - 'be plain or long integers. The arguments are converted to a ' - 'common\n' - 'type.\n' - '\n' - 'The "^" operator yields the bitwise XOR (exclusive OR) of its\n' - 'arguments, which must be plain or long integers. The arguments ' - 'are\n' - 'converted to a common type.\n' - '\n' - 'The "|" operator yields the bitwise (inclusive) OR of its ' - 'arguments,\n' - 'which must be plain or long integers. The arguments are ' - 'converted to\n' - 'a common type.\n', - 'bltin-code-objects': '\n' - 'Code Objects\n' - '************\n' - '\n' - 'Code objects are used by the implementation to ' - 'represent "pseudo-\n' - 'compiled" executable Python code such as a function ' - 'body. They differ\n' - "from function objects because they don't contain a " - 'reference to their\n' - 'global execution environment. Code objects are ' - 'returned by the built-\n' - 'in "compile()" function and can be extracted from ' - 'function objects\n' - 'through their "func_code" attribute. See also the ' - '"code" module.\n' - '\n' - 'A code object can be executed or evaluated by passing ' - 'it (instead of a\n' - 'source string) to the "exec" statement or the built-in ' - '"eval()"\n' - 'function.\n' - '\n' - 'See The standard type hierarchy for more ' - 'information.\n', - 'bltin-ellipsis-object': '\n' - 'The Ellipsis Object\n' - '*******************\n' - '\n' - 'This object is used by extended slice notation (see ' - 'Slicings). It\n' - 'supports no special operations. There is exactly ' - 'one ellipsis object,\n' - 'named "Ellipsis" (a built-in name).\n' - '\n' - 'It is written as "Ellipsis". When in a subscript, ' - 'it can also be\n' - 'written as "...", for example "seq[...]".\n', - 'bltin-file-objects': '\n' - 'File Objects\n' - '************\n' - '\n' - 'File objects are implemented using C\'s "stdio" ' - 'package and can be\n' - 'created with the built-in "open()" function. File ' - 'objects are also\n' - 'returned by some other built-in functions and methods, ' - 'such as\n' - '"os.popen()" and "os.fdopen()" and the "makefile()" ' - 'method of socket\n' - 'objects. Temporary files can be created using the ' - '"tempfile" module,\n' - 'and high-level file operations such as copying, ' - 'moving, and deleting\n' - 'files and directories can be achieved with the ' - '"shutil" module.\n' - '\n' - 'When a file operation fails for an I/O-related reason, ' - 'the exception\n' - '"IOError" is raised. This includes situations where ' - 'the operation is\n' - 'not defined for some reason, like "seek()" on a tty ' - 'device or writing\n' - 'a file opened for reading.\n' - '\n' - 'Files have the following methods:\n' - '\n' - 'file.close()\n' - '\n' - ' Close the file. A closed file cannot be read or ' - 'written any more.\n' - ' Any operation which requires that the file be open ' - 'will raise a\n' - ' "ValueError" after the file has been closed. ' - 'Calling "close()"\n' - ' more than once is allowed.\n' - '\n' - ' As of Python 2.5, you can avoid having to call this ' - 'method\n' - ' explicitly if you use the "with" statement. For ' - 'example, the\n' - ' following code will automatically close *f* when ' - 'the "with" block\n' - ' is exited:\n' - '\n' - ' from __future__ import with_statement # This ' - "isn't required in Python 2.6\n" - '\n' - ' with open("hello.txt") as f:\n' - ' for line in f:\n' - ' print line,\n' - '\n' - ' In older versions of Python, you would have needed ' - 'to do this to\n' - ' get the same effect:\n' - '\n' - ' f = open("hello.txt")\n' - ' try:\n' - ' for line in f:\n' - ' print line,\n' - ' finally:\n' - ' f.close()\n' - '\n' - ' Note: Not all "file-like" types in Python support ' - 'use as a\n' - ' context manager for the "with" statement. If ' - 'your code is\n' - ' intended to work with any file-like object, you ' - 'can use the\n' - ' function "contextlib.closing()" instead of using ' - 'the object\n' - ' directly.\n' - '\n' - 'file.flush()\n' - '\n' - ' Flush the internal buffer, like "stdio"\'s ' - '"fflush()". This may be\n' - ' a no-op on some file-like objects.\n' - '\n' - ' Note: "flush()" does not necessarily write the ' - "file's data to\n" - ' disk. Use "flush()" followed by "os.fsync()" to ' - 'ensure this\n' - ' behavior.\n' - '\n' - 'file.fileno()\n' - '\n' - ' Return the integer "file descriptor" that is used ' - 'by the underlying\n' - ' implementation to request I/O operations from the ' - 'operating system.\n' - ' This can be useful for other, lower level ' - 'interfaces that use file\n' - ' descriptors, such as the "fcntl" module or ' - '"os.read()" and friends.\n' - '\n' - ' Note: File-like objects which do not have a real ' - 'file descriptor\n' - ' should *not* provide this method!\n' - '\n' - 'file.isatty()\n' - '\n' - ' Return "True" if the file is connected to a ' - 'tty(-like) device, else\n' - ' "False".\n' - '\n' - ' Note: If a file-like object is not associated with ' - 'a real file,\n' - ' this method should *not* be implemented.\n' - '\n' - 'file.next()\n' - '\n' - ' A file object is its own iterator, for example ' - '"iter(f)" returns\n' - ' *f* (unless *f* is closed). When a file is used as ' - 'an iterator,\n' - ' typically in a "for" loop (for example, "for line ' - 'in f: print\n' - ' line.strip()"), the "next()" method is called ' - 'repeatedly. This\n' - ' method returns the next input line, or raises ' - '"StopIteration" when\n' - ' EOF is hit when the file is open for reading ' - '(behavior is undefined\n' - ' when the file is open for writing). In order to ' - 'make a "for" loop\n' - ' the most efficient way of looping over the lines of ' - 'a file (a very\n' - ' common operation), the "next()" method uses a ' - 'hidden read-ahead\n' - ' buffer. As a consequence of using a read-ahead ' - 'buffer, combining\n' - ' "next()" with other file methods (like ' - '"readline()") does not work\n' - ' right. However, using "seek()" to reposition the ' - 'file to an\n' - ' absolute position will flush the read-ahead ' - 'buffer.\n' - '\n' - ' New in version 2.3.\n' - '\n' - 'file.read([size])\n' - '\n' - ' Read at most *size* bytes from the file (less if ' - 'the read hits EOF\n' - ' before obtaining *size* bytes). If the *size* ' - 'argument is negative\n' - ' or omitted, read all data until EOF is reached. ' - 'The bytes are\n' - ' returned as a string object. An empty string is ' - 'returned when EOF\n' - ' is encountered immediately. (For certain files, ' - 'like ttys, it\n' - ' makes sense to continue reading after an EOF is ' - 'hit.) Note that\n' - ' this method may call the underlying C function ' - '"fread()" more than\n' - ' once in an effort to acquire as close to *size* ' - 'bytes as possible.\n' - ' Also note that when in non-blocking mode, less data ' - 'than was\n' - ' requested may be returned, even if no *size* ' - 'parameter was given.\n' - '\n' - ' Note: This function is simply a wrapper for the ' - 'underlying\n' - ' "fread()" C function, and will behave the same in ' - 'corner cases,\n' - ' such as whether the EOF value is cached.\n' - '\n' - 'file.readline([size])\n' - '\n' - ' Read one entire line from the file. A trailing ' - 'newline character\n' - ' is kept in the string (but may be absent when a ' - 'file ends with an\n' - ' incomplete line). [6] If the *size* argument is ' - 'present and non-\n' - ' negative, it is a maximum byte count (including the ' - 'trailing\n' - ' newline) and an incomplete line may be returned. ' - 'When *size* is not\n' - ' 0, an empty string is returned *only* when EOF is ' - 'encountered\n' - ' immediately.\n' - '\n' - ' Note: Unlike "stdio"\'s "fgets()", the returned ' - 'string contains\n' - ' null characters ("\'\\0\'") if they occurred in ' - 'the input.\n' - '\n' - 'file.readlines([sizehint])\n' - '\n' - ' Read until EOF using "readline()" and return a list ' - 'containing the\n' - ' lines thus read. If the optional *sizehint* ' - 'argument is present,\n' - ' instead of reading up to EOF, whole lines totalling ' - 'approximately\n' - ' *sizehint* bytes (possibly after rounding up to an ' - 'internal buffer\n' - ' size) are read. Objects implementing a file-like ' - 'interface may\n' - ' choose to ignore *sizehint* if it cannot be ' - 'implemented, or cannot\n' - ' be implemented efficiently.\n' - '\n' - 'file.xreadlines()\n' - '\n' - ' This method returns the same thing as "iter(f)".\n' - '\n' - ' New in version 2.1.\n' - '\n' - ' Deprecated since version 2.3: Use "for line in ' - 'file" instead.\n' - '\n' - 'file.seek(offset[, whence])\n' - '\n' - ' Set the file\'s current position, like "stdio"\'s ' - '"fseek()". The\n' - ' *whence* argument is optional and defaults to ' - '"os.SEEK_SET" or "0"\n' - ' (absolute file positioning); other values are ' - '"os.SEEK_CUR" or "1"\n' - ' (seek relative to the current position) and ' - '"os.SEEK_END" or "2"\n' - " (seek relative to the file's end). There is no " - 'return value.\n' - '\n' - ' For example, "f.seek(2, os.SEEK_CUR)" advances the ' - 'position by two\n' - ' and "f.seek(-3, os.SEEK_END)" sets the position to ' - 'the third to\n' - ' last.\n' - '\n' - ' Note that if the file is opened for appending (mode ' - '"\'a\'" or\n' - ' "\'a+\'"), any "seek()" operations will be undone ' - 'at the next write.\n' - ' If the file is only opened for writing in append ' - 'mode (mode "\'a\'"),\n' - ' this method is essentially a no-op, but it remains ' - 'useful for files\n' - ' opened in append mode with reading enabled (mode ' - '"\'a+\'"). If the\n' - ' file is opened in text mode (without "\'b\'"), only ' - 'offsets returned\n' - ' by "tell()" are legal. Use of other offsets causes ' - 'undefined\n' - ' behavior.\n' - '\n' - ' Note that not all file objects are seekable.\n' - '\n' - ' Changed in version 2.6: Passing float values as ' - 'offset has been\n' - ' deprecated.\n' - '\n' - 'file.tell()\n' - '\n' - " Return the file's current position, like " - '"stdio"\'s "ftell()".\n' - '\n' - ' Note: On Windows, "tell()" can return illegal ' - 'values (after an\n' - ' "fgets()") when reading files with Unix-style ' - 'line-endings. Use\n' - ' binary mode ("\'rb\'") to circumvent this ' - 'problem.\n' - '\n' - 'file.truncate([size])\n' - '\n' - " Truncate the file's size. If the optional *size* " - 'argument is\n' - ' present, the file is truncated to (at most) that ' - 'size. The size\n' - ' defaults to the current position. The current file ' - 'position is not\n' - ' changed. Note that if a specified size exceeds the ' - "file's current\n" - ' size, the result is platform-dependent: ' - 'possibilities include that\n' - ' the file may remain unchanged, increase to the ' - 'specified size as if\n' - ' zero-filled, or increase to the specified size with ' - 'undefined new\n' - ' content. Availability: Windows, many Unix ' - 'variants.\n' - '\n' - 'file.write(str)\n' - '\n' - ' Write a string to the file. There is no return ' - 'value. Due to\n' - ' buffering, the string may not actually show up in ' - 'the file until\n' - ' the "flush()" or "close()" method is called.\n' - '\n' - 'file.writelines(sequence)\n' - '\n' - ' Write a sequence of strings to the file. The ' - 'sequence can be any\n' - ' iterable object producing strings, typically a list ' - 'of strings.\n' - ' There is no return value. (The name is intended to ' - 'match\n' - ' "readlines()"; "writelines()" does not add line ' - 'separators.)\n' - '\n' - 'Files support the iterator protocol. Each iteration ' - 'returns the same\n' - 'result as "readline()", and iteration ends when the ' - '"readline()"\n' - 'method returns an empty string.\n' - '\n' - 'File objects also offer a number of other interesting ' - 'attributes.\n' - 'These are not required for file-like objects, but ' - 'should be\n' - 'implemented if they make sense for the particular ' - 'object.\n' - '\n' - 'file.closed\n' - '\n' - ' bool indicating the current state of the file ' - 'object. This is a\n' - ' read-only attribute; the "close()" method changes ' - 'the value. It may\n' - ' not be available on all file-like objects.\n' - '\n' - 'file.encoding\n' - '\n' - ' The encoding that this file uses. When Unicode ' - 'strings are written\n' - ' to a file, they will be converted to byte strings ' - 'using this\n' - ' encoding. In addition, when the file is connected ' - 'to a terminal,\n' - ' the attribute gives the encoding that the terminal ' - 'is likely to use\n' - ' (that information might be incorrect if the user ' - 'has misconfigured\n' - ' the terminal). The attribute is read-only and may ' - 'not be present\n' - ' on all file-like objects. It may also be "None", in ' - 'which case the\n' - ' file uses the system default encoding for ' - 'converting Unicode\n' - ' strings.\n' - '\n' - ' New in version 2.3.\n' - '\n' - 'file.errors\n' - '\n' - ' The Unicode error handler used along with the ' - 'encoding.\n' - '\n' - ' New in version 2.6.\n' - '\n' - 'file.mode\n' - '\n' - ' The I/O mode for the file. If the file was created ' - 'using the\n' - ' "open()" built-in function, this will be the value ' - 'of the *mode*\n' - ' parameter. This is a read-only attribute and may ' - 'not be present on\n' - ' all file-like objects.\n' - '\n' - 'file.name\n' - '\n' - ' If the file object was created using "open()", the ' - 'name of the\n' - ' file. Otherwise, some string that indicates the ' - 'source of the file\n' - ' object, of the form "<...>". This is a read-only ' - 'attribute and may\n' - ' not be present on all file-like objects.\n' - '\n' - 'file.newlines\n' - '\n' - ' If Python was built with *universal newlines* ' - 'enabled (the default)\n' - ' this read-only attribute exists, and for files ' - 'opened in universal\n' - ' newline read mode it keeps track of the types of ' - 'newlines\n' - ' encountered while reading the file. The values it ' - 'can take are\n' - ' "\'\\r\'", "\'\\n\'", "\'\\r\\n\'", "None" ' - '(unknown, no newlines read yet) or\n' - ' a tuple containing all the newline types seen, to ' - 'indicate that\n' - ' multiple newline conventions were encountered. For ' - 'files not opened\n' - ' in universal newlines read mode the value of this ' - 'attribute will be\n' - ' "None".\n' - '\n' - 'file.softspace\n' - '\n' - ' Boolean that indicates whether a space character ' - 'needs to be\n' - ' printed before another value when using the "print" ' - 'statement.\n' - ' Classes that are trying to simulate a file object ' - 'should also have\n' - ' a writable "softspace" attribute, which should be ' - 'initialized to\n' - ' zero. This will be automatic for most classes ' - 'implemented in\n' - ' Python (care may be needed for objects that ' - 'override attribute\n' - ' access); types implemented in C will have to ' - 'provide a writable\n' - ' "softspace" attribute.\n' - '\n' - ' Note: This attribute is not used to control the ' - '"print"\n' - ' statement, but to allow the implementation of ' - '"print" to keep\n' - ' track of its internal state.\n', - 'bltin-null-object': '\n' - 'The Null Object\n' - '***************\n' - '\n' - "This object is returned by functions that don't " - 'explicitly return a\n' - 'value. It supports no special operations. There is ' - 'exactly one null\n' - 'object, named "None" (a built-in name).\n' - '\n' - 'It is written as "None".\n', - 'bltin-type-objects': '\n' - 'Type Objects\n' - '************\n' - '\n' - 'Type objects represent the various object types. An ' - "object's type is\n" - 'accessed by the built-in function "type()". There are ' - 'no special\n' - 'operations on types. The standard module "types" ' - 'defines names for\n' - 'all standard built-in types.\n' - '\n' - 'Types are written like this: "".\n', - 'booleans': '\n' - 'Boolean operations\n' - '******************\n' - '\n' - ' or_test ::= and_test | or_test "or" and_test\n' - ' and_test ::= not_test | and_test "and" not_test\n' - ' not_test ::= comparison | "not" not_test\n' - '\n' - 'In the context of Boolean operations, and also when expressions ' - 'are\n' - 'used by control flow statements, the following values are ' - 'interpreted\n' - 'as false: "False", "None", numeric zero of all types, and empty\n' - 'strings and containers (including strings, tuples, lists,\n' - 'dictionaries, sets and frozensets). All other values are ' - 'interpreted\n' - 'as true. (See the "__nonzero__()" special method for a way to ' - 'change\n' - 'this.)\n' - '\n' - 'The operator "not" yields "True" if its argument is false, ' - '"False"\n' - 'otherwise.\n' - '\n' - 'The expression "x and y" first evaluates *x*; if *x* is false, ' - 'its\n' - 'value is returned; otherwise, *y* is evaluated and the resulting ' - 'value\n' - 'is returned.\n' - '\n' - 'The expression "x or y" first evaluates *x*; if *x* is true, its ' - 'value\n' - 'is returned; otherwise, *y* is evaluated and the resulting value ' - 'is\n' - 'returned.\n' - '\n' - '(Note that neither "and" nor "or" restrict the value and type ' - 'they\n' - 'return to "False" and "True", but rather return the last ' - 'evaluated\n' - 'argument. This is sometimes useful, e.g., if "s" is a string ' - 'that\n' - 'should be replaced by a default value if it is empty, the ' - 'expression\n' - '"s or \'foo\'" yields the desired value. Because "not" has to ' - 'invent a\n' - 'value anyway, it does not bother to return a value of the same ' - 'type as\n' - 'its argument, so e.g., "not \'foo\'" yields "False", not ' - '"\'\'".)\n', - 'break': '\n' - 'The "break" statement\n' - '*********************\n' - '\n' - ' break_stmt ::= "break"\n' - '\n' - '"break" may only occur syntactically nested in a "for" or "while"\n' - 'loop, but not nested in a function or class definition within that\n' - 'loop.\n' - '\n' - 'It terminates the nearest enclosing loop, skipping the optional ' - '"else"\n' - 'clause if the loop has one.\n' - '\n' - 'If a "for" loop is terminated by "break", the loop control target\n' - 'keeps its current value.\n' - '\n' - 'When "break" passes control out of a "try" statement with a ' - '"finally"\n' - 'clause, that "finally" clause is executed before really leaving ' - 'the\n' - 'loop.\n', - 'callable-types': '\n' - 'Emulating callable objects\n' - '**************************\n' - '\n' - 'object.__call__(self[, args...])\n' - '\n' - ' Called when the instance is "called" as a function; if ' - 'this method\n' - ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' - ' "x.__call__(arg1, arg2, ...)".\n', - 'calls': '\n' - 'Calls\n' - '*****\n' - '\n' - 'A call calls a callable object (e.g., a *function*) with a ' - 'possibly\n' - 'empty series of *arguments*:\n' - '\n' - ' call ::= primary "(" [argument_list [","]\n' - ' | expression genexpr_for] ")"\n' - ' argument_list ::= positional_arguments ["," ' - 'keyword_arguments]\n' - ' ["," "*" expression] ["," ' - 'keyword_arguments]\n' - ' ["," "**" expression]\n' - ' | keyword_arguments ["," "*" expression]\n' - ' ["," "**" expression]\n' - ' | "*" expression ["," keyword_arguments] ["," ' - '"**" expression]\n' - ' | "**" expression\n' - ' positional_arguments ::= expression ("," expression)*\n' - ' keyword_arguments ::= keyword_item ("," keyword_item)*\n' - ' keyword_item ::= identifier "=" expression\n' - '\n' - 'A trailing comma may be present after the positional and keyword\n' - 'arguments but does not affect the semantics.\n' - '\n' - 'The primary must evaluate to a callable object (user-defined\n' - 'functions, built-in functions, methods of built-in objects, class\n' - 'objects, methods of class instances, and certain class instances\n' - 'themselves are callable; extensions may define additional callable\n' - 'object types). All argument expressions are evaluated before the ' - 'call\n' - 'is attempted. Please refer to section Function definitions for ' - 'the\n' - 'syntax of formal *parameter* lists.\n' - '\n' - 'If keyword arguments are present, they are first converted to\n' - 'positional arguments, as follows. First, a list of unfilled slots ' - 'is\n' - 'created for the formal parameters. If there are N positional\n' - 'arguments, they are placed in the first N slots. Next, for each\n' - 'keyword argument, the identifier is used to determine the\n' - 'corresponding slot (if the identifier is the same as the first ' - 'formal\n' - 'parameter name, the first slot is used, and so on). If the slot ' - 'is\n' - 'already filled, a "TypeError" exception is raised. Otherwise, the\n' - 'value of the argument is placed in the slot, filling it (even if ' - 'the\n' - 'expression is "None", it fills the slot). When all arguments have\n' - 'been processed, the slots that are still unfilled are filled with ' - 'the\n' - 'corresponding default value from the function definition. ' - '(Default\n' - 'values are calculated, once, when the function is defined; thus, a\n' - 'mutable object such as a list or dictionary used as default value ' - 'will\n' - "be shared by all calls that don't specify an argument value for " - 'the\n' - 'corresponding slot; this should usually be avoided.) If there are ' - 'any\n' - 'unfilled slots for which no default value is specified, a ' - '"TypeError"\n' - 'exception is raised. Otherwise, the list of filled slots is used ' - 'as\n' - 'the argument list for the call.\n' - '\n' - '**CPython implementation detail:** An implementation may provide\n' - 'built-in functions whose positional parameters do not have names, ' - 'even\n' - "if they are 'named' for the purpose of documentation, and which\n" - 'therefore cannot be supplied by keyword. In CPython, this is the ' - 'case\n' - 'for functions implemented in C that use "PyArg_ParseTuple()" to ' - 'parse\n' - 'their arguments.\n' - '\n' - 'If there are more positional arguments than there are formal ' - 'parameter\n' - 'slots, a "TypeError" exception is raised, unless a formal ' - 'parameter\n' - 'using the syntax "*identifier" is present; in this case, that ' - 'formal\n' - 'parameter receives a tuple containing the excess positional ' - 'arguments\n' - '(or an empty tuple if there were no excess positional arguments).\n' - '\n' - 'If any keyword argument does not correspond to a formal parameter\n' - 'name, a "TypeError" exception is raised, unless a formal parameter\n' - 'using the syntax "**identifier" is present; in this case, that ' - 'formal\n' - 'parameter receives a dictionary containing the excess keyword\n' - 'arguments (using the keywords as keys and the argument values as\n' - 'corresponding values), or a (new) empty dictionary if there were ' - 'no\n' - 'excess keyword arguments.\n' - '\n' - 'If the syntax "*expression" appears in the function call, ' - '"expression"\n' - 'must evaluate to an iterable. Elements from this iterable are ' - 'treated\n' - 'as if they were additional positional arguments; if there are\n' - 'positional arguments *x1*, ..., *xN*, and "expression" evaluates to ' - 'a\n' - 'sequence *y1*, ..., *yM*, this is equivalent to a call with M+N\n' - 'positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n' - '\n' - 'A consequence of this is that although the "*expression" syntax ' - 'may\n' - 'appear *after* some keyword arguments, it is processed *before* ' - 'the\n' - 'keyword arguments (and the "**expression" argument, if any -- see\n' - 'below). So:\n' - '\n' - ' >>> def f(a, b):\n' - ' ... print a, b\n' - ' ...\n' - ' >>> f(b=1, *(2,))\n' - ' 2 1\n' - ' >>> f(a=1, *(2,))\n' - ' Traceback (most recent call last):\n' - ' File "", line 1, in ?\n' - " TypeError: f() got multiple values for keyword argument 'a'\n" - ' >>> f(1, *(2,))\n' - ' 1 2\n' - '\n' - 'It is unusual for both keyword arguments and the "*expression" ' - 'syntax\n' - 'to be used in the same call, so in practice this confusion does ' - 'not\n' - 'arise.\n' - '\n' - 'If the syntax "**expression" appears in the function call,\n' - '"expression" must evaluate to a mapping, the contents of which are\n' - 'treated as additional keyword arguments. In the case of a keyword\n' - 'appearing in both "expression" and as an explicit keyword argument, ' - 'a\n' - '"TypeError" exception is raised.\n' - '\n' - 'Formal parameters using the syntax "*identifier" or "**identifier"\n' - 'cannot be used as positional argument slots or as keyword argument\n' - 'names. Formal parameters using the syntax "(sublist)" cannot be ' - 'used\n' - 'as keyword argument names; the outermost sublist corresponds to a\n' - 'single unnamed argument slot, and the argument value is assigned ' - 'to\n' - 'the sublist using the usual tuple assignment rules after all other\n' - 'parameter processing is done.\n' - '\n' - 'A call always returns some value, possibly "None", unless it raises ' - 'an\n' - 'exception. How this value is computed depends on the type of the\n' - 'callable object.\n' - '\n' - 'If it is---\n' - '\n' - 'a user-defined function:\n' - ' The code block for the function is executed, passing it the\n' - ' argument list. The first thing the code block will do is bind ' - 'the\n' - ' formal parameters to the arguments; this is described in ' - 'section\n' - ' Function definitions. When the code block executes a "return"\n' - ' statement, this specifies the return value of the function ' - 'call.\n' - '\n' - 'a built-in function or method:\n' - ' The result is up to the interpreter; see Built-in Functions for ' - 'the\n' - ' descriptions of built-in functions and methods.\n' - '\n' - 'a class object:\n' - ' A new instance of that class is returned.\n' - '\n' - 'a class instance method:\n' - ' The corresponding user-defined function is called, with an ' - 'argument\n' - ' list that is one longer than the argument list of the call: the\n' - ' instance becomes the first argument.\n' - '\n' - 'a class instance:\n' - ' The class must define a "__call__()" method; the effect is then ' - 'the\n' - ' same as if that method was called.\n', - 'class': '\n' - 'Class definitions\n' - '*****************\n' - '\n' - 'A class definition defines a class object (see section The ' - 'standard\n' - 'type hierarchy):\n' - '\n' - ' classdef ::= "class" classname [inheritance] ":" suite\n' - ' inheritance ::= "(" [expression_list] ")"\n' - ' classname ::= identifier\n' - '\n' - 'A class definition is an executable statement. It first evaluates ' - 'the\n' - 'inheritance list, if present. Each item in the inheritance list\n' - 'should evaluate to a class object or class type which allows\n' - "subclassing. The class's suite is then executed in a new " - 'execution\n' - 'frame (see section Naming and binding), using a newly created ' - 'local\n' - 'namespace and the original global namespace. (Usually, the suite\n' - "contains only function definitions.) When the class's suite " - 'finishes\n' - 'execution, its execution frame is discarded but its local namespace ' - 'is\n' - 'saved. [4] A class object is then created using the inheritance ' - 'list\n' - 'for the base classes and the saved local namespace for the ' - 'attribute\n' - 'dictionary. The class name is bound to this class object in the\n' - 'original local namespace.\n' - '\n' - "**Programmer's note:** Variables defined in the class definition " - 'are\n' - 'class variables; they are shared by all instances. To create ' - 'instance\n' - 'variables, they can be set in a method with "self.name = value". ' - 'Both\n' - 'class and instance variables are accessible through the notation\n' - '""self.name"", and an instance variable hides a class variable ' - 'with\n' - 'the same name when accessed in this way. Class variables can be ' - 'used\n' - 'as defaults for instance variables, but using mutable values there ' - 'can\n' - 'lead to unexpected results. For *new-style class*es, descriptors ' - 'can\n' - 'be used to create instance variables with different implementation\n' - 'details.\n' - '\n' - 'Class definitions, like function definitions, may be wrapped by one ' - 'or\n' - 'more *decorator* expressions. The evaluation rules for the ' - 'decorator\n' - 'expressions are the same as for functions. The result must be a ' - 'class\n' - 'object, which is then bound to the class name.\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] The exception is propagated to the invocation stack unless\n' - ' there is a "finally" clause which happens to raise another\n' - ' exception. That new exception causes the old one to be lost.\n' - '\n' - '[2] Currently, control "flows off the end" except in the case of\n' - ' an exception or the execution of a "return", "continue", or\n' - ' "break" statement.\n' - '\n' - '[3] A string literal appearing as the first statement in the\n' - ' function body is transformed into the function\'s "__doc__"\n' - " attribute and therefore the function's *docstring*.\n" - '\n' - '[4] A string literal appearing as the first statement in the class\n' - ' body is transformed into the namespace\'s "__doc__" item and\n' - " therefore the class's *docstring*.\n", - 'comparisons': '\n' - 'Comparisons\n' - '***********\n' - '\n' - 'Unlike C, all comparison operations in Python have the same ' - 'priority,\n' - 'which is lower than that of any arithmetic, shifting or ' - 'bitwise\n' - 'operation. Also unlike C, expressions like "a < b < c" have ' - 'the\n' - 'interpretation that is conventional in mathematics:\n' - '\n' - ' comparison ::= or_expr ( comp_operator or_expr )*\n' - ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | ' - '"!="\n' - ' | "is" ["not"] | ["not"] "in"\n' - '\n' - 'Comparisons yield boolean values: "True" or "False".\n' - '\n' - 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" ' - 'is\n' - 'equivalent to "x < y and y <= z", except that "y" is ' - 'evaluated only\n' - 'once (but in both cases "z" is not evaluated at all when "x < ' - 'y" is\n' - 'found to be false).\n' - '\n' - 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and ' - '*op1*,\n' - '*op2*, ..., *opN* are comparison operators, then "a op1 b op2 ' - 'c ... y\n' - 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN ' - 'z", except\n' - 'that each expression is evaluated at most once.\n' - '\n' - 'Note that "a op1 b op2 c" doesn\'t imply any kind of ' - 'comparison between\n' - '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal ' - '(though\n' - 'perhaps not pretty).\n' - '\n' - 'The forms "<>" and "!=" are equivalent; for consistency with ' - 'C, "!="\n' - 'is preferred; where "!=" is mentioned below "<>" is also ' - 'accepted.\n' - 'The "<>" spelling is considered obsolescent.\n' - '\n' - 'The operators "<", ">", "==", ">=", "<=", and "!=" compare ' - 'the values\n' - 'of two objects. The objects need not have the same type. If ' - 'both are\n' - 'numbers, they are converted to a common type. Otherwise, ' - 'objects of\n' - 'different types *always* compare unequal, and are ordered ' - 'consistently\n' - 'but arbitrarily. You can control comparison behavior of ' - 'objects of\n' - 'non-built-in types by defining a "__cmp__" method or rich ' - 'comparison\n' - 'methods like "__gt__", described in section Special method ' - 'names.\n' - '\n' - '(This unusual definition of comparison was used to simplify ' - 'the\n' - 'definition of operations like sorting and the "in" and "not ' - 'in"\n' - 'operators. In the future, the comparison rules for objects ' - 'of\n' - 'different types are likely to change.)\n' - '\n' - 'Comparison of objects of the same type depends on the type:\n' - '\n' - '* Numbers are compared arithmetically.\n' - '\n' - '* Strings are compared lexicographically using the numeric\n' - ' equivalents (the result of the built-in function "ord()") ' - 'of their\n' - ' characters. Unicode and 8-bit strings are fully ' - 'interoperable in\n' - ' this behavior. [4]\n' - '\n' - '* Tuples and lists are compared lexicographically using ' - 'comparison\n' - ' of corresponding elements. This means that to compare ' - 'equal, each\n' - ' element must compare equal and the two sequences must be of ' - 'the same\n' - ' type and have the same length.\n' - '\n' - ' If not equal, the sequences are ordered the same as their ' - 'first\n' - ' differing elements. For example, "cmp([1,2,x], [1,2,y])" ' - 'returns\n' - ' the same as "cmp(x,y)". If the corresponding element does ' - 'not\n' - ' exist, the shorter sequence is ordered first (for example, ' - '"[1,2] <\n' - ' [1,2,3]").\n' - '\n' - '* Mappings (dictionaries) compare equal if and only if their ' - 'sorted\n' - ' (key, value) lists compare equal. [5] Outcomes other than ' - 'equality\n' - ' are resolved consistently, but are not otherwise defined. ' - '[6]\n' - '\n' - '* Most other objects of built-in types compare unequal unless ' - 'they\n' - ' are the same object; the choice whether one object is ' - 'considered\n' - ' smaller or larger than another one is made arbitrarily but\n' - ' consistently within one execution of a program.\n' - '\n' - 'The operators "in" and "not in" test for collection ' - 'membership. "x in\n' - 's" evaluates to true if *x* is a member of the collection ' - '*s*, and\n' - 'false otherwise. "x not in s" returns the negation of "x in ' - 's". The\n' - 'collection membership test has traditionally been bound to ' - 'sequences;\n' - 'an object is a member of a collection if the collection is a ' - 'sequence\n' - 'and contains an element equal to that object. However, it ' - 'make sense\n' - 'for many other object types to support membership tests ' - 'without being\n' - 'a sequence. In particular, dictionaries (for keys) and sets ' - 'support\n' - 'membership testing.\n' - '\n' - 'For the list and tuple types, "x in y" is true if and only if ' - 'there\n' - 'exists an index *i* such that either "x is y[i]" or "x == ' - 'y[i]" is\n' - 'true.\n' - '\n' - 'For the Unicode and string types, "x in y" is true if and ' - 'only if *x*\n' - 'is a substring of *y*. An equivalent test is "y.find(x) != ' - '-1".\n' - 'Note, *x* and *y* need not be the same type; consequently, ' - '"u\'ab\' in\n' - '\'abc\'" will return "True". Empty strings are always ' - 'considered to be a\n' - 'substring of any other string, so """ in "abc"" will return ' - '"True".\n' - '\n' - 'Changed in version 2.3: Previously, *x* was required to be a ' - 'string of\n' - 'length "1".\n' - '\n' - 'For user-defined classes which define the "__contains__()" ' - 'method, "x\n' - 'in y" is true if and only if "y.__contains__(x)" is true.\n' - '\n' - 'For user-defined classes which do not define "__contains__()" ' - 'but do\n' - 'define "__iter__()", "x in y" is true if some value "z" with ' - '"x == z"\n' - 'is produced while iterating over "y". If an exception is ' - 'raised\n' - 'during the iteration, it is as if "in" raised that ' - 'exception.\n' - '\n' - 'Lastly, the old-style iteration protocol is tried: if a class ' - 'defines\n' - '"__getitem__()", "x in y" is true if and only if there is a ' - 'non-\n' - 'negative integer index *i* such that "x == y[i]", and all ' - 'lower\n' - 'integer indices do not raise "IndexError" exception. (If any ' - 'other\n' - 'exception is raised, it is as if "in" raised that ' - 'exception).\n' - '\n' - 'The operator "not in" is defined to have the inverse true ' - 'value of\n' - '"in".\n' - '\n' - 'The operators "is" and "is not" test for object identity: "x ' - 'is y" is\n' - 'true if and only if *x* and *y* are the same object. "x is ' - 'not y"\n' - 'yields the inverse truth value. [7]\n', - 'compound': '\n' - 'Compound statements\n' - '*******************\n' - '\n' - 'Compound statements contain (groups of) other statements; they ' - 'affect\n' - 'or control the execution of those other statements in some way. ' - 'In\n' - 'general, compound statements span multiple lines, although in ' - 'simple\n' - 'incarnations a whole compound statement may be contained in one ' - 'line.\n' - '\n' - 'The "if", "while" and "for" statements implement traditional ' - 'control\n' - 'flow constructs. "try" specifies exception handlers and/or ' - 'cleanup\n' - 'code for a group of statements. Function and class definitions ' - 'are\n' - 'also syntactically compound statements.\n' - '\n' - "Compound statements consist of one or more 'clauses.' A clause\n" - "consists of a header and a 'suite.' The clause headers of a\n" - 'particular compound statement are all at the same indentation ' - 'level.\n' - 'Each clause header begins with a uniquely identifying keyword ' - 'and ends\n' - 'with a colon. A suite is a group of statements controlled by a\n' - 'clause. A suite can be one or more semicolon-separated simple\n' - 'statements on the same line as the header, following the ' - "header's\n" - 'colon, or it can be one or more indented statements on ' - 'subsequent\n' - 'lines. Only the latter form of suite can contain nested ' - 'compound\n' - "statements; the following is illegal, mostly because it wouldn't " - 'be\n' - 'clear to which "if" clause a following "else" clause would ' - 'belong:\n' - '\n' - ' if test1: if test2: print x\n' - '\n' - 'Also note that the semicolon binds tighter than the colon in ' - 'this\n' - 'context, so that in the following example, either all or none of ' - 'the\n' - '"print" statements are executed:\n' - '\n' - ' if x < y < z: print x; print y; print z\n' - '\n' - 'Summarizing:\n' - '\n' - ' compound_stmt ::= if_stmt\n' - ' | while_stmt\n' - ' | for_stmt\n' - ' | try_stmt\n' - ' | with_stmt\n' - ' | funcdef\n' - ' | classdef\n' - ' | decorated\n' - ' suite ::= stmt_list NEWLINE | NEWLINE INDENT ' - 'statement+ DEDENT\n' - ' statement ::= stmt_list NEWLINE | compound_stmt\n' - ' stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n' - '\n' - 'Note that statements always end in a "NEWLINE" possibly followed ' - 'by a\n' - '"DEDENT". Also note that optional continuation clauses always ' - 'begin\n' - 'with a keyword that cannot start a statement, thus there are no\n' - 'ambiguities (the \'dangling "else"\' problem is solved in Python ' - 'by\n' - 'requiring nested "if" statements to be indented).\n' - '\n' - 'The formatting of the grammar rules in the following sections ' - 'places\n' - 'each clause on a separate line for clarity.\n' - '\n' - '\n' - 'The "if" statement\n' - '==================\n' - '\n' - 'The "if" statement is used for conditional execution:\n' - '\n' - ' if_stmt ::= "if" expression ":" suite\n' - ' ( "elif" expression ":" suite )*\n' - ' ["else" ":" suite]\n' - '\n' - 'It selects exactly one of the suites by evaluating the ' - 'expressions one\n' - 'by one until one is found to be true (see section Boolean ' - 'operations\n' - 'for the definition of true and false); then that suite is ' - 'executed\n' - '(and no other part of the "if" statement is executed or ' - 'evaluated).\n' - 'If all expressions are false, the suite of the "else" clause, ' - 'if\n' - 'present, is executed.\n' - '\n' - '\n' - 'The "while" statement\n' - '=====================\n' - '\n' - 'The "while" statement is used for repeated execution as long as ' - 'an\n' - 'expression is true:\n' - '\n' - ' while_stmt ::= "while" expression ":" suite\n' - ' ["else" ":" suite]\n' - '\n' - 'This repeatedly tests the expression and, if it is true, ' - 'executes the\n' - 'first suite; if the expression is false (which may be the first ' - 'time\n' - 'it is tested) the suite of the "else" clause, if present, is ' - 'executed\n' - 'and the loop terminates.\n' - '\n' - 'A "break" statement executed in the first suite terminates the ' - 'loop\n' - 'without executing the "else" clause\'s suite. A "continue" ' - 'statement\n' - 'executed in the first suite skips the rest of the suite and goes ' - 'back\n' - 'to testing the expression.\n' - '\n' - '\n' - 'The "for" statement\n' - '===================\n' - '\n' - 'The "for" statement is used to iterate over the elements of a ' - 'sequence\n' - '(such as a string, tuple or list) or other iterable object:\n' - '\n' - ' for_stmt ::= "for" target_list "in" expression_list ":" ' - 'suite\n' - ' ["else" ":" suite]\n' - '\n' - 'The expression list is evaluated once; it should yield an ' - 'iterable\n' - 'object. An iterator is created for the result of the\n' - '"expression_list". The suite is then executed once for each ' - 'item\n' - 'provided by the iterator, in the order of ascending indices. ' - 'Each\n' - 'item in turn is assigned to the target list using the standard ' - 'rules\n' - 'for assignments, and then the suite is executed. When the items ' - 'are\n' - 'exhausted (which is immediately when the sequence is empty), the ' - 'suite\n' - 'in the "else" clause, if present, is executed, and the loop\n' - 'terminates.\n' - '\n' - 'A "break" statement executed in the first suite terminates the ' - 'loop\n' - 'without executing the "else" clause\'s suite. A "continue" ' - 'statement\n' - 'executed in the first suite skips the rest of the suite and ' - 'continues\n' - 'with the next item, or with the "else" clause if there was no ' - 'next\n' - 'item.\n' - '\n' - 'The suite may assign to the variable(s) in the target list; this ' - 'does\n' - 'not affect the next item assigned to it.\n' - '\n' - 'The target list is not deleted when the loop is finished, but if ' - 'the\n' - 'sequence is empty, it will not have been assigned to at all by ' - 'the\n' - 'loop. Hint: the built-in function "range()" returns a sequence ' - 'of\n' - 'integers suitable to emulate the effect of Pascal\'s "for i := a ' - 'to b\n' - 'do"; e.g., "range(3)" returns the list "[0, 1, 2]".\n' - '\n' - 'Note: There is a subtlety when the sequence is being modified by ' - 'the\n' - ' loop (this can only occur for mutable sequences, i.e. lists). ' - 'An\n' - ' internal counter is used to keep track of which item is used ' - 'next,\n' - ' and this is incremented on each iteration. When this counter ' - 'has\n' - ' reached the length of the sequence the loop terminates. This ' - 'means\n' - ' that if the suite deletes the current (or a previous) item ' - 'from the\n' - ' sequence, the next item will be skipped (since it gets the ' - 'index of\n' - ' the current item which has already been treated). Likewise, ' - 'if the\n' - ' suite inserts an item in the sequence before the current item, ' - 'the\n' - ' current item will be treated again the next time through the ' - 'loop.\n' - ' This can lead to nasty bugs that can be avoided by making a\n' - ' temporary copy using a slice of the whole sequence, e.g.,\n' - '\n' - ' for x in a[:]:\n' - ' if x < 0: a.remove(x)\n' - '\n' - '\n' - 'The "try" statement\n' - '===================\n' - '\n' - 'The "try" statement specifies exception handlers and/or cleanup ' - 'code\n' - 'for a group of statements:\n' - '\n' - ' try_stmt ::= try1_stmt | try2_stmt\n' - ' try1_stmt ::= "try" ":" suite\n' - ' ("except" [expression [("as" | ",") ' - 'identifier]] ":" suite)+\n' - ' ["else" ":" suite]\n' - ' ["finally" ":" suite]\n' - ' try2_stmt ::= "try" ":" suite\n' - ' "finally" ":" suite\n' - '\n' - 'Changed in version 2.5: In previous versions of Python,\n' - '"try"..."except"..."finally" did not work. "try"..."except" had ' - 'to be\n' - 'nested in "try"..."finally".\n' - '\n' - 'The "except" clause(s) specify one or more exception handlers. ' - 'When no\n' - 'exception occurs in the "try" clause, no exception handler is\n' - 'executed. When an exception occurs in the "try" suite, a search ' - 'for an\n' - 'exception handler is started. This search inspects the except ' - 'clauses\n' - 'in turn until one is found that matches the exception. An ' - 'expression-\n' - 'less except clause, if present, must be last; it matches any\n' - 'exception. For an except clause with an expression, that ' - 'expression\n' - 'is evaluated, and the clause matches the exception if the ' - 'resulting\n' - 'object is "compatible" with the exception. An object is ' - 'compatible\n' - 'with an exception if it is the class or a base class of the ' - 'exception\n' - 'object, or a tuple containing an item compatible with the ' - 'exception.\n' - '\n' - 'If no except clause matches the exception, the search for an ' - 'exception\n' - 'handler continues in the surrounding code and on the invocation ' - 'stack.\n' - '[1]\n' - '\n' - 'If the evaluation of an expression in the header of an except ' - 'clause\n' - 'raises an exception, the original search for a handler is ' - 'canceled and\n' - 'a search starts for the new exception in the surrounding code ' - 'and on\n' - 'the call stack (it is treated as if the entire "try" statement ' - 'raised\n' - 'the exception).\n' - '\n' - 'When a matching except clause is found, the exception is ' - 'assigned to\n' - 'the target specified in that except clause, if present, and the ' - 'except\n' - "clause's suite is executed. All except clauses must have an\n" - 'executable block. When the end of this block is reached, ' - 'execution\n' - 'continues normally after the entire try statement. (This means ' - 'that\n' - 'if two nested handlers exist for the same exception, and the ' - 'exception\n' - 'occurs in the try clause of the inner handler, the outer handler ' - 'will\n' - 'not handle the exception.)\n' - '\n' - "Before an except clause's suite is executed, details about the\n" - 'exception are assigned to three variables in the "sys" module:\n' - '"sys.exc_type" receives the object identifying the exception;\n' - '"sys.exc_value" receives the exception\'s parameter;\n' - '"sys.exc_traceback" receives a traceback object (see section ' - 'The\n' - 'standard type hierarchy) identifying the point in the program ' - 'where\n' - 'the exception occurred. These details are also available through ' - 'the\n' - '"sys.exc_info()" function, which returns a tuple "(exc_type,\n' - 'exc_value, exc_traceback)". Use of the corresponding variables ' - 'is\n' - 'deprecated in favor of this function, since their use is unsafe ' - 'in a\n' - 'threaded program. As of Python 1.5, the variables are restored ' - 'to\n' - 'their previous values (before the call) when returning from a ' - 'function\n' - 'that handled an exception.\n' - '\n' - 'The optional "else" clause is executed if and when control flows ' - 'off\n' - 'the end of the "try" clause. [2] Exceptions in the "else" clause ' - 'are\n' - 'not handled by the preceding "except" clauses.\n' - '\n' - 'If "finally" is present, it specifies a \'cleanup\' handler. ' - 'The "try"\n' - 'clause is executed, including any "except" and "else" clauses. ' - 'If an\n' - 'exception occurs in any of the clauses and is not handled, the\n' - 'exception is temporarily saved. The "finally" clause is ' - 'executed. If\n' - 'there is a saved exception, it is re-raised at the end of the\n' - '"finally" clause. If the "finally" clause raises another ' - 'exception or\n' - 'executes a "return" or "break" statement, the saved exception ' - 'is\n' - 'discarded:\n' - '\n' - ' >>> def f():\n' - ' ... try:\n' - ' ... 1/0\n' - ' ... finally:\n' - ' ... return 42\n' - ' ...\n' - ' >>> f()\n' - ' 42\n' - '\n' - 'The exception information is not available to the program ' - 'during\n' - 'execution of the "finally" clause.\n' - '\n' - 'When a "return", "break" or "continue" statement is executed in ' - 'the\n' - '"try" suite of a "try"..."finally" statement, the "finally" ' - 'clause is\n' - 'also executed \'on the way out.\' A "continue" statement is ' - 'illegal in\n' - 'the "finally" clause. (The reason is a problem with the current\n' - 'implementation --- this restriction may be lifted in the ' - 'future).\n' - '\n' - 'The return value of a function is determined by the last ' - '"return"\n' - 'statement executed. Since the "finally" clause always executes, ' - 'a\n' - '"return" statement executed in the "finally" clause will always ' - 'be the\n' - 'last one executed:\n' - '\n' - ' >>> def foo():\n' - ' ... try:\n' - " ... return 'try'\n" - ' ... finally:\n' - " ... return 'finally'\n" - ' ...\n' - ' >>> foo()\n' - " 'finally'\n" - '\n' - 'Additional information on exceptions can be found in section\n' - 'Exceptions, and information on using the "raise" statement to ' - 'generate\n' - 'exceptions may be found in section The raise statement.\n' - '\n' - '\n' - 'The "with" statement\n' - '====================\n' - '\n' - 'New in version 2.5.\n' - '\n' - 'The "with" statement is used to wrap the execution of a block ' - 'with\n' - 'methods defined by a context manager (see section With ' - 'Statement\n' - 'Context Managers). This allows common ' - '"try"..."except"..."finally"\n' - 'usage patterns to be encapsulated for convenient reuse.\n' - '\n' - ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n' - ' with_item ::= expression ["as" target]\n' - '\n' - 'The execution of the "with" statement with one "item" proceeds ' - 'as\n' - 'follows:\n' - '\n' - '1. The context expression (the expression given in the ' - '"with_item")\n' - ' is evaluated to obtain a context manager.\n' - '\n' - '2. The context manager\'s "__exit__()" is loaded for later use.\n' - '\n' - '3. The context manager\'s "__enter__()" method is invoked.\n' - '\n' - '4. If a target was included in the "with" statement, the return\n' - ' value from "__enter__()" is assigned to it.\n' - '\n' - ' Note: The "with" statement guarantees that if the ' - '"__enter__()"\n' - ' method returns without an error, then "__exit__()" will ' - 'always be\n' - ' called. Thus, if an error occurs during the assignment to ' - 'the\n' - ' target list, it will be treated the same as an error ' - 'occurring\n' - ' within the suite would be. See step 6 below.\n' - '\n' - '5. The suite is executed.\n' - '\n' - '6. The context manager\'s "__exit__()" method is invoked. If an\n' - ' exception caused the suite to be exited, its type, value, ' - 'and\n' - ' traceback are passed as arguments to "__exit__()". Otherwise, ' - 'three\n' - ' "None" arguments are supplied.\n' - '\n' - ' If the suite was exited due to an exception, and the return ' - 'value\n' - ' from the "__exit__()" method was false, the exception is ' - 'reraised.\n' - ' If the return value was true, the exception is suppressed, ' - 'and\n' - ' execution continues with the statement following the "with"\n' - ' statement.\n' - '\n' - ' If the suite was exited for any reason other than an ' - 'exception, the\n' - ' return value from "__exit__()" is ignored, and execution ' - 'proceeds\n' - ' at the normal location for the kind of exit that was taken.\n' - '\n' - 'With more than one item, the context managers are processed as ' - 'if\n' - 'multiple "with" statements were nested:\n' - '\n' - ' with A() as a, B() as b:\n' - ' suite\n' - '\n' - 'is equivalent to\n' - '\n' - ' with A() as a:\n' - ' with B() as b:\n' - ' suite\n' - '\n' - 'Note: In Python 2.5, the "with" statement is only allowed when ' - 'the\n' - ' "with_statement" feature has been enabled. It is always ' - 'enabled in\n' - ' Python 2.6.\n' - '\n' - 'Changed in version 2.7: Support for multiple context ' - 'expressions.\n' - '\n' - 'See also:\n' - '\n' - ' **PEP 343** - The "with" statement\n' - ' The specification, background, and examples for the Python ' - '"with"\n' - ' statement.\n' - '\n' - '\n' - 'Function definitions\n' - '====================\n' - '\n' - 'A function definition defines a user-defined function object ' - '(see\n' - 'section The standard type hierarchy):\n' - '\n' - ' decorated ::= decorators (classdef | funcdef)\n' - ' decorators ::= decorator+\n' - ' decorator ::= "@" dotted_name ["(" [argument_list [","]] ' - '")"] NEWLINE\n' - ' funcdef ::= "def" funcname "(" [parameter_list] ")" ' - '":" suite\n' - ' dotted_name ::= identifier ("." identifier)*\n' - ' parameter_list ::= (defparameter ",")*\n' - ' ( "*" identifier ["," "**" identifier]\n' - ' | "**" identifier\n' - ' | defparameter [","] )\n' - ' defparameter ::= parameter ["=" expression]\n' - ' sublist ::= parameter ("," parameter)* [","]\n' - ' parameter ::= identifier | "(" sublist ")"\n' - ' funcname ::= identifier\n' - '\n' - 'A function definition is an executable statement. Its execution ' - 'binds\n' - 'the function name in the current local namespace to a function ' - 'object\n' - '(a wrapper around the executable code for the function). This\n' - 'function object contains a reference to the current global ' - 'namespace\n' - 'as the global namespace to be used when the function is called.\n' - '\n' - 'The function definition does not execute the function body; this ' - 'gets\n' - 'executed only when the function is called. [3]\n' - '\n' - 'A function definition may be wrapped by one or more *decorator*\n' - 'expressions. Decorator expressions are evaluated when the ' - 'function is\n' - 'defined, in the scope that contains the function definition. ' - 'The\n' - 'result must be a callable, which is invoked with the function ' - 'object\n' - 'as the only argument. The returned value is bound to the ' - 'function name\n' - 'instead of the function object. Multiple decorators are applied ' - 'in\n' - 'nested fashion. For example, the following code:\n' - '\n' - ' @f1(arg)\n' - ' @f2\n' - ' def func(): pass\n' - '\n' - 'is equivalent to:\n' - '\n' - ' def func(): pass\n' - ' func = f1(arg)(f2(func))\n' - '\n' - 'When one or more top-level *parameters* have the form ' - '*parameter* "="\n' - '*expression*, the function is said to have "default parameter ' - 'values."\n' - 'For a parameter with a default value, the corresponding ' - '*argument* may\n' - "be omitted from a call, in which case the parameter's default " - 'value is\n' - 'substituted. If a parameter has a default value, all following\n' - 'parameters must also have a default value --- this is a ' - 'syntactic\n' - 'restriction that is not expressed by the grammar.\n' - '\n' - '**Default parameter values are evaluated when the function ' - 'definition\n' - 'is executed.** This means that the expression is evaluated ' - 'once, when\n' - 'the function is defined, and that the same "pre-computed" value ' - 'is\n' - 'used for each call. This is especially important to understand ' - 'when a\n' - 'default parameter is a mutable object, such as a list or a ' - 'dictionary:\n' - 'if the function modifies the object (e.g. by appending an item ' - 'to a\n' - 'list), the default value is in effect modified. This is ' - 'generally not\n' - 'what was intended. A way around this is to use "None" as the\n' - 'default, and explicitly test for it in the body of the function, ' - 'e.g.:\n' - '\n' - ' def whats_on_the_telly(penguin=None):\n' - ' if penguin is None:\n' - ' penguin = []\n' - ' penguin.append("property of the zoo")\n' - ' return penguin\n' - '\n' - 'Function call semantics are described in more detail in section ' - 'Calls.\n' - 'A function call always assigns values to all parameters ' - 'mentioned in\n' - 'the parameter list, either from position arguments, from ' - 'keyword\n' - 'arguments, or from default values. If the form ""*identifier"" ' - 'is\n' - 'present, it is initialized to a tuple receiving any excess ' - 'positional\n' - 'parameters, defaulting to the empty tuple. If the form\n' - '""**identifier"" is present, it is initialized to a new ' - 'dictionary\n' - 'receiving any excess keyword arguments, defaulting to a new ' - 'empty\n' - 'dictionary.\n' - '\n' - 'It is also possible to create anonymous functions (functions not ' - 'bound\n' - 'to a name), for immediate use in expressions. This uses lambda\n' - 'expressions, described in section Lambdas. Note that the ' - 'lambda\n' - 'expression is merely a shorthand for a simplified function ' - 'definition;\n' - 'a function defined in a ""def"" statement can be passed around ' - 'or\n' - 'assigned to another name just like a function defined by a ' - 'lambda\n' - 'expression. The ""def"" form is actually more powerful since ' - 'it\n' - 'allows the execution of multiple statements.\n' - '\n' - "**Programmer's note:** Functions are first-class objects. A " - '""def""\n' - 'form executed inside a function definition defines a local ' - 'function\n' - 'that can be returned or passed around. Free variables used in ' - 'the\n' - 'nested function can access the local variables of the function\n' - 'containing the def. See section Naming and binding for ' - 'details.\n' - '\n' - '\n' - 'Class definitions\n' - '=================\n' - '\n' - 'A class definition defines a class object (see section The ' - 'standard\n' - 'type hierarchy):\n' - '\n' - ' classdef ::= "class" classname [inheritance] ":" suite\n' - ' inheritance ::= "(" [expression_list] ")"\n' - ' classname ::= identifier\n' - '\n' - 'A class definition is an executable statement. It first ' - 'evaluates the\n' - 'inheritance list, if present. Each item in the inheritance ' - 'list\n' - 'should evaluate to a class object or class type which allows\n' - "subclassing. The class's suite is then executed in a new " - 'execution\n' - 'frame (see section Naming and binding), using a newly created ' - 'local\n' - 'namespace and the original global namespace. (Usually, the ' - 'suite\n' - "contains only function definitions.) When the class's suite " - 'finishes\n' - 'execution, its execution frame is discarded but its local ' - 'namespace is\n' - 'saved. [4] A class object is then created using the inheritance ' - 'list\n' - 'for the base classes and the saved local namespace for the ' - 'attribute\n' - 'dictionary. The class name is bound to this class object in ' - 'the\n' - 'original local namespace.\n' - '\n' - "**Programmer's note:** Variables defined in the class definition " - 'are\n' - 'class variables; they are shared by all instances. To create ' - 'instance\n' - 'variables, they can be set in a method with "self.name = ' - 'value". Both\n' - 'class and instance variables are accessible through the ' - 'notation\n' - '""self.name"", and an instance variable hides a class variable ' - 'with\n' - 'the same name when accessed in this way. Class variables can be ' - 'used\n' - 'as defaults for instance variables, but using mutable values ' - 'there can\n' - 'lead to unexpected results. For *new-style class*es, ' - 'descriptors can\n' - 'be used to create instance variables with different ' - 'implementation\n' - 'details.\n' - '\n' - 'Class definitions, like function definitions, may be wrapped by ' - 'one or\n' - 'more *decorator* expressions. The evaluation rules for the ' - 'decorator\n' - 'expressions are the same as for functions. The result must be a ' - 'class\n' - 'object, which is then bound to the class name.\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] The exception is propagated to the invocation stack unless\n' - ' there is a "finally" clause which happens to raise another\n' - ' exception. That new exception causes the old one to be ' - 'lost.\n' - '\n' - '[2] Currently, control "flows off the end" except in the case ' - 'of\n' - ' an exception or the execution of a "return", "continue", or\n' - ' "break" statement.\n' - '\n' - '[3] A string literal appearing as the first statement in the\n' - ' function body is transformed into the function\'s "__doc__"\n' - " attribute and therefore the function's *docstring*.\n" - '\n' - '[4] A string literal appearing as the first statement in the ' - 'class\n' - ' body is transformed into the namespace\'s "__doc__" item ' - 'and\n' - " therefore the class's *docstring*.\n", - 'context-managers': '\n' - 'With Statement Context Managers\n' - '*******************************\n' - '\n' - 'New in version 2.5.\n' - '\n' - 'A *context manager* is an object that defines the ' - 'runtime context to\n' - 'be established when executing a "with" statement. The ' - 'context manager\n' - 'handles the entry into, and the exit from, the desired ' - 'runtime context\n' - 'for the execution of the block of code. Context ' - 'managers are normally\n' - 'invoked using the "with" statement (described in section ' - 'The with\n' - 'statement), but can also be used by directly invoking ' - 'their methods.\n' - '\n' - 'Typical uses of context managers include saving and ' - 'restoring various\n' - 'kinds of global state, locking and unlocking resources, ' - 'closing opened\n' - 'files, etc.\n' - '\n' - 'For more information on context managers, see Context ' - 'Manager Types.\n' - '\n' - 'object.__enter__(self)\n' - '\n' - ' Enter the runtime context related to this object. The ' - '"with"\n' - " statement will bind this method's return value to the " - 'target(s)\n' - ' specified in the "as" clause of the statement, if ' - 'any.\n' - '\n' - 'object.__exit__(self, exc_type, exc_value, traceback)\n' - '\n' - ' Exit the runtime context related to this object. The ' - 'parameters\n' - ' describe the exception that caused the context to be ' - 'exited. If the\n' - ' context was exited without an exception, all three ' - 'arguments will\n' - ' be "None".\n' - '\n' - ' If an exception is supplied, and the method wishes to ' - 'suppress the\n' - ' exception (i.e., prevent it from being propagated), ' - 'it should\n' - ' return a true value. Otherwise, the exception will be ' - 'processed\n' - ' normally upon exit from this method.\n' - '\n' - ' Note that "__exit__()" methods should not reraise the ' - 'passed-in\n' - " exception; this is the caller's responsibility.\n" - '\n' - 'See also:\n' - '\n' - ' **PEP 343** - The "with" statement\n' - ' The specification, background, and examples for the ' - 'Python "with"\n' - ' statement.\n', - 'continue': '\n' - 'The "continue" statement\n' - '************************\n' - '\n' - ' continue_stmt ::= "continue"\n' - '\n' - '"continue" may only occur syntactically nested in a "for" or ' - '"while"\n' - 'loop, but not nested in a function or class definition or ' - '"finally"\n' - 'clause within that loop. It continues with the next cycle of ' - 'the\n' - 'nearest enclosing loop.\n' - '\n' - 'When "continue" passes control out of a "try" statement with a\n' - '"finally" clause, that "finally" clause is executed before ' - 'really\n' - 'starting the next loop cycle.\n', - 'conversions': '\n' - 'Arithmetic conversions\n' - '**********************\n' - '\n' - 'When a description of an arithmetic operator below uses the ' - 'phrase\n' - '"the numeric arguments are converted to a common type," the ' - 'arguments\n' - 'are coerced using the coercion rules listed at Coercion ' - 'rules. If\n' - 'both arguments are standard numeric types, the following ' - 'coercions are\n' - 'applied:\n' - '\n' - '* If either argument is a complex number, the other is ' - 'converted to\n' - ' complex;\n' - '\n' - '* otherwise, if either argument is a floating point number, ' - 'the\n' - ' other is converted to floating point;\n' - '\n' - '* otherwise, if either argument is a long integer, the other ' - 'is\n' - ' converted to long integer;\n' - '\n' - '* otherwise, both must be plain integers and no conversion ' - 'is\n' - ' necessary.\n' - '\n' - 'Some additional rules apply for certain operators (e.g., a ' - 'string left\n' - "argument to the '%' operator). Extensions can define their " - 'own\n' - 'coercions.\n', - 'customization': '\n' - 'Basic customization\n' - '*******************\n' - '\n' - 'object.__new__(cls[, ...])\n' - '\n' - ' Called to create a new instance of class *cls*. ' - '"__new__()" is a\n' - ' static method (special-cased so you need not declare it ' - 'as such)\n' - ' that takes the class of which an instance was requested ' - 'as its\n' - ' first argument. The remaining arguments are those ' - 'passed to the\n' - ' object constructor expression (the call to the class). ' - 'The return\n' - ' value of "__new__()" should be the new object instance ' - '(usually an\n' - ' instance of *cls*).\n' - '\n' - ' Typical implementations create a new instance of the ' - 'class by\n' - ' invoking the superclass\'s "__new__()" method using\n' - ' "super(currentclass, cls).__new__(cls[, ...])" with ' - 'appropriate\n' - ' arguments and then modifying the newly-created instance ' - 'as\n' - ' necessary before returning it.\n' - '\n' - ' If "__new__()" returns an instance of *cls*, then the ' - 'new\n' - ' instance\'s "__init__()" method will be invoked like\n' - ' "__init__(self[, ...])", where *self* is the new ' - 'instance and the\n' - ' remaining arguments are the same as were passed to ' - '"__new__()".\n' - '\n' - ' If "__new__()" does not return an instance of *cls*, ' - 'then the new\n' - ' instance\'s "__init__()" method will not be invoked.\n' - '\n' - ' "__new__()" is intended mainly to allow subclasses of ' - 'immutable\n' - ' types (like int, str, or tuple) to customize instance ' - 'creation. It\n' - ' is also commonly overridden in custom metaclasses in ' - 'order to\n' - ' customize class creation.\n' - '\n' - 'object.__init__(self[, ...])\n' - '\n' - ' Called after the instance has been created (by ' - '"__new__()"), but\n' - ' before it is returned to the caller. The arguments are ' - 'those\n' - ' passed to the class constructor expression. If a base ' - 'class has an\n' - ' "__init__()" method, the derived class\'s "__init__()" ' - 'method, if\n' - ' any, must explicitly call it to ensure proper ' - 'initialization of the\n' - ' base class part of the instance; for example:\n' - ' "BaseClass.__init__(self, [args...])".\n' - '\n' - ' Because "__new__()" and "__init__()" work together in ' - 'constructing\n' - ' objects ("__new__()" to create it, and "__init__()" to ' - 'customise\n' - ' it), no non-"None" value may be returned by ' - '"__init__()"; doing so\n' - ' will cause a "TypeError" to be raised at runtime.\n' - '\n' - 'object.__del__(self)\n' - '\n' - ' Called when the instance is about to be destroyed. This ' - 'is also\n' - ' called a destructor. If a base class has a "__del__()" ' - 'method, the\n' - ' derived class\'s "__del__()" method, if any, must ' - 'explicitly call it\n' - ' to ensure proper deletion of the base class part of the ' - 'instance.\n' - ' Note that it is possible (though not recommended!) for ' - 'the\n' - ' "__del__()" method to postpone destruction of the ' - 'instance by\n' - ' creating a new reference to it. It may then be called ' - 'at a later\n' - ' time when this new reference is deleted. It is not ' - 'guaranteed that\n' - ' "__del__()" methods are called for objects that still ' - 'exist when\n' - ' the interpreter exits.\n' - '\n' - ' Note: "del x" doesn\'t directly call "x.__del__()" --- ' - 'the former\n' - ' decrements the reference count for "x" by one, and the ' - 'latter is\n' - ' only called when "x"\'s reference count reaches zero. ' - 'Some common\n' - ' situations that may prevent the reference count of an ' - 'object from\n' - ' going to zero include: circular references between ' - 'objects (e.g.,\n' - ' a doubly-linked list or a tree data structure with ' - 'parent and\n' - ' child pointers); a reference to the object on the ' - 'stack frame of\n' - ' a function that caught an exception (the traceback ' - 'stored in\n' - ' "sys.exc_traceback" keeps the stack frame alive); or a ' - 'reference\n' - ' to the object on the stack frame that raised an ' - 'unhandled\n' - ' exception in interactive mode (the traceback stored ' - 'in\n' - ' "sys.last_traceback" keeps the stack frame alive). ' - 'The first\n' - ' situation can only be remedied by explicitly breaking ' - 'the cycles;\n' - ' the latter two situations can be resolved by storing ' - '"None" in\n' - ' "sys.exc_traceback" or "sys.last_traceback". Circular ' - 'references\n' - ' which are garbage are detected when the option cycle ' - 'detector is\n' - " enabled (it's on by default), but can only be cleaned " - 'up if there\n' - ' are no Python-level "__del__()" methods involved. ' - 'Refer to the\n' - ' documentation for the "gc" module for more information ' - 'about how\n' - ' "__del__()" methods are handled by the cycle ' - 'detector,\n' - ' particularly the description of the "garbage" value.\n' - '\n' - ' Warning: Due to the precarious circumstances under ' - 'which\n' - ' "__del__()" methods are invoked, exceptions that occur ' - 'during\n' - ' their execution are ignored, and a warning is printed ' - 'to\n' - ' "sys.stderr" instead. Also, when "__del__()" is ' - 'invoked in\n' - ' response to a module being deleted (e.g., when ' - 'execution of the\n' - ' program is done), other globals referenced by the ' - '"__del__()"\n' - ' method may already have been deleted or in the process ' - 'of being\n' - ' torn down (e.g. the import machinery shutting down). ' - 'For this\n' - ' reason, "__del__()" methods should do the absolute ' - 'minimum needed\n' - ' to maintain external invariants. Starting with ' - 'version 1.5,\n' - ' Python guarantees that globals whose name begins with ' - 'a single\n' - ' underscore are deleted from their module before other ' - 'globals are\n' - ' deleted; if no other references to such globals exist, ' - 'this may\n' - ' help in assuring that imported modules are still ' - 'available at the\n' - ' time when the "__del__()" method is called.\n' - '\n' - ' See also the "-R" command-line option.\n' - '\n' - 'object.__repr__(self)\n' - '\n' - ' Called by the "repr()" built-in function and by string ' - 'conversions\n' - ' (reverse quotes) to compute the "official" string ' - 'representation of\n' - ' an object. If at all possible, this should look like a ' - 'valid\n' - ' Python expression that could be used to recreate an ' - 'object with the\n' - ' same value (given an appropriate environment). If this ' - 'is not\n' - ' possible, a string of the form "<...some useful ' - 'description...>"\n' - ' should be returned. The return value must be a string ' - 'object. If a\n' - ' class defines "__repr__()" but not "__str__()", then ' - '"__repr__()"\n' - ' is also used when an "informal" string representation of ' - 'instances\n' - ' of that class is required.\n' - '\n' - ' This is typically used for debugging, so it is important ' - 'that the\n' - ' representation is information-rich and unambiguous.\n' - '\n' - 'object.__str__(self)\n' - '\n' - ' Called by the "str()" built-in function and by the ' - '"print"\n' - ' statement to compute the "informal" string ' - 'representation of an\n' - ' object. This differs from "__repr__()" in that it does ' - 'not have to\n' - ' be a valid Python expression: a more convenient or ' - 'concise\n' - ' representation may be used instead. The return value ' - 'must be a\n' - ' string object.\n' - '\n' - 'object.__lt__(self, other)\n' - 'object.__le__(self, other)\n' - 'object.__eq__(self, other)\n' - 'object.__ne__(self, other)\n' - 'object.__gt__(self, other)\n' - 'object.__ge__(self, other)\n' - '\n' - ' New in version 2.1.\n' - '\n' - ' These are the so-called "rich comparison" methods, and ' - 'are called\n' - ' for comparison operators in preference to "__cmp__()" ' - 'below. The\n' - ' correspondence between operator symbols and method names ' - 'is as\n' - ' follows: "xy" call ' - '"x.__ne__(y)",\n' - ' "x>y" calls "x.__gt__(y)", and "x>=y" calls ' - '"x.__ge__(y)".\n' - '\n' - ' A rich comparison method may return the singleton ' - '"NotImplemented"\n' - ' if it does not implement the operation for a given pair ' - 'of\n' - ' arguments. By convention, "False" and "True" are ' - 'returned for a\n' - ' successful comparison. However, these methods can return ' - 'any value,\n' - ' so if the comparison operator is used in a Boolean ' - 'context (e.g.,\n' - ' in the condition of an "if" statement), Python will call ' - '"bool()"\n' - ' on the value to determine if the result is true or ' - 'false.\n' - '\n' - ' There are no implied relationships among the comparison ' - 'operators.\n' - ' The truth of "x==y" does not imply that "x!=y" is ' - 'false.\n' - ' Accordingly, when defining "__eq__()", one should also ' - 'define\n' - ' "__ne__()" so that the operators will behave as ' - 'expected. See the\n' - ' paragraph on "__hash__()" for some important notes on ' - 'creating\n' - ' *hashable* objects which support custom comparison ' - 'operations and\n' - ' are usable as dictionary keys.\n' - '\n' - ' There are no swapped-argument versions of these methods ' - '(to be used\n' - ' when the left argument does not support the operation ' - 'but the right\n' - ' argument does); rather, "__lt__()" and "__gt__()" are ' - "each other's\n" - ' reflection, "__le__()" and "__ge__()" are each other\'s ' - 'reflection,\n' - ' and "__eq__()" and "__ne__()" are their own reflection.\n' - '\n' - ' Arguments to rich comparison methods are never coerced.\n' - '\n' - ' To automatically generate ordering operations from a ' - 'single root\n' - ' operation, see "functools.total_ordering()".\n' - '\n' - 'object.__cmp__(self, other)\n' - '\n' - ' Called by comparison operations if rich comparison (see ' - 'above) is\n' - ' not defined. Should return a negative integer if "self ' - '< other",\n' - ' zero if "self == other", a positive integer if "self > ' - 'other". If\n' - ' no "__cmp__()", "__eq__()" or "__ne__()" operation is ' - 'defined,\n' - ' class instances are compared by object identity ' - '("address"). See\n' - ' also the description of "__hash__()" for some important ' - 'notes on\n' - ' creating *hashable* objects which support custom ' - 'comparison\n' - ' operations and are usable as dictionary keys. (Note: ' - 'the\n' - ' restriction that exceptions are not propagated by ' - '"__cmp__()" has\n' - ' been removed since Python 1.5.)\n' - '\n' - 'object.__rcmp__(self, other)\n' - '\n' - ' Changed in version 2.1: No longer supported.\n' - '\n' - 'object.__hash__(self)\n' - '\n' - ' Called by built-in function "hash()" and for operations ' - 'on members\n' - ' of hashed collections including "set", "frozenset", and ' - '"dict".\n' - ' "__hash__()" should return an integer. The only ' - 'required property\n' - ' is that objects which compare equal have the same hash ' - 'value; it is\n' - ' advised to somehow mix together (e.g. using exclusive ' - 'or) the hash\n' - ' values for the components of the object that also play a ' - 'part in\n' - ' comparison of objects.\n' - '\n' - ' If a class does not define a "__cmp__()" or "__eq__()" ' - 'method it\n' - ' should not define a "__hash__()" operation either; if it ' - 'defines\n' - ' "__cmp__()" or "__eq__()" but not "__hash__()", its ' - 'instances will\n' - ' not be usable in hashed collections. If a class defines ' - 'mutable\n' - ' objects and implements a "__cmp__()" or "__eq__()" ' - 'method, it\n' - ' should not implement "__hash__()", since hashable ' - 'collection\n' - " implementations require that a object's hash value is " - 'immutable (if\n' - " the object's hash value changes, it will be in the wrong " - 'hash\n' - ' bucket).\n' - '\n' - ' User-defined classes have "__cmp__()" and "__hash__()" ' - 'methods by\n' - ' default; with them, all objects compare unequal (except ' - 'with\n' - ' themselves) and "x.__hash__()" returns a result derived ' - 'from\n' - ' "id(x)".\n' - '\n' - ' Classes which inherit a "__hash__()" method from a ' - 'parent class but\n' - ' change the meaning of "__cmp__()" or "__eq__()" such ' - 'that the hash\n' - ' value returned is no longer appropriate (e.g. by ' - 'switching to a\n' - ' value-based concept of equality instead of the default ' - 'identity\n' - ' based equality) can explicitly flag themselves as being ' - 'unhashable\n' - ' by setting "__hash__ = None" in the class definition. ' - 'Doing so\n' - ' means that not only will instances of the class raise ' - 'an\n' - ' appropriate "TypeError" when a program attempts to ' - 'retrieve their\n' - ' hash value, but they will also be correctly identified ' - 'as\n' - ' unhashable when checking "isinstance(obj, ' - 'collections.Hashable)"\n' - ' (unlike classes which define their own "__hash__()" to ' - 'explicitly\n' - ' raise "TypeError").\n' - '\n' - ' Changed in version 2.5: "__hash__()" may now also return ' - 'a long\n' - ' integer object; the 32-bit integer is then derived from ' - 'the hash of\n' - ' that object.\n' - '\n' - ' Changed in version 2.6: "__hash__" may now be set to ' - '"None" to\n' - ' explicitly flag instances of a class as unhashable.\n' - '\n' - 'object.__nonzero__(self)\n' - '\n' - ' Called to implement truth value testing and the built-in ' - 'operation\n' - ' "bool()"; should return "False" or "True", or their ' - 'integer\n' - ' equivalents "0" or "1". When this method is not ' - 'defined,\n' - ' "__len__()" is called, if it is defined, and the object ' - 'is\n' - ' considered true if its result is nonzero. If a class ' - 'defines\n' - ' neither "__len__()" nor "__nonzero__()", all its ' - 'instances are\n' - ' considered true.\n' - '\n' - 'object.__unicode__(self)\n' - '\n' - ' Called to implement "unicode()" built-in; should return ' - 'a Unicode\n' - ' object. When this method is not defined, string ' - 'conversion is\n' - ' attempted, and the result of string conversion is ' - 'converted to\n' - ' Unicode using the system default encoding.\n', - 'debugger': '\n' - '"pdb" --- The Python Debugger\n' - '*****************************\n' - '\n' - '**Source code:** Lib/pdb.py\n' - '\n' - '======================================================================\n' - '\n' - 'The module "pdb" defines an interactive source code debugger ' - 'for\n' - 'Python programs. It supports setting (conditional) breakpoints ' - 'and\n' - 'single stepping at the source line level, inspection of stack ' - 'frames,\n' - 'source code listing, and evaluation of arbitrary Python code in ' - 'the\n' - 'context of any stack frame. It also supports post-mortem ' - 'debugging\n' - 'and can be called under program control.\n' - '\n' - 'The debugger is extensible --- it is actually defined as the ' - 'class\n' - '"Pdb". This is currently undocumented but easily understood by ' - 'reading\n' - 'the source. The extension interface uses the modules "bdb" and ' - '"cmd".\n' - '\n' - 'The debugger\'s prompt is "(Pdb)". Typical usage to run a ' - 'program under\n' - 'control of the debugger is:\n' - '\n' - ' >>> import pdb\n' - ' >>> import mymodule\n' - " >>> pdb.run('mymodule.test()')\n" - ' > (0)?()\n' - ' (Pdb) continue\n' - ' > (1)?()\n' - ' (Pdb) continue\n' - " NameError: 'spam'\n" - ' > (1)?()\n' - ' (Pdb)\n' - '\n' - '"pdb.py" can also be invoked as a script to debug other ' - 'scripts. For\n' - 'example:\n' - '\n' - ' python -m pdb myscript.py\n' - '\n' - 'When invoked as a script, pdb will automatically enter ' - 'post-mortem\n' - 'debugging if the program being debugged exits abnormally. After ' - 'post-\n' - 'mortem debugging (or after normal exit of the program), pdb ' - 'will\n' - "restart the program. Automatic restarting preserves pdb's state " - '(such\n' - 'as breakpoints) and in most cases is more useful than quitting ' - 'the\n' - "debugger upon program's exit.\n" - '\n' - 'New in version 2.4: Restarting post-mortem behavior added.\n' - '\n' - 'The typical usage to break into the debugger from a running ' - 'program is\n' - 'to insert\n' - '\n' - ' import pdb; pdb.set_trace()\n' - '\n' - 'at the location you want to break into the debugger. You can ' - 'then\n' - 'step through the code following this statement, and continue ' - 'running\n' - 'without the debugger using the "c" command.\n' - '\n' - 'The typical usage to inspect a crashed program is:\n' - '\n' - ' >>> import pdb\n' - ' >>> import mymodule\n' - ' >>> mymodule.test()\n' - ' Traceback (most recent call last):\n' - ' File "", line 1, in ?\n' - ' File "./mymodule.py", line 4, in test\n' - ' test2()\n' - ' File "./mymodule.py", line 3, in test2\n' - ' print spam\n' - ' NameError: spam\n' - ' >>> pdb.pm()\n' - ' > ./mymodule.py(3)test2()\n' - ' -> print spam\n' - ' (Pdb)\n' - '\n' - 'The module defines the following functions; each enters the ' - 'debugger\n' - 'in a slightly different way:\n' - '\n' - 'pdb.run(statement[, globals[, locals]])\n' - '\n' - ' Execute the *statement* (given as a string) under debugger ' - 'control.\n' - ' The debugger prompt appears before any code is executed; you ' - 'can\n' - ' set breakpoints and type "continue", or you can step through ' - 'the\n' - ' statement using "step" or "next" (all these commands are ' - 'explained\n' - ' below). The optional *globals* and *locals* arguments ' - 'specify the\n' - ' environment in which the code is executed; by default the\n' - ' dictionary of the module "__main__" is used. (See the ' - 'explanation\n' - ' of the "exec" statement or the "eval()" built-in function.)\n' - '\n' - 'pdb.runeval(expression[, globals[, locals]])\n' - '\n' - ' Evaluate the *expression* (given as a string) under debugger\n' - ' control. When "runeval()" returns, it returns the value of ' - 'the\n' - ' expression. Otherwise this function is similar to "run()".\n' - '\n' - 'pdb.runcall(function[, argument, ...])\n' - '\n' - ' Call the *function* (a function or method object, not a ' - 'string)\n' - ' with the given arguments. When "runcall()" returns, it ' - 'returns\n' - ' whatever the function call returned. The debugger prompt ' - 'appears\n' - ' as soon as the function is entered.\n' - '\n' - 'pdb.set_trace()\n' - '\n' - ' Enter the debugger at the calling stack frame. This is ' - 'useful to\n' - ' hard-code a breakpoint at a given point in a program, even if ' - 'the\n' - ' code is not otherwise being debugged (e.g. when an assertion\n' - ' fails).\n' - '\n' - 'pdb.post_mortem([traceback])\n' - '\n' - ' Enter post-mortem debugging of the given *traceback* object. ' - 'If no\n' - ' *traceback* is given, it uses the one of the exception that ' - 'is\n' - ' currently being handled (an exception must be being handled ' - 'if the\n' - ' default is to be used).\n' - '\n' - 'pdb.pm()\n' - '\n' - ' Enter post-mortem debugging of the traceback found in\n' - ' "sys.last_traceback".\n' - '\n' - 'The "run*" functions and "set_trace()" are aliases for ' - 'instantiating\n' - 'the "Pdb" class and calling the method of the same name. If you ' - 'want\n' - 'to access further features, you have to do this yourself:\n' - '\n' - "class pdb.Pdb(completekey='tab', stdin=None, stdout=None, " - 'skip=None)\n' - '\n' - ' "Pdb" is the debugger class.\n' - '\n' - ' The *completekey*, *stdin* and *stdout* arguments are passed ' - 'to the\n' - ' underlying "cmd.Cmd" class; see the description there.\n' - '\n' - ' The *skip* argument, if given, must be an iterable of ' - 'glob-style\n' - ' module name patterns. The debugger will not step into frames ' - 'that\n' - ' originate in a module that matches one of these patterns. ' - '[1]\n' - '\n' - ' Example call to enable tracing with *skip*:\n' - '\n' - " import pdb; pdb.Pdb(skip=['django.*']).set_trace()\n" - '\n' - ' New in version 2.7: The *skip* argument.\n' - '\n' - ' run(statement[, globals[, locals]])\n' - ' runeval(expression[, globals[, locals]])\n' - ' runcall(function[, argument, ...])\n' - ' set_trace()\n' - '\n' - ' See the documentation for the functions explained above.\n', - 'del': '\n' - 'The "del" statement\n' - '*******************\n' - '\n' - ' del_stmt ::= "del" target_list\n' - '\n' - 'Deletion is recursively defined very similar to the way assignment ' - 'is\n' - 'defined. Rather than spelling it out in full details, here are some\n' - 'hints.\n' - '\n' - 'Deletion of a target list recursively deletes each target, from left\n' - 'to right.\n' - '\n' - 'Deletion of a name removes the binding of that name from the local ' - 'or\n' - 'global namespace, depending on whether the name occurs in a "global"\n' - 'statement in the same code block. If the name is unbound, a\n' - '"NameError" exception will be raised.\n' - '\n' - 'It is illegal to delete a name from the local namespace if it occurs\n' - 'as a free variable in a nested block.\n' - '\n' - 'Deletion of attribute references, subscriptions and slicings is ' - 'passed\n' - 'to the primary object involved; deletion of a slicing is in general\n' - 'equivalent to assignment of an empty slice of the right type (but ' - 'even\n' - 'this is determined by the sliced object).\n', - 'dict': '\n' - 'Dictionary displays\n' - '*******************\n' - '\n' - 'A dictionary display is a possibly empty series of key/datum pairs\n' - 'enclosed in curly braces:\n' - '\n' - ' dict_display ::= "{" [key_datum_list | dict_comprehension] ' - '"}"\n' - ' key_datum_list ::= key_datum ("," key_datum)* [","]\n' - ' key_datum ::= expression ":" expression\n' - ' dict_comprehension ::= expression ":" expression comp_for\n' - '\n' - 'A dictionary display yields a new dictionary object.\n' - '\n' - 'If a comma-separated sequence of key/datum pairs is given, they are\n' - 'evaluated from left to right to define the entries of the ' - 'dictionary:\n' - 'each key object is used as a key into the dictionary to store the\n' - 'corresponding datum. This means that you can specify the same key\n' - "multiple times in the key/datum list, and the final dictionary's " - 'value\n' - 'for that key will be the last one given.\n' - '\n' - 'A dict comprehension, in contrast to list and set comprehensions,\n' - 'needs two expressions separated with a colon followed by the usual\n' - '"for" and "if" clauses. When the comprehension is run, the ' - 'resulting\n' - 'key and value elements are inserted in the new dictionary in the ' - 'order\n' - 'they are produced.\n' - '\n' - 'Restrictions on the types of the key values are listed earlier in\n' - 'section The standard type hierarchy. (To summarize, the key type\n' - 'should be *hashable*, which excludes all mutable objects.) Clashes\n' - 'between duplicate keys are not detected; the last datum (textually\n' - 'rightmost in the display) stored for a given key value prevails.\n', - 'dynamic-features': '\n' - 'Interaction with dynamic features\n' - '*********************************\n' - '\n' - 'There are several cases where Python statements are ' - 'illegal when used\n' - 'in conjunction with nested scopes that contain free ' - 'variables.\n' - '\n' - 'If a variable is referenced in an enclosing scope, it is ' - 'illegal to\n' - 'delete the name. An error will be reported at compile ' - 'time.\n' - '\n' - 'If the wild card form of import --- "import *" --- is ' - 'used in a\n' - 'function and the function contains or is a nested block ' - 'with free\n' - 'variables, the compiler will raise a "SyntaxError".\n' - '\n' - 'If "exec" is used in a function and the function ' - 'contains or is a\n' - 'nested block with free variables, the compiler will ' - 'raise a\n' - '"SyntaxError" unless the exec explicitly specifies the ' - 'local namespace\n' - 'for the "exec". (In other words, "exec obj" would be ' - 'illegal, but\n' - '"exec obj in ns" would be legal.)\n' - '\n' - 'The "eval()", "execfile()", and "input()" functions and ' - 'the "exec"\n' - 'statement do not have access to the full environment for ' - 'resolving\n' - 'names. Names may be resolved in the local and global ' - 'namespaces of\n' - 'the caller. Free variables are not resolved in the ' - 'nearest enclosing\n' - 'namespace, but in the global namespace. [1] The "exec" ' - 'statement and\n' - 'the "eval()" and "execfile()" functions have optional ' - 'arguments to\n' - 'override the global and local namespace. If only one ' - 'namespace is\n' - 'specified, it is used for both.\n', - 'else': '\n' - 'The "if" statement\n' - '******************\n' - '\n' - 'The "if" statement is used for conditional execution:\n' - '\n' - ' if_stmt ::= "if" expression ":" suite\n' - ' ( "elif" expression ":" suite )*\n' - ' ["else" ":" suite]\n' - '\n' - 'It selects exactly one of the suites by evaluating the expressions ' - 'one\n' - 'by one until one is found to be true (see section Boolean ' - 'operations\n' - 'for the definition of true and false); then that suite is executed\n' - '(and no other part of the "if" statement is executed or evaluated).\n' - 'If all expressions are false, the suite of the "else" clause, if\n' - 'present, is executed.\n', - 'exceptions': '\n' - 'Exceptions\n' - '**********\n' - '\n' - 'Exceptions are a means of breaking out of the normal flow of ' - 'control\n' - 'of a code block in order to handle errors or other ' - 'exceptional\n' - 'conditions. An exception is *raised* at the point where the ' - 'error is\n' - 'detected; it may be *handled* by the surrounding code block or ' - 'by any\n' - 'code block that directly or indirectly invoked the code block ' - 'where\n' - 'the error occurred.\n' - '\n' - 'The Python interpreter raises an exception when it detects a ' - 'run-time\n' - 'error (such as division by zero). A Python program can also\n' - 'explicitly raise an exception with the "raise" statement. ' - 'Exception\n' - 'handlers are specified with the "try" ... "except" statement. ' - 'The\n' - '"finally" clause of such a statement can be used to specify ' - 'cleanup\n' - 'code which does not handle the exception, but is executed ' - 'whether an\n' - 'exception occurred or not in the preceding code.\n' - '\n' - 'Python uses the "termination" model of error handling: an ' - 'exception\n' - 'handler can find out what happened and continue execution at ' - 'an outer\n' - 'level, but it cannot repair the cause of the error and retry ' - 'the\n' - 'failing operation (except by re-entering the offending piece ' - 'of code\n' - 'from the top).\n' - '\n' - 'When an exception is not handled at all, the interpreter ' - 'terminates\n' - 'execution of the program, or returns to its interactive main ' - 'loop. In\n' - 'either case, it prints a stack backtrace, except when the ' - 'exception is\n' - '"SystemExit".\n' - '\n' - 'Exceptions are identified by class instances. The "except" ' - 'clause is\n' - 'selected depending on the class of the instance: it must ' - 'reference the\n' - 'class of the instance or a base class thereof. The instance ' - 'can be\n' - 'received by the handler and can carry additional information ' - 'about the\n' - 'exceptional condition.\n' - '\n' - 'Exceptions can also be identified by strings, in which case ' - 'the\n' - '"except" clause is selected by object identity. An arbitrary ' - 'value\n' - 'can be raised along with the identifying string which can be ' - 'passed to\n' - 'the handler.\n' - '\n' - 'Note: Messages to exceptions are not part of the Python API. ' - 'Their\n' - ' contents may change from one version of Python to the next ' - 'without\n' - ' warning and should not be relied on by code which will run ' - 'under\n' - ' multiple versions of the interpreter.\n' - '\n' - 'See also the description of the "try" statement in section The ' - 'try\n' - 'statement and "raise" statement in section The raise ' - 'statement.\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] This limitation occurs because the code that is executed ' - 'by\n' - ' these operations is not available at the time the module ' - 'is\n' - ' compiled.\n', - 'exec': '\n' - 'The "exec" statement\n' - '********************\n' - '\n' - ' exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n' - '\n' - 'This statement supports dynamic execution of Python code. The ' - 'first\n' - 'expression should evaluate to either a Unicode string, a *Latin-1*\n' - 'encoded string, an open file object, a code object, or a tuple. If ' - 'it\n' - 'is a string, the string is parsed as a suite of Python statements\n' - 'which is then executed (unless a syntax error occurs). [1] If it is ' - 'an\n' - 'open file, the file is parsed until EOF and executed. If it is a ' - 'code\n' - 'object, it is simply executed. For the interpretation of a tuple, ' - 'see\n' - "below. In all cases, the code that's executed is expected to be " - 'valid\n' - 'as file input (see section File input). Be aware that the "return"\n' - 'and "yield" statements may not be used outside of function ' - 'definitions\n' - 'even within the context of code passed to the "exec" statement.\n' - '\n' - 'In all cases, if the optional parts are omitted, the code is ' - 'executed\n' - 'in the current scope. If only the first expression after "in" is\n' - 'specified, it should be a dictionary, which will be used for both ' - 'the\n' - 'global and the local variables. If two expressions are given, they\n' - 'are used for the global and local variables, respectively. If\n' - 'provided, *locals* can be any mapping object. Remember that at ' - 'module\n' - 'level, globals and locals are the same dictionary. If two separate\n' - 'objects are given as *globals* and *locals*, the code will be ' - 'executed\n' - 'as if it were embedded in a class definition.\n' - '\n' - 'The first expression may also be a tuple of length 2 or 3. In this\n' - 'case, the optional parts must be omitted. The form "exec(expr,\n' - 'globals)" is equivalent to "exec expr in globals", while the form\n' - '"exec(expr, globals, locals)" is equivalent to "exec expr in ' - 'globals,\n' - 'locals". The tuple form of "exec" provides compatibility with ' - 'Python\n' - '3, where "exec" is a function rather than a statement.\n' - '\n' - 'Changed in version 2.4: Formerly, *locals* was required to be a\n' - 'dictionary.\n' - '\n' - 'As a side effect, an implementation may insert additional keys into\n' - 'the dictionaries given besides those corresponding to variable ' - 'names\n' - 'set by the executed code. For example, the current implementation ' - 'may\n' - 'add a reference to the dictionary of the built-in module ' - '"__builtin__"\n' - 'under the key "__builtins__" (!).\n' - '\n' - "**Programmer's hints:** dynamic evaluation of expressions is " - 'supported\n' - 'by the built-in function "eval()". The built-in functions ' - '"globals()"\n' - 'and "locals()" return the current global and local dictionary,\n' - 'respectively, which may be useful to pass around for use by "exec".\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] Note that the parser only accepts the Unix-style end of line\n' - ' convention. If you are reading the code from a file, make sure ' - 'to\n' - ' use *universal newlines* mode to convert Windows or Mac-style\n' - ' newlines.\n', - 'execmodel': '\n' - 'Execution model\n' - '***************\n' - '\n' - '\n' - 'Naming and binding\n' - '==================\n' - '\n' - '*Names* refer to objects. Names are introduced by name ' - 'binding\n' - 'operations. Each occurrence of a name in the program text ' - 'refers to\n' - 'the *binding* of that name established in the innermost ' - 'function block\n' - 'containing the use.\n' - '\n' - 'A *block* is a piece of Python program text that is executed as ' - 'a\n' - 'unit. The following are blocks: a module, a function body, and ' - 'a class\n' - 'definition. Each command typed interactively is a block. A ' - 'script\n' - 'file (a file given as standard input to the interpreter or ' - 'specified\n' - 'on the interpreter command line the first argument) is a code ' - 'block.\n' - 'A script command (a command specified on the interpreter ' - 'command line\n' - "with the '**-c**' option) is a code block. The file read by " - 'the\n' - 'built-in function "execfile()" is a code block. The string ' - 'argument\n' - 'passed to the built-in function "eval()" and to the "exec" ' - 'statement\n' - 'is a code block. The expression read and evaluated by the ' - 'built-in\n' - 'function "input()" is a code block.\n' - '\n' - 'A code block is executed in an *execution frame*. A frame ' - 'contains\n' - 'some administrative information (used for debugging) and ' - 'determines\n' - "where and how execution continues after the code block's " - 'execution has\n' - 'completed.\n' - '\n' - 'A *scope* defines the visibility of a name within a block. If ' - 'a local\n' - 'variable is defined in a block, its scope includes that block. ' - 'If the\n' - 'definition occurs in a function block, the scope extends to any ' - 'blocks\n' - 'contained within the defining one, unless a contained block ' - 'introduces\n' - 'a different binding for the name. The scope of names defined ' - 'in a\n' - 'class block is limited to the class block; it does not extend ' - 'to the\n' - 'code blocks of methods -- this includes generator expressions ' - 'since\n' - 'they are implemented using a function scope. This means that ' - 'the\n' - 'following will fail:\n' - '\n' - ' class A:\n' - ' a = 42\n' - ' b = list(a + i for i in range(10))\n' - '\n' - 'When a name is used in a code block, it is resolved using the ' - 'nearest\n' - 'enclosing scope. The set of all such scopes visible to a code ' - 'block\n' - "is called the block's *environment*.\n" - '\n' - 'If a name is bound in a block, it is a local variable of that ' - 'block.\n' - 'If a name is bound at the module level, it is a global ' - 'variable. (The\n' - 'variables of the module code block are local and global.) If ' - 'a\n' - 'variable is used in a code block but not defined there, it is a ' - '*free\n' - 'variable*.\n' - '\n' - 'When a name is not found at all, a "NameError" exception is ' - 'raised.\n' - 'If the name refers to a local variable that has not been bound, ' - 'a\n' - '"UnboundLocalError" exception is raised. "UnboundLocalError" ' - 'is a\n' - 'subclass of "NameError".\n' - '\n' - 'The following constructs bind names: formal parameters to ' - 'functions,\n' - '"import" statements, class and function definitions (these bind ' - 'the\n' - 'class or function name in the defining block), and targets that ' - 'are\n' - 'identifiers if occurring in an assignment, "for" loop header, ' - 'in the\n' - 'second position of an "except" clause header or after "as" in a ' - '"with"\n' - 'statement. The "import" statement of the form "from ... import ' - '*"\n' - 'binds all names defined in the imported module, except those ' - 'beginning\n' - 'with an underscore. This form may only be used at the module ' - 'level.\n' - '\n' - 'A target occurring in a "del" statement is also considered ' - 'bound for\n' - 'this purpose (though the actual semantics are to unbind the ' - 'name). It\n' - 'is illegal to unbind a name that is referenced by an enclosing ' - 'scope;\n' - 'the compiler will report a "SyntaxError".\n' - '\n' - 'Each assignment or import statement occurs within a block ' - 'defined by a\n' - 'class or function definition or at the module level (the ' - 'top-level\n' - 'code block).\n' - '\n' - 'If a name binding operation occurs anywhere within a code ' - 'block, all\n' - 'uses of the name within the block are treated as references to ' - 'the\n' - 'current block. This can lead to errors when a name is used ' - 'within a\n' - 'block before it is bound. This rule is subtle. Python lacks\n' - 'declarations and allows name binding operations to occur ' - 'anywhere\n' - 'within a code block. The local variables of a code block can ' - 'be\n' - 'determined by scanning the entire text of the block for name ' - 'binding\n' - 'operations.\n' - '\n' - 'If the global statement occurs within a block, all uses of the ' - 'name\n' - 'specified in the statement refer to the binding of that name in ' - 'the\n' - 'top-level namespace. Names are resolved in the top-level ' - 'namespace by\n' - 'searching the global namespace, i.e. the namespace of the ' - 'module\n' - 'containing the code block, and the builtins namespace, the ' - 'namespace\n' - 'of the module "__builtin__". The global namespace is searched ' - 'first.\n' - 'If the name is not found there, the builtins namespace is ' - 'searched.\n' - 'The global statement must precede all uses of the name.\n' - '\n' - 'The builtins namespace associated with the execution of a code ' - 'block\n' - 'is actually found by looking up the name "__builtins__" in its ' - 'global\n' - 'namespace; this should be a dictionary or a module (in the ' - 'latter case\n' - "the module's dictionary is used). By default, when in the " - '"__main__"\n' - 'module, "__builtins__" is the built-in module "__builtin__" ' - '(note: no\n' - '\'s\'); when in any other module, "__builtins__" is an alias ' - 'for the\n' - 'dictionary of the "__builtin__" module itself. "__builtins__" ' - 'can be\n' - 'set to a user-created dictionary to create a weak form of ' - 'restricted\n' - 'execution.\n' - '\n' - '**CPython implementation detail:** Users should not touch\n' - '"__builtins__"; it is strictly an implementation detail. ' - 'Users\n' - 'wanting to override values in the builtins namespace should ' - '"import"\n' - 'the "__builtin__" (no \'s\') module and modify its attributes\n' - 'appropriately.\n' - '\n' - 'The namespace for a module is automatically created the first ' - 'time a\n' - 'module is imported. The main module for a script is always ' - 'called\n' - '"__main__".\n' - '\n' - 'The "global" statement has the same scope as a name binding ' - 'operation\n' - 'in the same block. If the nearest enclosing scope for a free ' - 'variable\n' - 'contains a global statement, the free variable is treated as a ' - 'global.\n' - '\n' - 'A class definition is an executable statement that may use and ' - 'define\n' - 'names. These references follow the normal rules for name ' - 'resolution.\n' - 'The namespace of the class definition becomes the attribute ' - 'dictionary\n' - 'of the class. Names defined at the class scope are not visible ' - 'in\n' - 'methods.\n' - '\n' - '\n' - 'Interaction with dynamic features\n' - '---------------------------------\n' - '\n' - 'There are several cases where Python statements are illegal ' - 'when used\n' - 'in conjunction with nested scopes that contain free variables.\n' - '\n' - 'If a variable is referenced in an enclosing scope, it is ' - 'illegal to\n' - 'delete the name. An error will be reported at compile time.\n' - '\n' - 'If the wild card form of import --- "import *" --- is used in ' - 'a\n' - 'function and the function contains or is a nested block with ' - 'free\n' - 'variables, the compiler will raise a "SyntaxError".\n' - '\n' - 'If "exec" is used in a function and the function contains or is ' - 'a\n' - 'nested block with free variables, the compiler will raise a\n' - '"SyntaxError" unless the exec explicitly specifies the local ' - 'namespace\n' - 'for the "exec". (In other words, "exec obj" would be illegal, ' - 'but\n' - '"exec obj in ns" would be legal.)\n' - '\n' - 'The "eval()", "execfile()", and "input()" functions and the ' - '"exec"\n' - 'statement do not have access to the full environment for ' - 'resolving\n' - 'names. Names may be resolved in the local and global ' - 'namespaces of\n' - 'the caller. Free variables are not resolved in the nearest ' - 'enclosing\n' - 'namespace, but in the global namespace. [1] The "exec" ' - 'statement and\n' - 'the "eval()" and "execfile()" functions have optional arguments ' - 'to\n' - 'override the global and local namespace. If only one namespace ' - 'is\n' - 'specified, it is used for both.\n' - '\n' - '\n' - 'Exceptions\n' - '==========\n' - '\n' - 'Exceptions are a means of breaking out of the normal flow of ' - 'control\n' - 'of a code block in order to handle errors or other exceptional\n' - 'conditions. An exception is *raised* at the point where the ' - 'error is\n' - 'detected; it may be *handled* by the surrounding code block or ' - 'by any\n' - 'code block that directly or indirectly invoked the code block ' - 'where\n' - 'the error occurred.\n' - '\n' - 'The Python interpreter raises an exception when it detects a ' - 'run-time\n' - 'error (such as division by zero). A Python program can also\n' - 'explicitly raise an exception with the "raise" statement. ' - 'Exception\n' - 'handlers are specified with the "try" ... "except" statement. ' - 'The\n' - '"finally" clause of such a statement can be used to specify ' - 'cleanup\n' - 'code which does not handle the exception, but is executed ' - 'whether an\n' - 'exception occurred or not in the preceding code.\n' - '\n' - 'Python uses the "termination" model of error handling: an ' - 'exception\n' - 'handler can find out what happened and continue execution at an ' - 'outer\n' - 'level, but it cannot repair the cause of the error and retry ' - 'the\n' - 'failing operation (except by re-entering the offending piece of ' - 'code\n' - 'from the top).\n' - '\n' - 'When an exception is not handled at all, the interpreter ' - 'terminates\n' - 'execution of the program, or returns to its interactive main ' - 'loop. In\n' - 'either case, it prints a stack backtrace, except when the ' - 'exception is\n' - '"SystemExit".\n' - '\n' - 'Exceptions are identified by class instances. The "except" ' - 'clause is\n' - 'selected depending on the class of the instance: it must ' - 'reference the\n' - 'class of the instance or a base class thereof. The instance ' - 'can be\n' - 'received by the handler and can carry additional information ' - 'about the\n' - 'exceptional condition.\n' - '\n' - 'Exceptions can also be identified by strings, in which case ' - 'the\n' - '"except" clause is selected by object identity. An arbitrary ' - 'value\n' - 'can be raised along with the identifying string which can be ' - 'passed to\n' - 'the handler.\n' - '\n' - 'Note: Messages to exceptions are not part of the Python API. ' - 'Their\n' - ' contents may change from one version of Python to the next ' - 'without\n' - ' warning and should not be relied on by code which will run ' - 'under\n' - ' multiple versions of the interpreter.\n' - '\n' - 'See also the description of the "try" statement in section The ' - 'try\n' - 'statement and "raise" statement in section The raise ' - 'statement.\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] This limitation occurs because the code that is executed ' - 'by\n' - ' these operations is not available at the time the module ' - 'is\n' - ' compiled.\n', - 'exprlists': '\n' - 'Expression lists\n' - '****************\n' - '\n' - ' expression_list ::= expression ( "," expression )* [","]\n' - '\n' - 'An expression list containing at least one comma yields a ' - 'tuple. The\n' - 'length of the tuple is the number of expressions in the list. ' - 'The\n' - 'expressions are evaluated from left to right.\n' - '\n' - 'The trailing comma is required only to create a single tuple ' - '(a.k.a. a\n' - '*singleton*); it is optional in all other cases. A single ' - 'expression\n' - "without a trailing comma doesn't create a tuple, but rather " - 'yields the\n' - 'value of that expression. (To create an empty tuple, use an ' - 'empty pair\n' - 'of parentheses: "()".)\n', - 'floating': '\n' - 'Floating point literals\n' - '***********************\n' - '\n' - 'Floating point literals are described by the following lexical\n' - 'definitions:\n' - '\n' - ' floatnumber ::= pointfloat | exponentfloat\n' - ' pointfloat ::= [intpart] fraction | intpart "."\n' - ' exponentfloat ::= (intpart | pointfloat) exponent\n' - ' intpart ::= digit+\n' - ' fraction ::= "." digit+\n' - ' exponent ::= ("e" | "E") ["+" | "-"] digit+\n' - '\n' - 'Note that the integer and exponent parts of floating point ' - 'numbers can\n' - 'look like octal integers, but are interpreted using radix 10. ' - 'For\n' - 'example, "077e010" is legal, and denotes the same number as ' - '"77e10".\n' - 'The allowed range of floating point literals is implementation-\n' - 'dependent. Some examples of floating point literals:\n' - '\n' - ' 3.14 10. .001 1e100 3.14e-10 0e0\n' - '\n' - 'Note that numeric literals do not include a sign; a phrase like ' - '"-1"\n' - 'is actually an expression composed of the unary operator "-" and ' - 'the\n' - 'literal "1".\n', - 'for': '\n' - 'The "for" statement\n' - '*******************\n' - '\n' - 'The "for" statement is used to iterate over the elements of a ' - 'sequence\n' - '(such as a string, tuple or list) or other iterable object:\n' - '\n' - ' for_stmt ::= "for" target_list "in" expression_list ":" suite\n' - ' ["else" ":" suite]\n' - '\n' - 'The expression list is evaluated once; it should yield an iterable\n' - 'object. An iterator is created for the result of the\n' - '"expression_list". The suite is then executed once for each item\n' - 'provided by the iterator, in the order of ascending indices. Each\n' - 'item in turn is assigned to the target list using the standard rules\n' - 'for assignments, and then the suite is executed. When the items are\n' - 'exhausted (which is immediately when the sequence is empty), the ' - 'suite\n' - 'in the "else" clause, if present, is executed, and the loop\n' - 'terminates.\n' - '\n' - 'A "break" statement executed in the first suite terminates the loop\n' - 'without executing the "else" clause\'s suite. A "continue" ' - 'statement\n' - 'executed in the first suite skips the rest of the suite and ' - 'continues\n' - 'with the next item, or with the "else" clause if there was no next\n' - 'item.\n' - '\n' - 'The suite may assign to the variable(s) in the target list; this ' - 'does\n' - 'not affect the next item assigned to it.\n' - '\n' - 'The target list is not deleted when the loop is finished, but if the\n' - 'sequence is empty, it will not have been assigned to at all by the\n' - 'loop. Hint: the built-in function "range()" returns a sequence of\n' - 'integers suitable to emulate the effect of Pascal\'s "for i := a to ' - 'b\n' - 'do"; e.g., "range(3)" returns the list "[0, 1, 2]".\n' - '\n' - 'Note: There is a subtlety when the sequence is being modified by the\n' - ' loop (this can only occur for mutable sequences, i.e. lists). An\n' - ' internal counter is used to keep track of which item is used next,\n' - ' and this is incremented on each iteration. When this counter has\n' - ' reached the length of the sequence the loop terminates. This ' - 'means\n' - ' that if the suite deletes the current (or a previous) item from ' - 'the\n' - ' sequence, the next item will be skipped (since it gets the index ' - 'of\n' - ' the current item which has already been treated). Likewise, if ' - 'the\n' - ' suite inserts an item in the sequence before the current item, the\n' - ' current item will be treated again the next time through the loop.\n' - ' This can lead to nasty bugs that can be avoided by making a\n' - ' temporary copy using a slice of the whole sequence, e.g.,\n' - '\n' - ' for x in a[:]:\n' - ' if x < 0: a.remove(x)\n', - 'formatstrings': '\n' - 'Format String Syntax\n' - '********************\n' - '\n' - 'The "str.format()" method and the "Formatter" class share ' - 'the same\n' - 'syntax for format strings (although in the case of ' - '"Formatter",\n' - 'subclasses can define their own format string syntax).\n' - '\n' - 'Format strings contain "replacement fields" surrounded by ' - 'curly braces\n' - '"{}". Anything that is not contained in braces is ' - 'considered literal\n' - 'text, which is copied unchanged to the output. If you need ' - 'to include\n' - 'a brace character in the literal text, it can be escaped by ' - 'doubling:\n' - '"{{" and "}}".\n' - '\n' - 'The grammar for a replacement field is as follows:\n' - '\n' - ' replacement_field ::= "{" [field_name] ["!" ' - 'conversion] [":" format_spec] "}"\n' - ' field_name ::= arg_name ("." attribute_name | ' - '"[" element_index "]")*\n' - ' arg_name ::= [identifier | integer]\n' - ' attribute_name ::= identifier\n' - ' element_index ::= integer | index_string\n' - ' index_string ::= +\n' - ' conversion ::= "r" | "s"\n' - ' format_spec ::= \n' - '\n' - 'In less formal terms, the replacement field can start with ' - 'a\n' - '*field_name* that specifies the object whose value is to be ' - 'formatted\n' - 'and inserted into the output instead of the replacement ' - 'field. The\n' - '*field_name* is optionally followed by a *conversion* ' - 'field, which is\n' - 'preceded by an exclamation point "\'!\'", and a ' - '*format_spec*, which is\n' - 'preceded by a colon "\':\'". These specify a non-default ' - 'format for the\n' - 'replacement value.\n' - '\n' - 'See also the Format Specification Mini-Language section.\n' - '\n' - 'The *field_name* itself begins with an *arg_name* that is ' - 'either a\n' - "number or a keyword. If it's a number, it refers to a " - 'positional\n' - "argument, and if it's a keyword, it refers to a named " - 'keyword\n' - 'argument. If the numerical arg_names in a format string ' - 'are 0, 1, 2,\n' - '... in sequence, they can all be omitted (not just some) ' - 'and the\n' - 'numbers 0, 1, 2, ... will be automatically inserted in that ' - 'order.\n' - 'Because *arg_name* is not quote-delimited, it is not ' - 'possible to\n' - 'specify arbitrary dictionary keys (e.g., the strings ' - '"\'10\'" or\n' - '"\':-]\'") within a format string. The *arg_name* can be ' - 'followed by any\n' - 'number of index or attribute expressions. An expression of ' - 'the form\n' - '"\'.name\'" selects the named attribute using "getattr()", ' - 'while an\n' - 'expression of the form "\'[index]\'" does an index lookup ' - 'using\n' - '"__getitem__()".\n' - '\n' - 'Changed in version 2.7: The positional argument specifiers ' - 'can be\n' - 'omitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n' - '\n' - 'Some simple format string examples:\n' - '\n' - ' "First, thou shalt count to {0}" # References first ' - 'positional argument\n' - ' "Bring me a {}" # Implicitly ' - 'references the first positional argument\n' - ' "From {} to {}" # Same as "From {0} to ' - '{1}"\n' - ' "My quest is {name}" # References keyword ' - "argument 'name'\n" - ' "Weight in tons {0.weight}" # \'weight\' attribute ' - 'of first positional arg\n' - ' "Units destroyed: {players[0]}" # First element of ' - "keyword argument 'players'.\n" - '\n' - 'The *conversion* field causes a type coercion before ' - 'formatting.\n' - 'Normally, the job of formatting a value is done by the ' - '"__format__()"\n' - 'method of the value itself. However, in some cases it is ' - 'desirable to\n' - 'force a type to be formatted as a string, overriding its ' - 'own\n' - 'definition of formatting. By converting the value to a ' - 'string before\n' - 'calling "__format__()", the normal formatting logic is ' - 'bypassed.\n' - '\n' - 'Two conversion flags are currently supported: "\'!s\'" ' - 'which calls\n' - '"str()" on the value, and "\'!r\'" which calls "repr()".\n' - '\n' - 'Some examples:\n' - '\n' - ' "Harold\'s a clever {0!s}" # Calls str() on the ' - 'argument first\n' - ' "Bring out the holy {name!r}" # Calls repr() on the ' - 'argument first\n' - '\n' - 'The *format_spec* field contains a specification of how the ' - 'value\n' - 'should be presented, including such details as field width, ' - 'alignment,\n' - 'padding, decimal precision and so on. Each value type can ' - 'define its\n' - 'own "formatting mini-language" or interpretation of the ' - '*format_spec*.\n' - '\n' - 'Most built-in types support a common formatting ' - 'mini-language, which\n' - 'is described in the next section.\n' - '\n' - 'A *format_spec* field can also include nested replacement ' - 'fields\n' - 'within it. These nested replacement fields may contain a ' - 'field name,\n' - 'conversion flag and format specification, but deeper ' - 'nesting is not\n' - 'allowed. The replacement fields within the format_spec ' - 'are\n' - 'substituted before the *format_spec* string is interpreted. ' - 'This\n' - 'allows the formatting of a value to be dynamically ' - 'specified.\n' - '\n' - 'See the Format examples section for some examples.\n' - '\n' - '\n' - 'Format Specification Mini-Language\n' - '==================================\n' - '\n' - '"Format specifications" are used within replacement fields ' - 'contained\n' - 'within a format string to define how individual values are ' - 'presented\n' - '(see Format String Syntax). They can also be passed ' - 'directly to the\n' - 'built-in "format()" function. Each formattable type may ' - 'define how\n' - 'the format specification is to be interpreted.\n' - '\n' - 'Most built-in types implement the following options for ' - 'format\n' - 'specifications, although some of the formatting options are ' - 'only\n' - 'supported by the numeric types.\n' - '\n' - 'A general convention is that an empty format string ("""") ' - 'produces\n' - 'the same result as if you had called "str()" on the value. ' - 'A non-empty\n' - 'format string typically modifies the result.\n' - '\n' - 'The general form of a *standard format specifier* is:\n' - '\n' - ' format_spec ::= ' - '[[fill]align][sign][#][0][width][,][.precision][type]\n' - ' fill ::= \n' - ' align ::= "<" | ">" | "=" | "^"\n' - ' sign ::= "+" | "-" | " "\n' - ' width ::= integer\n' - ' precision ::= integer\n' - ' type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" ' - '| "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n' - '\n' - 'If a valid *align* value is specified, it can be preceded ' - 'by a *fill*\n' - 'character that can be any character and defaults to a space ' - 'if\n' - 'omitted. It is not possible to use a literal curly brace ' - '(""{"" or\n' - '""}"") as the *fill* character when using the ' - '"str.format()" method.\n' - 'However, it is possible to insert a curly brace with a ' - 'nested\n' - "replacement field. This limitation doesn't affect the " - '"format()"\n' - 'function.\n' - '\n' - 'The meaning of the various alignment options is as ' - 'follows:\n' - '\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | Option | ' - 'Meaning ' - '|\n' - ' ' - '+===========+============================================================+\n' - ' | "\'<\'" | Forces the field to be left-aligned ' - 'within the available |\n' - ' | | space (this is the default for most ' - 'objects). |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'>\'" | Forces the field to be right-aligned ' - 'within the available |\n' - ' | | space (this is the default for ' - 'numbers). |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'=\'" | Forces the padding to be placed after ' - 'the sign (if any) |\n' - ' | | but before the digits. This is used for ' - 'printing fields |\n' - " | | in the form '+000000120'. This alignment " - 'option is only |\n' - ' | | valid for numeric types. It becomes the ' - "default when '0' |\n" - ' | | immediately precedes the field ' - 'width. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'^\'" | Forces the field to be centered within ' - 'the available |\n' - ' | | ' - 'space. ' - '|\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - '\n' - 'Note that unless a minimum field width is defined, the ' - 'field width\n' - 'will always be the same size as the data to fill it, so ' - 'that the\n' - 'alignment option has no meaning in this case.\n' - '\n' - 'The *sign* option is only valid for number types, and can ' - 'be one of\n' - 'the following:\n' - '\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | Option | ' - 'Meaning ' - '|\n' - ' ' - '+===========+============================================================+\n' - ' | "\'+\'" | indicates that a sign should be used for ' - 'both positive as |\n' - ' | | well as negative ' - 'numbers. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'-\'" | indicates that a sign should be used ' - 'only for negative |\n' - ' | | numbers (this is the default ' - 'behavior). |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | space | indicates that a leading space should be ' - 'used on positive |\n' - ' | | numbers, and a minus sign on negative ' - 'numbers. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - '\n' - 'The "\'#\'" option is only valid for integers, and only for ' - 'binary,\n' - 'octal, or hexadecimal output. If present, it specifies ' - 'that the\n' - 'output will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", ' - 'respectively.\n' - '\n' - 'The "\',\'" option signals the use of a comma for a ' - 'thousands separator.\n' - 'For a locale aware separator, use the "\'n\'" integer ' - 'presentation type\n' - 'instead.\n' - '\n' - 'Changed in version 2.7: Added the "\',\'" option (see also ' - '**PEP 378**).\n' - '\n' - '*width* is a decimal integer defining the minimum field ' - 'width. If not\n' - 'specified, then the field width will be determined by the ' - 'content.\n' - '\n' - 'When no explicit alignment is given, preceding the *width* ' - 'field by a\n' - 'zero ("\'0\'") character enables sign-aware zero-padding ' - 'for numeric\n' - 'types. This is equivalent to a *fill* character of "\'0\'" ' - 'with an\n' - '*alignment* type of "\'=\'".\n' - '\n' - 'The *precision* is a decimal number indicating how many ' - 'digits should\n' - 'be displayed after the decimal point for a floating point ' - 'value\n' - 'formatted with "\'f\'" and "\'F\'", or before and after the ' - 'decimal point\n' - 'for a floating point value formatted with "\'g\'" or ' - '"\'G\'". For non-\n' - 'number types the field indicates the maximum field size - ' - 'in other\n' - 'words, how many characters will be used from the field ' - 'content. The\n' - '*precision* is not allowed for integer values.\n' - '\n' - 'Finally, the *type* determines how the data should be ' - 'presented.\n' - '\n' - 'The available string presentation types are:\n' - '\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | Type | ' - 'Meaning ' - '|\n' - ' ' - '+===========+============================================================+\n' - ' | "\'s\'" | String format. This is the default type ' - 'for strings and |\n' - ' | | may be ' - 'omitted. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | None | The same as ' - '"\'s\'". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - '\n' - 'The available integer presentation types are:\n' - '\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | Type | ' - 'Meaning ' - '|\n' - ' ' - '+===========+============================================================+\n' - ' | "\'b\'" | Binary format. Outputs the number in ' - 'base 2. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'c\'" | Character. Converts the integer to the ' - 'corresponding |\n' - ' | | unicode character before ' - 'printing. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'d\'" | Decimal Integer. Outputs the number in ' - 'base 10. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'o\'" | Octal format. Outputs the number in base ' - '8. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'x\'" | Hex format. Outputs the number in base ' - '16, using lower- |\n' - ' | | case letters for the digits above ' - '9. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'X\'" | Hex format. Outputs the number in base ' - '16, using upper- |\n' - ' | | case letters for the digits above ' - '9. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'n\'" | Number. This is the same as "\'d\'", ' - 'except that it uses the |\n' - ' | | current locale setting to insert the ' - 'appropriate number |\n' - ' | | separator ' - 'characters. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | None | The same as ' - '"\'d\'". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - '\n' - 'In addition to the above presentation types, integers can ' - 'be formatted\n' - 'with the floating point presentation types listed below ' - '(except "\'n\'"\n' - 'and None). When doing so, "float()" is used to convert the ' - 'integer to\n' - 'a floating point number before formatting.\n' - '\n' - 'The available presentation types for floating point and ' - 'decimal values\n' - 'are:\n' - '\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | Type | ' - 'Meaning ' - '|\n' - ' ' - '+===========+============================================================+\n' - ' | "\'e\'" | Exponent notation. Prints the number in ' - 'scientific |\n' - " | | notation using the letter 'e' to indicate " - 'the exponent. |\n' - ' | | The default precision is ' - '"6". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'E\'" | Exponent notation. Same as "\'e\'" ' - 'except it uses an upper |\n' - " | | case 'E' as the separator " - 'character. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'f\'" | Fixed point. Displays the number as a ' - 'fixed-point number. |\n' - ' | | The default precision is ' - '"6". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'F\'" | Fixed point. Same as ' - '"\'f\'". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'g\'" | General format. For a given precision ' - '"p >= 1", this |\n' - ' | | rounds the number to "p" significant ' - 'digits and then |\n' - ' | | formats the result in either fixed-point ' - 'format or in |\n' - ' | | scientific notation, depending on its ' - 'magnitude. The |\n' - ' | | precise rules are as follows: suppose that ' - 'the result |\n' - ' | | formatted with presentation type "\'e\'" ' - 'and precision "p-1" |\n' - ' | | would have exponent "exp". Then if "-4 <= ' - 'exp < p", the |\n' - ' | | number is formatted with presentation type ' - '"\'f\'" and |\n' - ' | | precision "p-1-exp". Otherwise, the ' - 'number is formatted |\n' - ' | | with presentation type "\'e\'" and ' - 'precision "p-1". In both |\n' - ' | | cases insignificant trailing zeros are ' - 'removed from the |\n' - ' | | significand, and the decimal point is also ' - 'removed if |\n' - ' | | there are no remaining digits following ' - 'it. Positive and |\n' - ' | | negative infinity, positive and negative ' - 'zero, and nans, |\n' - ' | | are formatted as "inf", "-inf", "0", "-0" ' - 'and "nan" |\n' - ' | | respectively, regardless of the ' - 'precision. A precision of |\n' - ' | | "0" is treated as equivalent to a ' - 'precision of "1". The |\n' - ' | | default precision is ' - '"6". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'G\'" | General format. Same as "\'g\'" except ' - 'switches to "\'E\'" if |\n' - ' | | the number gets too large. The ' - 'representations of infinity |\n' - ' | | and NaN are uppercased, ' - 'too. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'n\'" | Number. This is the same as "\'g\'", ' - 'except that it uses the |\n' - ' | | current locale setting to insert the ' - 'appropriate number |\n' - ' | | separator ' - 'characters. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | "\'%\'" | Percentage. Multiplies the number by 100 ' - 'and displays in |\n' - ' | | fixed ("\'f\'") format, followed by a ' - 'percent sign. |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - ' | None | The same as ' - '"\'g\'". |\n' - ' ' - '+-----------+------------------------------------------------------------+\n' - '\n' - '\n' - 'Format examples\n' - '===============\n' - '\n' - 'This section contains examples of the "str.format()" syntax ' - 'and\n' - 'comparison with the old "%"-formatting.\n' - '\n' - 'In most of the cases the syntax is similar to the old ' - '"%"-formatting,\n' - 'with the addition of the "{}" and with ":" used instead of ' - '"%". For\n' - 'example, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n' - '\n' - 'The new format syntax also supports new and different ' - 'options, shown\n' - 'in the follow examples.\n' - '\n' - 'Accessing arguments by position:\n' - '\n' - " >>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" - " 'a, b, c'\n" - " >>> '{}, {}, {}'.format('a', 'b', 'c') # 2.7+ only\n" - " 'a, b, c'\n" - " >>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" - " 'c, b, a'\n" - " >>> '{2}, {1}, {0}'.format(*'abc') # unpacking " - 'argument sequence\n' - " 'c, b, a'\n" - " >>> '{0}{1}{0}'.format('abra', 'cad') # arguments' " - 'indices can be repeated\n' - " 'abracadabra'\n" - '\n' - 'Accessing arguments by name:\n' - '\n' - " >>> 'Coordinates: {latitude}, " - "{longitude}'.format(latitude='37.24N', " - "longitude='-115.81W')\n" - " 'Coordinates: 37.24N, -115.81W'\n" - " >>> coord = {'latitude': '37.24N', 'longitude': " - "'-115.81W'}\n" - " >>> 'Coordinates: {latitude}, " - "{longitude}'.format(**coord)\n" - " 'Coordinates: 37.24N, -115.81W'\n" - '\n' - "Accessing arguments' attributes:\n" - '\n' - ' >>> c = 3-5j\n' - " >>> ('The complex number {0} is formed from the real " - "part {0.real} '\n" - " ... 'and the imaginary part {0.imag}.').format(c)\n" - " 'The complex number (3-5j) is formed from the real part " - "3.0 and the imaginary part -5.0.'\n" - ' >>> class Point(object):\n' - ' ... def __init__(self, x, y):\n' - ' ... self.x, self.y = x, y\n' - ' ... def __str__(self):\n' - " ... return 'Point({self.x}, " - "{self.y})'.format(self=self)\n" - ' ...\n' - ' >>> str(Point(4, 2))\n' - " 'Point(4, 2)'\n" - '\n' - "Accessing arguments' items:\n" - '\n' - ' >>> coord = (3, 5)\n' - " >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" - " 'X: 3; Y: 5'\n" - '\n' - 'Replacing "%s" and "%r":\n' - '\n' - ' >>> "repr() shows quotes: {!r}; str() doesn\'t: ' - '{!s}".format(\'test1\', \'test2\')\n' - ' "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n' - '\n' - 'Aligning the text and specifying a width:\n' - '\n' - " >>> '{:<30}'.format('left aligned')\n" - " 'left aligned '\n" - " >>> '{:>30}'.format('right aligned')\n" - " ' right aligned'\n" - " >>> '{:^30}'.format('centered')\n" - " ' centered '\n" - " >>> '{:*^30}'.format('centered') # use '*' as a fill " - 'char\n' - " '***********centered***********'\n" - '\n' - 'Replacing "%+f", "%-f", and "% f" and specifying a sign:\n' - '\n' - " >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it " - 'always\n' - " '+3.140000; -3.140000'\n" - " >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space " - 'for positive numbers\n' - " ' 3.140000; -3.140000'\n" - " >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the " - "minus -- same as '{:f}; {:f}'\n" - " '3.140000; -3.140000'\n" - '\n' - 'Replacing "%x" and "%o" and converting the value to ' - 'different bases:\n' - '\n' - ' >>> # format also supports binary numbers\n' - ' >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: ' - '{0:b}".format(42)\n' - " 'int: 42; hex: 2a; oct: 52; bin: 101010'\n" - ' >>> # with 0x, 0o, or 0b as prefix:\n' - ' >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: ' - '{0:#b}".format(42)\n' - " 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'\n" - '\n' - 'Using the comma as a thousands separator:\n' - '\n' - " >>> '{:,}'.format(1234567890)\n" - " '1,234,567,890'\n" - '\n' - 'Expressing a percentage:\n' - '\n' - ' >>> points = 19.5\n' - ' >>> total = 22\n' - " >>> 'Correct answers: {:.2%}'.format(points/total)\n" - " 'Correct answers: 88.64%'\n" - '\n' - 'Using type-specific formatting:\n' - '\n' - ' >>> import datetime\n' - ' >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n' - " >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" - " '2010-07-04 12:15:58'\n" - '\n' - 'Nesting arguments and more complex examples:\n' - '\n' - " >>> for align, text in zip('<^>', ['left', 'center', " - "'right']):\n" - " ... '{0:{fill}{align}16}'.format(text, fill=align, " - 'align=align)\n' - ' ...\n' - " 'left<<<<<<<<<<<<'\n" - " '^^^^^center^^^^^'\n" - " '>>>>>>>>>>>right'\n" - ' >>>\n' - ' >>> octets = [192, 168, 0, 1]\n' - " >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n" - " 'C0A80001'\n" - ' >>> int(_, 16)\n' - ' 3232235521\n' - ' >>>\n' - ' >>> width = 5\n' - ' >>> for num in range(5,12):\n' - " ... for base in 'dXob':\n" - " ... print '{0:{width}{base}}'.format(num, " - 'base=base, width=width),\n' - ' ... print\n' - ' ...\n' - ' 5 5 5 101\n' - ' 6 6 6 110\n' - ' 7 7 7 111\n' - ' 8 8 10 1000\n' - ' 9 9 11 1001\n' - ' 10 A 12 1010\n' - ' 11 B 13 1011\n', - 'function': '\n' - 'Function definitions\n' - '********************\n' - '\n' - 'A function definition defines a user-defined function object ' - '(see\n' - 'section The standard type hierarchy):\n' - '\n' - ' decorated ::= decorators (classdef | funcdef)\n' - ' decorators ::= decorator+\n' - ' decorator ::= "@" dotted_name ["(" [argument_list [","]] ' - '")"] NEWLINE\n' - ' funcdef ::= "def" funcname "(" [parameter_list] ")" ' - '":" suite\n' - ' dotted_name ::= identifier ("." identifier)*\n' - ' parameter_list ::= (defparameter ",")*\n' - ' ( "*" identifier ["," "**" identifier]\n' - ' | "**" identifier\n' - ' | defparameter [","] )\n' - ' defparameter ::= parameter ["=" expression]\n' - ' sublist ::= parameter ("," parameter)* [","]\n' - ' parameter ::= identifier | "(" sublist ")"\n' - ' funcname ::= identifier\n' - '\n' - 'A function definition is an executable statement. Its execution ' - 'binds\n' - 'the function name in the current local namespace to a function ' - 'object\n' - '(a wrapper around the executable code for the function). This\n' - 'function object contains a reference to the current global ' - 'namespace\n' - 'as the global namespace to be used when the function is called.\n' - '\n' - 'The function definition does not execute the function body; this ' - 'gets\n' - 'executed only when the function is called. [3]\n' - '\n' - 'A function definition may be wrapped by one or more *decorator*\n' - 'expressions. Decorator expressions are evaluated when the ' - 'function is\n' - 'defined, in the scope that contains the function definition. ' - 'The\n' - 'result must be a callable, which is invoked with the function ' - 'object\n' - 'as the only argument. The returned value is bound to the ' - 'function name\n' - 'instead of the function object. Multiple decorators are applied ' - 'in\n' - 'nested fashion. For example, the following code:\n' - '\n' - ' @f1(arg)\n' - ' @f2\n' - ' def func(): pass\n' - '\n' - 'is equivalent to:\n' - '\n' - ' def func(): pass\n' - ' func = f1(arg)(f2(func))\n' - '\n' - 'When one or more top-level *parameters* have the form ' - '*parameter* "="\n' - '*expression*, the function is said to have "default parameter ' - 'values."\n' - 'For a parameter with a default value, the corresponding ' - '*argument* may\n' - "be omitted from a call, in which case the parameter's default " - 'value is\n' - 'substituted. If a parameter has a default value, all following\n' - 'parameters must also have a default value --- this is a ' - 'syntactic\n' - 'restriction that is not expressed by the grammar.\n' - '\n' - '**Default parameter values are evaluated when the function ' - 'definition\n' - 'is executed.** This means that the expression is evaluated ' - 'once, when\n' - 'the function is defined, and that the same "pre-computed" value ' - 'is\n' - 'used for each call. This is especially important to understand ' - 'when a\n' - 'default parameter is a mutable object, such as a list or a ' - 'dictionary:\n' - 'if the function modifies the object (e.g. by appending an item ' - 'to a\n' - 'list), the default value is in effect modified. This is ' - 'generally not\n' - 'what was intended. A way around this is to use "None" as the\n' - 'default, and explicitly test for it in the body of the function, ' - 'e.g.:\n' - '\n' - ' def whats_on_the_telly(penguin=None):\n' - ' if penguin is None:\n' - ' penguin = []\n' - ' penguin.append("property of the zoo")\n' - ' return penguin\n' - '\n' - 'Function call semantics are described in more detail in section ' - 'Calls.\n' - 'A function call always assigns values to all parameters ' - 'mentioned in\n' - 'the parameter list, either from position arguments, from ' - 'keyword\n' - 'arguments, or from default values. If the form ""*identifier"" ' - 'is\n' - 'present, it is initialized to a tuple receiving any excess ' - 'positional\n' - 'parameters, defaulting to the empty tuple. If the form\n' - '""**identifier"" is present, it is initialized to a new ' - 'dictionary\n' - 'receiving any excess keyword arguments, defaulting to a new ' - 'empty\n' - 'dictionary.\n' - '\n' - 'It is also possible to create anonymous functions (functions not ' - 'bound\n' - 'to a name), for immediate use in expressions. This uses lambda\n' - 'expressions, described in section Lambdas. Note that the ' - 'lambda\n' - 'expression is merely a shorthand for a simplified function ' - 'definition;\n' - 'a function defined in a ""def"" statement can be passed around ' - 'or\n' - 'assigned to another name just like a function defined by a ' - 'lambda\n' - 'expression. The ""def"" form is actually more powerful since ' - 'it\n' - 'allows the execution of multiple statements.\n' - '\n' - "**Programmer's note:** Functions are first-class objects. A " - '""def""\n' - 'form executed inside a function definition defines a local ' - 'function\n' - 'that can be returned or passed around. Free variables used in ' - 'the\n' - 'nested function can access the local variables of the function\n' - 'containing the def. See section Naming and binding for ' - 'details.\n', - 'global': '\n' - 'The "global" statement\n' - '**********************\n' - '\n' - ' global_stmt ::= "global" identifier ("," identifier)*\n' - '\n' - 'The "global" statement is a declaration which holds for the ' - 'entire\n' - 'current code block. It means that the listed identifiers are to ' - 'be\n' - 'interpreted as globals. It would be impossible to assign to a ' - 'global\n' - 'variable without "global", although free variables may refer to\n' - 'globals without being declared global.\n' - '\n' - 'Names listed in a "global" statement must not be used in the same ' - 'code\n' - 'block textually preceding that "global" statement.\n' - '\n' - 'Names listed in a "global" statement must not be defined as ' - 'formal\n' - 'parameters or in a "for" loop control target, "class" definition,\n' - 'function definition, or "import" statement.\n' - '\n' - '**CPython implementation detail:** The current implementation does ' - 'not\n' - 'enforce the latter two restrictions, but programs should not ' - 'abuse\n' - 'this freedom, as future implementations may enforce them or ' - 'silently\n' - 'change the meaning of the program.\n' - '\n' - '**Programmer\'s note:** the "global" is a directive to the ' - 'parser. It\n' - 'applies only to code parsed at the same time as the "global"\n' - 'statement. In particular, a "global" statement contained in an ' - '"exec"\n' - 'statement does not affect the code block *containing* the "exec"\n' - 'statement, and code contained in an "exec" statement is unaffected ' - 'by\n' - '"global" statements in the code containing the "exec" statement. ' - 'The\n' - 'same applies to the "eval()", "execfile()" and "compile()" ' - 'functions.\n', - 'id-classes': '\n' - 'Reserved classes of identifiers\n' - '*******************************\n' - '\n' - 'Certain classes of identifiers (besides keywords) have ' - 'special\n' - 'meanings. These classes are identified by the patterns of ' - 'leading and\n' - 'trailing underscore characters:\n' - '\n' - '"_*"\n' - ' Not imported by "from module import *". The special ' - 'identifier "_"\n' - ' is used in the interactive interpreter to store the result ' - 'of the\n' - ' last evaluation; it is stored in the "__builtin__" module. ' - 'When\n' - ' not in interactive mode, "_" has no special meaning and is ' - 'not\n' - ' defined. See section The import statement.\n' - '\n' - ' Note: The name "_" is often used in conjunction with\n' - ' internationalization; refer to the documentation for the\n' - ' "gettext" module for more information on this ' - 'convention.\n' - '\n' - '"__*__"\n' - ' System-defined names. These names are defined by the ' - 'interpreter\n' - ' and its implementation (including the standard library). ' - 'Current\n' - ' system names are discussed in the Special method names ' - 'section and\n' - ' elsewhere. More will likely be defined in future versions ' - 'of\n' - ' Python. *Any* use of "__*__" names, in any context, that ' - 'does not\n' - ' follow explicitly documented use, is subject to breakage ' - 'without\n' - ' warning.\n' - '\n' - '"__*"\n' - ' Class-private names. Names in this category, when used ' - 'within the\n' - ' context of a class definition, are re-written to use a ' - 'mangled form\n' - ' to help avoid name clashes between "private" attributes of ' - 'base and\n' - ' derived classes. See section Identifiers (Names).\n', - 'identifiers': '\n' - 'Identifiers and keywords\n' - '************************\n' - '\n' - 'Identifiers (also referred to as *names*) are described by ' - 'the\n' - 'following lexical definitions:\n' - '\n' - ' identifier ::= (letter|"_") (letter | digit | "_")*\n' - ' letter ::= lowercase | uppercase\n' - ' lowercase ::= "a"..."z"\n' - ' uppercase ::= "A"..."Z"\n' - ' digit ::= "0"..."9"\n' - '\n' - 'Identifiers are unlimited in length. Case is significant.\n' - '\n' - '\n' - 'Keywords\n' - '========\n' - '\n' - 'The following identifiers are used as reserved words, or ' - '*keywords* of\n' - 'the language, and cannot be used as ordinary identifiers. ' - 'They must\n' - 'be spelled exactly as written here:\n' - '\n' - ' and del from not while\n' - ' as elif global or with\n' - ' assert else if pass yield\n' - ' break except import print\n' - ' class exec in raise\n' - ' continue finally is return\n' - ' def for lambda try\n' - '\n' - 'Changed in version 2.4: "None" became a constant and is now ' - 'recognized\n' - 'by the compiler as a name for the built-in object "None". ' - 'Although it\n' - 'is not a keyword, you cannot assign a different object to ' - 'it.\n' - '\n' - 'Changed in version 2.5: Using "as" and "with" as identifiers ' - 'triggers\n' - 'a warning. To use them as keywords, enable the ' - '"with_statement"\n' - 'future feature .\n' - '\n' - 'Changed in version 2.6: "as" and "with" are full keywords.\n' - '\n' - '\n' - 'Reserved classes of identifiers\n' - '===============================\n' - '\n' - 'Certain classes of identifiers (besides keywords) have ' - 'special\n' - 'meanings. These classes are identified by the patterns of ' - 'leading and\n' - 'trailing underscore characters:\n' - '\n' - '"_*"\n' - ' Not imported by "from module import *". The special ' - 'identifier "_"\n' - ' is used in the interactive interpreter to store the result ' - 'of the\n' - ' last evaluation; it is stored in the "__builtin__" ' - 'module. When\n' - ' not in interactive mode, "_" has no special meaning and is ' - 'not\n' - ' defined. See section The import statement.\n' - '\n' - ' Note: The name "_" is often used in conjunction with\n' - ' internationalization; refer to the documentation for ' - 'the\n' - ' "gettext" module for more information on this ' - 'convention.\n' - '\n' - '"__*__"\n' - ' System-defined names. These names are defined by the ' - 'interpreter\n' - ' and its implementation (including the standard library). ' - 'Current\n' - ' system names are discussed in the Special method names ' - 'section and\n' - ' elsewhere. More will likely be defined in future versions ' - 'of\n' - ' Python. *Any* use of "__*__" names, in any context, that ' - 'does not\n' - ' follow explicitly documented use, is subject to breakage ' - 'without\n' - ' warning.\n' - '\n' - '"__*"\n' - ' Class-private names. Names in this category, when used ' - 'within the\n' - ' context of a class definition, are re-written to use a ' - 'mangled form\n' - ' to help avoid name clashes between "private" attributes of ' - 'base and\n' - ' derived classes. See section Identifiers (Names).\n', - 'if': '\n' - 'The "if" statement\n' - '******************\n' - '\n' - 'The "if" statement is used for conditional execution:\n' - '\n' - ' if_stmt ::= "if" expression ":" suite\n' - ' ( "elif" expression ":" suite )*\n' - ' ["else" ":" suite]\n' - '\n' - 'It selects exactly one of the suites by evaluating the expressions ' - 'one\n' - 'by one until one is found to be true (see section Boolean operations\n' - 'for the definition of true and false); then that suite is executed\n' - '(and no other part of the "if" statement is executed or evaluated).\n' - 'If all expressions are false, the suite of the "else" clause, if\n' - 'present, is executed.\n', - 'imaginary': '\n' - 'Imaginary literals\n' - '******************\n' - '\n' - 'Imaginary literals are described by the following lexical ' - 'definitions:\n' - '\n' - ' imagnumber ::= (floatnumber | intpart) ("j" | "J")\n' - '\n' - 'An imaginary literal yields a complex number with a real part ' - 'of 0.0.\n' - 'Complex numbers are represented as a pair of floating point ' - 'numbers\n' - 'and have the same restrictions on their range. To create a ' - 'complex\n' - 'number with a nonzero real part, add a floating point number to ' - 'it,\n' - 'e.g., "(3+4j)". Some examples of imaginary literals:\n' - '\n' - ' 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', - 'import': '\n' - 'The "import" statement\n' - '**********************\n' - '\n' - ' import_stmt ::= "import" module ["as" name] ( "," module ' - '["as" name] )*\n' - ' | "from" relative_module "import" identifier ' - '["as" name]\n' - ' ( "," identifier ["as" name] )*\n' - ' | "from" relative_module "import" "(" ' - 'identifier ["as" name]\n' - ' ( "," identifier ["as" name] )* [","] ")"\n' - ' | "from" module "import" "*"\n' - ' module ::= (identifier ".")* identifier\n' - ' relative_module ::= "."* module | "."+\n' - ' name ::= identifier\n' - '\n' - 'Import statements are executed in two steps: (1) find a module, ' - 'and\n' - 'initialize it if necessary; (2) define a name or names in the ' - 'local\n' - 'namespace (of the scope where the "import" statement occurs). The\n' - 'statement comes in two forms differing on whether it uses the ' - '"from"\n' - 'keyword. The first form (without "from") repeats these steps for ' - 'each\n' - 'identifier in the list. The form with "from" performs step (1) ' - 'once,\n' - 'and then performs step (2) repeatedly.\n' - '\n' - 'To understand how step (1) occurs, one must first understand how\n' - 'Python handles hierarchical naming of modules. To help organize\n' - 'modules and provide a hierarchy in naming, Python has a concept ' - 'of\n' - 'packages. A package can contain other packages and modules while\n' - 'modules cannot contain other modules or packages. From a file ' - 'system\n' - 'perspective, packages are directories and modules are files.\n' - '\n' - 'Once the name of the module is known (unless otherwise specified, ' - 'the\n' - 'term "module" will refer to both packages and modules), searching ' - 'for\n' - 'the module or package can begin. The first place checked is\n' - '"sys.modules", the cache of all modules that have been imported\n' - 'previously. If the module is found there then it is used in step ' - '(2)\n' - 'of import.\n' - '\n' - 'If the module is not found in the cache, then "sys.meta_path" is\n' - 'searched (the specification for "sys.meta_path" can be found in ' - '**PEP\n' - '302**). The object is a list of *finder* objects which are queried ' - 'in\n' - 'order as to whether they know how to load the module by calling ' - 'their\n' - '"find_module()" method with the name of the module. If the module\n' - 'happens to be contained within a package (as denoted by the ' - 'existence\n' - 'of a dot in the name), then a second argument to "find_module()" ' - 'is\n' - 'given as the value of the "__path__" attribute from the parent ' - 'package\n' - '(everything up to the last dot in the name of the module being\n' - 'imported). If a finder can find the module it returns a *loader*\n' - '(discussed later) or returns "None".\n' - '\n' - 'If none of the finders on "sys.meta_path" are able to find the ' - 'module\n' - 'then some implicitly defined finders are queried. Implementations ' - 'of\n' - 'Python vary in what implicit meta path finders are defined. The ' - 'one\n' - 'they all do define, though, is one that handles "sys.path_hooks",\n' - '"sys.path_importer_cache", and "sys.path".\n' - '\n' - 'The implicit finder searches for the requested module in the ' - '"paths"\n' - 'specified in one of two places ("paths" do not have to be file ' - 'system\n' - 'paths). If the module being imported is supposed to be contained\n' - 'within a package then the second argument passed to ' - '"find_module()",\n' - '"__path__" on the parent package, is used as the source of paths. ' - 'If\n' - 'the module is not contained in a package then "sys.path" is used ' - 'as\n' - 'the source of paths.\n' - '\n' - 'Once the source of paths is chosen it is iterated over to find a\n' - 'finder that can handle that path. The dict at\n' - '"sys.path_importer_cache" caches finders for paths and is checked ' - 'for\n' - 'a finder. If the path does not have a finder cached then\n' - '"sys.path_hooks" is searched by calling each object in the list ' - 'with a\n' - 'single argument of the path, returning a finder or raises\n' - '"ImportError". If a finder is returned then it is cached in\n' - '"sys.path_importer_cache" and then used for that path entry. If ' - 'no\n' - 'finder can be found but the path exists then a value of "None" is\n' - 'stored in "sys.path_importer_cache" to signify that an implicit, ' - 'file-\n' - 'based finder that handles modules stored as individual files ' - 'should be\n' - 'used for that path. If the path does not exist then a finder ' - 'which\n' - 'always returns "None" is placed in the cache for the path.\n' - '\n' - 'If no finder can find the module then "ImportError" is raised.\n' - 'Otherwise some finder returned a loader whose "load_module()" ' - 'method\n' - 'is called with the name of the module to load (see **PEP 302** for ' - 'the\n' - 'original definition of loaders). A loader has several ' - 'responsibilities\n' - 'to perform on a module it loads. First, if the module already ' - 'exists\n' - 'in "sys.modules" (a possibility if the loader is called outside of ' - 'the\n' - 'import machinery) then it is to use that module for initialization ' - 'and\n' - 'not a new module. But if the module does not exist in ' - '"sys.modules"\n' - 'then it is to be added to that dict before initialization begins. ' - 'If\n' - 'an error occurs during loading of the module and it was added to\n' - '"sys.modules" it is to be removed from the dict. If an error ' - 'occurs\n' - 'but the module was already in "sys.modules" it is left in the ' - 'dict.\n' - '\n' - 'The loader must set several attributes on the module. "__name__" ' - 'is to\n' - 'be set to the name of the module. "__file__" is to be the "path" ' - 'to\n' - 'the file unless the module is built-in (and thus listed in\n' - '"sys.builtin_module_names") in which case the attribute is not ' - 'set. If\n' - 'what is being imported is a package then "__path__" is to be set ' - 'to a\n' - 'list of paths to be searched when looking for modules and ' - 'packages\n' - 'contained within the package being imported. "__package__" is ' - 'optional\n' - 'but should be set to the name of package that contains the module ' - 'or\n' - 'package (the empty string is used for module not contained in a\n' - 'package). "__loader__" is also optional but should be set to the\n' - 'loader object that is loading the module.\n' - '\n' - 'If an error occurs during loading then the loader raises ' - '"ImportError"\n' - 'if some other exception is not already being propagated. Otherwise ' - 'the\n' - 'loader returns the module that was loaded and initialized.\n' - '\n' - 'When step (1) finishes without raising an exception, step (2) can\n' - 'begin.\n' - '\n' - 'The first form of "import" statement binds the module name in the\n' - 'local namespace to the module object, and then goes on to import ' - 'the\n' - 'next identifier, if any. If the module name is followed by "as", ' - 'the\n' - 'name following "as" is used as the local name for the module.\n' - '\n' - 'The "from" form does not bind the module name: it goes through ' - 'the\n' - 'list of identifiers, looks each one of them up in the module found ' - 'in\n' - 'step (1), and binds the name in the local namespace to the object ' - 'thus\n' - 'found. As with the first form of "import", an alternate local ' - 'name\n' - 'can be supplied by specifying ""as" localname". If a name is not\n' - 'found, "ImportError" is raised. If the list of identifiers is\n' - 'replaced by a star ("\'*\'"), all public names defined in the ' - 'module are\n' - 'bound in the local namespace of the "import" statement..\n' - '\n' - 'The *public names* defined by a module are determined by checking ' - 'the\n' - 'module\'s namespace for a variable named "__all__"; if defined, it ' - 'must\n' - 'be a sequence of strings which are names defined or imported by ' - 'that\n' - 'module. The names given in "__all__" are all considered public ' - 'and\n' - 'are required to exist. If "__all__" is not defined, the set of ' - 'public\n' - "names includes all names found in the module's namespace which do " - 'not\n' - 'begin with an underscore character ("\'_\'"). "__all__" should ' - 'contain\n' - 'the entire public API. It is intended to avoid accidentally ' - 'exporting\n' - 'items that are not part of the API (such as library modules which ' - 'were\n' - 'imported and used within the module).\n' - '\n' - 'The "from" form with "*" may only occur in a module scope. If ' - 'the\n' - 'wild card form of import --- "import *" --- is used in a function ' - 'and\n' - 'the function contains or is a nested block with free variables, ' - 'the\n' - 'compiler will raise a "SyntaxError".\n' - '\n' - 'When specifying what module to import you do not have to specify ' - 'the\n' - 'absolute name of the module. When a module or package is ' - 'contained\n' - 'within another package it is possible to make a relative import ' - 'within\n' - 'the same top package without having to mention the package name. ' - 'By\n' - 'using leading dots in the specified module or package after "from" ' - 'you\n' - 'can specify how high to traverse up the current package hierarchy\n' - 'without specifying exact names. One leading dot means the current\n' - 'package where the module making the import exists. Two dots means ' - 'up\n' - 'one package level. Three dots is up two levels, etc. So if you ' - 'execute\n' - '"from . import mod" from a module in the "pkg" package then you ' - 'will\n' - 'end up importing "pkg.mod". If you execute "from ..subpkg2 import ' - 'mod"\n' - 'from within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\n' - 'specification for relative imports is contained within **PEP ' - '328**.\n' - '\n' - '"importlib.import_module()" is provided to support applications ' - 'that\n' - 'determine which modules need to be loaded dynamically.\n' - '\n' - '\n' - 'Future statements\n' - '=================\n' - '\n' - 'A *future statement* is a directive to the compiler that a ' - 'particular\n' - 'module should be compiled using syntax or semantics that will be\n' - 'available in a specified future release of Python. The future\n' - 'statement is intended to ease migration to future versions of ' - 'Python\n' - 'that introduce incompatible changes to the language. It allows ' - 'use of\n' - 'the new features on a per-module basis before the release in which ' - 'the\n' - 'feature becomes standard.\n' - '\n' - ' future_statement ::= "from" "__future__" "import" feature ["as" ' - 'name]\n' - ' ("," feature ["as" name])*\n' - ' | "from" "__future__" "import" "(" feature ' - '["as" name]\n' - ' ("," feature ["as" name])* [","] ")"\n' - ' feature ::= identifier\n' - ' name ::= identifier\n' - '\n' - 'A future statement must appear near the top of the module. The ' - 'only\n' - 'lines that can appear before a future statement are:\n' - '\n' - '* the module docstring (if any),\n' - '\n' - '* comments,\n' - '\n' - '* blank lines, and\n' - '\n' - '* other future statements.\n' - '\n' - 'The features recognized by Python 2.6 are "unicode_literals",\n' - '"print_function", "absolute_import", "division", "generators",\n' - '"nested_scopes" and "with_statement". "generators", ' - '"with_statement",\n' - '"nested_scopes" are redundant in Python version 2.6 and above ' - 'because\n' - 'they are always enabled.\n' - '\n' - 'A future statement is recognized and treated specially at compile\n' - 'time: Changes to the semantics of core constructs are often\n' - 'implemented by generating different code. It may even be the ' - 'case\n' - 'that a new feature introduces new incompatible syntax (such as a ' - 'new\n' - 'reserved word), in which case the compiler may need to parse the\n' - 'module differently. Such decisions cannot be pushed off until\n' - 'runtime.\n' - '\n' - 'For any given release, the compiler knows which feature names ' - 'have\n' - 'been defined, and raises a compile-time error if a future ' - 'statement\n' - 'contains a feature not known to it.\n' - '\n' - 'The direct runtime semantics are the same as for any import ' - 'statement:\n' - 'there is a standard module "__future__", described later, and it ' - 'will\n' - 'be imported in the usual way at the time the future statement is\n' - 'executed.\n' - '\n' - 'The interesting runtime semantics depend on the specific feature\n' - 'enabled by the future statement.\n' - '\n' - 'Note that there is nothing special about the statement:\n' - '\n' - ' import __future__ [as name]\n' - '\n' - "That is not a future statement; it's an ordinary import statement " - 'with\n' - 'no special semantics or syntax restrictions.\n' - '\n' - 'Code compiled by an "exec" statement or calls to the built-in\n' - 'functions "compile()" and "execfile()" that occur in a module "M"\n' - 'containing a future statement will, by default, use the new ' - 'syntax or\n' - 'semantics associated with the future statement. This can, ' - 'starting\n' - 'with Python 2.2 be controlled by optional arguments to "compile()" ' - '---\n' - 'see the documentation of that function for details.\n' - '\n' - 'A future statement typed at an interactive interpreter prompt ' - 'will\n' - 'take effect for the rest of the interpreter session. If an\n' - 'interpreter is started with the "-i" option, is passed a script ' - 'name\n' - 'to execute, and the script includes a future statement, it will be ' - 'in\n' - 'effect in the interactive session started after the script is\n' - 'executed.\n' - '\n' - 'See also:\n' - '\n' - ' **PEP 236** - Back to the __future__\n' - ' The original proposal for the __future__ mechanism.\n', - 'in': '\n' - 'Comparisons\n' - '***********\n' - '\n' - 'Unlike C, all comparison operations in Python have the same priority,\n' - 'which is lower than that of any arithmetic, shifting or bitwise\n' - 'operation. Also unlike C, expressions like "a < b < c" have the\n' - 'interpretation that is conventional in mathematics:\n' - '\n' - ' comparison ::= or_expr ( comp_operator or_expr )*\n' - ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n' - ' | "is" ["not"] | ["not"] "in"\n' - '\n' - 'Comparisons yield boolean values: "True" or "False".\n' - '\n' - 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" is\n' - 'equivalent to "x < y and y <= z", except that "y" is evaluated only\n' - 'once (but in both cases "z" is not evaluated at all when "x < y" is\n' - 'found to be false).\n' - '\n' - 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n' - '*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\n' - 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\n' - 'that each expression is evaluated at most once.\n' - '\n' - 'Note that "a op1 b op2 c" doesn\'t imply any kind of comparison ' - 'between\n' - '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\n' - 'perhaps not pretty).\n' - '\n' - 'The forms "<>" and "!=" are equivalent; for consistency with C, "!="\n' - 'is preferred; where "!=" is mentioned below "<>" is also accepted.\n' - 'The "<>" spelling is considered obsolescent.\n' - '\n' - 'The operators "<", ">", "==", ">=", "<=", and "!=" compare the values\n' - 'of two objects. The objects need not have the same type. If both are\n' - 'numbers, they are converted to a common type. Otherwise, objects of\n' - 'different types *always* compare unequal, and are ordered ' - 'consistently\n' - 'but arbitrarily. You can control comparison behavior of objects of\n' - 'non-built-in types by defining a "__cmp__" method or rich comparison\n' - 'methods like "__gt__", described in section Special method names.\n' - '\n' - '(This unusual definition of comparison was used to simplify the\n' - 'definition of operations like sorting and the "in" and "not in"\n' - 'operators. In the future, the comparison rules for objects of\n' - 'different types are likely to change.)\n' - '\n' - 'Comparison of objects of the same type depends on the type:\n' - '\n' - '* Numbers are compared arithmetically.\n' - '\n' - '* Strings are compared lexicographically using the numeric\n' - ' equivalents (the result of the built-in function "ord()") of their\n' - ' characters. Unicode and 8-bit strings are fully interoperable in\n' - ' this behavior. [4]\n' - '\n' - '* Tuples and lists are compared lexicographically using comparison\n' - ' of corresponding elements. This means that to compare equal, each\n' - ' element must compare equal and the two sequences must be of the ' - 'same\n' - ' type and have the same length.\n' - '\n' - ' If not equal, the sequences are ordered the same as their first\n' - ' differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n' - ' the same as "cmp(x,y)". If the corresponding element does not\n' - ' exist, the shorter sequence is ordered first (for example, "[1,2] <\n' - ' [1,2,3]").\n' - '\n' - '* Mappings (dictionaries) compare equal if and only if their sorted\n' - ' (key, value) lists compare equal. [5] Outcomes other than equality\n' - ' are resolved consistently, but are not otherwise defined. [6]\n' - '\n' - '* Most other objects of built-in types compare unequal unless they\n' - ' are the same object; the choice whether one object is considered\n' - ' smaller or larger than another one is made arbitrarily but\n' - ' consistently within one execution of a program.\n' - '\n' - 'The operators "in" and "not in" test for collection membership. "x ' - 'in\n' - 's" evaluates to true if *x* is a member of the collection *s*, and\n' - 'false otherwise. "x not in s" returns the negation of "x in s". The\n' - 'collection membership test has traditionally been bound to sequences;\n' - 'an object is a member of a collection if the collection is a sequence\n' - 'and contains an element equal to that object. However, it make sense\n' - 'for many other object types to support membership tests without being\n' - 'a sequence. In particular, dictionaries (for keys) and sets support\n' - 'membership testing.\n' - '\n' - 'For the list and tuple types, "x in y" is true if and only if there\n' - 'exists an index *i* such that either "x is y[i]" or "x == y[i]" is\n' - 'true.\n' - '\n' - 'For the Unicode and string types, "x in y" is true if and only if *x*\n' - 'is a substring of *y*. An equivalent test is "y.find(x) != -1".\n' - 'Note, *x* and *y* need not be the same type; consequently, "u\'ab\' ' - 'in\n' - '\'abc\'" will return "True". Empty strings are always considered to be ' - 'a\n' - 'substring of any other string, so """ in "abc"" will return "True".\n' - '\n' - 'Changed in version 2.3: Previously, *x* was required to be a string ' - 'of\n' - 'length "1".\n' - '\n' - 'For user-defined classes which define the "__contains__()" method, "x\n' - 'in y" is true if and only if "y.__contains__(x)" is true.\n' - '\n' - 'For user-defined classes which do not define "__contains__()" but do\n' - 'define "__iter__()", "x in y" is true if some value "z" with "x == z"\n' - 'is produced while iterating over "y". If an exception is raised\n' - 'during the iteration, it is as if "in" raised that exception.\n' - '\n' - 'Lastly, the old-style iteration protocol is tried: if a class defines\n' - '"__getitem__()", "x in y" is true if and only if there is a non-\n' - 'negative integer index *i* such that "x == y[i]", and all lower\n' - 'integer indices do not raise "IndexError" exception. (If any other\n' - 'exception is raised, it is as if "in" raised that exception).\n' - '\n' - 'The operator "not in" is defined to have the inverse true value of\n' - '"in".\n' - '\n' - 'The operators "is" and "is not" test for object identity: "x is y" is\n' - 'true if and only if *x* and *y* are the same object. "x is not y"\n' - 'yields the inverse truth value. [7]\n', - 'integers': '\n' - 'Integer and long integer literals\n' - '*********************************\n' - '\n' - 'Integer and long integer literals are described by the ' - 'following\n' - 'lexical definitions:\n' - '\n' - ' longinteger ::= integer ("l" | "L")\n' - ' integer ::= decimalinteger | octinteger | hexinteger | ' - 'bininteger\n' - ' decimalinteger ::= nonzerodigit digit* | "0"\n' - ' octinteger ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\n' - ' hexinteger ::= "0" ("x" | "X") hexdigit+\n' - ' bininteger ::= "0" ("b" | "B") bindigit+\n' - ' nonzerodigit ::= "1"..."9"\n' - ' octdigit ::= "0"..."7"\n' - ' bindigit ::= "0" | "1"\n' - ' hexdigit ::= digit | "a"..."f" | "A"..."F"\n' - '\n' - 'Although both lower case "\'l\'" and upper case "\'L\'" are ' - 'allowed as\n' - 'suffix for long integers, it is strongly recommended to always ' - 'use\n' - '"\'L\'", since the letter "\'l\'" looks too much like the digit ' - '"\'1\'".\n' - '\n' - 'Plain integer literals that are above the largest representable ' - 'plain\n' - 'integer (e.g., 2147483647 when using 32-bit arithmetic) are ' - 'accepted\n' - 'as if they were long integers instead. [1] There is no limit ' - 'for long\n' - 'integer literals apart from what can be stored in available ' - 'memory.\n' - '\n' - 'Some examples of plain integer literals (first row) and long ' - 'integer\n' - 'literals (second and third rows):\n' - '\n' - ' 7 2147483647 0177\n' - ' 3L 79228162514264337593543950336L 0377L 0x100000000L\n' - ' 79228162514264337593543950336 0xdeadbeef\n', - 'lambda': '\n' - 'Lambdas\n' - '*******\n' - '\n' - ' lambda_expr ::= "lambda" [parameter_list]: expression\n' - ' old_lambda_expr ::= "lambda" [parameter_list]: old_expression\n' - '\n' - 'Lambda expressions (sometimes called lambda forms) have the same\n' - 'syntactic position as expressions. They are a shorthand to ' - 'create\n' - 'anonymous functions; the expression "lambda arguments: ' - 'expression"\n' - 'yields a function object. The unnamed object behaves like a ' - 'function\n' - 'object defined with\n' - '\n' - ' def name(arguments):\n' - ' return expression\n' - '\n' - 'See section Function definitions for the syntax of parameter ' - 'lists.\n' - 'Note that functions created with lambda expressions cannot ' - 'contain\n' - 'statements.\n', - 'lists': '\n' - 'List displays\n' - '*************\n' - '\n' - 'A list display is a possibly empty series of expressions enclosed ' - 'in\n' - 'square brackets:\n' - '\n' - ' list_display ::= "[" [expression_list | ' - 'list_comprehension] "]"\n' - ' list_comprehension ::= expression list_for\n' - ' list_for ::= "for" target_list "in" ' - 'old_expression_list [list_iter]\n' - ' old_expression_list ::= old_expression [("," old_expression)+ ' - '[","]]\n' - ' old_expression ::= or_test | old_lambda_expr\n' - ' list_iter ::= list_for | list_if\n' - ' list_if ::= "if" old_expression [list_iter]\n' - '\n' - 'A list display yields a new list object. Its contents are ' - 'specified\n' - 'by providing either a list of expressions or a list comprehension.\n' - 'When a comma-separated list of expressions is supplied, its ' - 'elements\n' - 'are evaluated from left to right and placed into the list object ' - 'in\n' - 'that order. When a list comprehension is supplied, it consists of ' - 'a\n' - 'single expression followed by at least one "for" clause and zero ' - 'or\n' - 'more "for" or "if" clauses. In this case, the elements of the new\n' - 'list are those that would be produced by considering each of the ' - '"for"\n' - 'or "if" clauses a block, nesting from left to right, and ' - 'evaluating\n' - 'the expression to produce a list element each time the innermost ' - 'block\n' - 'is reached [1].\n', - 'naming': '\n' - 'Naming and binding\n' - '******************\n' - '\n' - '*Names* refer to objects. Names are introduced by name binding\n' - 'operations. Each occurrence of a name in the program text refers ' - 'to\n' - 'the *binding* of that name established in the innermost function ' - 'block\n' - 'containing the use.\n' - '\n' - 'A *block* is a piece of Python program text that is executed as a\n' - 'unit. The following are blocks: a module, a function body, and a ' - 'class\n' - 'definition. Each command typed interactively is a block. A ' - 'script\n' - 'file (a file given as standard input to the interpreter or ' - 'specified\n' - 'on the interpreter command line the first argument) is a code ' - 'block.\n' - 'A script command (a command specified on the interpreter command ' - 'line\n' - "with the '**-c**' option) is a code block. The file read by the\n" - 'built-in function "execfile()" is a code block. The string ' - 'argument\n' - 'passed to the built-in function "eval()" and to the "exec" ' - 'statement\n' - 'is a code block. The expression read and evaluated by the ' - 'built-in\n' - 'function "input()" is a code block.\n' - '\n' - 'A code block is executed in an *execution frame*. A frame ' - 'contains\n' - 'some administrative information (used for debugging) and ' - 'determines\n' - "where and how execution continues after the code block's execution " - 'has\n' - 'completed.\n' - '\n' - 'A *scope* defines the visibility of a name within a block. If a ' - 'local\n' - 'variable is defined in a block, its scope includes that block. If ' - 'the\n' - 'definition occurs in a function block, the scope extends to any ' - 'blocks\n' - 'contained within the defining one, unless a contained block ' - 'introduces\n' - 'a different binding for the name. The scope of names defined in ' - 'a\n' - 'class block is limited to the class block; it does not extend to ' - 'the\n' - 'code blocks of methods -- this includes generator expressions ' - 'since\n' - 'they are implemented using a function scope. This means that the\n' - 'following will fail:\n' - '\n' - ' class A:\n' - ' a = 42\n' - ' b = list(a + i for i in range(10))\n' - '\n' - 'When a name is used in a code block, it is resolved using the ' - 'nearest\n' - 'enclosing scope. The set of all such scopes visible to a code ' - 'block\n' - "is called the block's *environment*.\n" - '\n' - 'If a name is bound in a block, it is a local variable of that ' - 'block.\n' - 'If a name is bound at the module level, it is a global variable. ' - '(The\n' - 'variables of the module code block are local and global.) If a\n' - 'variable is used in a code block but not defined there, it is a ' - '*free\n' - 'variable*.\n' - '\n' - 'When a name is not found at all, a "NameError" exception is ' - 'raised.\n' - 'If the name refers to a local variable that has not been bound, a\n' - '"UnboundLocalError" exception is raised. "UnboundLocalError" is ' - 'a\n' - 'subclass of "NameError".\n' - '\n' - 'The following constructs bind names: formal parameters to ' - 'functions,\n' - '"import" statements, class and function definitions (these bind ' - 'the\n' - 'class or function name in the defining block), and targets that ' - 'are\n' - 'identifiers if occurring in an assignment, "for" loop header, in ' - 'the\n' - 'second position of an "except" clause header or after "as" in a ' - '"with"\n' - 'statement. The "import" statement of the form "from ... import ' - '*"\n' - 'binds all names defined in the imported module, except those ' - 'beginning\n' - 'with an underscore. This form may only be used at the module ' - 'level.\n' - '\n' - 'A target occurring in a "del" statement is also considered bound ' - 'for\n' - 'this purpose (though the actual semantics are to unbind the ' - 'name). It\n' - 'is illegal to unbind a name that is referenced by an enclosing ' - 'scope;\n' - 'the compiler will report a "SyntaxError".\n' - '\n' - 'Each assignment or import statement occurs within a block defined ' - 'by a\n' - 'class or function definition or at the module level (the ' - 'top-level\n' - 'code block).\n' - '\n' - 'If a name binding operation occurs anywhere within a code block, ' - 'all\n' - 'uses of the name within the block are treated as references to ' - 'the\n' - 'current block. This can lead to errors when a name is used within ' - 'a\n' - 'block before it is bound. This rule is subtle. Python lacks\n' - 'declarations and allows name binding operations to occur anywhere\n' - 'within a code block. The local variables of a code block can be\n' - 'determined by scanning the entire text of the block for name ' - 'binding\n' - 'operations.\n' - '\n' - 'If the global statement occurs within a block, all uses of the ' - 'name\n' - 'specified in the statement refer to the binding of that name in ' - 'the\n' - 'top-level namespace. Names are resolved in the top-level namespace ' - 'by\n' - 'searching the global namespace, i.e. the namespace of the module\n' - 'containing the code block, and the builtins namespace, the ' - 'namespace\n' - 'of the module "__builtin__". The global namespace is searched ' - 'first.\n' - 'If the name is not found there, the builtins namespace is ' - 'searched.\n' - 'The global statement must precede all uses of the name.\n' - '\n' - 'The builtins namespace associated with the execution of a code ' - 'block\n' - 'is actually found by looking up the name "__builtins__" in its ' - 'global\n' - 'namespace; this should be a dictionary or a module (in the latter ' - 'case\n' - "the module's dictionary is used). By default, when in the " - '"__main__"\n' - 'module, "__builtins__" is the built-in module "__builtin__" (note: ' - 'no\n' - '\'s\'); when in any other module, "__builtins__" is an alias for ' - 'the\n' - 'dictionary of the "__builtin__" module itself. "__builtins__" can ' - 'be\n' - 'set to a user-created dictionary to create a weak form of ' - 'restricted\n' - 'execution.\n' - '\n' - '**CPython implementation detail:** Users should not touch\n' - '"__builtins__"; it is strictly an implementation detail. Users\n' - 'wanting to override values in the builtins namespace should ' - '"import"\n' - 'the "__builtin__" (no \'s\') module and modify its attributes\n' - 'appropriately.\n' - '\n' - 'The namespace for a module is automatically created the first time ' - 'a\n' - 'module is imported. The main module for a script is always ' - 'called\n' - '"__main__".\n' - '\n' - 'The "global" statement has the same scope as a name binding ' - 'operation\n' - 'in the same block. If the nearest enclosing scope for a free ' - 'variable\n' - 'contains a global statement, the free variable is treated as a ' - 'global.\n' - '\n' - 'A class definition is an executable statement that may use and ' - 'define\n' - 'names. These references follow the normal rules for name ' - 'resolution.\n' - 'The namespace of the class definition becomes the attribute ' - 'dictionary\n' - 'of the class. Names defined at the class scope are not visible ' - 'in\n' - 'methods.\n' - '\n' - '\n' - 'Interaction with dynamic features\n' - '=================================\n' - '\n' - 'There are several cases where Python statements are illegal when ' - 'used\n' - 'in conjunction with nested scopes that contain free variables.\n' - '\n' - 'If a variable is referenced in an enclosing scope, it is illegal ' - 'to\n' - 'delete the name. An error will be reported at compile time.\n' - '\n' - 'If the wild card form of import --- "import *" --- is used in a\n' - 'function and the function contains or is a nested block with free\n' - 'variables, the compiler will raise a "SyntaxError".\n' - '\n' - 'If "exec" is used in a function and the function contains or is a\n' - 'nested block with free variables, the compiler will raise a\n' - '"SyntaxError" unless the exec explicitly specifies the local ' - 'namespace\n' - 'for the "exec". (In other words, "exec obj" would be illegal, ' - 'but\n' - '"exec obj in ns" would be legal.)\n' - '\n' - 'The "eval()", "execfile()", and "input()" functions and the ' - '"exec"\n' - 'statement do not have access to the full environment for ' - 'resolving\n' - 'names. Names may be resolved in the local and global namespaces ' - 'of\n' - 'the caller. Free variables are not resolved in the nearest ' - 'enclosing\n' - 'namespace, but in the global namespace. [1] The "exec" statement ' - 'and\n' - 'the "eval()" and "execfile()" functions have optional arguments ' - 'to\n' - 'override the global and local namespace. If only one namespace ' - 'is\n' - 'specified, it is used for both.\n', - 'numbers': '\n' - 'Numeric literals\n' - '****************\n' - '\n' - 'There are four types of numeric literals: plain integers, long\n' - 'integers, floating point numbers, and imaginary numbers. There ' - 'are no\n' - 'complex literals (complex numbers can be formed by adding a real\n' - 'number and an imaginary number).\n' - '\n' - 'Note that numeric literals do not include a sign; a phrase like ' - '"-1"\n' - 'is actually an expression composed of the unary operator \'"-"\' ' - 'and the\n' - 'literal "1".\n', - 'numeric-types': '\n' - 'Emulating numeric types\n' - '***********************\n' - '\n' - 'The following methods can be defined to emulate numeric ' - 'objects.\n' - 'Methods corresponding to operations that are not supported ' - 'by the\n' - 'particular kind of number implemented (e.g., bitwise ' - 'operations for\n' - 'non-integral numbers) should be left undefined.\n' - '\n' - 'object.__add__(self, other)\n' - 'object.__sub__(self, other)\n' - 'object.__mul__(self, other)\n' - 'object.__floordiv__(self, other)\n' - 'object.__mod__(self, other)\n' - 'object.__divmod__(self, other)\n' - 'object.__pow__(self, other[, modulo])\n' - 'object.__lshift__(self, other)\n' - 'object.__rshift__(self, other)\n' - 'object.__and__(self, other)\n' - 'object.__xor__(self, other)\n' - 'object.__or__(self, other)\n' - '\n' - ' These methods are called to implement the binary ' - 'arithmetic\n' - ' operations ("+", "-", "*", "//", "%", "divmod()", ' - '"pow()", "**",\n' - ' "<<", ">>", "&", "^", "|"). For instance, to evaluate ' - 'the\n' - ' expression "x + y", where *x* is an instance of a class ' - 'that has an\n' - ' "__add__()" method, "x.__add__(y)" is called. The ' - '"__divmod__()"\n' - ' method should be the equivalent to using ' - '"__floordiv__()" and\n' - ' "__mod__()"; it should not be related to "__truediv__()" ' - '(described\n' - ' below). Note that "__pow__()" should be defined to ' - 'accept an\n' - ' optional third argument if the ternary version of the ' - 'built-in\n' - ' "pow()" function is to be supported.\n' - '\n' - ' If one of those methods does not support the operation ' - 'with the\n' - ' supplied arguments, it should return "NotImplemented".\n' - '\n' - 'object.__div__(self, other)\n' - 'object.__truediv__(self, other)\n' - '\n' - ' The division operator ("/") is implemented by these ' - 'methods. The\n' - ' "__truediv__()" method is used when ' - '"__future__.division" is in\n' - ' effect, otherwise "__div__()" is used. If only one of ' - 'these two\n' - ' methods is defined, the object will not support division ' - 'in the\n' - ' alternate context; "TypeError" will be raised instead.\n' - '\n' - 'object.__radd__(self, other)\n' - 'object.__rsub__(self, other)\n' - 'object.__rmul__(self, other)\n' - 'object.__rdiv__(self, other)\n' - 'object.__rtruediv__(self, other)\n' - 'object.__rfloordiv__(self, other)\n' - 'object.__rmod__(self, other)\n' - 'object.__rdivmod__(self, other)\n' - 'object.__rpow__(self, other)\n' - 'object.__rlshift__(self, other)\n' - 'object.__rrshift__(self, other)\n' - 'object.__rand__(self, other)\n' - 'object.__rxor__(self, other)\n' - 'object.__ror__(self, other)\n' - '\n' - ' These methods are called to implement the binary ' - 'arithmetic\n' - ' operations ("+", "-", "*", "/", "%", "divmod()", ' - '"pow()", "**",\n' - ' "<<", ">>", "&", "^", "|") with reflected (swapped) ' - 'operands.\n' - ' These functions are only called if the left operand does ' - 'not\n' - ' support the corresponding operation and the operands are ' - 'of\n' - ' different types. [2] For instance, to evaluate the ' - 'expression "x -\n' - ' y", where *y* is an instance of a class that has an ' - '"__rsub__()"\n' - ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" ' - 'returns\n' - ' *NotImplemented*.\n' - '\n' - ' Note that ternary "pow()" will not try calling ' - '"__rpow__()" (the\n' - ' coercion rules would become too complicated).\n' - '\n' - " Note: If the right operand's type is a subclass of the " - 'left\n' - " operand's type and that subclass provides the " - 'reflected method\n' - ' for the operation, this method will be called before ' - 'the left\n' - " operand's non-reflected method. This behavior allows " - 'subclasses\n' - " to override their ancestors' operations.\n" - '\n' - 'object.__iadd__(self, other)\n' - 'object.__isub__(self, other)\n' - 'object.__imul__(self, other)\n' - 'object.__idiv__(self, other)\n' - 'object.__itruediv__(self, other)\n' - 'object.__ifloordiv__(self, other)\n' - 'object.__imod__(self, other)\n' - 'object.__ipow__(self, other[, modulo])\n' - 'object.__ilshift__(self, other)\n' - 'object.__irshift__(self, other)\n' - 'object.__iand__(self, other)\n' - 'object.__ixor__(self, other)\n' - 'object.__ior__(self, other)\n' - '\n' - ' These methods are called to implement the augmented ' - 'arithmetic\n' - ' assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", ' - '"<<=",\n' - ' ">>=", "&=", "^=", "|="). These methods should attempt ' - 'to do the\n' - ' operation in-place (modifying *self*) and return the ' - 'result (which\n' - ' could be, but does not have to be, *self*). If a ' - 'specific method\n' - ' is not defined, the augmented assignment falls back to ' - 'the normal\n' - ' methods. For instance, to execute the statement "x += ' - 'y", where\n' - ' *x* is an instance of a class that has an "__iadd__()" ' - 'method,\n' - ' "x.__iadd__(y)" is called. If *x* is an instance of a ' - 'class that\n' - ' does not define a "__iadd__()" method, "x.__add__(y)" ' - 'and\n' - ' "y.__radd__(x)" are considered, as with the evaluation ' - 'of "x + y".\n' - '\n' - 'object.__neg__(self)\n' - 'object.__pos__(self)\n' - 'object.__abs__(self)\n' - 'object.__invert__(self)\n' - '\n' - ' Called to implement the unary arithmetic operations ' - '("-", "+",\n' - ' "abs()" and "~").\n' - '\n' - 'object.__complex__(self)\n' - 'object.__int__(self)\n' - 'object.__long__(self)\n' - 'object.__float__(self)\n' - '\n' - ' Called to implement the built-in functions "complex()", ' - '"int()",\n' - ' "long()", and "float()". Should return a value of the ' - 'appropriate\n' - ' type.\n' - '\n' - 'object.__oct__(self)\n' - 'object.__hex__(self)\n' - '\n' - ' Called to implement the built-in functions "oct()" and ' - '"hex()".\n' - ' Should return a string value.\n' - '\n' - 'object.__index__(self)\n' - '\n' - ' Called to implement "operator.index()". Also called ' - 'whenever\n' - ' Python needs an integer object (such as in slicing). ' - 'Must return\n' - ' an integer (int or long).\n' - '\n' - ' New in version 2.5.\n' - '\n' - 'object.__coerce__(self, other)\n' - '\n' - ' Called to implement "mixed-mode" numeric arithmetic. ' - 'Should either\n' - ' return a 2-tuple containing *self* and *other* converted ' - 'to a\n' - ' common numeric type, or "None" if conversion is ' - 'impossible. When\n' - ' the common type would be the type of "other", it is ' - 'sufficient to\n' - ' return "None", since the interpreter will also ask the ' - 'other object\n' - ' to attempt a coercion (but sometimes, if the ' - 'implementation of the\n' - ' other type cannot be changed, it is useful to do the ' - 'conversion to\n' - ' the other type here). A return value of ' - '"NotImplemented" is\n' - ' equivalent to returning "None".\n', - 'objects': '\n' - 'Objects, values and types\n' - '*************************\n' - '\n' - "*Objects* are Python's abstraction for data. All data in a " - 'Python\n' - 'program is represented by objects or by relations between ' - 'objects. (In\n' - 'a sense, and in conformance to Von Neumann\'s model of a "stored\n' - 'program computer," code is also represented by objects.)\n' - '\n' - "Every object has an identity, a type and a value. An object's\n" - '*identity* never changes once it has been created; you may think ' - 'of it\n' - 'as the object\'s address in memory. The \'"is"\' operator ' - 'compares the\n' - 'identity of two objects; the "id()" function returns an integer\n' - 'representing its identity (currently implemented as its address). ' - 'An\n' - "object's *type* is also unchangeable. [1] An object's type " - 'determines\n' - 'the operations that the object supports (e.g., "does it have a\n' - 'length?") and also defines the possible values for objects of ' - 'that\n' - 'type. The "type()" function returns an object\'s type (which is ' - 'an\n' - 'object itself). The *value* of some objects can change. ' - 'Objects\n' - 'whose value can change are said to be *mutable*; objects whose ' - 'value\n' - 'is unchangeable once they are created are called *immutable*. ' - '(The\n' - 'value of an immutable container object that contains a reference ' - 'to a\n' - "mutable object can change when the latter's value is changed; " - 'however\n' - 'the container is still considered immutable, because the ' - 'collection of\n' - 'objects it contains cannot be changed. So, immutability is not\n' - 'strictly the same as having an unchangeable value, it is more ' - 'subtle.)\n' - "An object's mutability is determined by its type; for instance,\n" - 'numbers, strings and tuples are immutable, while dictionaries ' - 'and\n' - 'lists are mutable.\n' - '\n' - 'Objects are never explicitly destroyed; however, when they ' - 'become\n' - 'unreachable they may be garbage-collected. An implementation is\n' - 'allowed to postpone garbage collection or omit it altogether --- ' - 'it is\n' - 'a matter of implementation quality how garbage collection is\n' - 'implemented, as long as no objects are collected that are still\n' - 'reachable.\n' - '\n' - '**CPython implementation detail:** CPython currently uses a ' - 'reference-\n' - 'counting scheme with (optional) delayed detection of cyclically ' - 'linked\n' - 'garbage, which collects most objects as soon as they become\n' - 'unreachable, but is not guaranteed to collect garbage containing\n' - 'circular references. See the documentation of the "gc" module ' - 'for\n' - 'information on controlling the collection of cyclic garbage. ' - 'Other\n' - 'implementations act differently and CPython may change. Do not ' - 'depend\n' - 'on immediate finalization of objects when they become unreachable ' - '(ex:\n' - 'always close files).\n' - '\n' - "Note that the use of the implementation's tracing or debugging\n" - 'facilities may keep objects alive that would normally be ' - 'collectable.\n' - 'Also note that catching an exception with a \'"try"..."except"\'\n' - 'statement may keep objects alive.\n' - '\n' - 'Some objects contain references to "external" resources such as ' - 'open\n' - 'files or windows. It is understood that these resources are ' - 'freed\n' - 'when the object is garbage-collected, but since garbage ' - 'collection is\n' - 'not guaranteed to happen, such objects also provide an explicit ' - 'way to\n' - 'release the external resource, usually a "close()" method. ' - 'Programs\n' - 'are strongly recommended to explicitly close such objects. The\n' - '\'"try"..."finally"\' statement provides a convenient way to do ' - 'this.\n' - '\n' - 'Some objects contain references to other objects; these are ' - 'called\n' - '*containers*. Examples of containers are tuples, lists and\n' - "dictionaries. The references are part of a container's value. " - 'In\n' - 'most cases, when we talk about the value of a container, we imply ' - 'the\n' - 'values, not the identities of the contained objects; however, ' - 'when we\n' - 'talk about the mutability of a container, only the identities of ' - 'the\n' - 'immediately contained objects are implied. So, if an immutable\n' - 'container (like a tuple) contains a reference to a mutable ' - 'object, its\n' - 'value changes if that mutable object is changed.\n' - '\n' - 'Types affect almost all aspects of object behavior. Even the\n' - 'importance of object identity is affected in some sense: for ' - 'immutable\n' - 'types, operations that compute new values may actually return a\n' - 'reference to any existing object with the same type and value, ' - 'while\n' - 'for mutable objects this is not allowed. E.g., after "a = 1; b = ' - '1",\n' - '"a" and "b" may or may not refer to the same object with the ' - 'value\n' - 'one, depending on the implementation, but after "c = []; d = []", ' - '"c"\n' - 'and "d" are guaranteed to refer to two different, unique, newly\n' - 'created empty lists. (Note that "c = d = []" assigns the same ' - 'object\n' - 'to both "c" and "d".)\n', - 'operator-summary': '\n' - 'Operator precedence\n' - '*******************\n' - '\n' - 'The following table summarizes the operator precedences ' - 'in Python,\n' - 'from lowest precedence (least binding) to highest ' - 'precedence (most\n' - 'binding). Operators in the same box have the same ' - 'precedence. Unless\n' - 'the syntax is explicitly given, operators are binary. ' - 'Operators in\n' - 'the same box group left to right (except for ' - 'comparisons, including\n' - 'tests, which all have the same precedence and chain from ' - 'left to right\n' - '--- see section Comparisons --- and exponentiation, ' - 'which groups from\n' - 'right to left).\n' - '\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| Operator | ' - 'Description |\n' - '+=================================================+=======================================+\n' - '| "lambda" | ' - 'Lambda expression |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "if" -- "else" | ' - 'Conditional expression |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "or" | ' - 'Boolean OR |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "and" | ' - 'Boolean AND |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "not" "x" | ' - 'Boolean NOT |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "in", "not in", "is", "is not", "<", "<=", ">", | ' - 'Comparisons, including membership |\n' - '| ">=", "<>", "!=", "==" | ' - 'tests and identity tests |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "|" | ' - 'Bitwise OR |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "^" | ' - 'Bitwise XOR |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "&" | ' - 'Bitwise AND |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "<<", ">>" | ' - 'Shifts |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "+", "-" | ' - 'Addition and subtraction |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "*", "/", "//", "%" | ' - 'Multiplication, division, remainder |\n' - '| | ' - '[8] |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "+x", "-x", "~x" | ' - 'Positive, negative, bitwise NOT |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "**" | ' - 'Exponentiation [9] |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "x[index]", "x[index:index]", | ' - 'Subscription, slicing, call, |\n' - '| "x(arguments...)", "x.attribute" | ' - 'attribute reference |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '| "(expressions...)", "[expressions...]", "{key: | ' - 'Binding or tuple display, list |\n' - '| value...}", "`expressions...`" | ' - 'display, dictionary display, string |\n' - '| | ' - 'conversion |\n' - '+-------------------------------------------------+---------------------------------------+\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] In Python 2.3 and later releases, a list ' - 'comprehension "leaks"\n' - ' the control variables of each "for" it contains into ' - 'the\n' - ' containing scope. However, this behavior is ' - 'deprecated, and\n' - ' relying on it will not work in Python 3.\n' - '\n' - '[2] While "abs(x%y) < abs(y)" is true mathematically, ' - 'for floats\n' - ' it may not be true numerically due to roundoff. For ' - 'example, and\n' - ' assuming a platform on which a Python float is an ' - 'IEEE 754 double-\n' - ' precision number, in order that "-1e-100 % 1e100" ' - 'have the same\n' - ' sign as "1e100", the computed result is "-1e-100 + ' - '1e100", which\n' - ' is numerically exactly equal to "1e100". The ' - 'function\n' - ' "math.fmod()" returns a result whose sign matches ' - 'the sign of the\n' - ' first argument instead, and so returns "-1e-100" in ' - 'this case.\n' - ' Which approach is more appropriate depends on the ' - 'application.\n' - '\n' - '[3] If x is very close to an exact integer multiple of ' - "y, it's\n" - ' possible for "floor(x/y)" to be one larger than ' - '"(x-x%y)/y" due to\n' - ' rounding. In such cases, Python returns the latter ' - 'result, in\n' - ' order to preserve that "divmod(x,y)[0] * y + x % y" ' - 'be very close\n' - ' to "x".\n' - '\n' - '[4] While comparisons between unicode strings make sense ' - 'at the\n' - ' byte level, they may be counter-intuitive to users. ' - 'For example,\n' - ' the strings "u"\\u00C7"" and "u"\\u0043\\u0327"" ' - 'compare differently,\n' - ' even though they both represent the same unicode ' - 'character (LATIN\n' - ' CAPITAL LETTER C WITH CEDILLA). To compare strings ' - 'in a human\n' - ' recognizable way, compare using ' - '"unicodedata.normalize()".\n' - '\n' - '[5] The implementation computes this efficiently, ' - 'without\n' - ' constructing lists or sorting.\n' - '\n' - '[6] Earlier versions of Python used lexicographic ' - 'comparison of\n' - ' the sorted (key, value) lists, but this was very ' - 'expensive for the\n' - ' common case of comparing for equality. An even ' - 'earlier version of\n' - ' Python compared dictionaries by identity only, but ' - 'this caused\n' - ' surprises because people expected to be able to test ' - 'a dictionary\n' - ' for emptiness by comparing it to "{}".\n' - '\n' - '[7] Due to automatic garbage-collection, free lists, and ' - 'the\n' - ' dynamic nature of descriptors, you may notice ' - 'seemingly unusual\n' - ' behaviour in certain uses of the "is" operator, like ' - 'those\n' - ' involving comparisons between instance methods, or ' - 'constants.\n' - ' Check their documentation for more info.\n' - '\n' - '[8] The "%" operator is also used for string formatting; ' - 'the same\n' - ' precedence applies.\n' - '\n' - '[9] The power operator "**" binds less tightly than an ' - 'arithmetic\n' - ' or bitwise unary operator on its right, that is, ' - '"2**-1" is "0.5".\n', - 'pass': '\n' - 'The "pass" statement\n' - '********************\n' - '\n' - ' pass_stmt ::= "pass"\n' - '\n' - '"pass" is a null operation --- when it is executed, nothing ' - 'happens.\n' - 'It is useful as a placeholder when a statement is required\n' - 'syntactically, but no code needs to be executed, for example:\n' - '\n' - ' def f(arg): pass # a function that does nothing (yet)\n' - '\n' - ' class C: pass # a class with no methods (yet)\n', - 'power': '\n' - 'The power operator\n' - '******************\n' - '\n' - 'The power operator binds more tightly than unary operators on its\n' - 'left; it binds less tightly than unary operators on its right. ' - 'The\n' - 'syntax is:\n' - '\n' - ' power ::= primary ["**" u_expr]\n' - '\n' - 'Thus, in an unparenthesized sequence of power and unary operators, ' - 'the\n' - 'operators are evaluated from right to left (this does not ' - 'constrain\n' - 'the evaluation order for the operands): "-1**2" results in "-1".\n' - '\n' - 'The power operator has the same semantics as the built-in "pow()"\n' - 'function, when called with two arguments: it yields its left ' - 'argument\n' - 'raised to the power of its right argument. The numeric arguments ' - 'are\n' - 'first converted to a common type. The result type is that of the\n' - 'arguments after coercion.\n' - '\n' - 'With mixed operand types, the coercion rules for binary arithmetic\n' - 'operators apply. For int and long int operands, the result has the\n' - 'same type as the operands (after coercion) unless the second ' - 'argument\n' - 'is negative; in that case, all arguments are converted to float and ' - 'a\n' - 'float result is delivered. For example, "10**2" returns "100", but\n' - '"10**-2" returns "0.01". (This last feature was added in Python ' - '2.2.\n' - 'In Python 2.1 and before, if both arguments were of integer types ' - 'and\n' - 'the second argument was negative, an exception was raised).\n' - '\n' - 'Raising "0.0" to a negative power results in a ' - '"ZeroDivisionError".\n' - 'Raising a negative number to a fractional power results in a\n' - '"ValueError".\n', - 'print': '\n' - 'The "print" statement\n' - '*********************\n' - '\n' - ' print_stmt ::= "print" ([expression ("," expression)* [","]]\n' - ' | ">>" expression [("," expression)+ [","]])\n' - '\n' - '"print" evaluates each expression in turn and writes the resulting\n' - 'object to standard output (see below). If an object is not a ' - 'string,\n' - 'it is first converted to a string using the rules for string\n' - 'conversions. The (resulting or original) string is then written. ' - 'A\n' - 'space is written before each object is (converted and) written, ' - 'unless\n' - 'the output system believes it is positioned at the beginning of a\n' - 'line. This is the case (1) when no characters have yet been ' - 'written\n' - 'to standard output, (2) when the last character written to ' - 'standard\n' - 'output is a whitespace character except "\' \'", or (3) when the ' - 'last\n' - 'write operation on standard output was not a "print" statement. ' - '(In\n' - 'some cases it may be functional to write an empty string to ' - 'standard\n' - 'output for this reason.)\n' - '\n' - 'Note: Objects which act like file objects but which are not the\n' - ' built-in file objects often do not properly emulate this aspect ' - 'of\n' - " the file object's behavior, so it is best not to rely on this.\n" - '\n' - 'A "\'\\n\'" character is written at the end, unless the "print" ' - 'statement\n' - 'ends with a comma. This is the only action if the statement ' - 'contains\n' - 'just the keyword "print".\n' - '\n' - 'Standard output is defined as the file object named "stdout" in ' - 'the\n' - 'built-in module "sys". If no such object exists, or if it does ' - 'not\n' - 'have a "write()" method, a "RuntimeError" exception is raised.\n' - '\n' - '"print" also has an extended form, defined by the second portion ' - 'of\n' - 'the syntax described above. This form is sometimes referred to as\n' - '""print" chevron." In this form, the first expression after the ' - '">>"\n' - 'must evaluate to a "file-like" object, specifically an object that ' - 'has\n' - 'a "write()" method as described above. With this extended form, ' - 'the\n' - 'subsequent expressions are printed to this file object. If the ' - 'first\n' - 'expression evaluates to "None", then "sys.stdout" is used as the ' - 'file\n' - 'for output.\n', - 'raise': '\n' - 'The "raise" statement\n' - '*********************\n' - '\n' - ' raise_stmt ::= "raise" [expression ["," expression ["," ' - 'expression]]]\n' - '\n' - 'If no expressions are present, "raise" re-raises the last ' - 'exception\n' - 'that was active in the current scope. If no exception is active ' - 'in\n' - 'the current scope, a "TypeError" exception is raised indicating ' - 'that\n' - 'this is an error (if running under IDLE, a "Queue.Empty" exception ' - 'is\n' - 'raised instead).\n' - '\n' - 'Otherwise, "raise" evaluates the expressions to get three objects,\n' - 'using "None" as the value of omitted expressions. The first two\n' - 'objects are used to determine the *type* and *value* of the ' - 'exception.\n' - '\n' - 'If the first object is an instance, the type of the exception is ' - 'the\n' - 'class of the instance, the instance itself is the value, and the\n' - 'second object must be "None".\n' - '\n' - 'If the first object is a class, it becomes the type of the ' - 'exception.\n' - 'The second object is used to determine the exception value: If it ' - 'is\n' - 'an instance of the class, the instance becomes the exception value. ' - 'If\n' - 'the second object is a tuple, it is used as the argument list for ' - 'the\n' - 'class constructor; if it is "None", an empty argument list is ' - 'used,\n' - 'and any other object is treated as a single argument to the\n' - 'constructor. The instance so created by calling the constructor ' - 'is\n' - 'used as the exception value.\n' - '\n' - 'If a third object is present and not "None", it must be a ' - 'traceback\n' - 'object (see section The standard type hierarchy), and it is\n' - 'substituted instead of the current location as the place where the\n' - 'exception occurred. If the third object is present and not a\n' - 'traceback object or "None", a "TypeError" exception is raised. ' - 'The\n' - 'three-expression form of "raise" is useful to re-raise an ' - 'exception\n' - 'transparently in an except clause, but "raise" with no expressions\n' - 'should be preferred if the exception to be re-raised was the most\n' - 'recently active exception in the current scope.\n' - '\n' - 'Additional information on exceptions can be found in section\n' - 'Exceptions, and information about handling exceptions is in ' - 'section\n' - 'The try statement.\n', - 'return': '\n' - 'The "return" statement\n' - '**********************\n' - '\n' - ' return_stmt ::= "return" [expression_list]\n' - '\n' - '"return" may only occur syntactically nested in a function ' - 'definition,\n' - 'not within a nested class definition.\n' - '\n' - 'If an expression list is present, it is evaluated, else "None" is\n' - 'substituted.\n' - '\n' - '"return" leaves the current function call with the expression list ' - '(or\n' - '"None") as return value.\n' - '\n' - 'When "return" passes control out of a "try" statement with a ' - '"finally"\n' - 'clause, that "finally" clause is executed before really leaving ' - 'the\n' - 'function.\n' - '\n' - 'In a generator function, the "return" statement is not allowed to\n' - 'include an "expression_list". In that context, a bare "return"\n' - 'indicates that the generator is done and will cause ' - '"StopIteration" to\n' - 'be raised.\n', - 'sequence-types': '\n' - 'Emulating container types\n' - '*************************\n' - '\n' - 'The following methods can be defined to implement ' - 'container objects.\n' - 'Containers usually are sequences (such as lists or tuples) ' - 'or mappings\n' - '(like dictionaries), but can represent other containers as ' - 'well. The\n' - 'first set of methods is used either to emulate a sequence ' - 'or to\n' - 'emulate a mapping; the difference is that for a sequence, ' - 'the\n' - 'allowable keys should be the integers *k* for which "0 <= ' - 'k < N" where\n' - '*N* is the length of the sequence, or slice objects, which ' - 'define a\n' - 'range of items. (For backwards compatibility, the method\n' - '"__getslice__()" (see below) can also be defined to handle ' - 'simple, but\n' - 'not extended slices.) It is also recommended that mappings ' - 'provide the\n' - 'methods "keys()", "values()", "items()", "has_key()", ' - '"get()",\n' - '"clear()", "setdefault()", "iterkeys()", "itervalues()",\n' - '"iteritems()", "pop()", "popitem()", "copy()", and ' - '"update()" behaving\n' - "similar to those for Python's standard dictionary " - 'objects. The\n' - '"UserDict" module provides a "DictMixin" class to help ' - 'create those\n' - 'methods from a base set of "__getitem__()", ' - '"__setitem__()",\n' - '"__delitem__()", and "keys()". Mutable sequences should ' - 'provide\n' - 'methods "append()", "count()", "index()", "extend()", ' - '"insert()",\n' - '"pop()", "remove()", "reverse()" and "sort()", like Python ' - 'standard\n' - 'list objects. Finally, sequence types should implement ' - 'addition\n' - '(meaning concatenation) and multiplication (meaning ' - 'repetition) by\n' - 'defining the methods "__add__()", "__radd__()", ' - '"__iadd__()",\n' - '"__mul__()", "__rmul__()" and "__imul__()" described ' - 'below; they\n' - 'should not define "__coerce__()" or other numerical ' - 'operators. It is\n' - 'recommended that both mappings and sequences implement ' - 'the\n' - '"__contains__()" method to allow efficient use of the "in" ' - 'operator;\n' - 'for mappings, "in" should be equivalent of "has_key()"; ' - 'for sequences,\n' - 'it should search through the values. It is further ' - 'recommended that\n' - 'both mappings and sequences implement the "__iter__()" ' - 'method to allow\n' - 'efficient iteration through the container; for mappings, ' - '"__iter__()"\n' - 'should be the same as "iterkeys()"; for sequences, it ' - 'should iterate\n' - 'through the values.\n' - '\n' - 'object.__len__(self)\n' - '\n' - ' Called to implement the built-in function "len()". ' - 'Should return\n' - ' the length of the object, an integer ">=" 0. Also, an ' - 'object that\n' - ' doesn\'t define a "__nonzero__()" method and whose ' - '"__len__()"\n' - ' method returns zero is considered to be false in a ' - 'Boolean context.\n' - '\n' - 'object.__getitem__(self, key)\n' - '\n' - ' Called to implement evaluation of "self[key]". For ' - 'sequence types,\n' - ' the accepted keys should be integers and slice ' - 'objects. Note that\n' - ' the special interpretation of negative indexes (if the ' - 'class wishes\n' - ' to emulate a sequence type) is up to the ' - '"__getitem__()" method. If\n' - ' *key* is of an inappropriate type, "TypeError" may be ' - 'raised; if of\n' - ' a value outside the set of indexes for the sequence ' - '(after any\n' - ' special interpretation of negative values), ' - '"IndexError" should be\n' - ' raised. For mapping types, if *key* is missing (not in ' - 'the\n' - ' container), "KeyError" should be raised.\n' - '\n' - ' Note: "for" loops expect that an "IndexError" will be ' - 'raised for\n' - ' illegal indexes to allow proper detection of the end ' - 'of the\n' - ' sequence.\n' - '\n' - 'object.__missing__(self, key)\n' - '\n' - ' Called by "dict"."__getitem__()" to implement ' - '"self[key]" for dict\n' - ' subclasses when key is not in the dictionary.\n' - '\n' - 'object.__setitem__(self, key, value)\n' - '\n' - ' Called to implement assignment to "self[key]". Same ' - 'note as for\n' - ' "__getitem__()". This should only be implemented for ' - 'mappings if\n' - ' the objects support changes to the values for keys, or ' - 'if new keys\n' - ' can be added, or for sequences if elements can be ' - 'replaced. The\n' - ' same exceptions should be raised for improper *key* ' - 'values as for\n' - ' the "__getitem__()" method.\n' - '\n' - 'object.__delitem__(self, key)\n' - '\n' - ' Called to implement deletion of "self[key]". Same note ' - 'as for\n' - ' "__getitem__()". This should only be implemented for ' - 'mappings if\n' - ' the objects support removal of keys, or for sequences ' - 'if elements\n' - ' can be removed from the sequence. The same exceptions ' - 'should be\n' - ' raised for improper *key* values as for the ' - '"__getitem__()" method.\n' - '\n' - 'object.__iter__(self)\n' - '\n' - ' This method is called when an iterator is required for ' - 'a container.\n' - ' This method should return a new iterator object that ' - 'can iterate\n' - ' over all the objects in the container. For mappings, ' - 'it should\n' - ' iterate over the keys of the container, and should also ' - 'be made\n' - ' available as the method "iterkeys()".\n' - '\n' - ' Iterator objects also need to implement this method; ' - 'they are\n' - ' required to return themselves. For more information on ' - 'iterator\n' - ' objects, see Iterator Types.\n' - '\n' - 'object.__reversed__(self)\n' - '\n' - ' Called (if present) by the "reversed()" built-in to ' - 'implement\n' - ' reverse iteration. It should return a new iterator ' - 'object that\n' - ' iterates over all the objects in the container in ' - 'reverse order.\n' - '\n' - ' If the "__reversed__()" method is not provided, the ' - '"reversed()"\n' - ' built-in will fall back to using the sequence protocol ' - '("__len__()"\n' - ' and "__getitem__()"). Objects that support the ' - 'sequence protocol\n' - ' should only provide "__reversed__()" if they can ' - 'provide an\n' - ' implementation that is more efficient than the one ' - 'provided by\n' - ' "reversed()".\n' - '\n' - ' New in version 2.6.\n' - '\n' - 'The membership test operators ("in" and "not in") are ' - 'normally\n' - 'implemented as an iteration through a sequence. However, ' - 'container\n' - 'objects can supply the following special method with a ' - 'more efficient\n' - 'implementation, which also does not require the object be ' - 'a sequence.\n' - '\n' - 'object.__contains__(self, item)\n' - '\n' - ' Called to implement membership test operators. Should ' - 'return true\n' - ' if *item* is in *self*, false otherwise. For mapping ' - 'objects, this\n' - ' should consider the keys of the mapping rather than the ' - 'values or\n' - ' the key-item pairs.\n' - '\n' - ' For objects that don\'t define "__contains__()", the ' - 'membership test\n' - ' first tries iteration via "__iter__()", then the old ' - 'sequence\n' - ' iteration protocol via "__getitem__()", see this ' - 'section in the\n' - ' language reference.\n', - 'shifting': '\n' - 'Shifting operations\n' - '*******************\n' - '\n' - 'The shifting operations have lower priority than the arithmetic\n' - 'operations:\n' - '\n' - ' shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n' - '\n' - 'These operators accept plain or long integers as arguments. ' - 'The\n' - 'arguments are converted to a common type. They shift the first\n' - 'argument to the left or right by the number of bits given by ' - 'the\n' - 'second argument.\n' - '\n' - 'A right shift by *n* bits is defined as division by "pow(2, ' - 'n)". A\n' - 'left shift by *n* bits is defined as multiplication with "pow(2, ' - 'n)".\n' - 'Negative shift counts raise a "ValueError" exception.\n' - '\n' - 'Note: In the current implementation, the right-hand operand is\n' - ' required to be at most "sys.maxsize". If the right-hand ' - 'operand is\n' - ' larger than "sys.maxsize" an "OverflowError" exception is ' - 'raised.\n', - 'slicings': '\n' - 'Slicings\n' - '********\n' - '\n' - 'A slicing selects a range of items in a sequence object (e.g., ' - 'a\n' - 'string, tuple or list). Slicings may be used as expressions or ' - 'as\n' - 'targets in assignment or "del" statements. The syntax for a ' - 'slicing:\n' - '\n' - ' slicing ::= simple_slicing | extended_slicing\n' - ' simple_slicing ::= primary "[" short_slice "]"\n' - ' extended_slicing ::= primary "[" slice_list "]"\n' - ' slice_list ::= slice_item ("," slice_item)* [","]\n' - ' slice_item ::= expression | proper_slice | ellipsis\n' - ' proper_slice ::= short_slice | long_slice\n' - ' short_slice ::= [lower_bound] ":" [upper_bound]\n' - ' long_slice ::= short_slice ":" [stride]\n' - ' lower_bound ::= expression\n' - ' upper_bound ::= expression\n' - ' stride ::= expression\n' - ' ellipsis ::= "..."\n' - '\n' - 'There is ambiguity in the formal syntax here: anything that ' - 'looks like\n' - 'an expression list also looks like a slice list, so any ' - 'subscription\n' - 'can be interpreted as a slicing. Rather than further ' - 'complicating the\n' - 'syntax, this is disambiguated by defining that in this case the\n' - 'interpretation as a subscription takes priority over the\n' - 'interpretation as a slicing (this is the case if the slice list\n' - 'contains no proper slice nor ellipses). Similarly, when the ' - 'slice\n' - 'list has exactly one short slice and no trailing comma, the\n' - 'interpretation as a simple slicing takes priority over that as ' - 'an\n' - 'extended slicing.\n' - '\n' - 'The semantics for a simple slicing are as follows. The primary ' - 'must\n' - 'evaluate to a sequence object. The lower and upper bound ' - 'expressions,\n' - 'if present, must evaluate to plain integers; defaults are zero ' - 'and the\n' - '"sys.maxint", respectively. If either bound is negative, the\n' - "sequence's length is added to it. The slicing now selects all " - 'items\n' - 'with index *k* such that "i <= k < j" where *i* and *j* are the\n' - 'specified lower and upper bounds. This may be an empty ' - 'sequence. It\n' - 'is not an error if *i* or *j* lie outside the range of valid ' - 'indexes\n' - "(such items don't exist so they aren't selected).\n" - '\n' - 'The semantics for an extended slicing are as follows. The ' - 'primary\n' - 'must evaluate to a mapping object, and it is indexed with a key ' - 'that\n' - 'is constructed from the slice list, as follows. If the slice ' - 'list\n' - 'contains at least one comma, the key is a tuple containing the\n' - 'conversion of the slice items; otherwise, the conversion of the ' - 'lone\n' - 'slice item is the key. The conversion of a slice item that is ' - 'an\n' - 'expression is that expression. The conversion of an ellipsis ' - 'slice\n' - 'item is the built-in "Ellipsis" object. The conversion of a ' - 'proper\n' - 'slice is a slice object (see section The standard type ' - 'hierarchy)\n' - 'whose "start", "stop" and "step" attributes are the values of ' - 'the\n' - 'expressions given as lower bound, upper bound and stride,\n' - 'respectively, substituting "None" for missing expressions.\n', - 'specialattrs': '\n' - 'Special Attributes\n' - '******************\n' - '\n' - 'The implementation adds a few special read-only attributes ' - 'to several\n' - 'object types, where they are relevant. Some of these are ' - 'not reported\n' - 'by the "dir()" built-in function.\n' - '\n' - 'object.__dict__\n' - '\n' - ' A dictionary or other mapping object used to store an ' - "object's\n" - ' (writable) attributes.\n' - '\n' - 'object.__methods__\n' - '\n' - ' Deprecated since version 2.2: Use the built-in function ' - '"dir()" to\n' - " get a list of an object's attributes. This attribute is " - 'no longer\n' - ' available.\n' - '\n' - 'object.__members__\n' - '\n' - ' Deprecated since version 2.2: Use the built-in function ' - '"dir()" to\n' - " get a list of an object's attributes. This attribute is " - 'no longer\n' - ' available.\n' - '\n' - 'instance.__class__\n' - '\n' - ' The class to which a class instance belongs.\n' - '\n' - 'class.__bases__\n' - '\n' - ' The tuple of base classes of a class object.\n' - '\n' - 'class.__name__\n' - '\n' - ' The name of the class or type.\n' - '\n' - 'The following attributes are only supported by *new-style ' - 'class*es.\n' - '\n' - 'class.__mro__\n' - '\n' - ' This attribute is a tuple of classes that are considered ' - 'when\n' - ' looking for base classes during method resolution.\n' - '\n' - 'class.mro()\n' - '\n' - ' This method can be overridden by a metaclass to customize ' - 'the\n' - ' method resolution order for its instances. It is called ' - 'at class\n' - ' instantiation, and its result is stored in "__mro__".\n' - '\n' - 'class.__subclasses__()\n' - '\n' - ' Each new-style class keeps a list of weak references to ' - 'its\n' - ' immediate subclasses. This method returns a list of all ' - 'those\n' - ' references still alive. Example:\n' - '\n' - ' >>> int.__subclasses__()\n' - " []\n" - '\n' - '-[ Footnotes ]-\n' - '\n' - '[1] Additional information on these special methods may be ' - 'found\n' - ' in the Python Reference Manual (Basic customization).\n' - '\n' - '[2] As a consequence, the list "[1, 2]" is considered equal ' - 'to\n' - ' "[1.0, 2.0]", and similarly for tuples.\n' - '\n' - "[3] They must have since the parser can't tell the type of " - 'the\n' - ' operands.\n' - '\n' - '[4] Cased characters are those with general category ' - 'property\n' - ' being one of "Lu" (Letter, uppercase), "Ll" (Letter, ' - 'lowercase),\n' - ' or "Lt" (Letter, titlecase).\n' - '\n' - '[5] To format only a tuple you should therefore provide a\n' - ' singleton tuple whose only element is the tuple to be ' - 'formatted.\n' - '\n' - '[6] The advantage of leaving the newline on is that ' - 'returning an\n' - ' empty string is then an unambiguous EOF indication. It ' - 'is also\n' - ' possible (in cases where it might matter, for example, ' - 'if you want\n' - ' to make an exact copy of a file while scanning its ' - 'lines) to tell\n' - ' whether the last line of a file ended in a newline or ' - 'not (yes\n' - ' this happens!).\n', - 'specialnames': '\n' - 'Special method names\n' - '********************\n' - '\n' - 'A class can implement certain operations that are invoked by ' - 'special\n' - 'syntax (such as arithmetic operations or subscripting and ' - 'slicing) by\n' - "defining methods with special names. This is Python's " - 'approach to\n' - '*operator overloading*, allowing classes to define their own ' - 'behavior\n' - 'with respect to language operators. For instance, if a ' - 'class defines\n' - 'a method named "__getitem__()", and "x" is an instance of ' - 'this class,\n' - 'then "x[i]" is roughly equivalent to "x.__getitem__(i)" for ' - 'old-style\n' - 'classes and "type(x).__getitem__(x, i)" for new-style ' - 'classes. Except\n' - 'where mentioned, attempts to execute an operation raise an ' - 'exception\n' - 'when no appropriate method is defined (typically ' - '"AttributeError" or\n' - '"TypeError").\n' - '\n' - 'When implementing a class that emulates any built-in type, ' - 'it is\n' - 'important that the emulation only be implemented to the ' - 'degree that it\n' - 'makes sense for the object being modelled. For example, ' - 'some\n' - 'sequences may work well with retrieval of individual ' - 'elements, but\n' - 'extracting a slice may not make sense. (One example of this ' - 'is the\n' - '"NodeList" interface in the W3C\'s Document Object Model.)\n' - '\n' - '\n' - 'Basic customization\n' - '===================\n' - '\n' - 'object.__new__(cls[, ...])\n' - '\n' - ' Called to create a new instance of class *cls*. ' - '"__new__()" is a\n' - ' static method (special-cased so you need not declare it ' - 'as such)\n' - ' that takes the class of which an instance was requested ' - 'as its\n' - ' first argument. The remaining arguments are those passed ' - 'to the\n' - ' object constructor expression (the call to the class). ' - 'The return\n' - ' value of "__new__()" should be the new object instance ' - '(usually an\n' - ' instance of *cls*).\n' - '\n' - ' Typical implementations create a new instance of the ' - 'class by\n' - ' invoking the superclass\'s "__new__()" method using\n' - ' "super(currentclass, cls).__new__(cls[, ...])" with ' - 'appropriate\n' - ' arguments and then modifying the newly-created instance ' - 'as\n' - ' necessary before returning it.\n' - '\n' - ' If "__new__()" returns an instance of *cls*, then the ' - 'new\n' - ' instance\'s "__init__()" method will be invoked like\n' - ' "__init__(self[, ...])", where *self* is the new instance ' - 'and the\n' - ' remaining arguments are the same as were passed to ' - '"__new__()".\n' - '\n' - ' If "__new__()" does not return an instance of *cls*, then ' - 'the new\n' - ' instance\'s "__init__()" method will not be invoked.\n' - '\n' - ' "__new__()" is intended mainly to allow subclasses of ' - 'immutable\n' - ' types (like int, str, or tuple) to customize instance ' - 'creation. It\n' - ' is also commonly overridden in custom metaclasses in ' - 'order to\n' - ' customize class creation.\n' - '\n' - 'object.__init__(self[, ...])\n' - '\n' - ' Called after the instance has been created (by ' - '"__new__()"), but\n' - ' before it is returned to the caller. The arguments are ' - 'those\n' - ' passed to the class constructor expression. If a base ' - 'class has an\n' - ' "__init__()" method, the derived class\'s "__init__()" ' - 'method, if\n' - ' any, must explicitly call it to ensure proper ' - 'initialization of the\n' - ' base class part of the instance; for example:\n' - ' "BaseClass.__init__(self, [args...])".\n' - '\n' - ' Because "__new__()" and "__init__()" work together in ' - 'constructing\n' - ' objects ("__new__()" to create it, and "__init__()" to ' - 'customise\n' - ' it), no non-"None" value may be returned by "__init__()"; ' - 'doing so\n' - ' will cause a "TypeError" to be raised at runtime.\n' - '\n' - 'object.__del__(self)\n' - '\n' - ' Called when the instance is about to be destroyed. This ' - 'is also\n' - ' called a destructor. If a base class has a "__del__()" ' - 'method, the\n' - ' derived class\'s "__del__()" method, if any, must ' - 'explicitly call it\n' - ' to ensure proper deletion of the base class part of the ' - 'instance.\n' - ' Note that it is possible (though not recommended!) for ' - 'the\n' - ' "__del__()" method to postpone destruction of the ' - 'instance by\n' - ' creating a new reference to it. It may then be called at ' - 'a later\n' - ' time when this new reference is deleted. It is not ' - 'guaranteed that\n' - ' "__del__()" methods are called for objects that still ' - 'exist when\n' - ' the interpreter exits.\n' - '\n' - ' Note: "del x" doesn\'t directly call "x.__del__()" --- ' - 'the former\n' - ' decrements the reference count for "x" by one, and the ' - 'latter is\n' - ' only called when "x"\'s reference count reaches zero. ' - 'Some common\n' - ' situations that may prevent the reference count of an ' - 'object from\n' - ' going to zero include: circular references between ' - 'objects (e.g.,\n' - ' a doubly-linked list or a tree data structure with ' - 'parent and\n' - ' child pointers); a reference to the object on the stack ' - 'frame of\n' - ' a function that caught an exception (the traceback ' - 'stored in\n' - ' "sys.exc_traceback" keeps the stack frame alive); or a ' - 'reference\n' - ' to the object on the stack frame that raised an ' - 'unhandled\n' - ' exception in interactive mode (the traceback stored in\n' - ' "sys.last_traceback" keeps the stack frame alive). The ' - 'first\n' - ' situation can only be remedied by explicitly breaking ' - 'the cycles;\n' - ' the latter two situations can be resolved by storing ' - '"None" in\n' - ' "sys.exc_traceback" or "sys.last_traceback". Circular ' - 'references\n' - ' which are garbage are detected when the option cycle ' - 'detector is\n' - " enabled (it's on by default), but can only be cleaned " - 'up if there\n' - ' are no Python-level "__del__()" methods involved. Refer ' - 'to the\n' - ' documentation for the "gc" module for more information ' - 'about how\n' - ' "__del__()" methods are handled by the cycle detector,\n' - ' particularly the description of the "garbage" value.\n' - '\n' - ' Warning: Due to the precarious circumstances under which\n' - ' "__del__()" methods are invoked, exceptions that occur ' - 'during\n' - ' their execution are ignored, and a warning is printed ' - 'to\n' - ' "sys.stderr" instead. Also, when "__del__()" is invoked ' - 'in\n' - ' response to a module being deleted (e.g., when ' - 'execution of the\n' - ' program is done), other globals referenced by the ' - '"__del__()"\n' - ' method may already have been deleted or in the process ' - 'of being\n' - ' torn down (e.g. the import machinery shutting down). ' - 'For this\n' - ' reason, "__del__()" methods should do the absolute ' - 'minimum needed\n' - ' to maintain external invariants. Starting with version ' - '1.5,\n' - ' Python guarantees that globals whose name begins with a ' - 'single\n' - ' underscore are deleted from their module before other ' - 'globals are\n' - ' deleted; if no other references to such globals exist, ' - 'this may\n' - ' help in assuring that imported modules are still ' - 'available at the\n' - ' time when the "__del__()" method is called.\n' - '\n' - ' See also the "-R" command-line option.\n' - '\n' - 'object.__repr__(self)\n' - '\n' - ' Called by the "repr()" built-in function and by string ' - 'conversions\n' - ' (reverse quotes) to compute the "official" string ' - 'representation of\n' - ' an object. If at all possible, this should look like a ' - 'valid\n' - ' Python expression that could be used to recreate an ' - 'object with the\n' - ' same value (given an appropriate environment). If this ' - 'is not\n' - ' possible, a string of the form "<...some useful ' - 'description...>"\n' - ' should be returned. The return value must be a string ' - 'object. If a\n' - ' class defines "__repr__()" but not "__str__()", then ' - '"__repr__()"\n' - ' is also used when an "informal" string representation of ' - 'instances\n' - ' of that class is required.\n' - '\n' - ' This is typically used for debugging, so it is important ' - 'that the\n' - ' representation is information-rich and unambiguous.\n' - '\n' - 'object.__str__(self)\n' - '\n' - ' Called by the "str()" built-in function and by the ' - '"print"\n' - ' statement to compute the "informal" string representation ' - 'of an\n' - ' object. This differs from "__repr__()" in that it does ' - 'not have to\n' - ' be a valid Python expression: a more convenient or ' - 'concise\n' - ' representation may be used instead. The return value must ' - 'be a\n' - ' string object.\n' - '\n' - 'object.__lt__(self, other)\n' - 'object.__le__(self, other)\n' - 'object.__eq__(self, other)\n' - 'object.__ne__(self, other)\n' - 'object.__gt__(self, other)\n' - 'object.__ge__(self, other)\n' - '\n' - ' New in version 2.1.\n' - '\n' - ' These are the so-called "rich comparison" methods, and ' - 'are called\n' - ' for comparison operators in preference to "__cmp__()" ' - 'below. The\n' - ' correspondence between operator symbols and method names ' - 'is as\n' - ' follows: "xy" call ' - '"x.__ne__(y)",\n' - ' "x>y" calls "x.__gt__(y)", and "x>=y" calls ' - '"x.__ge__(y)".\n' - '\n' - ' A rich comparison method may return the singleton ' - '"NotImplemented"\n' - ' if it does not implement the operation for a given pair ' - 'of\n' - ' arguments. By convention, "False" and "True" are returned ' - 'for a\n' - ' successful comparison. However, these methods can return ' - 'any value,\n' - ' so if the comparison operator is used in a Boolean ' - 'context (e.g.,\n' - ' in the condition of an "if" statement), Python will call ' - '"bool()"\n' - ' on the value to determine if the result is true or ' - 'false.\n' - '\n' - ' There are no implied relationships among the comparison ' - 'operators.\n' - ' The truth of "x==y" does not imply that "x!=y" is false.\n' - ' Accordingly, when defining "__eq__()", one should also ' - 'define\n' - ' "__ne__()" so that the operators will behave as ' - 'expected. See the\n' - ' paragraph on "__hash__()" for some important notes on ' - 'creating\n' - ' *hashable* objects which support custom comparison ' - 'operations and\n' - ' are usable as dictionary keys.\n' - '\n' - ' There are no swapped-argument versions of these methods ' - '(to be used\n' - ' when the left argument does not support the operation but ' - 'the right\n' - ' argument does); rather, "__lt__()" and "__gt__()" are ' - "each other's\n" - ' reflection, "__le__()" and "__ge__()" are each other\'s ' - 'reflection,\n' - ' and "__eq__()" and "__ne__()" are their own reflection.\n' - '\n' - ' Arguments to rich comparison methods are never coerced.\n' - '\n' - ' To automatically generate ordering operations from a ' - 'single root\n' - ' operation, see "functools.total_ordering()".\n' - '\n' - 'object.__cmp__(self, other)\n' - '\n' - ' Called by comparison operations if rich comparison (see ' - 'above) is\n' - ' not defined. Should return a negative integer if "self < ' - 'other",\n' - ' zero if "self == other", a positive integer if "self > ' - 'other". If\n' - ' no "__cmp__()", "__eq__()" or "__ne__()" operation is ' - 'defined,\n' - ' class instances are compared by object identity ' - '("address"). See\n' - ' also the description of "__hash__()" for some important ' - 'notes on\n' - ' creating *hashable* objects which support custom ' - 'comparison\n' - ' operations and are usable as dictionary keys. (Note: the\n' - ' restriction that exceptions are not propagated by ' - '"__cmp__()" has\n' - ' been removed since Python 1.5.)\n' - '\n' - 'object.__rcmp__(self, other)\n' - '\n' - ' Changed in version 2.1: No longer supported.\n' - '\n' - 'object.__hash__(self)\n' - '\n' - ' Called by built-in function "hash()" and for operations ' - 'on members\n' - ' of hashed collections including "set", "frozenset", and ' - '"dict".\n' - ' "__hash__()" should return an integer. The only required ' - 'property\n' - ' is that objects which compare equal have the same hash ' - 'value; it is\n' - ' advised to somehow mix together (e.g. using exclusive or) ' - 'the hash\n' - ' values for the components of the object that also play a ' - 'part in\n' - ' comparison of objects.\n' - '\n' - ' If a class does not define a "__cmp__()" or "__eq__()" ' - 'method it\n' - ' should not define a "__hash__()" operation either; if it ' - 'defines\n' - ' "__cmp__()" or "__eq__()" but not "__hash__()", its ' - 'instances will\n' - ' not be usable in hashed collections. If a class defines ' - 'mutable\n' - ' objects and implements a "__cmp__()" or "__eq__()" ' - 'method, it\n' - ' should not implement "__hash__()", since hashable ' - 'collection\n' - " implementations require that a object's hash value is " - 'immutable (if\n' - " the object's hash value changes, it will be in the wrong " - 'hash\n' - ' bucket).\n' - '\n' - ' User-defined classes have "__cmp__()" and "__hash__()" ' - 'methods by\n' - ' default; with them, all objects compare unequal (except ' - 'with\n' - ' themselves) and "x.__hash__()" returns a result derived ' - 'from\n' - ' "id(x)".\n' - '\n' - ' Classes which inherit a "__hash__()" method from a parent ' - 'class but\n' - ' change the meaning of "__cmp__()" or "__eq__()" such that ' - 'the hash\n' - ' value returned is no longer appropriate (e.g. by ' - 'switching to a\n' - ' value-based concept of equality instead of the default ' - 'identity\n' - ' based equality) can explicitly flag themselves as being ' - 'unhashable\n' - ' by setting "__hash__ = None" in the class definition. ' - 'Doing so\n' - ' means that not only will instances of the class raise an\n' - ' appropriate "TypeError" when a program attempts to ' - 'retrieve their\n' - ' hash value, but they will also be correctly identified ' - 'as\n' - ' unhashable when checking "isinstance(obj, ' - 'collections.Hashable)"\n' - ' (unlike classes which define their own "__hash__()" to ' - 'explicitly\n' - ' raise "TypeError").\n' - '\n' - ' Changed in version 2.5: "__hash__()" may now also return ' - 'a long\n' - ' integer object; the 32-bit integer is then derived from ' - 'the hash of\n' - ' that object.\n' - '\n' - ' Changed in version 2.6: "__hash__" may now be set to ' - '"None" to\n' - ' explicitly flag instances of a class as unhashable.\n' - '\n' - 'object.__nonzero__(self)\n' - '\n' - ' Called to implement truth value testing and the built-in ' - 'operation\n' - ' "bool()"; should return "False" or "True", or their ' - 'integer\n' - ' equivalents "0" or "1". When this method is not ' - 'defined,\n' - ' "__len__()" is called, if it is defined, and the object ' - 'is\n' - ' considered true if its result is nonzero. If a class ' - 'defines\n' - ' neither "__len__()" nor "__nonzero__()", all its ' - 'instances are\n' - ' considered true.\n' - '\n' - 'object.__unicode__(self)\n' - '\n' - ' Called to implement "unicode()" built-in; should return a ' - 'Unicode\n' - ' object. When this method is not defined, string ' - 'conversion is\n' - ' attempted, and the result of string conversion is ' - 'converted to\n' - ' Unicode using the system default encoding.\n' - '\n' - '\n' - 'Customizing attribute access\n' - '============================\n' - '\n' - 'The following methods can be defined to customize the ' - 'meaning of\n' - 'attribute access (use of, assignment to, or deletion of ' - '"x.name") for\n' - 'class instances.\n' - '\n' - 'object.__getattr__(self, name)\n' - '\n' - ' Called when an attribute lookup has not found the ' - 'attribute in the\n' - ' usual places (i.e. it is not an instance attribute nor is ' - 'it found\n' - ' in the class tree for "self"). "name" is the attribute ' - 'name. This\n' - ' method should return the (computed) attribute value or ' - 'raise an\n' - ' "AttributeError" exception.\n' - '\n' - ' Note that if the attribute is found through the normal ' - 'mechanism,\n' - ' "__getattr__()" is not called. (This is an intentional ' - 'asymmetry\n' - ' between "__getattr__()" and "__setattr__()".) This is ' - 'done both for\n' - ' efficiency reasons and because otherwise "__getattr__()" ' - 'would have\n' - ' no way to access other attributes of the instance. Note ' - 'that at\n' - ' least for instance variables, you can fake total control ' - 'by not\n' - ' inserting any values in the instance attribute dictionary ' - '(but\n' - ' instead inserting them in another object). See the\n' - ' "__getattribute__()" method below for a way to actually ' - 'get total\n' - ' control in new-style classes.\n' - '\n' - 'object.__setattr__(self, name, value)\n' - '\n' - ' Called when an attribute assignment is attempted. This ' - 'is called\n' - ' instead of the normal mechanism (i.e. store the value in ' - 'the\n' - ' instance dictionary). *name* is the attribute name, ' - '*value* is the\n' - ' value to be assigned to it.\n' - '\n' - ' If "__setattr__()" wants to assign to an instance ' - 'attribute, it\n' - ' should not simply execute "self.name = value" --- this ' - 'would cause\n' - ' a recursive call to itself. Instead, it should insert ' - 'the value in\n' - ' the dictionary of instance attributes, e.g., ' - '"self.__dict__[name] =\n' - ' value". For new-style classes, rather than accessing the ' - 'instance\n' - ' dictionary, it should call the base class method with the ' - 'same\n' - ' name, for example, "object.__setattr__(self, name, ' - 'value)".\n' - '\n' - 'object.__delattr__(self, name)\n' - '\n' - ' Like "__setattr__()" but for attribute deletion instead ' - 'of\n' - ' assignment. This should only be implemented if "del ' - 'obj.name" is\n' - ' meaningful for the object.\n' - '\n' - '\n' - 'More attribute access for new-style classes\n' - '-------------------------------------------\n' - '\n' - 'The following methods only apply to new-style classes.\n' - '\n' - 'object.__getattribute__(self, name)\n' - '\n' - ' Called unconditionally to implement attribute accesses ' - 'for\n' - ' instances of the class. If the class also defines ' - '"__getattr__()",\n' - ' the latter will not be called unless "__getattribute__()" ' - 'either\n' - ' calls it explicitly or raises an "AttributeError". This ' - 'method\n' - ' should return the (computed) attribute value or raise an\n' - ' "AttributeError" exception. In order to avoid infinite ' - 'recursion in\n' - ' this method, its implementation should always call the ' - 'base class\n' - ' method with the same name to access any attributes it ' - 'needs, for\n' - ' example, "object.__getattribute__(self, name)".\n' - '\n' - ' Note: This method may still be bypassed when looking up ' - 'special\n' - ' methods as the result of implicit invocation via ' - 'language syntax\n' - ' or built-in functions. See Special method lookup for ' - 'new-style\n' - ' classes.\n' - '\n' - '\n' - 'Implementing Descriptors\n' - '------------------------\n' - '\n' - 'The following methods only apply when an instance of the ' - 'class\n' - 'containing the method (a so-called *descriptor* class) ' - 'appears in an\n' - "*owner* class (the descriptor must be in either the owner's " - 'class\n' - 'dictionary or in the class dictionary for one of its ' - 'parents). In the\n' - 'examples below, "the attribute" refers to the attribute ' - 'whose name is\n' - 'the key of the property in the owner class\' "__dict__".\n' - '\n' - 'object.__get__(self, instance, owner)\n' - '\n' - ' Called to get the attribute of the owner class (class ' - 'attribute\n' - ' access) or of an instance of that class (instance ' - 'attribute\n' - ' access). *owner* is always the owner class, while ' - '*instance* is the\n' - ' instance that the attribute was accessed through, or ' - '"None" when\n' - ' the attribute is accessed through the *owner*. This ' - 'method should\n' - ' return the (computed) attribute value or raise an ' - '"AttributeError"\n' - ' exception.\n' - '\n' - 'object.__set__(self, instance, value)\n' - '\n' - ' Called to set the attribute on an instance *instance* of ' - 'the owner\n' - ' class to a new value, *value*.\n' - '\n' - 'object.__delete__(self, instance)\n' - '\n' - ' Called to delete the attribute on an instance *instance* ' - 'of the\n' - ' owner class.\n' - '\n' - '\n' - 'Invoking Descriptors\n' - '--------------------\n' - '\n' - 'In general, a descriptor is an object attribute with ' - '"binding\n' - 'behavior", one whose attribute access has been overridden by ' - 'methods\n' - 'in the descriptor protocol: "__get__()", "__set__()", and\n' - '"__delete__()". If any of those methods are defined for an ' - 'object, it\n' - 'is said to be a descriptor.\n' - '\n' - 'The default behavior for attribute access is to get, set, or ' - 'delete\n' - "the attribute from an object's dictionary. For instance, " - '"a.x" has a\n' - 'lookup chain starting with "a.__dict__[\'x\']", then\n' - '"type(a).__dict__[\'x\']", and continuing through the base ' - 'classes of\n' - '"type(a)" excluding metaclasses.\n' - '\n' - 'However, if the looked-up value is an object defining one of ' - 'the\n' - 'descriptor methods, then Python may override the default ' - 'behavior and\n' - 'invoke the descriptor method instead. Where this occurs in ' - 'the\n' - 'precedence chain depends on which descriptor methods were ' - 'defined and\n' - 'how they were called. Note that descriptors are only ' - 'invoked for new\n' - 'style objects or classes (ones that subclass "object()" or ' - '"type()").\n' - '\n' - 'The starting point for descriptor invocation is a binding, ' - '"a.x". How\n' - 'the arguments are assembled depends on "a":\n' - '\n' - 'Direct Call\n' - ' The simplest and least common call is when user code ' - 'directly\n' - ' invokes a descriptor method: "x.__get__(a)".\n' - '\n' - 'Instance Binding\n' - ' If binding to a new-style object instance, "a.x" is ' - 'transformed\n' - ' into the call: "type(a).__dict__[\'x\'].__get__(a, ' - 'type(a))".\n' - '\n' - 'Class Binding\n' - ' If binding to a new-style class, "A.x" is transformed ' - 'into the\n' - ' call: "A.__dict__[\'x\'].__get__(None, A)".\n' - '\n' - 'Super Binding\n' - ' If "a" is an instance of "super", then the binding ' - '"super(B,\n' - ' obj).m()" searches "obj.__class__.__mro__" for the base ' - 'class "A"\n' - ' immediately preceding "B" and then invokes the descriptor ' - 'with the\n' - ' call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n' - '\n' - 'For instance bindings, the precedence of descriptor ' - 'invocation depends\n' - 'on the which descriptor methods are defined. A descriptor ' - 'can define\n' - 'any combination of "__get__()", "__set__()" and ' - '"__delete__()". If it\n' - 'does not define "__get__()", then accessing the attribute ' - 'will return\n' - 'the descriptor object itself unless there is a value in the ' - "object's\n" - 'instance dictionary. If the descriptor defines "__set__()" ' - 'and/or\n' - '"__delete__()", it is a data descriptor; if it defines ' - 'neither, it is\n' - 'a non-data descriptor. Normally, data descriptors define ' - 'both\n' - '"__get__()" and "__set__()", while non-data descriptors have ' - 'just the\n' - '"__get__()" method. Data descriptors with "__set__()" and ' - '"__get__()"\n' - 'defined always override a redefinition in an instance ' - 'dictionary. In\n' - 'contrast, non-data descriptors can be overridden by ' - 'instances.\n' - '\n' - 'Python methods (including "staticmethod()" and ' - '"classmethod()") are\n' - 'implemented as non-data descriptors. Accordingly, instances ' - 'can\n' - 'redefine and override methods. This allows individual ' - 'instances to\n' - 'acquire behaviors that differ from other instances of the ' - 'same class.\n' - '\n' - 'The "property()" function is implemented as a data ' - 'descriptor.\n' - 'Accordingly, instances cannot override the behavior of a ' - 'property.\n' - '\n' - '\n' - '__slots__\n' - '---------\n' - '\n' - 'By default, instances of both old and new-style classes have ' - 'a\n' - 'dictionary for attribute storage. This wastes space for ' - 'objects\n' - 'having very few instance variables. The space consumption ' - 'can become\n' - 'acute when creating large numbers of instances.\n' - '\n' - 'The default can be overridden by defining *__slots__* in a ' - 'new-style\n' - 'class definition. The *__slots__* declaration takes a ' - 'sequence of\n' - 'instance variables and reserves just enough space in each ' - 'instance to\n' - 'hold a value for each variable. Space is saved because ' - '*__dict__* is\n' - 'not created for each instance.\n' - '\n' - '__slots__\n' - '\n' - ' This class variable can be assigned a string, iterable, ' - 'or sequence\n' - ' of strings with variable names used by instances. If ' - 'defined in a\n' - ' new-style class, *__slots__* reserves space for the ' - 'declared\n' - ' variables and prevents the automatic creation of ' - '*__dict__* and\n' - ' *__weakref__* for each instance.\n' - '\n' - ' New in version 2.2.\n' - '\n' - 'Notes on using *__slots__*\n' - '\n' - '* When inheriting from a class without *__slots__*, the ' - '*__dict__*\n' - ' attribute of that class will always be accessible, so a ' - '*__slots__*\n' - ' definition in the subclass is meaningless.\n' - '\n' - '* Without a *__dict__* variable, instances cannot be ' - 'assigned new\n' - ' variables not listed in the *__slots__* definition. ' - 'Attempts to\n' - ' assign to an unlisted variable name raises ' - '"AttributeError". If\n' - ' dynamic assignment of new variables is desired, then add\n' - ' "\'__dict__\'" to the sequence of strings in the ' - '*__slots__*\n' - ' declaration.\n' - '\n' - ' Changed in version 2.3: Previously, adding "\'__dict__\'" ' - 'to the\n' - ' *__slots__* declaration would not enable the assignment of ' - 'new\n' - ' attributes not specifically listed in the sequence of ' - 'instance\n' - ' variable names.\n' - '\n' - '* Without a *__weakref__* variable for each instance, ' - 'classes\n' - ' defining *__slots__* do not support weak references to ' - 'its\n' - ' instances. If weak reference support is needed, then add\n' - ' "\'__weakref__\'" to the sequence of strings in the ' - '*__slots__*\n' - ' declaration.\n' - '\n' - ' Changed in version 2.3: Previously, adding ' - '"\'__weakref__\'" to the\n' - ' *__slots__* declaration would not enable support for weak\n' - ' references.\n' - '\n' - '* *__slots__* are implemented at the class level by ' - 'creating\n' - ' descriptors (Implementing Descriptors) for each variable ' - 'name. As a\n' - ' result, class attributes cannot be used to set default ' - 'values for\n' - ' instance variables defined by *__slots__*; otherwise, the ' - 'class\n' - ' attribute would overwrite the descriptor assignment.\n' - '\n' - '* The action of a *__slots__* declaration is limited to the ' - 'class\n' - ' where it is defined. As a result, subclasses will have a ' - '*__dict__*\n' - ' unless they also define *__slots__* (which must only ' - 'contain names\n' - ' of any *additional* slots).\n' - '\n' - '* If a class defines a slot also defined in a base class, ' - 'the\n' - ' instance variable defined by the base class slot is ' - 'inaccessible\n' - ' (except by retrieving its descriptor directly from the ' - 'base class).\n' - ' This renders the meaning of the program undefined. In the ' - 'future, a\n' - ' check may be added to prevent this.\n' - '\n' - '* Nonempty *__slots__* does not work for classes derived ' - 'from\n' - ' "variable-length" built-in types such as "long", "str" and ' - '"tuple".\n' - '\n' - '* Any non-string iterable may be assigned to *__slots__*. ' - 'Mappings\n' - ' may also be used; however, in the future, special meaning ' - 'may be\n' - ' assigned to the values corresponding to each key.\n' - '\n' - '* *__class__* assignment works only if both classes have the ' - 'same\n' - ' *__slots__*.\n' - '\n' - ' Changed in version 2.6: Previously, *__class__* assignment ' - 'raised an\n' - ' error if either new or old class had *__slots__*.\n' - '\n' - '\n' - 'Customizing class creation\n' - '==========================\n' - '\n' - 'By default, new-style classes are constructed using ' - '"type()". A class\n' - 'definition is read into a separate namespace and the value ' - 'of class\n' - 'name is bound to the result of "type(name, bases, dict)".\n' - '\n' - 'When the class definition is read, if *__metaclass__* is ' - 'defined then\n' - 'the callable assigned to it will be called instead of ' - '"type()". This\n' - 'allows classes or functions to be written which monitor or ' - 'alter the\n' - 'class creation process:\n' - '\n' - '* Modifying the class dictionary prior to the class being ' - 'created.\n' - '\n' - '* Returning an instance of another class -- essentially ' - 'performing\n' - ' the role of a factory function.\n' - '\n' - "These steps will have to be performed in the metaclass's " - '"__new__()"\n' - 'method -- "type.__new__()" can then be called from this ' - 'method to\n' - 'create a class with different properties. This example adds ' - 'a new\n' - 'element to the class dictionary before creating the class:\n' - '\n' - ' class metacls(type):\n' - ' def __new__(mcs, name, bases, dict):\n' - " dict['foo'] = 'metacls was here'\n" - ' return type.__new__(mcs, name, bases, dict)\n' - '\n' - 'You can of course also override other class methods (or add ' - 'new\n' - 'methods); for example defining a custom "__call__()" method ' - 'in the\n' - 'metaclass allows custom behavior when the class is called, ' - 'e.g. not\n' - 'always creating a new instance.\n' - '\n' - '__metaclass__\n' - '\n' - ' This variable can be any callable accepting arguments for ' - '"name",\n' - ' "bases", and "dict". Upon class creation, the callable ' - 'is used\n' - ' instead of the built-in "type()".\n' - '\n' - ' New in version 2.2.\n' - '\n' - 'The appropriate metaclass is determined by the following ' - 'precedence\n' - 'rules:\n' - '\n' - '* If "dict[\'__metaclass__\']" exists, it is used.\n' - '\n' - '* Otherwise, if there is at least one base class, its ' - 'metaclass is\n' - ' used (this looks for a *__class__* attribute first and if ' - 'not found,\n' - ' uses its type).\n' - '\n' - '* Otherwise, if a global variable named __metaclass__ ' - 'exists, it is\n' - ' used.\n' - '\n' - '* Otherwise, the old-style, classic metaclass ' - '(types.ClassType) is\n' - ' used.\n' - '\n' - 'The potential uses for metaclasses are boundless. Some ideas ' - 'that have\n' - 'been explored including logging, interface checking, ' - 'automatic\n' - 'delegation, automatic property creation, proxies, ' - 'frameworks, and\n' - 'automatic resource locking/synchronization.\n' - '\n' - '\n' - 'Customizing instance and subclass checks\n' - '========================================\n' - '\n' - 'New in version 2.6.\n' - '\n' - 'The following methods are used to override the default ' - 'behavior of the\n' - '"isinstance()" and "issubclass()" built-in functions.\n' - '\n' - 'In particular, the metaclass "abc.ABCMeta" implements these ' - 'methods in\n' - 'order to allow the addition of Abstract Base Classes (ABCs) ' - 'as\n' - '"virtual base classes" to any class or type (including ' - 'built-in\n' - 'types), including other ABCs.\n' - '\n' - 'class.__instancecheck__(self, instance)\n' - '\n' - ' Return true if *instance* should be considered a (direct ' - 'or\n' - ' indirect) instance of *class*. If defined, called to ' - 'implement\n' - ' "isinstance(instance, class)".\n' - '\n' - 'class.__subclasscheck__(self, subclass)\n' - '\n' - ' Return true if *subclass* should be considered a (direct ' - 'or\n' - ' indirect) subclass of *class*. If defined, called to ' - 'implement\n' - ' "issubclass(subclass, class)".\n' - '\n' - 'Note that these methods are looked up on the type ' - '(metaclass) of a\n' - 'class. They cannot be defined as class methods in the ' - 'actual class.\n' - 'This is consistent with the lookup of special methods that ' - 'are called\n' - 'on instances, only in this case the instance is itself a ' - 'class.\n' - '\n' - 'See also:\n' - '\n' - ' **PEP 3119** - Introducing Abstract Base Classes\n' - ' Includes the specification for customizing ' - '"isinstance()" and\n' - ' "issubclass()" behavior through "__instancecheck__()" ' - 'and\n' - ' "__subclasscheck__()", with motivation for this ' - 'functionality in\n' - ' the context of adding Abstract Base Classes (see the ' - '"abc"\n' - ' module) to the language.\n' - '\n' - '\n' - 'Emulating callable objects\n' - '==========================\n' - '\n' - 'object.__call__(self[, args...])\n' - '\n' - ' Called when the instance is "called" as a function; if ' - 'this method\n' - ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' - ' "x.__call__(arg1, arg2, ...)".\n' - '\n' - '\n' - 'Emulating container types\n' - '=========================\n' - '\n' - 'The following methods can be defined to implement container ' - 'objects.\n' - 'Containers usually are sequences (such as lists or tuples) ' - 'or mappings\n' - '(like dictionaries), but can represent other containers as ' - 'well. The\n' - 'first set of methods is used either to emulate a sequence or ' - 'to\n' - 'emulate a mapping; the difference is that for a sequence, ' - 'the\n' - 'allowable keys should be the integers *k* for which "0 <= k ' - '< N" where\n' - '*N* is the length of the sequence, or slice objects, which ' - 'define a\n' - 'range of items. (For backwards compatibility, the method\n' - '"__getslice__()" (see below) can also be defined to handle ' - 'simple, but\n' - 'not extended slices.) It is also recommended that mappings ' - 'provide the\n' - 'methods "keys()", "values()", "items()", "has_key()", ' - '"get()",\n' - '"clear()", "setdefault()", "iterkeys()", "itervalues()",\n' - '"iteritems()", "pop()", "popitem()", "copy()", and ' - '"update()" behaving\n' - "similar to those for Python's standard dictionary objects. " - 'The\n' - '"UserDict" module provides a "DictMixin" class to help ' - 'create those\n' - 'methods from a base set of "__getitem__()", ' - '"__setitem__()",\n' - '"__delitem__()", and "keys()". Mutable sequences should ' - 'provide\n' - 'methods "append()", "count()", "index()", "extend()", ' - '"insert()",\n' - '"pop()", "remove()", "reverse()" and "sort()", like Python ' - 'standard\n' - 'list objects. Finally, sequence types should implement ' - 'addition\n' - '(meaning concatenation) and multiplication (meaning ' - 'repetition) by\n' - 'defining the methods "__add__()", "__radd__()", ' - '"__iadd__()",\n' - '"__mul__()", "__rmul__()" and "__imul__()" described below; ' - 'they\n' - 'should not define "__coerce__()" or other numerical ' - 'operators. It is\n' - 'recommended that both mappings and sequences implement the\n' - '"__contains__()" method to allow efficient use of the "in" ' - 'operator;\n' - 'for mappings, "in" should be equivalent of "has_key()"; for ' - 'sequences,\n' - 'it should search through the values. It is further ' - 'recommended that\n' - 'both mappings and sequences implement the "__iter__()" ' - 'method to allow\n' - 'efficient iteration through the container; for mappings, ' - '"__iter__()"\n' - 'should be the same as "iterkeys()"; for sequences, it should ' - 'iterate\n' - 'through the values.\n' - '\n' - 'object.__len__(self)\n' - '\n' - ' Called to implement the built-in function "len()". ' - 'Should return\n' - ' the length of the object, an integer ">=" 0. Also, an ' - 'object that\n' - ' doesn\'t define a "__nonzero__()" method and whose ' - '"__len__()"\n' - ' method returns zero is considered to be false in a ' - 'Boolean context.\n' - '\n' - 'object.__getitem__(self, key)\n' - '\n' - ' Called to implement evaluation of "self[key]". For ' - 'sequence types,\n' - ' the accepted keys should be integers and slice objects. ' - 'Note that\n' - ' the special interpretation of negative indexes (if the ' - 'class wishes\n' - ' to emulate a sequence type) is up to the "__getitem__()" ' - 'method. If\n' - ' *key* is of an inappropriate type, "TypeError" may be ' - 'raised; if of\n' - ' a value outside the set of indexes for the sequence ' - '(after any\n' - ' special interpretation of negative values), "IndexError" ' - 'should be\n' - ' raised. For mapping types, if *key* is missing (not in ' - 'the\n' - ' container), "KeyError" should be raised.\n' - '\n' - ' Note: "for" loops expect that an "IndexError" will be ' - 'raised for\n' - ' illegal indexes to allow proper detection of the end of ' - 'the\n' - ' sequence.\n' - '\n' - 'object.__missing__(self, key)\n' - '\n' - ' Called by "dict"."__getitem__()" to implement "self[key]" ' - 'for dict\n' - ' subclasses when key is not in the dictionary.\n' - '\n' - 'object.__setitem__(self, key, value)\n' - '\n' - ' Called to implement assignment to "self[key]". Same note ' - 'as for\n' - ' "__getitem__()". This should only be implemented for ' - 'mappings if\n' - ' the objects support changes to the values for keys, or if ' - 'new keys\n' - ' can be added, or for sequences if elements can be ' - 'replaced. The\n' - ' same exceptions should be raised for improper *key* ' - 'values as for\n' - ' the "__getitem__()" method.\n' - '\n' - 'object.__delitem__(self, key)\n' - '\n' - ' Called to implement deletion of "self[key]". Same note ' - 'as for\n' - ' "__getitem__()". This should only be implemented for ' - 'mappings if\n' - ' the objects support removal of keys, or for sequences if ' - 'elements\n' - ' can be removed from the sequence. The same exceptions ' - 'should be\n' - ' raised for improper *key* values as for the ' - '"__getitem__()" method.\n' - '\n' - 'object.__iter__(self)\n' - '\n' - ' This method is called when an iterator is required for a ' - 'container.\n' - ' This method should return a new iterator object that can ' - 'iterate\n' - ' over all the objects in the container. For mappings, it ' - 'should\n' - ' iterate over the keys of the container, and should also ' - 'be made\n' - ' available as the method "iterkeys()".\n' - '\n' - ' Iterator objects also need to implement this method; they ' - 'are\n' - ' required to return themselves. For more information on ' - 'iterator\n' - ' objects, see Iterator Types.\n' - '\n' - 'object.__reversed__(self)\n' - '\n' - ' Called (if present) by the "reversed()" built-in to ' - 'implement\n' - ' reverse iteration. It should return a new iterator ' - 'object that\n' - ' iterates over all the objects in the container in reverse ' - 'order.\n' - '\n' - ' If the "__reversed__()" method is not provided, the ' - '"reversed()"\n' - ' built-in will fall back to using the sequence protocol ' - '("__len__()"\n' - ' and "__getitem__()"). Objects that support the sequence ' - 'protocol\n' - ' should only provide "__reversed__()" if they can provide ' - 'an\n' - ' implementation that is more efficient than the one ' - 'provided by\n' - ' "reversed()".\n' - '\n' - ' New in version 2.6.\n' - '\n' - 'The membership test operators ("in" and "not in") are ' - 'normally\n' - 'implemented as an iteration through a sequence. However, ' - 'container\n' - 'objects can supply the following special method with a more ' - 'efficient\n' - 'implementation, which also does not require the object be a ' - 'sequence.\n' - '\n' - 'object.__contains__(self, item)\n' - '\n' - ' Called to implement membership test operators. Should ' - 'return true\n' - ' if *item* is in *self*, false otherwise. For mapping ' - 'objects, this\n' - ' should consider the keys of the mapping rather than the ' - 'values or\n' - ' the key-item pairs.\n' - '\n' - ' For objects that don\'t define "__contains__()", the ' - 'membership test\n' - ' first tries iteration via "__iter__()", then the old ' - 'sequence\n' - ' iteration protocol via "__getitem__()", see this section ' - 'in the\n' - ' language reference.\n' - '\n' - '\n' - 'Additional methods for emulation of sequence types\n' - '==================================================\n' - '\n' - 'The following optional methods can be defined to further ' - 'emulate\n' - 'sequence objects. Immutable sequences methods should at ' - 'most only\n' - 'define "__getslice__()"; mutable sequences might define all ' - 'three\n' - 'methods.\n' - '\n' - 'object.__getslice__(self, i, j)\n' - '\n' - ' Deprecated since version 2.0: Support slice objects as ' - 'parameters\n' - ' to the "__getitem__()" method. (However, built-in types ' - 'in CPython\n' - ' currently still implement "__getslice__()". Therefore, ' - 'you have to\n' - ' override it in derived classes when implementing ' - 'slicing.)\n' - '\n' - ' Called to implement evaluation of "self[i:j]". The ' - 'returned object\n' - ' should be of the same type as *self*. Note that missing ' - '*i* or *j*\n' - ' in the slice expression are replaced by zero or ' - '"sys.maxsize",\n' - ' respectively. If negative indexes are used in the slice, ' - 'the\n' - ' length of the sequence is added to that index. If the ' - 'instance does\n' - ' not implement the "__len__()" method, an "AttributeError" ' - 'is\n' - ' raised. No guarantee is made that indexes adjusted this ' - 'way are not\n' - ' still negative. Indexes which are greater than the ' - 'length of the\n' - ' sequence are not modified. If no "__getslice__()" is ' - 'found, a slice\n' - ' object is created instead, and passed to "__getitem__()" ' - 'instead.\n' - '\n' - 'object.__setslice__(self, i, j, sequence)\n' - '\n' - ' Called to implement assignment to "self[i:j]". Same notes ' - 'for *i*\n' - ' and *j* as for "__getslice__()".\n' - '\n' - ' This method is deprecated. If no "__setslice__()" is ' - 'found, or for\n' - ' extended slicing of the form "self[i:j:k]", a slice ' - 'object is\n' - ' created, and passed to "__setitem__()", instead of ' - '"__setslice__()"\n' - ' being called.\n' - '\n' - 'object.__delslice__(self, i, j)\n' - '\n' - ' Called to implement deletion of "self[i:j]". Same notes ' - 'for *i* and\n' - ' *j* as for "__getslice__()". This method is deprecated. ' - 'If no\n' - ' "__delslice__()" is found, or for extended slicing of the ' - 'form\n' - ' "self[i:j:k]", a slice object is created, and passed to\n' - ' "__delitem__()", instead of "__delslice__()" being ' - 'called.\n' - '\n' - 'Notice that these methods are only invoked when a single ' - 'slice with a\n' - 'single colon is used, and the slice method is available. ' - 'For slice\n' - 'operations involving extended slice notation, or in absence ' - 'of the\n' - 'slice methods, "__getitem__()", "__setitem__()" or ' - '"__delitem__()" is\n' - 'called with a slice object as argument.\n' - '\n' - 'The following example demonstrate how to make your program ' - 'or module\n' - 'compatible with earlier versions of Python (assuming that ' - 'methods\n' - '"__getitem__()", "__setitem__()" and "__delitem__()" support ' - 'slice\n' - 'objects as arguments):\n' - '\n' - ' class MyClass:\n' - ' ...\n' - ' def __getitem__(self, index):\n' - ' ...\n' - ' def __setitem__(self, index, value):\n' - ' ...\n' - ' def __delitem__(self, index):\n' - ' ...\n' - '\n' - ' if sys.version_info < (2, 0):\n' - " # They won't be defined if version is at least " - '2.0 final\n' - '\n' - ' def __getslice__(self, i, j):\n' - ' return self[max(0, i):max(0, j):]\n' - ' def __setslice__(self, i, j, seq):\n' - ' self[max(0, i):max(0, j):] = seq\n' - ' def __delslice__(self, i, j):\n' - ' del self[max(0, i):max(0, j):]\n' - ' ...\n' - '\n' - 'Note the calls to "max()"; these are necessary because of ' - 'the handling\n' - 'of negative indices before the "__*slice__()" methods are ' - 'called.\n' - 'When negative indexes are used, the "__*item__()" methods ' - 'receive them\n' - 'as provided, but the "__*slice__()" methods get a "cooked" ' - 'form of the\n' - 'index values. For each negative index value, the length of ' - 'the\n' - 'sequence is added to the index before calling the method ' - '(which may\n' - 'still result in a negative index); this is the customary ' - 'handling of\n' - 'negative indexes by the built-in sequence types, and the ' - '"__*item__()"\n' - 'methods are expected to do this as well. However, since ' - 'they should\n' - 'already be doing that, negative indexes cannot be passed in; ' - 'they must\n' - 'be constrained to the bounds of the sequence before being ' - 'passed to\n' - 'the "__*item__()" methods. Calling "max(0, i)" conveniently ' - 'returns\n' - 'the proper value.\n' - '\n' - '\n' - 'Emulating numeric types\n' - '=======================\n' - '\n' - 'The following methods can be defined to emulate numeric ' - 'objects.\n' - 'Methods corresponding to operations that are not supported ' - 'by the\n' - 'particular kind of number implemented (e.g., bitwise ' - 'operations for\n' - 'non-integral numbers) should be left undefined.\n' - '\n' - 'object.__add__(self, other)\n' - 'object.__sub__(self, other)\n' - 'object.__mul__(self, other)\n' - 'object.__floordiv__(self, other)\n' - 'object.__mod__(self, other)\n' - 'object.__divmod__(self, other)\n' - 'object.__pow__(self, other[, modulo])\n' - 'object.__lshift__(self, other)\n' - 'object.__rshift__(self, other)\n' - 'object.__and__(self, other)\n' - 'object.__xor__(self, other)\n' - 'object.__or__(self, other)\n' - '\n' - ' These methods are called to implement the binary ' - 'arithmetic\n' - ' operations ("+", "-", "*", "//", "%", "divmod()", ' - '"pow()", "**",\n' - ' "<<", ">>", "&", "^", "|"). For instance, to evaluate ' - 'the\n' - ' expression "x + y", where *x* is an instance of a class ' - 'that has an\n' - ' "__add__()" method, "x.__add__(y)" is called. The ' - '"__divmod__()"\n' - ' method should be the equivalent to using "__floordiv__()" ' - 'and\n' - ' "__mod__()"; it should not be related to "__truediv__()" ' - '(described\n' - ' below). Note that "__pow__()" should be defined to ' - 'accept an\n' - ' optional third argument if the ternary version of the ' - 'built-in\n' - ' "pow()" function is to be supported.\n' - '\n' - ' If one of those methods does not support the operation ' - 'with the\n' - ' supplied arguments, it should return "NotImplemented".\n' - '\n' - 'object.__div__(self, other)\n' - 'object.__truediv__(self, other)\n' - '\n' - ' The division operator ("/") is implemented by these ' - 'methods. The\n' - ' "__truediv__()" method is used when "__future__.division" ' - 'is in\n' - ' effect, otherwise "__div__()" is used. If only one of ' - 'these two\n' - ' methods is defined, the object will not support division ' - 'in the\n' - ' alternate context; "TypeError" will be raised instead.\n' - '\n' - 'object.__radd__(self, other)\n' - 'object.__rsub__(self, other)\n' - 'object.__rmul__(self, other)\n' - 'object.__rdiv__(self, other)\n' - 'object.__rtruediv__(self, other)\n' - 'object.__rfloordiv__(self, other)\n' - 'object.__rmod__(self, other)\n' - 'object.__rdivmod__(self, other)\n' - 'object.__rpow__(self, other)\n' - 'object.__rlshift__(self, other)\n' - 'object.__rrshift__(self, other)\n' - 'object.__rand__(self, other)\n' - 'object.__rxor__(self, other)\n' - 'object.__ror__(self, other)\n' - '\n' - ' These methods are called to implement the binary ' - 'arithmetic\n' - ' operations ("+", "-", "*", "/", "%", "divmod()", "pow()", ' - '"**",\n' - ' "<<", ">>", "&", "^", "|") with reflected (swapped) ' - 'operands.\n' - ' These functions are only called if the left operand does ' - 'not\n' - ' support the corresponding operation and the operands are ' - 'of\n' - ' different types. [2] For instance, to evaluate the ' - 'expression "x -\n' - ' y", where *y* is an instance of a class that has an ' - '"__rsub__()"\n' - ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" ' - 'returns\n' - ' *NotImplemented*.\n' - '\n' - ' Note that ternary "pow()" will not try calling ' - '"__rpow__()" (the\n' - ' coercion rules would become too complicated).\n' - '\n' - " Note: If the right operand's type is a subclass of the " - 'left\n' - " operand's type and that subclass provides the reflected " - 'method\n' - ' for the operation, this method will be called before ' - 'the left\n' - " operand's non-reflected method. This behavior allows " - 'subclasses\n' - " to override their ancestors' operations.\n" - '\n' - 'object.__iadd__(self, other)\n' - 'object.__isub__(self, other)\n' - 'object.__imul__(self, other)\n' - 'object.__idiv__(self, other)\n' - 'object.__itruediv__(self, other)\n' - 'object.__ifloordiv__(self, other)\n' - 'object.__imod__(self, other)\n' - 'object.__ipow__(self, other[, modulo])\n' - 'object.__ilshift__(self, other)\n' - 'object.__irshift__(self, other)\n' - 'object.__iand__(self, other)\n' - 'object.__ixor__(self, other)\n' - 'object.__ior__(self, other)\n' - '\n' - ' These methods are called to implement the augmented ' - 'arithmetic\n' - ' assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", ' - '"<<=",\n' - ' ">>=", "&=", "^=", "|="). These methods should attempt ' - 'to do the\n' - ' operation in-place (modifying *self*) and return the ' - 'result (which\n' - ' could be, but does not have to be, *self*). If a ' - 'specific method\n' - ' is not defined, the augmented assignment falls back to ' - 'the normal\n' - ' methods. For instance, to execute the statement "x += ' - 'y", where\n' - ' *x* is an instance of a class that has an "__iadd__()" ' - 'method,\n' - ' "x.__iadd__(y)" is called. If *x* is an instance of a ' - 'class that\n' - ' does not define a "__iadd__()" method, "x.__add__(y)" ' - 'and\n' - ' "y.__radd__(x)" are considered, as with the evaluation of ' - '"x + y".\n' - '\n' - 'object.__neg__(self)\n' - 'object.__pos__(self)\n' - 'object.__abs__(self)\n' - 'object.__invert__(self)\n' - '\n' - ' Called to implement the unary arithmetic operations ("-", ' - '"+",\n' - ' "abs()" and "~").\n' - '\n' - 'object.__complex__(self)\n' - 'object.__int__(self)\n' - 'object.__long__(self)\n' - 'object.__float__(self)\n' - '\n' - ' Called to implement the built-in functions "complex()", ' - '"int()",\n' - ' "long()", and "float()". Should return a value of the ' - 'appropriate\n' - ' type.\n' - '\n' - 'object.__oct__(self)\n' - 'object.__hex__(self)\n' - '\n' - ' Called to implement the built-in functions "oct()" and ' - '"hex()".\n' - ' Should return a string value.\n' - '\n' - 'object.__index__(self)\n' - '\n' - ' Called to implement "operator.index()". Also called ' - 'whenever\n' - ' Python needs an integer object (such as in slicing). ' - 'Must return\n' - ' an integer (int or long).\n' - '\n' - ' New in version 2.5.\n' - '\n' - 'object.__coerce__(self, other)\n' - '\n' - ' Called to implement "mixed-mode" numeric arithmetic. ' - 'Should either\n' - ' return a 2-tuple containing *self* and *other* converted ' - 'to a\n' - ' common numeric type, or "None" if conversion is ' - 'impossible. When\n' - ' the common type would be the type of "other", it is ' - 'sufficient to\n' - ' return "None", since the interpreter will also ask the ' - 'other object\n' - ' to attempt a coercion (but sometimes, if the ' - 'implementation of the\n' - ' other type cannot be changed, it is useful to do the ' - 'conversion to\n' - ' the other type here). A return value of "NotImplemented" ' - 'is\n' - ' equivalent to returning "None".\n' - '\n' - '\n' - 'Coercion rules\n' - '==============\n' - '\n' - 'This section used to document the rules for coercion. As ' - 'the language\n' - 'has evolved, the coercion rules have become hard to ' - 'document\n' - 'precisely; documenting what one version of one particular\n' - 'implementation does is undesirable. Instead, here are some ' - 'informal\n' - 'guidelines regarding coercion. In Python 3, coercion will ' - 'not be\n' - 'supported.\n' - '\n' - '* If the left operand of a % operator is a string or Unicode ' - 'object,\n' - ' no coercion takes place and the string formatting ' - 'operation is\n' - ' invoked instead.\n' - '\n' - '* It is no longer recommended to define a coercion ' - 'operation. Mixed-\n' - " mode operations on types that don't define coercion pass " - 'the\n' - ' original arguments to the operation.\n' - '\n' - '* New-style classes (those derived from "object") never ' - 'invoke the\n' - ' "__coerce__()" method in response to a binary operator; ' - 'the only\n' - ' time "__coerce__()" is invoked is when the built-in ' - 'function\n' - ' "coerce()" is called.\n' - '\n' - '* For most intents and purposes, an operator that returns\n' - ' "NotImplemented" is treated the same as one that is not ' - 'implemented\n' - ' at all.\n' - '\n' - '* Below, "__op__()" and "__rop__()" are used to signify the ' - 'generic\n' - ' method names corresponding to an operator; "__iop__()" is ' - 'used for\n' - ' the corresponding in-place operator. For example, for the ' - 'operator\n' - ' \'"+"\', "__add__()" and "__radd__()" are used for the ' - 'left and right\n' - ' variant of the binary operator, and "__iadd__()" for the ' - 'in-place\n' - ' variant.\n' - '\n' - '* For objects *x* and *y*, first "x.__op__(y)" is tried. If ' - 'this is\n' - ' not implemented or returns "NotImplemented", ' - '"y.__rop__(x)" is\n' - ' tried. If this is also not implemented or returns ' - '"NotImplemented",\n' - ' a "TypeError" exception is raised. But see the following ' - 'exception:\n' - '\n' - '* Exception to the previous item: if the left operand is an ' - 'instance\n' - ' of a built-in type or a new-style class, and the right ' - 'operand is an\n' - ' instance of a proper subclass of that type or class and ' - 'overrides\n' - ' the base\'s "__rop__()" method, the right operand\'s ' - '"__rop__()"\n' - ' method is tried *before* the left operand\'s "__op__()" ' - 'method.\n' - '\n' - ' This is done so that a subclass can completely override ' - 'binary\n' - ' operators. Otherwise, the left operand\'s "__op__()" ' - 'method would\n' - ' always accept the right operand: when an instance of a ' - 'given class\n' - ' is expected, an instance of a subclass of that class is ' - 'always\n' - ' acceptable.\n' - '\n' - '* When either operand type defines a coercion, this coercion ' - 'is\n' - ' called before that type\'s "__op__()" or "__rop__()" ' - 'method is\n' - ' called, but no sooner. If the coercion returns an object ' - 'of a\n' - ' different type for the operand whose coercion is invoked, ' - 'part of\n' - ' the process is redone using the new object.\n' - '\n' - '* When an in-place operator (like \'"+="\') is used, if the ' - 'left\n' - ' operand implements "__iop__()", it is invoked without any ' - 'coercion.\n' - ' When the operation falls back to "__op__()" and/or ' - '"__rop__()", the\n' - ' normal coercion rules apply.\n' - '\n' - '* In "x + y", if *x* is a sequence that implements sequence\n' - ' concatenation, sequence concatenation is invoked.\n' - '\n' - '* In "x * y", if one operand is a sequence that implements ' - 'sequence\n' - ' repetition, and the other is an integer ("int" or "long"), ' - 'sequence\n' - ' repetition is invoked.\n' - '\n' - '* Rich comparisons (implemented by methods "__eq__()" and so ' - 'on)\n' - ' never use coercion. Three-way comparison (implemented by\n' - ' "__cmp__()") does use coercion under the same conditions ' - 'as other\n' - ' binary operations use it.\n' - '\n' - '* In the current implementation, the built-in numeric types ' - '"int",\n' - ' "long", "float", and "complex" do not use coercion. All ' - 'these types\n' - ' implement a "__coerce__()" method, for use by the ' - 'built-in\n' - ' "coerce()" function.\n' - '\n' - ' Changed in version 2.7: The complex type no longer makes ' - 'implicit\n' - ' calls to the "__coerce__()" method for mixed-type binary ' - 'arithmetic\n' - ' operations.\n' - '\n' - '\n' - 'With Statement Context Managers\n' - '===============================\n' - '\n' - 'New in version 2.5.\n' - '\n' - 'A *context manager* is an object that defines the runtime ' - 'context to\n' - 'be established when executing a "with" statement. The ' - 'context manager\n' - 'handles the entry into, and the exit from, the desired ' - 'runtime context\n' - 'for the execution of the block of code. Context managers ' - 'are normally\n' - 'invoked using the "with" statement (described in section The ' - 'with\n' - 'statement), but can also be used by directly invoking their ' - 'methods.\n' - '\n' - 'Typical uses of context managers include saving and ' - 'restoring various\n' - 'kinds of global state, locking and unlocking resources, ' - 'closing opened\n' - 'files, etc.\n' - '\n' - 'For more information on context managers, see Context ' - 'Manager Types.\n' - '\n' - 'object.__enter__(self)\n' - '\n' - ' Enter the runtime context related to this object. The ' - '"with"\n' - " statement will bind this method's return value to the " - 'target(s)\n' - ' specified in the "as" clause of the statement, if any.\n' - '\n' - 'object.__exit__(self, exc_type, exc_value, traceback)\n' - '\n' - ' Exit the runtime context related to this object. The ' - 'parameters\n' - ' describe the exception that caused the context to be ' - 'exited. If the\n' - ' context was exited without an exception, all three ' - 'arguments will\n' - ' be "None".\n' - '\n' - ' If an exception is supplied, and the method wishes to ' - 'suppress the\n' - ' exception (i.e., prevent it from being propagated), it ' - 'should\n' - ' return a true value. Otherwise, the exception will be ' - 'processed\n' - ' normally upon exit from this method.\n' - '\n' - ' Note that "__exit__()" methods should not reraise the ' - 'passed-in\n' - " exception; this is the caller's responsibility.\n" - '\n' - 'See also:\n' - '\n' - ' **PEP 343** - The "with" statement\n' - ' The specification, background, and examples for the ' - 'Python "with"\n' - ' statement.\n' - '\n' - '\n' - 'Special method lookup for old-style classes\n' - '===========================================\n' - '\n' - 'For old-style classes, special methods are always looked up ' - 'in exactly\n' - 'the same way as any other method or attribute. This is the ' - 'case\n' - 'regardless of whether the method is being looked up ' - 'explicitly as in\n' - '"x.__getitem__(i)" or implicitly as in "x[i]".\n' - '\n' - 'This behaviour means that special methods may exhibit ' - 'different\n' - 'behaviour for different instances of a single old-style ' - 'class if the\n' - 'appropriate special attributes are set differently:\n' - '\n' - ' >>> class C:\n' - ' ... pass\n' - ' ...\n' - ' >>> c1 = C()\n' - ' >>> c2 = C()\n' - ' >>> c1.__len__ = lambda: 5\n' - ' >>> c2.__len__ = lambda: 9\n' - ' >>> len(c1)\n' - ' 5\n' - ' >>> len(c2)\n' - ' 9\n' - '\n' - '\n' - 'Special method lookup for new-style classes\n' - '===========================================\n' - '\n' - 'For new-style classes, implicit invocations of special ' - 'methods are\n' - "only guaranteed to work correctly if defined on an object's " - 'type, not\n' - "in the object's instance dictionary. That behaviour is the " - 'reason why\n' - 'the following code raises an exception (unlike the ' - 'equivalent example\n' - 'with old-style classes):\n' - '\n' - ' >>> class C(object):\n' - ' ... pass\n' - ' ...\n' - ' >>> c = C()\n' - ' >>> c.__len__ = lambda: 5\n' - ' >>> len(c)\n' - ' Traceback (most recent call last):\n' - ' File "", line 1, in \n' - " TypeError: object of type 'C' has no len()\n" - '\n' - 'The rationale behind this behaviour lies with a number of ' - 'special\n' - 'methods such as "__hash__()" and "__repr__()" that are ' - 'implemented by\n' - 'all objects, including type objects. If the implicit lookup ' - 'of these\n' - 'methods used the conventional lookup process, they would ' - 'fail when\n' - 'invoked on the type object itself:\n' - '\n' - ' >>> 1 .__hash__() == hash(1)\n' - ' True\n' - ' >>> int.__hash__() == hash(int)\n' - ' Traceback (most recent call last):\n' - ' File "", line 1, in \n' - " TypeError: descriptor '__hash__' of 'int' object needs an " - 'argument\n' - '\n' - 'Incorrectly attempting to invoke an unbound method of a ' - 'class in this\n' - "way is sometimes referred to as 'metaclass confusion', and " - 'is avoided\n' - 'by bypassing the instance when looking up special methods:\n' - '\n' - ' >>> type(1).__hash__(1) == hash(1)\n' - ' True\n' - ' >>> type(int).__hash__(int) == hash(int)\n' - ' True\n' - '\n' - 'In addition to bypassing any instance attributes in the ' - 'interest of\n' - 'correctness, implicit special method lookup generally also ' - 'bypasses\n' - 'the "__getattribute__()" method even of the object\'s ' - 'metaclass:\n' - '\n' - ' >>> class Meta(type):\n' - ' ... def __getattribute__(*args):\n' - ' ... print "Metaclass getattribute invoked"\n' - ' ... return type.__getattribute__(*args)\n' - ' ...\n' - ' >>> class C(object):\n' - ' ... __metaclass__ = Meta\n' - ' ... def __len__(self):\n' - ' ... return 10\n' - ' ... def __getattribute__(*args):\n' - ' ... print "Class getattribute invoked"\n' - ' ... return object.__getattribute__(*args)\n' - ' ...\n' - ' >>> c = C()\n' - ' >>> c.__len__() # Explicit lookup via ' - 'instance\n' - ' Class getattribute invoked\n' - ' 10\n' - ' >>> type(c).__len__(c) # Explicit lookup via ' - 'type\n' - ' Metaclass getattribute invoked\n' - ' 10\n' - ' >>> len(c) # Implicit lookup\n' - ' 10\n' - '\n' - 'Bypassing the "__getattribute__()" machinery in this fashion ' - 'provides\n' - 'significant scope for speed optimisations within the ' - 'interpreter, at\n' - 'the cost of some flexibility in the handling of special ' - 'methods (the\n' - 'special method *must* be set on the class object itself in ' - 'order to be\n' - 'consistently invoked by the interpreter).\n' - '\n' - '-[ Footnotes ]-\n' - '\n' - "[1] It *is* possible in some cases to change an object's " - 'type,\n' - " under certain controlled conditions. It generally isn't " - 'a good\n' - ' idea though, since it can lead to some very strange ' - 'behaviour if\n' - ' it is handled incorrectly.\n' - '\n' - '[2] For operands of the same type, it is assumed that if the ' - 'non-\n' - ' reflected method (such as "__add__()") fails the ' - 'operation is not\n' - ' supported, which is why the reflected method is not ' - 'called.\n', - 'string-methods': '\n' - 'String Methods\n' - '**************\n' - '\n' - 'Below are listed the string methods which both 8-bit ' - 'strings and\n' - 'Unicode objects support. Some of them are also available ' - 'on\n' - '"bytearray" objects.\n' - '\n' - "In addition, Python's strings support the sequence type " - 'methods\n' - 'described in the Sequence Types --- str, unicode, list, ' - 'tuple,\n' - 'bytearray, buffer, xrange section. To output formatted ' - 'strings use\n' - 'template strings or the "%" operator described in the ' - 'String\n' - 'Formatting Operations section. Also, see the "re" module ' - 'for string\n' - 'functions based on regular expressions.\n' - '\n' - 'str.capitalize()\n' - '\n' - ' Return a copy of the string with its first character ' - 'capitalized\n' - ' and the rest lowercased.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.center(width[, fillchar])\n' - '\n' - ' Return centered in a string of length *width*. Padding ' - 'is done\n' - ' using the specified *fillchar* (default is a space).\n' - '\n' - ' Changed in version 2.4: Support for the *fillchar* ' - 'argument.\n' - '\n' - 'str.count(sub[, start[, end]])\n' - '\n' - ' Return the number of non-overlapping occurrences of ' - 'substring *sub*\n' - ' in the range [*start*, *end*]. Optional arguments ' - '*start* and\n' - ' *end* are interpreted as in slice notation.\n' - '\n' - 'str.decode([encoding[, errors]])\n' - '\n' - ' Decodes the string using the codec registered for ' - '*encoding*.\n' - ' *encoding* defaults to the default string encoding. ' - '*errors* may\n' - ' be given to set a different error handling scheme. The ' - 'default is\n' - ' "\'strict\'", meaning that encoding errors raise ' - '"UnicodeError".\n' - ' Other possible values are "\'ignore\'", "\'replace\'" ' - 'and any other\n' - ' name registered via "codecs.register_error()", see ' - 'section Codec\n' - ' Base Classes.\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' Changed in version 2.3: Support for other error ' - 'handling schemes\n' - ' added.\n' - '\n' - ' Changed in version 2.7: Support for keyword arguments ' - 'added.\n' - '\n' - 'str.encode([encoding[, errors]])\n' - '\n' - ' Return an encoded version of the string. Default ' - 'encoding is the\n' - ' current default string encoding. *errors* may be given ' - 'to set a\n' - ' different error handling scheme. The default for ' - '*errors* is\n' - ' "\'strict\'", meaning that encoding errors raise a ' - '"UnicodeError".\n' - ' Other possible values are "\'ignore\'", "\'replace\'",\n' - ' "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any ' - 'other name\n' - ' registered via "codecs.register_error()", see section ' - 'Codec Base\n' - ' Classes. For a list of possible encodings, see section ' - 'Standard\n' - ' Encodings.\n' - '\n' - ' New in version 2.0.\n' - '\n' - ' Changed in version 2.3: Support for ' - '"\'xmlcharrefreplace\'" and\n' - ' "\'backslashreplace\'" and other error handling schemes ' - 'added.\n' - '\n' - ' Changed in version 2.7: Support for keyword arguments ' - 'added.\n' - '\n' - 'str.endswith(suffix[, start[, end]])\n' - '\n' - ' Return "True" if the string ends with the specified ' - '*suffix*,\n' - ' otherwise return "False". *suffix* can also be a tuple ' - 'of suffixes\n' - ' to look for. With optional *start*, test beginning at ' - 'that\n' - ' position. With optional *end*, stop comparing at that ' - 'position.\n' - '\n' - ' Changed in version 2.5: Accept tuples as *suffix*.\n' - '\n' - 'str.expandtabs([tabsize])\n' - '\n' - ' Return a copy of the string where all tab characters ' - 'are replaced\n' - ' by one or more spaces, depending on the current column ' - 'and the\n' - ' given tab size. Tab positions occur every *tabsize* ' - 'characters\n' - ' (default is 8, giving tab positions at columns 0, 8, 16 ' - 'and so on).\n' - ' To expand the string, the current column is set to zero ' - 'and the\n' - ' string is examined character by character. If the ' - 'character is a\n' - ' tab ("\\t"), one or more space characters are inserted ' - 'in the result\n' - ' until the current column is equal to the next tab ' - 'position. (The\n' - ' tab character itself is not copied.) If the character ' - 'is a newline\n' - ' ("\\n") or return ("\\r"), it is copied and the current ' - 'column is\n' - ' reset to zero. Any other character is copied unchanged ' - 'and the\n' - ' current column is incremented by one regardless of how ' - 'the\n' - ' character is represented when printed.\n' - '\n' - " >>> '01\\t012\\t0123\\t01234'.expandtabs()\n" - " '01 012 0123 01234'\n" - " >>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" - " '01 012 0123 01234'\n" - '\n' - 'str.find(sub[, start[, end]])\n' - '\n' - ' Return the lowest index in the string where substring ' - '*sub* is\n' - ' found within the slice "s[start:end]". Optional ' - 'arguments *start*\n' - ' and *end* are interpreted as in slice notation. Return ' - '"-1" if\n' - ' *sub* is not found.\n' - '\n' - ' Note: The "find()" method should be used only if you ' - 'need to know\n' - ' the position of *sub*. To check if *sub* is a ' - 'substring or not,\n' - ' use the "in" operator:\n' - '\n' - " >>> 'Py' in 'Python'\n" - ' True\n' - '\n' - 'str.format(*args, **kwargs)\n' - '\n' - ' Perform a string formatting operation. The string on ' - 'which this\n' - ' method is called can contain literal text or ' - 'replacement fields\n' - ' delimited by braces "{}". Each replacement field ' - 'contains either\n' - ' the numeric index of a positional argument, or the name ' - 'of a\n' - ' keyword argument. Returns a copy of the string where ' - 'each\n' - ' replacement field is replaced with the string value of ' - 'the\n' - ' corresponding argument.\n' - '\n' - ' >>> "The sum of 1 + 2 is {0}".format(1+2)\n' - " 'The sum of 1 + 2 is 3'\n" - '\n' - ' See Format String Syntax for a description of the ' - 'various\n' - ' formatting options that can be specified in format ' - 'strings.\n' - '\n' - ' This method of string formatting is the new standard in ' - 'Python 3,\n' - ' and should be preferred to the "%" formatting described ' - 'in String\n' - ' Formatting Operations in new code.\n' - '\n' - ' New in version 2.6.\n' - '\n' - 'str.index(sub[, start[, end]])\n' - '\n' - ' Like "find()", but raise "ValueError" when the ' - 'substring is not\n' - ' found.\n' - '\n' - 'str.isalnum()\n' - '\n' - ' Return true if all characters in the string are ' - 'alphanumeric and\n' - ' there is at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isalpha()\n' - '\n' - ' Return true if all characters in the string are ' - 'alphabetic and\n' - ' there is at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isdigit()\n' - '\n' - ' Return true if all characters in the string are digits ' - 'and there is\n' - ' at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.islower()\n' - '\n' - ' Return true if all cased characters [4] in the string ' - 'are lowercase\n' - ' and there is at least one cased character, false ' - 'otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isspace()\n' - '\n' - ' Return true if there are only whitespace characters in ' - 'the string\n' - ' and there is at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.istitle()\n' - '\n' - ' Return true if the string is a titlecased string and ' - 'there is at\n' - ' least one character, for example uppercase characters ' - 'may only\n' - ' follow uncased characters and lowercase characters only ' - 'cased ones.\n' - ' Return false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isupper()\n' - '\n' - ' Return true if all cased characters [4] in the string ' - 'are uppercase\n' - ' and there is at least one cased character, false ' - 'otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.join(iterable)\n' - '\n' - ' Return a string which is the concatenation of the ' - 'strings in the\n' - ' *iterable* *iterable*. The separator between elements ' - 'is the\n' - ' string providing this method.\n' - '\n' - 'str.ljust(width[, fillchar])\n' - '\n' - ' Return the string left justified in a string of length ' - '*width*.\n' - ' Padding is done using the specified *fillchar* (default ' - 'is a\n' - ' space). The original string is returned if *width* is ' - 'less than or\n' - ' equal to "len(s)".\n' - '\n' - ' Changed in version 2.4: Support for the *fillchar* ' - 'argument.\n' - '\n' - 'str.lower()\n' - '\n' - ' Return a copy of the string with all the cased ' - 'characters [4]\n' - ' converted to lowercase.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.lstrip([chars])\n' - '\n' - ' Return a copy of the string with leading characters ' - 'removed. The\n' - ' *chars* argument is a string specifying the set of ' - 'characters to be\n' - ' removed. If omitted or "None", the *chars* argument ' - 'defaults to\n' - ' removing whitespace. The *chars* argument is not a ' - 'prefix; rather,\n' - ' all combinations of its values are stripped:\n' - '\n' - " >>> ' spacious '.lstrip()\n" - " 'spacious '\n" - " >>> 'www.example.com'.lstrip('cmowz.')\n" - " 'example.com'\n" - '\n' - ' Changed in version 2.2.2: Support for the *chars* ' - 'argument.\n' - '\n' - 'str.partition(sep)\n' - '\n' - ' Split the string at the first occurrence of *sep*, and ' - 'return a\n' - ' 3-tuple containing the part before the separator, the ' - 'separator\n' - ' itself, and the part after the separator. If the ' - 'separator is not\n' - ' found, return a 3-tuple containing the string itself, ' - 'followed by\n' - ' two empty strings.\n' - '\n' - ' New in version 2.5.\n' - '\n' - 'str.replace(old, new[, count])\n' - '\n' - ' Return a copy of the string with all occurrences of ' - 'substring *old*\n' - ' replaced by *new*. If the optional argument *count* is ' - 'given, only\n' - ' the first *count* occurrences are replaced.\n' - '\n' - 'str.rfind(sub[, start[, end]])\n' - '\n' - ' Return the highest index in the string where substring ' - '*sub* is\n' - ' found, such that *sub* is contained within ' - '"s[start:end]".\n' - ' Optional arguments *start* and *end* are interpreted as ' - 'in slice\n' - ' notation. Return "-1" on failure.\n' - '\n' - 'str.rindex(sub[, start[, end]])\n' - '\n' - ' Like "rfind()" but raises "ValueError" when the ' - 'substring *sub* is\n' - ' not found.\n' - '\n' - 'str.rjust(width[, fillchar])\n' - '\n' - ' Return the string right justified in a string of length ' - '*width*.\n' - ' Padding is done using the specified *fillchar* (default ' - 'is a\n' - ' space). The original string is returned if *width* is ' - 'less than or\n' - ' equal to "len(s)".\n' - '\n' - ' Changed in version 2.4: Support for the *fillchar* ' - 'argument.\n' - '\n' - 'str.rpartition(sep)\n' - '\n' - ' Split the string at the last occurrence of *sep*, and ' - 'return a\n' - ' 3-tuple containing the part before the separator, the ' - 'separator\n' - ' itself, and the part after the separator. If the ' - 'separator is not\n' - ' found, return a 3-tuple containing two empty strings, ' - 'followed by\n' - ' the string itself.\n' - '\n' - ' New in version 2.5.\n' - '\n' - 'str.rsplit([sep[, maxsplit]])\n' - '\n' - ' Return a list of the words in the string, using *sep* ' - 'as the\n' - ' delimiter string. If *maxsplit* is given, at most ' - '*maxsplit* splits\n' - ' are done, the *rightmost* ones. If *sep* is not ' - 'specified or\n' - ' "None", any whitespace string is a separator. Except ' - 'for splitting\n' - ' from the right, "rsplit()" behaves like "split()" which ' - 'is\n' - ' described in detail below.\n' - '\n' - ' New in version 2.4.\n' - '\n' - 'str.rstrip([chars])\n' - '\n' - ' Return a copy of the string with trailing characters ' - 'removed. The\n' - ' *chars* argument is a string specifying the set of ' - 'characters to be\n' - ' removed. If omitted or "None", the *chars* argument ' - 'defaults to\n' - ' removing whitespace. The *chars* argument is not a ' - 'suffix; rather,\n' - ' all combinations of its values are stripped:\n' - '\n' - " >>> ' spacious '.rstrip()\n" - " ' spacious'\n" - " >>> 'mississippi'.rstrip('ipz')\n" - " 'mississ'\n" - '\n' - ' Changed in version 2.2.2: Support for the *chars* ' - 'argument.\n' - '\n' - 'str.split([sep[, maxsplit]])\n' - '\n' - ' Return a list of the words in the string, using *sep* ' - 'as the\n' - ' delimiter string. If *maxsplit* is given, at most ' - '*maxsplit*\n' - ' splits are done (thus, the list will have at most ' - '"maxsplit+1"\n' - ' elements). If *maxsplit* is not specified or "-1", ' - 'then there is\n' - ' no limit on the number of splits (all possible splits ' - 'are made).\n' - '\n' - ' If *sep* is given, consecutive delimiters are not ' - 'grouped together\n' - ' and are deemed to delimit empty strings (for example,\n' - ' "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', ' - '\'2\']"). The *sep* argument\n' - ' may consist of multiple characters (for example,\n' - ' "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', ' - '\'3\']"). Splitting an\n' - ' empty string with a specified separator returns ' - '"[\'\']".\n' - '\n' - ' If *sep* is not specified or is "None", a different ' - 'splitting\n' - ' algorithm is applied: runs of consecutive whitespace ' - 'are regarded\n' - ' as a single separator, and the result will contain no ' - 'empty strings\n' - ' at the start or end if the string has leading or ' - 'trailing\n' - ' whitespace. Consequently, splitting an empty string or ' - 'a string\n' - ' consisting of just whitespace with a "None" separator ' - 'returns "[]".\n' - '\n' - ' For example, "\' 1 2 3 \'.split()" returns "[\'1\', ' - '\'2\', \'3\']", and\n' - ' "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', ' - '\'2 3 \']".\n' - '\n' - 'str.splitlines([keepends])\n' - '\n' - ' Return a list of the lines in the string, breaking at ' - 'line\n' - ' boundaries. This method uses the *universal newlines* ' - 'approach to\n' - ' splitting lines. Line breaks are not included in the ' - 'resulting list\n' - ' unless *keepends* is given and true.\n' - '\n' - ' For example, "\'ab c\\n\\nde ' - 'fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n' - ' c\', \'\', \'de fg\', \'kl\']", while the same call ' - 'with\n' - ' "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de ' - 'fg\\r\', \'kl\\r\\n\']".\n' - '\n' - ' Unlike "split()" when a delimiter string *sep* is ' - 'given, this\n' - ' method returns an empty list for the empty string, and ' - 'a terminal\n' - ' line break does not result in an extra line.\n' - '\n' - 'str.startswith(prefix[, start[, end]])\n' - '\n' - ' Return "True" if string starts with the *prefix*, ' - 'otherwise return\n' - ' "False". *prefix* can also be a tuple of prefixes to ' - 'look for.\n' - ' With optional *start*, test string beginning at that ' - 'position.\n' - ' With optional *end*, stop comparing string at that ' - 'position.\n' - '\n' - ' Changed in version 2.5: Accept tuples as *prefix*.\n' - '\n' - 'str.strip([chars])\n' - '\n' - ' Return a copy of the string with the leading and ' - 'trailing\n' - ' characters removed. The *chars* argument is a string ' - 'specifying the\n' - ' set of characters to be removed. If omitted or "None", ' - 'the *chars*\n' - ' argument defaults to removing whitespace. The *chars* ' - 'argument is\n' - ' not a prefix or suffix; rather, all combinations of its ' - 'values are\n' - ' stripped:\n' - '\n' - " >>> ' spacious '.strip()\n" - " 'spacious'\n" - " >>> 'www.example.com'.strip('cmowz.')\n" - " 'example'\n" - '\n' - ' Changed in version 2.2.2: Support for the *chars* ' - 'argument.\n' - '\n' - 'str.swapcase()\n' - '\n' - ' Return a copy of the string with uppercase characters ' - 'converted to\n' - ' lowercase and vice versa.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.title()\n' - '\n' - ' Return a titlecased version of the string where words ' - 'start with an\n' - ' uppercase character and the remaining characters are ' - 'lowercase.\n' - '\n' - ' The algorithm uses a simple language-independent ' - 'definition of a\n' - ' word as groups of consecutive letters. The definition ' - 'works in\n' - ' many contexts but it means that apostrophes in ' - 'contractions and\n' - ' possessives form word boundaries, which may not be the ' - 'desired\n' - ' result:\n' - '\n' - ' >>> "they\'re bill\'s friends from the UK".title()\n' - ' "They\'Re Bill\'S Friends From The Uk"\n' - '\n' - ' A workaround for apostrophes can be constructed using ' - 'regular\n' - ' expressions:\n' - '\n' - ' >>> import re\n' - ' >>> def titlecase(s):\n' - ' ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n' - ' ... lambda mo: ' - 'mo.group(0)[0].upper() +\n' - ' ... ' - 'mo.group(0)[1:].lower(),\n' - ' ... s)\n' - ' ...\n' - ' >>> titlecase("they\'re bill\'s friends.")\n' - ' "They\'re Bill\'s Friends."\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.translate(table[, deletechars])\n' - '\n' - ' Return a copy of the string where all characters ' - 'occurring in the\n' - ' optional argument *deletechars* are removed, and the ' - 'remaining\n' - ' characters have been mapped through the given ' - 'translation table,\n' - ' which must be a string of length 256.\n' - '\n' - ' You can use the "maketrans()" helper function in the ' - '"string"\n' - ' module to create a translation table. For string ' - 'objects, set the\n' - ' *table* argument to "None" for translations that only ' - 'delete\n' - ' characters:\n' - '\n' - " >>> 'read this short text'.translate(None, 'aeiou')\n" - " 'rd ths shrt txt'\n" - '\n' - ' New in version 2.6: Support for a "None" *table* ' - 'argument.\n' - '\n' - ' For Unicode objects, the "translate()" method does not ' - 'accept the\n' - ' optional *deletechars* argument. Instead, it returns a ' - 'copy of the\n' - ' *s* where all characters have been mapped through the ' - 'given\n' - ' translation table which must be a mapping of Unicode ' - 'ordinals to\n' - ' Unicode ordinals, Unicode strings or "None". Unmapped ' - 'characters\n' - ' are left untouched. Characters mapped to "None" are ' - 'deleted. Note,\n' - ' a more flexible approach is to create a custom ' - 'character mapping\n' - ' codec using the "codecs" module (see "encodings.cp1251" ' - 'for an\n' - ' example).\n' - '\n' - 'str.upper()\n' - '\n' - ' Return a copy of the string with all the cased ' - 'characters [4]\n' - ' converted to uppercase. Note that ' - '"str.upper().isupper()" might be\n' - ' "False" if "s" contains uncased characters or if the ' - 'Unicode\n' - ' category of the resulting character(s) is not "Lu" ' - '(Letter,\n' - ' uppercase), but e.g. "Lt" (Letter, titlecase).\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.zfill(width)\n' - '\n' - ' Return the numeric string left filled with zeros in a ' - 'string of\n' - ' length *width*. A sign prefix is handled correctly. ' - 'The original\n' - ' string is returned if *width* is less than or equal to ' - '"len(s)".\n' - '\n' - ' New in version 2.2.2.\n' - '\n' - 'The following methods are present only on unicode ' - 'objects:\n' - '\n' - 'unicode.isnumeric()\n' - '\n' - ' Return "True" if there are only numeric characters in ' - 'S, "False"\n' - ' otherwise. Numeric characters include digit characters, ' - 'and all\n' - ' characters that have the Unicode numeric value ' - 'property, e.g.\n' - ' U+2155, VULGAR FRACTION ONE FIFTH.\n' - '\n' - 'unicode.isdecimal()\n' - '\n' - ' Return "True" if there are only decimal characters in ' - 'S, "False"\n' - ' otherwise. Decimal characters include digit characters, ' - 'and all\n' - ' characters that can be used to form decimal-radix ' - 'numbers, e.g.\n' - ' U+0660, ARABIC-INDIC DIGIT ZERO.\n', - 'strings': '\n' - 'String literals\n' - '***************\n' - '\n' - 'String literals are described by the following lexical ' - 'definitions:\n' - '\n' - ' stringliteral ::= [stringprefix](shortstring | longstring)\n' - ' stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" ' - '| "uR"\n' - ' | "b" | "B" | "br" | "Br" | "bR" | "BR"\n' - ' shortstring ::= "\'" shortstringitem* "\'" | \'"\' ' - 'shortstringitem* \'"\'\n' - ' longstring ::= "\'\'\'" longstringitem* "\'\'\'"\n' - ' | \'"""\' longstringitem* \'"""\'\n' - ' shortstringitem ::= shortstringchar | escapeseq\n' - ' longstringitem ::= longstringchar | escapeseq\n' - ' shortstringchar ::= \n' - ' longstringchar ::= \n' - ' escapeseq ::= "\\" \n' - '\n' - 'One syntactic restriction not indicated by these productions is ' - 'that\n' - 'whitespace is not allowed between the "stringprefix" and the rest ' - 'of\n' - 'the string literal. The source character set is defined by the\n' - 'encoding declaration; it is ASCII if no encoding declaration is ' - 'given\n' - 'in the source file; see section Encoding declarations.\n' - '\n' - 'In plain English: String literals can be enclosed in matching ' - 'single\n' - 'quotes ("\'") or double quotes ("""). They can also be enclosed ' - 'in\n' - 'matching groups of three single or double quotes (these are ' - 'generally\n' - 'referred to as *triple-quoted strings*). The backslash ("\\")\n' - 'character is used to escape characters that otherwise have a ' - 'special\n' - 'meaning, such as newline, backslash itself, or the quote ' - 'character.\n' - 'String literals may optionally be prefixed with a letter "\'r\'" ' - 'or\n' - '"\'R\'"; such strings are called *raw strings* and use different ' - 'rules\n' - 'for interpreting backslash escape sequences. A prefix of "\'u\'" ' - 'or\n' - '"\'U\'" makes the string a Unicode string. Unicode strings use ' - 'the\n' - 'Unicode character set as defined by the Unicode Consortium and ' - 'ISO\n' - '10646. Some additional escape sequences, described below, are\n' - 'available in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ' - 'ignored in\n' - 'Python 2; it indicates that the literal should become a bytes ' - 'literal\n' - 'in Python 3 (e.g. when code is automatically converted with ' - '2to3). A\n' - '"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n' - '\n' - 'In triple-quoted strings, unescaped newlines and quotes are ' - 'allowed\n' - '(and are retained), except that three unescaped quotes in a row\n' - 'terminate the string. (A "quote" is the character used to open ' - 'the\n' - 'string, i.e. either "\'" or """.)\n' - '\n' - 'Unless an "\'r\'" or "\'R\'" prefix is present, escape sequences ' - 'in\n' - 'strings are interpreted according to rules similar to those used ' - 'by\n' - 'Standard C. The recognized escape sequences are:\n' - '\n' - '+-------------------+-----------------------------------+---------+\n' - '| Escape Sequence | Meaning | Notes ' - '|\n' - '+===================+===================================+=========+\n' - '| "\\newline" | Ignored ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\\\" | Backslash ("\\") ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\\'" | Single quote ("\'") ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\"" | Double quote (""") ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\a" | ASCII Bell (BEL) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\b" | ASCII Backspace (BS) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\f" | ASCII Formfeed (FF) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\n" | ASCII Linefeed (LF) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\N{name}" | Character named *name* in the ' - '| |\n' - '| | Unicode database (Unicode only) | ' - '|\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\r" | ASCII Carriage Return (CR) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\t" | ASCII Horizontal Tab (TAB) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\uxxxx" | Character with 16-bit hex value | ' - '(1) |\n' - '| | *xxxx* (Unicode only) | ' - '|\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\Uxxxxxxxx" | Character with 32-bit hex value | ' - '(2) |\n' - '| | *xxxxxxxx* (Unicode only) | ' - '|\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\v" | ASCII Vertical Tab (VT) ' - '| |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\ooo" | Character with octal value *ooo* | ' - '(3,5) |\n' - '+-------------------+-----------------------------------+---------+\n' - '| "\\xhh" | Character with hex value *hh* | ' - '(4,5) |\n' - '+-------------------+-----------------------------------+---------+\n' - '\n' - 'Notes:\n' - '\n' - '1. Individual code units which form parts of a surrogate pair ' - 'can\n' - ' be encoded using this escape sequence.\n' - '\n' - '2. Any Unicode character can be encoded this way, but characters\n' - ' outside the Basic Multilingual Plane (BMP) will be encoded ' - 'using a\n' - ' surrogate pair if Python is compiled to use 16-bit code units ' - '(the\n' - ' default).\n' - '\n' - '3. As in Standard C, up to three octal digits are accepted.\n' - '\n' - '4. Unlike in Standard C, exactly two hex digits are required.\n' - '\n' - '5. In a string literal, hexadecimal and octal escapes denote the\n' - ' byte with the given value; it is not necessary that the byte\n' - ' encodes a character in the source character set. In a Unicode\n' - ' literal, these escapes denote a Unicode character with the ' - 'given\n' - ' value.\n' - '\n' - 'Unlike Standard C, all unrecognized escape sequences are left in ' - 'the\n' - 'string unchanged, i.e., *the backslash is left in the string*. ' - '(This\n' - 'behavior is useful when debugging: if an escape sequence is ' - 'mistyped,\n' - 'the resulting output is more easily recognized as broken.) It is ' - 'also\n' - 'important to note that the escape sequences marked as "(Unicode ' - 'only)"\n' - 'in the table above fall into the category of unrecognized escapes ' - 'for\n' - 'non-Unicode string literals.\n' - '\n' - 'When an "\'r\'" or "\'R\'" prefix is present, a character ' - 'following a\n' - 'backslash is included in the string without change, and *all\n' - 'backslashes are left in the string*. For example, the string ' - 'literal\n' - '"r"\\n"" consists of two characters: a backslash and a lowercase ' - '"\'n\'".\n' - 'String quotes can be escaped with a backslash, but the backslash\n' - 'remains in the string; for example, "r"\\""" is a valid string ' - 'literal\n' - 'consisting of two characters: a backslash and a double quote; ' - '"r"\\""\n' - 'is not a valid string literal (even a raw string cannot end in an ' - 'odd\n' - 'number of backslashes). Specifically, *a raw string cannot end ' - 'in a\n' - 'single backslash* (since the backslash would escape the ' - 'following\n' - 'quote character). Note also that a single backslash followed by ' - 'a\n' - 'newline is interpreted as those two characters as part of the ' - 'string,\n' - '*not* as a line continuation.\n' - '\n' - 'When an "\'r\'" or "\'R\'" prefix is used in conjunction with a ' - '"\'u\'" or\n' - '"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape ' - 'sequences are\n' - 'processed while *all other backslashes are left in the string*. ' - 'For\n' - 'example, the string literal "ur"\\u0062\\n"" consists of three ' - 'Unicode\n' - "characters: 'LATIN SMALL LETTER B', 'REVERSE SOLIDUS', and " - "'LATIN\n" - "SMALL LETTER N'. Backslashes can be escaped with a preceding\n" - 'backslash; however, both remain in the string. As a result, ' - '"\\uXXXX"\n' - 'escape sequences are only recognized when there are an odd number ' - 'of\n' - 'backslashes.\n', - 'subscriptions': '\n' - 'Subscriptions\n' - '*************\n' - '\n' - 'A subscription selects an item of a sequence (string, tuple ' - 'or list)\n' - 'or mapping (dictionary) object:\n' - '\n' - ' subscription ::= primary "[" expression_list "]"\n' - '\n' - 'The primary must evaluate to an object of a sequence or ' - 'mapping type.\n' - '\n' - 'If the primary is a mapping, the expression list must ' - 'evaluate to an\n' - 'object whose value is one of the keys of the mapping, and ' - 'the\n' - 'subscription selects the value in the mapping that ' - 'corresponds to that\n' - 'key. (The expression list is a tuple except if it has ' - 'exactly one\n' - 'item.)\n' - '\n' - 'If the primary is a sequence, the expression (list) must ' - 'evaluate to a\n' - 'plain integer. If this value is negative, the length of ' - 'the sequence\n' - 'is added to it (so that, e.g., "x[-1]" selects the last ' - 'item of "x".)\n' - 'The resulting value must be a nonnegative integer less than ' - 'the number\n' - 'of items in the sequence, and the subscription selects the ' - 'item whose\n' - 'index is that value (counting from zero).\n' - '\n' - "A string's items are characters. A character is not a " - 'separate data\n' - 'type but a string of exactly one character.\n', - 'truth': '\n' - 'Truth Value Testing\n' - '*******************\n' - '\n' - 'Any object can be tested for truth value, for use in an "if" or\n' - '"while" condition or as operand of the Boolean operations below. ' - 'The\n' - 'following values are considered false:\n' - '\n' - '* "None"\n' - '\n' - '* "False"\n' - '\n' - '* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n' - '\n' - '* any empty sequence, for example, "\'\'", "()", "[]".\n' - '\n' - '* any empty mapping, for example, "{}".\n' - '\n' - '* instances of user-defined classes, if the class defines a\n' - ' "__nonzero__()" or "__len__()" method, when that method returns ' - 'the\n' - ' integer zero or "bool" value "False". [1]\n' - '\n' - 'All other values are considered true --- so objects of many types ' - 'are\n' - 'always true.\n' - '\n' - 'Operations and built-in functions that have a Boolean result ' - 'always\n' - 'return "0" or "False" for false and "1" or "True" for true, unless\n' - 'otherwise stated. (Important exception: the Boolean operations ' - '"or"\n' - 'and "and" always return one of their operands.)\n', - 'try': '\n' - 'The "try" statement\n' - '*******************\n' - '\n' - 'The "try" statement specifies exception handlers and/or cleanup code\n' - 'for a group of statements:\n' - '\n' - ' try_stmt ::= try1_stmt | try2_stmt\n' - ' try1_stmt ::= "try" ":" suite\n' - ' ("except" [expression [("as" | ",") identifier]] ":" ' - 'suite)+\n' - ' ["else" ":" suite]\n' - ' ["finally" ":" suite]\n' - ' try2_stmt ::= "try" ":" suite\n' - ' "finally" ":" suite\n' - '\n' - 'Changed in version 2.5: In previous versions of Python,\n' - '"try"..."except"..."finally" did not work. "try"..."except" had to ' - 'be\n' - 'nested in "try"..."finally".\n' - '\n' - 'The "except" clause(s) specify one or more exception handlers. When ' - 'no\n' - 'exception occurs in the "try" clause, no exception handler is\n' - 'executed. When an exception occurs in the "try" suite, a search for ' - 'an\n' - 'exception handler is started. This search inspects the except ' - 'clauses\n' - 'in turn until one is found that matches the exception. An ' - 'expression-\n' - 'less except clause, if present, must be last; it matches any\n' - 'exception. For an except clause with an expression, that expression\n' - 'is evaluated, and the clause matches the exception if the resulting\n' - 'object is "compatible" with the exception. An object is compatible\n' - 'with an exception if it is the class or a base class of the ' - 'exception\n' - 'object, or a tuple containing an item compatible with the exception.\n' - '\n' - 'If no except clause matches the exception, the search for an ' - 'exception\n' - 'handler continues in the surrounding code and on the invocation ' - 'stack.\n' - '[1]\n' - '\n' - 'If the evaluation of an expression in the header of an except clause\n' - 'raises an exception, the original search for a handler is canceled ' - 'and\n' - 'a search starts for the new exception in the surrounding code and on\n' - 'the call stack (it is treated as if the entire "try" statement ' - 'raised\n' - 'the exception).\n' - '\n' - 'When a matching except clause is found, the exception is assigned to\n' - 'the target specified in that except clause, if present, and the ' - 'except\n' - "clause's suite is executed. All except clauses must have an\n" - 'executable block. When the end of this block is reached, execution\n' - 'continues normally after the entire try statement. (This means that\n' - 'if two nested handlers exist for the same exception, and the ' - 'exception\n' - 'occurs in the try clause of the inner handler, the outer handler ' - 'will\n' - 'not handle the exception.)\n' - '\n' - "Before an except clause's suite is executed, details about the\n" - 'exception are assigned to three variables in the "sys" module:\n' - '"sys.exc_type" receives the object identifying the exception;\n' - '"sys.exc_value" receives the exception\'s parameter;\n' - '"sys.exc_traceback" receives a traceback object (see section The\n' - 'standard type hierarchy) identifying the point in the program where\n' - 'the exception occurred. These details are also available through the\n' - '"sys.exc_info()" function, which returns a tuple "(exc_type,\n' - 'exc_value, exc_traceback)". Use of the corresponding variables is\n' - 'deprecated in favor of this function, since their use is unsafe in a\n' - 'threaded program. As of Python 1.5, the variables are restored to\n' - 'their previous values (before the call) when returning from a ' - 'function\n' - 'that handled an exception.\n' - '\n' - 'The optional "else" clause is executed if and when control flows off\n' - 'the end of the "try" clause. [2] Exceptions in the "else" clause are\n' - 'not handled by the preceding "except" clauses.\n' - '\n' - 'If "finally" is present, it specifies a \'cleanup\' handler. The ' - '"try"\n' - 'clause is executed, including any "except" and "else" clauses. If ' - 'an\n' - 'exception occurs in any of the clauses and is not handled, the\n' - 'exception is temporarily saved. The "finally" clause is executed. ' - 'If\n' - 'there is a saved exception, it is re-raised at the end of the\n' - '"finally" clause. If the "finally" clause raises another exception ' - 'or\n' - 'executes a "return" or "break" statement, the saved exception is\n' - 'discarded:\n' - '\n' - ' >>> def f():\n' - ' ... try:\n' - ' ... 1/0\n' - ' ... finally:\n' - ' ... return 42\n' - ' ...\n' - ' >>> f()\n' - ' 42\n' - '\n' - 'The exception information is not available to the program during\n' - 'execution of the "finally" clause.\n' - '\n' - 'When a "return", "break" or "continue" statement is executed in the\n' - '"try" suite of a "try"..."finally" statement, the "finally" clause ' - 'is\n' - 'also executed \'on the way out.\' A "continue" statement is illegal ' - 'in\n' - 'the "finally" clause. (The reason is a problem with the current\n' - 'implementation --- this restriction may be lifted in the future).\n' - '\n' - 'The return value of a function is determined by the last "return"\n' - 'statement executed. Since the "finally" clause always executes, a\n' - '"return" statement executed in the "finally" clause will always be ' - 'the\n' - 'last one executed:\n' - '\n' - ' >>> def foo():\n' - ' ... try:\n' - " ... return 'try'\n" - ' ... finally:\n' - " ... return 'finally'\n" - ' ...\n' - ' >>> foo()\n' - " 'finally'\n" - '\n' - 'Additional information on exceptions can be found in section\n' - 'Exceptions, and information on using the "raise" statement to ' - 'generate\n' - 'exceptions may be found in section The raise statement.\n', - 'types': '\n' - 'The standard type hierarchy\n' - '***************************\n' - '\n' - 'Below is a list of the types that are built into Python. ' - 'Extension\n' - 'modules (written in C, Java, or other languages, depending on the\n' - 'implementation) can define additional types. Future versions of\n' - 'Python may add types to the type hierarchy (e.g., rational ' - 'numbers,\n' - 'efficiently stored arrays of integers, etc.).\n' - '\n' - 'Some of the type descriptions below contain a paragraph listing\n' - "'special attributes.' These are attributes that provide access to " - 'the\n' - 'implementation and are not intended for general use. Their ' - 'definition\n' - 'may change in the future.\n' - '\n' - 'None\n' - ' This type has a single value. There is a single object with ' - 'this\n' - ' value. This object is accessed through the built-in name "None". ' - 'It\n' - ' is used to signify the absence of a value in many situations, ' - 'e.g.,\n' - " it is returned from functions that don't explicitly return\n" - ' anything. Its truth value is false.\n' - '\n' - 'NotImplemented\n' - ' This type has a single value. There is a single object with ' - 'this\n' - ' value. This object is accessed through the built-in name\n' - ' "NotImplemented". Numeric methods and rich comparison methods ' - 'may\n' - ' return this value if they do not implement the operation for ' - 'the\n' - ' operands provided. (The interpreter will then try the ' - 'reflected\n' - ' operation, or some other fallback, depending on the operator.) ' - 'Its\n' - ' truth value is true.\n' - '\n' - 'Ellipsis\n' - ' This type has a single value. There is a single object with ' - 'this\n' - ' value. This object is accessed through the built-in name\n' - ' "Ellipsis". It is used to indicate the presence of the "..." ' - 'syntax\n' - ' in a slice. Its truth value is true.\n' - '\n' - '"numbers.Number"\n' - ' These are created by numeric literals and returned as results ' - 'by\n' - ' arithmetic operators and arithmetic built-in functions. ' - 'Numeric\n' - ' objects are immutable; once created their value never changes.\n' - ' Python numbers are of course strongly related to mathematical\n' - ' numbers, but subject to the limitations of numerical ' - 'representation\n' - ' in computers.\n' - '\n' - ' Python distinguishes between integers, floating point numbers, ' - 'and\n' - ' complex numbers:\n' - '\n' - ' "numbers.Integral"\n' - ' These represent elements from the mathematical set of ' - 'integers\n' - ' (positive and negative).\n' - '\n' - ' There are three types of integers:\n' - '\n' - ' Plain integers\n' - ' These represent numbers in the range -2147483648 through\n' - ' 2147483647. (The range may be larger on machines with a\n' - ' larger natural word size, but not smaller.) When the ' - 'result\n' - ' of an operation would fall outside this range, the result ' - 'is\n' - ' normally returned as a long integer (in some cases, the\n' - ' exception "OverflowError" is raised instead). For the\n' - ' purpose of shift and mask operations, integers are assumed ' - 'to\n' - " have a binary, 2's complement notation using 32 or more " - 'bits,\n' - ' and hiding no bits from the user (i.e., all 4294967296\n' - ' different bit patterns correspond to different values).\n' - '\n' - ' Long integers\n' - ' These represent numbers in an unlimited range, subject to\n' - ' available (virtual) memory only. For the purpose of ' - 'shift\n' - ' and mask operations, a binary representation is assumed, ' - 'and\n' - " negative numbers are represented in a variant of 2's\n" - ' complement which gives the illusion of an infinite string ' - 'of\n' - ' sign bits extending to the left.\n' - '\n' - ' Booleans\n' - ' These represent the truth values False and True. The two\n' - ' objects representing the values "False" and "True" are ' - 'the\n' - ' only Boolean objects. The Boolean type is a subtype of ' - 'plain\n' - ' integers, and Boolean values behave like the values 0 and ' - '1,\n' - ' respectively, in almost all contexts, the exception being\n' - ' that when converted to a string, the strings ""False"" or\n' - ' ""True"" are returned, respectively.\n' - '\n' - ' The rules for integer representation are intended to give ' - 'the\n' - ' most meaningful interpretation of shift and mask operations\n' - ' involving negative integers and the least surprises when\n' - ' switching between the plain and long integer domains. Any\n' - ' operation, if it yields a result in the plain integer ' - 'domain,\n' - ' will yield the same result in the long integer domain or ' - 'when\n' - ' using mixed operands. The switch between domains is ' - 'transparent\n' - ' to the programmer.\n' - '\n' - ' "numbers.Real" ("float")\n' - ' These represent machine-level double precision floating ' - 'point\n' - ' numbers. You are at the mercy of the underlying machine\n' - ' architecture (and C or Java implementation) for the accepted\n' - ' range and handling of overflow. Python does not support ' - 'single-\n' - ' precision floating point numbers; the savings in processor ' - 'and\n' - ' memory usage that are usually the reason for using these are\n' - ' dwarfed by the overhead of using objects in Python, so there ' - 'is\n' - ' no reason to complicate the language with two kinds of ' - 'floating\n' - ' point numbers.\n' - '\n' - ' "numbers.Complex"\n' - ' These represent complex numbers as a pair of machine-level\n' - ' double precision floating point numbers. The same caveats ' - 'apply\n' - ' as for floating point numbers. The real and imaginary parts ' - 'of a\n' - ' complex number "z" can be retrieved through the read-only\n' - ' attributes "z.real" and "z.imag".\n' - '\n' - 'Sequences\n' - ' These represent finite ordered sets indexed by non-negative\n' - ' numbers. The built-in function "len()" returns the number of ' - 'items\n' - ' of a sequence. When the length of a sequence is *n*, the index ' - 'set\n' - ' contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* ' - 'is\n' - ' selected by "a[i]".\n' - '\n' - ' Sequences also support slicing: "a[i:j]" selects all items with\n' - ' index *k* such that *i* "<=" *k* "<" *j*. When used as an\n' - ' expression, a slice is a sequence of the same type. This ' - 'implies\n' - ' that the index set is renumbered so that it starts at 0.\n' - '\n' - ' Some sequences also support "extended slicing" with a third ' - '"step"\n' - ' parameter: "a[i:j:k]" selects all items of *a* with index *x* ' - 'where\n' - ' "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n' - '\n' - ' Sequences are distinguished according to their mutability:\n' - '\n' - ' Immutable sequences\n' - ' An object of an immutable sequence type cannot change once it ' - 'is\n' - ' created. (If the object contains references to other ' - 'objects,\n' - ' these other objects may be mutable and may be changed; ' - 'however,\n' - ' the collection of objects directly referenced by an ' - 'immutable\n' - ' object cannot change.)\n' - '\n' - ' The following types are immutable sequences:\n' - '\n' - ' Strings\n' - ' The items of a string are characters. There is no ' - 'separate\n' - ' character type; a character is represented by a string of ' - 'one\n' - ' item. Characters represent (at least) 8-bit bytes. The\n' - ' built-in functions "chr()" and "ord()" convert between\n' - ' characters and nonnegative integers representing the byte\n' - ' values. Bytes with the values 0-127 usually represent ' - 'the\n' - ' corresponding ASCII values, but the interpretation of ' - 'values\n' - ' is up to the program. The string data type is also used ' - 'to\n' - ' represent arrays of bytes, e.g., to hold data read from a\n' - ' file.\n' - '\n' - ' (On systems whose native character set is not ASCII, ' - 'strings\n' - ' may use EBCDIC in their internal representation, provided ' - 'the\n' - ' functions "chr()" and "ord()" implement a mapping between\n' - ' ASCII and EBCDIC, and string comparison preserves the ' - 'ASCII\n' - ' order. Or perhaps someone can propose a better rule?)\n' - '\n' - ' Unicode\n' - ' The items of a Unicode object are Unicode code units. A\n' - ' Unicode code unit is represented by a Unicode object of ' - 'one\n' - ' item and can hold either a 16-bit or 32-bit value\n' - ' representing a Unicode ordinal (the maximum value for the\n' - ' ordinal is given in "sys.maxunicode", and depends on how\n' - ' Python is configured at compile time). Surrogate pairs ' - 'may\n' - ' be present in the Unicode object, and will be reported as ' - 'two\n' - ' separate items. The built-in functions "unichr()" and\n' - ' "ord()" convert between code units and nonnegative ' - 'integers\n' - ' representing the Unicode ordinals as defined in the ' - 'Unicode\n' - ' Standard 3.0. Conversion from and to other encodings are\n' - ' possible through the Unicode method "encode()" and the ' - 'built-\n' - ' in function "unicode()".\n' - '\n' - ' Tuples\n' - ' The items of a tuple are arbitrary Python objects. Tuples ' - 'of\n' - ' two or more items are formed by comma-separated lists of\n' - " expressions. A tuple of one item (a 'singleton') can be\n" - ' formed by affixing a comma to an expression (an expression ' - 'by\n' - ' itself does not create a tuple, since parentheses must be\n' - ' usable for grouping of expressions). An empty tuple can ' - 'be\n' - ' formed by an empty pair of parentheses.\n' - '\n' - ' Mutable sequences\n' - ' Mutable sequences can be changed after they are created. ' - 'The\n' - ' subscription and slicing notations can be used as the target ' - 'of\n' - ' assignment and "del" (delete) statements.\n' - '\n' - ' There are currently two intrinsic mutable sequence types:\n' - '\n' - ' Lists\n' - ' The items of a list are arbitrary Python objects. Lists ' - 'are\n' - ' formed by placing a comma-separated list of expressions ' - 'in\n' - ' square brackets. (Note that there are no special cases ' - 'needed\n' - ' to form lists of length 0 or 1.)\n' - '\n' - ' Byte Arrays\n' - ' A bytearray object is a mutable array. They are created ' - 'by\n' - ' the built-in "bytearray()" constructor. Aside from being\n' - ' mutable (and hence unhashable), byte arrays otherwise ' - 'provide\n' - ' the same interface and functionality as immutable bytes\n' - ' objects.\n' - '\n' - ' The extension module "array" provides an additional example ' - 'of a\n' - ' mutable sequence type.\n' - '\n' - 'Set types\n' - ' These represent unordered, finite sets of unique, immutable\n' - ' objects. As such, they cannot be indexed by any subscript. ' - 'However,\n' - ' they can be iterated over, and the built-in function "len()"\n' - ' returns the number of items in a set. Common uses for sets are ' - 'fast\n' - ' membership testing, removing duplicates from a sequence, and\n' - ' computing mathematical operations such as intersection, union,\n' - ' difference, and symmetric difference.\n' - '\n' - ' For set elements, the same immutability rules apply as for\n' - ' dictionary keys. Note that numeric types obey the normal rules ' - 'for\n' - ' numeric comparison: if two numbers compare equal (e.g., "1" and\n' - ' "1.0"), only one of them can be contained in a set.\n' - '\n' - ' There are currently two intrinsic set types:\n' - '\n' - ' Sets\n' - ' These represent a mutable set. They are created by the ' - 'built-in\n' - ' "set()" constructor and can be modified afterwards by ' - 'several\n' - ' methods, such as "add()".\n' - '\n' - ' Frozen sets\n' - ' These represent an immutable set. They are created by the\n' - ' built-in "frozenset()" constructor. As a frozenset is ' - 'immutable\n' - ' and *hashable*, it can be used again as an element of ' - 'another\n' - ' set, or as a dictionary key.\n' - '\n' - 'Mappings\n' - ' These represent finite sets of objects indexed by arbitrary ' - 'index\n' - ' sets. The subscript notation "a[k]" selects the item indexed by ' - '"k"\n' - ' from the mapping "a"; this can be used in expressions and as ' - 'the\n' - ' target of assignments or "del" statements. The built-in ' - 'function\n' - ' "len()" returns the number of items in a mapping.\n' - '\n' - ' There is currently a single intrinsic mapping type:\n' - '\n' - ' Dictionaries\n' - ' These represent finite sets of objects indexed by nearly\n' - ' arbitrary values. The only types of values not acceptable ' - 'as\n' - ' keys are values containing lists or dictionaries or other\n' - ' mutable types that are compared by value rather than by ' - 'object\n' - ' identity, the reason being that the efficient implementation ' - 'of\n' - " dictionaries requires a key's hash value to remain constant.\n" - ' Numeric types used for keys obey the normal rules for ' - 'numeric\n' - ' comparison: if two numbers compare equal (e.g., "1" and ' - '"1.0")\n' - ' then they can be used interchangeably to index the same\n' - ' dictionary entry.\n' - '\n' - ' Dictionaries are mutable; they can be created by the "{...}"\n' - ' notation (see section Dictionary displays).\n' - '\n' - ' The extension modules "dbm", "gdbm", and "bsddb" provide\n' - ' additional examples of mapping types.\n' - '\n' - 'Callable types\n' - ' These are the types to which the function call operation (see\n' - ' section Calls) can be applied:\n' - '\n' - ' User-defined functions\n' - ' A user-defined function object is created by a function\n' - ' definition (see section Function definitions). It should be\n' - ' called with an argument list containing the same number of ' - 'items\n' - " as the function's formal parameter list.\n" - '\n' - ' Special attributes:\n' - '\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | Attribute | Meaning ' - '| |\n' - ' ' - '+=========================+=================================+=============+\n' - ' | "__doc__" "func_doc" | The function\'s documentation ' - '| Writable |\n' - ' | | string, or "None" if ' - '| |\n' - ' | | unavailable. ' - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__name__" "func_name" | The function\'s name. ' - '| Writable |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__module__" | The name of the module the | ' - 'Writable |\n' - ' | | function was defined in, or ' - '| |\n' - ' | | "None" if unavailable. ' - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__defaults__" | A tuple containing default | ' - 'Writable |\n' - ' | "func_defaults" | argument values for those ' - '| |\n' - ' | | arguments that have defaults, ' - '| |\n' - ' | | or "None" if no arguments have ' - '| |\n' - ' | | a default value. ' - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__code__" "func_code" | The code object representing | ' - 'Writable |\n' - ' | | the compiled function body. ' - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__globals__" | A reference to the dictionary | ' - 'Read-only |\n' - ' | "func_globals" | that holds the function\'s ' - '| |\n' - ' | | global variables --- the global ' - '| |\n' - ' | | namespace of the module in ' - '| |\n' - ' | | which the function was defined. ' - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__dict__" "func_dict" | The namespace supporting | ' - 'Writable |\n' - ' | | arbitrary function attributes. ' - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - ' | "__closure__" | "None" or a tuple of cells that | ' - 'Read-only |\n' - ' | "func_closure" | contain bindings for the ' - '| |\n' - " | | function's free variables. " - '| |\n' - ' ' - '+-------------------------+---------------------------------+-------------+\n' - '\n' - ' Most of the attributes labelled "Writable" check the type of ' - 'the\n' - ' assigned value.\n' - '\n' - ' Changed in version 2.4: "func_name" is now writable.\n' - '\n' - ' Changed in version 2.6: The double-underscore attributes\n' - ' "__closure__", "__code__", "__defaults__", and "__globals__"\n' - ' were introduced as aliases for the corresponding "func_*"\n' - ' attributes for forwards compatibility with Python 3.\n' - '\n' - ' Function objects also support getting and setting arbitrary\n' - ' attributes, which can be used, for example, to attach ' - 'metadata\n' - ' to functions. Regular attribute dot-notation is used to get ' - 'and\n' - ' set such attributes. *Note that the current implementation ' - 'only\n' - ' supports function attributes on user-defined functions. ' - 'Function\n' - ' attributes on built-in functions may be supported in the\n' - ' future.*\n' - '\n' - " Additional information about a function's definition can be\n" - ' retrieved from its code object; see the description of ' - 'internal\n' - ' types below.\n' - '\n' - ' User-defined methods\n' - ' A user-defined method object combines a class, a class ' - 'instance\n' - ' (or "None") and any callable object (normally a user-defined\n' - ' function).\n' - '\n' - ' Special read-only attributes: "im_self" is the class ' - 'instance\n' - ' object, "im_func" is the function object; "im_class" is the\n' - ' class of "im_self" for bound methods or the class that asked ' - 'for\n' - ' the method for unbound methods; "__doc__" is the method\'s\n' - ' documentation (same as "im_func.__doc__"); "__name__" is the\n' - ' method name (same as "im_func.__name__"); "__module__" is ' - 'the\n' - ' name of the module the method was defined in, or "None" if\n' - ' unavailable.\n' - '\n' - ' Changed in version 2.2: "im_self" used to refer to the class\n' - ' that defined the method.\n' - '\n' - ' Changed in version 2.6: For Python 3 forward-compatibility,\n' - ' "im_func" is also available as "__func__", and "im_self" as\n' - ' "__self__".\n' - '\n' - ' Methods also support accessing (but not setting) the ' - 'arbitrary\n' - ' function attributes on the underlying function object.\n' - '\n' - ' User-defined method objects may be created when getting an\n' - ' attribute of a class (perhaps via an instance of that class), ' - 'if\n' - ' that attribute is a user-defined function object, an unbound\n' - ' user-defined method object, or a class method object. When ' - 'the\n' - ' attribute is a user-defined method object, a new method ' - 'object\n' - ' is only created if the class from which it is being retrieved ' - 'is\n' - ' the same as, or a derived class of, the class stored in the\n' - ' original method object; otherwise, the original method object ' - 'is\n' - ' used as it is.\n' - '\n' - ' When a user-defined method object is created by retrieving a\n' - ' user-defined function object from a class, its "im_self"\n' - ' attribute is "None" and the method object is said to be ' - 'unbound.\n' - ' When one is created by retrieving a user-defined function ' - 'object\n' - ' from a class via one of its instances, its "im_self" ' - 'attribute\n' - ' is the instance, and the method object is said to be bound. ' - 'In\n' - ' either case, the new method\'s "im_class" attribute is the ' - 'class\n' - ' from which the retrieval takes place, and its "im_func"\n' - ' attribute is the original function object.\n' - '\n' - ' When a user-defined method object is created by retrieving\n' - ' another method object from a class or instance, the behaviour ' - 'is\n' - ' the same as for a function object, except that the "im_func"\n' - ' attribute of the new instance is not the original method ' - 'object\n' - ' but its "im_func" attribute.\n' - '\n' - ' When a user-defined method object is created by retrieving a\n' - ' class method object from a class or instance, its "im_self"\n' - ' attribute is the class itself, and its "im_func" attribute ' - 'is\n' - ' the function object underlying the class method.\n' - '\n' - ' When an unbound user-defined method object is called, the\n' - ' underlying function ("im_func") is called, with the ' - 'restriction\n' - ' that the first argument must be an instance of the proper ' - 'class\n' - ' ("im_class") or of a derived class thereof.\n' - '\n' - ' When a bound user-defined method object is called, the\n' - ' underlying function ("im_func") is called, inserting the ' - 'class\n' - ' instance ("im_self") in front of the argument list. For\n' - ' instance, when "C" is a class which contains a definition for ' - 'a\n' - ' function "f()", and "x" is an instance of "C", calling ' - '"x.f(1)"\n' - ' is equivalent to calling "C.f(x, 1)".\n' - '\n' - ' When a user-defined method object is derived from a class ' - 'method\n' - ' object, the "class instance" stored in "im_self" will ' - 'actually\n' - ' be the class itself, so that calling either "x.f(1)" or ' - '"C.f(1)"\n' - ' is equivalent to calling "f(C,1)" where "f" is the ' - 'underlying\n' - ' function.\n' - '\n' - ' Note that the transformation from function object to (unbound ' - 'or\n' - ' bound) method object happens each time the attribute is\n' - ' retrieved from the class or instance. In some cases, a ' - 'fruitful\n' - ' optimization is to assign the attribute to a local variable ' - 'and\n' - ' call that local variable. Also notice that this ' - 'transformation\n' - ' only happens for user-defined functions; other callable ' - 'objects\n' - ' (and all non-callable objects) are retrieved without\n' - ' transformation. It is also important to note that ' - 'user-defined\n' - ' functions which are attributes of a class instance are not\n' - ' converted to bound methods; this *only* happens when the\n' - ' function is an attribute of the class.\n' - '\n' - ' Generator functions\n' - ' A function or method which uses the "yield" statement (see\n' - ' section The yield statement) is called a *generator ' - 'function*.\n' - ' Such a function, when called, always returns an iterator ' - 'object\n' - ' which can be used to execute the body of the function: ' - 'calling\n' - ' the iterator\'s "next()" method will cause the function to\n' - ' execute until it provides a value using the "yield" ' - 'statement.\n' - ' When the function executes a "return" statement or falls off ' - 'the\n' - ' end, a "StopIteration" exception is raised and the iterator ' - 'will\n' - ' have reached the end of the set of values to be returned.\n' - '\n' - ' Built-in functions\n' - ' A built-in function object is a wrapper around a C function.\n' - ' Examples of built-in functions are "len()" and "math.sin()"\n' - ' ("math" is a standard built-in module). The number and type ' - 'of\n' - ' the arguments are determined by the C function. Special ' - 'read-\n' - ' only attributes: "__doc__" is the function\'s documentation\n' - ' string, or "None" if unavailable; "__name__" is the ' - "function's\n" - ' name; "__self__" is set to "None" (but see the next item);\n' - ' "__module__" is the name of the module the function was ' - 'defined\n' - ' in or "None" if unavailable.\n' - '\n' - ' Built-in methods\n' - ' This is really a different disguise of a built-in function, ' - 'this\n' - ' time containing an object passed to the C function as an\n' - ' implicit extra argument. An example of a built-in method is\n' - ' "alist.append()", assuming *alist* is a list object. In this\n' - ' case, the special read-only attribute "__self__" is set to ' - 'the\n' - ' object denoted by *alist*.\n' - '\n' - ' Class Types\n' - ' Class types, or "new-style classes," are callable. These\n' - ' objects normally act as factories for new instances of\n' - ' themselves, but variations are possible for class types that\n' - ' override "__new__()". The arguments of the call are passed ' - 'to\n' - ' "__new__()" and, in the typical case, to "__init__()" to\n' - ' initialize the new instance.\n' - '\n' - ' Classic Classes\n' - ' Class objects are described below. When a class object is\n' - ' called, a new class instance (also described below) is ' - 'created\n' - " and returned. This implies a call to the class's " - '"__init__()"\n' - ' method if it has one. Any arguments are passed on to the\n' - ' "__init__()" method. If there is no "__init__()" method, ' - 'the\n' - ' class must be called without arguments.\n' - '\n' - ' Class instances\n' - ' Class instances are described below. Class instances are\n' - ' callable only when the class has a "__call__()" method;\n' - ' "x(arguments)" is a shorthand for "x.__call__(arguments)".\n' - '\n' - 'Modules\n' - ' Modules are imported by the "import" statement (see section The\n' - ' import statement). A module object has a namespace implemented ' - 'by a\n' - ' dictionary object (this is the dictionary referenced by the\n' - ' func_globals attribute of functions defined in the module).\n' - ' Attribute references are translated to lookups in this ' - 'dictionary,\n' - ' e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\n' - ' does not contain the code object used to initialize the module\n' - " (since it isn't needed once the initialization is done).\n" - '\n' - " Attribute assignment updates the module's namespace dictionary,\n" - ' e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n' - '\n' - ' Special read-only attribute: "__dict__" is the module\'s ' - 'namespace\n' - ' as a dictionary object.\n' - '\n' - ' **CPython implementation detail:** Because of the way CPython\n' - ' clears module dictionaries, the module dictionary will be ' - 'cleared\n' - ' when the module falls out of scope even if the dictionary still ' - 'has\n' - ' live references. To avoid this, copy the dictionary or keep ' - 'the\n' - ' module around while using its dictionary directly.\n' - '\n' - ' Predefined (writable) attributes: "__name__" is the module\'s ' - 'name;\n' - ' "__doc__" is the module\'s documentation string, or "None" if\n' - ' unavailable; "__file__" is the pathname of the file from which ' - 'the\n' - ' module was loaded, if it was loaded from a file. The "__file__"\n' - ' attribute is not present for C modules that are statically ' - 'linked\n' - ' into the interpreter; for extension modules loaded dynamically ' - 'from\n' - ' a shared library, it is the pathname of the shared library ' - 'file.\n' - '\n' - 'Classes\n' - ' Both class types (new-style classes) and class objects (old-\n' - ' style/classic classes) are typically created by class ' - 'definitions\n' - ' (see section Class definitions). A class has a namespace\n' - ' implemented by a dictionary object. Class attribute references ' - 'are\n' - ' translated to lookups in this dictionary, e.g., "C.x" is ' - 'translated\n' - ' to "C.__dict__["x"]" (although for new-style classes in ' - 'particular\n' - ' there are a number of hooks which allow for other means of ' - 'locating\n' - ' attributes). When the attribute name is not found there, the\n' - ' attribute search continues in the base classes. For old-style\n' - ' classes, the search is depth-first, left-to-right in the order ' - 'of\n' - ' occurrence in the base class list. New-style classes use the ' - 'more\n' - ' complex C3 method resolution order which behaves correctly even ' - 'in\n' - " the presence of 'diamond' inheritance structures where there " - 'are\n' - ' multiple inheritance paths leading back to a common ancestor.\n' - ' Additional details on the C3 MRO used by new-style classes can ' - 'be\n' - ' found in the documentation accompanying the 2.3 release at\n' - ' https://www.python.org/download/releases/2.3/mro/.\n' - '\n' - ' When a class attribute reference (for class "C", say) would ' - 'yield a\n' - ' user-defined function object or an unbound user-defined method\n' - ' object whose associated class is either "C" or one of its base\n' - ' classes, it is transformed into an unbound user-defined method\n' - ' object whose "im_class" attribute is "C". When it would yield a\n' - ' class method object, it is transformed into a bound ' - 'user-defined\n' - ' method object whose "im_self" attribute is "C". When it would\n' - ' yield a static method object, it is transformed into the object\n' - ' wrapped by the static method object. See section Implementing\n' - ' Descriptors for another way in which attributes retrieved from ' - 'a\n' - ' class may differ from those actually contained in its ' - '"__dict__"\n' - ' (note that only new-style classes support descriptors).\n' - '\n' - " Class attribute assignments update the class's dictionary, " - 'never\n' - ' the dictionary of a base class.\n' - '\n' - ' A class object can be called (see above) to yield a class ' - 'instance\n' - ' (see below).\n' - '\n' - ' Special attributes: "__name__" is the class name; "__module__" ' - 'is\n' - ' the module name in which the class was defined; "__dict__" is ' - 'the\n' - ' dictionary containing the class\'s namespace; "__bases__" is a ' - 'tuple\n' - ' (possibly empty or a singleton) containing the base classes, in ' - 'the\n' - ' order of their occurrence in the base class list; "__doc__" is ' - 'the\n' - " class's documentation string, or None if undefined.\n" - '\n' - 'Class instances\n' - ' A class instance is created by calling a class object (see ' - 'above).\n' - ' A class instance has a namespace implemented as a dictionary ' - 'which\n' - ' is the first place in which attribute references are searched.\n' - " When an attribute is not found there, and the instance's class " - 'has\n' - ' an attribute by that name, the search continues with the class\n' - ' attributes. If a class attribute is found that is a ' - 'user-defined\n' - ' function object or an unbound user-defined method object whose\n' - ' associated class is the class (call it "C") of the instance for\n' - ' which the attribute reference was initiated or one of its bases, ' - 'it\n' - ' is transformed into a bound user-defined method object whose\n' - ' "im_class" attribute is "C" and whose "im_self" attribute is ' - 'the\n' - ' instance. Static method and class method objects are also\n' - ' transformed, as if they had been retrieved from class "C"; see\n' - ' above under "Classes". See section Implementing Descriptors for\n' - ' another way in which attributes of a class retrieved via its\n' - ' instances may differ from the objects actually stored in the\n' - ' class\'s "__dict__". If no class attribute is found, and the\n' - ' object\'s class has a "__getattr__()" method, that is called to\n' - ' satisfy the lookup.\n' - '\n' - " Attribute assignments and deletions update the instance's\n" - " dictionary, never a class's dictionary. If the class has a\n" - ' "__setattr__()" or "__delattr__()" method, this is called ' - 'instead\n' - ' of updating the instance dictionary directly.\n' - '\n' - ' Class instances can pretend to be numbers, sequences, or ' - 'mappings\n' - ' if they have methods with certain special names. See section\n' - ' Special method names.\n' - '\n' - ' Special attributes: "__dict__" is the attribute dictionary;\n' - ' "__class__" is the instance\'s class.\n' - '\n' - 'Files\n' - ' A file object represents an open file. File objects are created ' - 'by\n' - ' the "open()" built-in function, and also by "os.popen()",\n' - ' "os.fdopen()", and the "makefile()" method of socket objects ' - '(and\n' - ' perhaps by other functions or methods provided by extension\n' - ' modules). The objects "sys.stdin", "sys.stdout" and ' - '"sys.stderr"\n' - ' are initialized to file objects corresponding to the ' - "interpreter's\n" - ' standard input, output and error streams. See File Objects for\n' - ' complete documentation of file objects.\n' - '\n' - 'Internal types\n' - ' A few types used internally by the interpreter are exposed to ' - 'the\n' - ' user. Their definitions may change with future versions of the\n' - ' interpreter, but they are mentioned here for completeness.\n' - '\n' - ' Code objects\n' - ' Code objects represent *byte-compiled* executable Python ' - 'code,\n' - ' or *bytecode*. The difference between a code object and a\n' - ' function object is that the function object contains an ' - 'explicit\n' - " reference to the function's globals (the module in which it " - 'was\n' - ' defined), while a code object contains no context; also the\n' - ' default argument values are stored in the function object, ' - 'not\n' - ' in the code object (because they represent values calculated ' - 'at\n' - ' run-time). Unlike function objects, code objects are ' - 'immutable\n' - ' and contain no references (directly or indirectly) to ' - 'mutable\n' - ' objects.\n' - '\n' - ' Special read-only attributes: "co_name" gives the function ' - 'name;\n' - ' "co_argcount" is the number of positional arguments ' - '(including\n' - ' arguments with default values); "co_nlocals" is the number ' - 'of\n' - ' local variables used by the function (including arguments);\n' - ' "co_varnames" is a tuple containing the names of the local\n' - ' variables (starting with the argument names); "co_cellvars" ' - 'is a\n' - ' tuple containing the names of local variables that are\n' - ' referenced by nested functions; "co_freevars" is a tuple\n' - ' containing the names of free variables; "co_code" is a ' - 'string\n' - ' representing the sequence of bytecode instructions; ' - '"co_consts"\n' - ' is a tuple containing the literals used by the bytecode;\n' - ' "co_names" is a tuple containing the names used by the ' - 'bytecode;\n' - ' "co_filename" is the filename from which the code was ' - 'compiled;\n' - ' "co_firstlineno" is the first line number of the function;\n' - ' "co_lnotab" is a string encoding the mapping from bytecode\n' - ' offsets to line numbers (for details see the source code of ' - 'the\n' - ' interpreter); "co_stacksize" is the required stack size\n' - ' (including local variables); "co_flags" is an integer ' - 'encoding a\n' - ' number of flags for the interpreter.\n' - '\n' - ' The following flag bits are defined for "co_flags": bit ' - '"0x04"\n' - ' is set if the function uses the "*arguments" syntax to accept ' - 'an\n' - ' arbitrary number of positional arguments; bit "0x08" is set ' - 'if\n' - ' the function uses the "**keywords" syntax to accept ' - 'arbitrary\n' - ' keyword arguments; bit "0x20" is set if the function is a\n' - ' generator.\n' - '\n' - ' Future feature declarations ("from __future__ import ' - 'division")\n' - ' also use bits in "co_flags" to indicate whether a code ' - 'object\n' - ' was compiled with a particular feature enabled: bit "0x2000" ' - 'is\n' - ' set if the function was compiled with future division ' - 'enabled;\n' - ' bits "0x10" and "0x1000" were used in earlier versions of\n' - ' Python.\n' - '\n' - ' Other bits in "co_flags" are reserved for internal use.\n' - '\n' - ' If a code object represents a function, the first item in\n' - ' "co_consts" is the documentation string of the function, or\n' - ' "None" if undefined.\n' - '\n' - ' Frame objects\n' - ' Frame objects represent execution frames. They may occur in\n' - ' traceback objects (see below).\n' - '\n' - ' Special read-only attributes: "f_back" is to the previous ' - 'stack\n' - ' frame (towards the caller), or "None" if this is the bottom\n' - ' stack frame; "f_code" is the code object being executed in ' - 'this\n' - ' frame; "f_locals" is the dictionary used to look up local\n' - ' variables; "f_globals" is used for global variables;\n' - ' "f_builtins" is used for built-in (intrinsic) names;\n' - ' "f_restricted" is a flag indicating whether the function is\n' - ' executing in restricted execution mode; "f_lasti" gives the\n' - ' precise instruction (this is an index into the bytecode ' - 'string\n' - ' of the code object).\n' - '\n' - ' Special writable attributes: "f_trace", if not "None", is a\n' - ' function called at the start of each source code line (this ' - 'is\n' - ' used by the debugger); "f_exc_type", "f_exc_value",\n' - ' "f_exc_traceback" represent the last exception raised in the\n' - ' parent frame provided another exception was ever raised in ' - 'the\n' - ' current frame (in all other cases they are None); "f_lineno" ' - 'is\n' - ' the current line number of the frame --- writing to this ' - 'from\n' - ' within a trace function jumps to the given line (only for ' - 'the\n' - ' bottom-most frame). A debugger can implement a Jump command\n' - ' (aka Set Next Statement) by writing to f_lineno.\n' - '\n' - ' Traceback objects\n' - ' Traceback objects represent a stack trace of an exception. ' - 'A\n' - ' traceback object is created when an exception occurs. When ' - 'the\n' - ' search for an exception handler unwinds the execution stack, ' - 'at\n' - ' each unwound level a traceback object is inserted in front ' - 'of\n' - ' the current traceback. When an exception handler is ' - 'entered,\n' - ' the stack trace is made available to the program. (See ' - 'section\n' - ' The try statement.) It is accessible as "sys.exc_traceback", ' - 'and\n' - ' also as the third item of the tuple returned by\n' - ' "sys.exc_info()". The latter is the preferred interface, ' - 'since\n' - ' it works correctly when the program is using multiple ' - 'threads.\n' - ' When the program contains no suitable handler, the stack ' - 'trace\n' - ' is written (nicely formatted) to the standard error stream; ' - 'if\n' - ' the interpreter is interactive, it is also made available to ' - 'the\n' - ' user as "sys.last_traceback".\n' - '\n' - ' Special read-only attributes: "tb_next" is the next level in ' - 'the\n' - ' stack trace (towards the frame where the exception occurred), ' - 'or\n' - ' "None" if there is no next level; "tb_frame" points to the\n' - ' execution frame of the current level; "tb_lineno" gives the ' - 'line\n' - ' number where the exception occurred; "tb_lasti" indicates ' - 'the\n' - ' precise instruction. The line number and last instruction ' - 'in\n' - ' the traceback may differ from the line number of its frame\n' - ' object if the exception occurred in a "try" statement with ' - 'no\n' - ' matching except clause or with a finally clause.\n' - '\n' - ' Slice objects\n' - ' Slice objects are used to represent slices when *extended ' - 'slice\n' - ' syntax* is used. This is a slice using two colons, or ' - 'multiple\n' - ' slices or ellipses separated by commas, e.g., "a[i:j:step]",\n' - ' "a[i:j, k:l]", or "a[..., i:j]". They are also created by ' - 'the\n' - ' built-in "slice()" function.\n' - '\n' - ' Special read-only attributes: "start" is the lower bound; ' - '"stop"\n' - ' is the upper bound; "step" is the step value; each is "None" ' - 'if\n' - ' omitted. These attributes can have any type.\n' - '\n' - ' Slice objects support one method:\n' - '\n' - ' slice.indices(self, length)\n' - '\n' - ' This method takes a single integer argument *length* and\n' - ' computes information about the extended slice that the ' - 'slice\n' - ' object would describe if applied to a sequence of ' - '*length*\n' - ' items. It returns a tuple of three integers; ' - 'respectively\n' - ' these are the *start* and *stop* indices and the *step* ' - 'or\n' - ' stride length of the slice. Missing or out-of-bounds ' - 'indices\n' - ' are handled in a manner consistent with regular slices.\n' - '\n' - ' New in version 2.3.\n' - '\n' - ' Static method objects\n' - ' Static method objects provide a way of defeating the\n' - ' transformation of function objects to method objects ' - 'described\n' - ' above. A static method object is a wrapper around any other\n' - ' object, usually a user-defined method object. When a static\n' - ' method object is retrieved from a class or a class instance, ' - 'the\n' - ' object actually returned is the wrapped object, which is not\n' - ' subject to any further transformation. Static method objects ' - 'are\n' - ' not themselves callable, although the objects they wrap ' - 'usually\n' - ' are. Static method objects are created by the built-in\n' - ' "staticmethod()" constructor.\n' - '\n' - ' Class method objects\n' - ' A class method object, like a static method object, is a ' - 'wrapper\n' - ' around another object that alters the way in which that ' - 'object\n' - ' is retrieved from classes and class instances. The behaviour ' - 'of\n' - ' class method objects upon such retrieval is described above,\n' - ' under "User-defined methods". Class method objects are ' - 'created\n' - ' by the built-in "classmethod()" constructor.\n', - 'typesfunctions': '\n' - 'Functions\n' - '*********\n' - '\n' - 'Function objects are created by function definitions. The ' - 'only\n' - 'operation on a function object is to call it: ' - '"func(argument-list)".\n' - '\n' - 'There are really two flavors of function objects: built-in ' - 'functions\n' - 'and user-defined functions. Both support the same ' - 'operation (to call\n' - 'the function), but the implementation is different, hence ' - 'the\n' - 'different object types.\n' - '\n' - 'See Function definitions for more information.\n', - 'typesmapping': '\n' - 'Mapping Types --- "dict"\n' - '************************\n' - '\n' - 'A *mapping* object maps *hashable* values to arbitrary ' - 'objects.\n' - 'Mappings are mutable objects. There is currently only one ' - 'standard\n' - 'mapping type, the *dictionary*. (For other containers see ' - 'the built\n' - 'in "list", "set", and "tuple" classes, and the "collections" ' - 'module.)\n' - '\n' - "A dictionary's keys are *almost* arbitrary values. Values " - 'that are\n' - 'not *hashable*, that is, values containing lists, ' - 'dictionaries or\n' - 'other mutable types (that are compared by value rather than ' - 'by object\n' - 'identity) may not be used as keys. Numeric types used for ' - 'keys obey\n' - 'the normal rules for numeric comparison: if two numbers ' - 'compare equal\n' - '(such as "1" and "1.0") then they can be used ' - 'interchangeably to index\n' - 'the same dictionary entry. (Note however, that since ' - 'computers store\n' - 'floating-point numbers as approximations it is usually ' - 'unwise to use\n' - 'them as dictionary keys.)\n' - '\n' - 'Dictionaries can be created by placing a comma-separated ' - 'list of "key:\n' - 'value" pairs within braces, for example: "{\'jack\': 4098, ' - "'sjoerd':\n" - '4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the ' - '"dict"\n' - 'constructor.\n' - '\n' - 'class dict(**kwarg)\n' - 'class dict(mapping, **kwarg)\n' - 'class dict(iterable, **kwarg)\n' - '\n' - ' Return a new dictionary initialized from an optional ' - 'positional\n' - ' argument and a possibly empty set of keyword arguments.\n' - '\n' - ' If no positional argument is given, an empty dictionary ' - 'is created.\n' - ' If a positional argument is given and it is a mapping ' - 'object, a\n' - ' dictionary is created with the same key-value pairs as ' - 'the mapping\n' - ' object. Otherwise, the positional argument must be an ' - '*iterable*\n' - ' object. Each item in the iterable must itself be an ' - 'iterable with\n' - ' exactly two objects. The first object of each item ' - 'becomes a key\n' - ' in the new dictionary, and the second object the ' - 'corresponding\n' - ' value. If a key occurs more than once, the last value ' - 'for that key\n' - ' becomes the corresponding value in the new dictionary.\n' - '\n' - ' If keyword arguments are given, the keyword arguments and ' - 'their\n' - ' values are added to the dictionary created from the ' - 'positional\n' - ' argument. If a key being added is already present, the ' - 'value from\n' - ' the keyword argument replaces the value from the ' - 'positional\n' - ' argument.\n' - '\n' - ' To illustrate, the following examples all return a ' - 'dictionary equal\n' - ' to "{"one": 1, "two": 2, "three": 3}":\n' - '\n' - ' >>> a = dict(one=1, two=2, three=3)\n' - " >>> b = {'one': 1, 'two': 2, 'three': 3}\n" - " >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n" - " >>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n" - " >>> e = dict({'three': 3, 'one': 1, 'two': 2})\n" - ' >>> a == b == c == d == e\n' - ' True\n' - '\n' - ' Providing keyword arguments as in the first example only ' - 'works for\n' - ' keys that are valid Python identifiers. Otherwise, any ' - 'valid keys\n' - ' can be used.\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' Changed in version 2.3: Support for building a dictionary ' - 'from\n' - ' keyword arguments added.\n' - '\n' - ' These are the operations that dictionaries support (and ' - 'therefore,\n' - ' custom mapping types should support too):\n' - '\n' - ' len(d)\n' - '\n' - ' Return the number of items in the dictionary *d*.\n' - '\n' - ' d[key]\n' - '\n' - ' Return the item of *d* with key *key*. Raises a ' - '"KeyError" if\n' - ' *key* is not in the map.\n' - '\n' - ' If a subclass of dict defines a method "__missing__()" ' - 'and *key*\n' - ' is not present, the "d[key]" operation calls that ' - 'method with\n' - ' the key *key* as argument. The "d[key]" operation ' - 'then returns\n' - ' or raises whatever is returned or raised by the\n' - ' "__missing__(key)" call. No other operations or ' - 'methods invoke\n' - ' "__missing__()". If "__missing__()" is not defined, ' - '"KeyError"\n' - ' is raised. "__missing__()" must be a method; it cannot ' - 'be an\n' - ' instance variable:\n' - '\n' - ' >>> class Counter(dict):\n' - ' ... def __missing__(self, key):\n' - ' ... return 0\n' - ' >>> c = Counter()\n' - " >>> c['red']\n" - ' 0\n' - " >>> c['red'] += 1\n" - " >>> c['red']\n" - ' 1\n' - '\n' - ' The example above shows part of the implementation of\n' - ' "collections.Counter". A different "__missing__" ' - 'method is used\n' - ' by "collections.defaultdict".\n' - '\n' - ' New in version 2.5: Recognition of __missing__ methods ' - 'of dict\n' - ' subclasses.\n' - '\n' - ' d[key] = value\n' - '\n' - ' Set "d[key]" to *value*.\n' - '\n' - ' del d[key]\n' - '\n' - ' Remove "d[key]" from *d*. Raises a "KeyError" if ' - '*key* is not\n' - ' in the map.\n' - '\n' - ' key in d\n' - '\n' - ' Return "True" if *d* has a key *key*, else "False".\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' key not in d\n' - '\n' - ' Equivalent to "not key in d".\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' iter(d)\n' - '\n' - ' Return an iterator over the keys of the dictionary. ' - 'This is a\n' - ' shortcut for "iterkeys()".\n' - '\n' - ' clear()\n' - '\n' - ' Remove all items from the dictionary.\n' - '\n' - ' copy()\n' - '\n' - ' Return a shallow copy of the dictionary.\n' - '\n' - ' fromkeys(seq[, value])\n' - '\n' - ' Create a new dictionary with keys from *seq* and ' - 'values set to\n' - ' *value*.\n' - '\n' - ' "fromkeys()" is a class method that returns a new ' - 'dictionary.\n' - ' *value* defaults to "None".\n' - '\n' - ' New in version 2.3.\n' - '\n' - ' get(key[, default])\n' - '\n' - ' Return the value for *key* if *key* is in the ' - 'dictionary, else\n' - ' *default*. If *default* is not given, it defaults to ' - '"None", so\n' - ' that this method never raises a "KeyError".\n' - '\n' - ' has_key(key)\n' - '\n' - ' Test for the presence of *key* in the dictionary. ' - '"has_key()"\n' - ' is deprecated in favor of "key in d".\n' - '\n' - ' items()\n' - '\n' - ' Return a copy of the dictionary\'s list of "(key, ' - 'value)" pairs.\n' - '\n' - ' **CPython implementation detail:** Keys and values are ' - 'listed in\n' - ' an arbitrary order which is non-random, varies across ' - 'Python\n' - " implementations, and depends on the dictionary's " - 'history of\n' - ' insertions and deletions.\n' - '\n' - ' If "items()", "keys()", "values()", "iteritems()", ' - '"iterkeys()",\n' - ' and "itervalues()" are called with no intervening ' - 'modifications\n' - ' to the dictionary, the lists will directly ' - 'correspond. This\n' - ' allows the creation of "(value, key)" pairs using ' - '"zip()":\n' - ' "pairs = zip(d.values(), d.keys())". The same ' - 'relationship\n' - ' holds for the "iterkeys()" and "itervalues()" methods: ' - '"pairs =\n' - ' zip(d.itervalues(), d.iterkeys())" provides the same ' - 'value for\n' - ' "pairs". Another way to create the same list is "pairs ' - '= [(v, k)\n' - ' for (k, v) in d.iteritems()]".\n' - '\n' - ' iteritems()\n' - '\n' - ' Return an iterator over the dictionary\'s "(key, ' - 'value)" pairs.\n' - ' See the note for "dict.items()".\n' - '\n' - ' Using "iteritems()" while adding or deleting entries ' - 'in the\n' - ' dictionary may raise a "RuntimeError" or fail to ' - 'iterate over\n' - ' all entries.\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' iterkeys()\n' - '\n' - " Return an iterator over the dictionary's keys. See " - 'the note for\n' - ' "dict.items()".\n' - '\n' - ' Using "iterkeys()" while adding or deleting entries in ' - 'the\n' - ' dictionary may raise a "RuntimeError" or fail to ' - 'iterate over\n' - ' all entries.\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' itervalues()\n' - '\n' - " Return an iterator over the dictionary's values. See " - 'the note\n' - ' for "dict.items()".\n' - '\n' - ' Using "itervalues()" while adding or deleting entries ' - 'in the\n' - ' dictionary may raise a "RuntimeError" or fail to ' - 'iterate over\n' - ' all entries.\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' keys()\n' - '\n' - " Return a copy of the dictionary's list of keys. See " - 'the note\n' - ' for "dict.items()".\n' - '\n' - ' pop(key[, default])\n' - '\n' - ' If *key* is in the dictionary, remove it and return ' - 'its value,\n' - ' else return *default*. If *default* is not given and ' - '*key* is\n' - ' not in the dictionary, a "KeyError" is raised.\n' - '\n' - ' New in version 2.3.\n' - '\n' - ' popitem()\n' - '\n' - ' Remove and return an arbitrary "(key, value)" pair ' - 'from the\n' - ' dictionary.\n' - '\n' - ' "popitem()" is useful to destructively iterate over a\n' - ' dictionary, as often used in set algorithms. If the ' - 'dictionary\n' - ' is empty, calling "popitem()" raises a "KeyError".\n' - '\n' - ' setdefault(key[, default])\n' - '\n' - ' If *key* is in the dictionary, return its value. If ' - 'not, insert\n' - ' *key* with a value of *default* and return *default*. ' - '*default*\n' - ' defaults to "None".\n' - '\n' - ' update([other])\n' - '\n' - ' Update the dictionary with the key/value pairs from ' - '*other*,\n' - ' overwriting existing keys. Return "None".\n' - '\n' - ' "update()" accepts either another dictionary object or ' - 'an\n' - ' iterable of key/value pairs (as tuples or other ' - 'iterables of\n' - ' length two). If keyword arguments are specified, the ' - 'dictionary\n' - ' is then updated with those key/value pairs: ' - '"d.update(red=1,\n' - ' blue=2)".\n' - '\n' - ' Changed in version 2.4: Allowed the argument to be an ' - 'iterable\n' - ' of key/value pairs and allowed keyword arguments.\n' - '\n' - ' values()\n' - '\n' - " Return a copy of the dictionary's list of values. See " - 'the note\n' - ' for "dict.items()".\n' - '\n' - ' viewitems()\n' - '\n' - ' Return a new view of the dictionary\'s items ("(key, ' - 'value)"\n' - ' pairs). See below for documentation of view objects.\n' - '\n' - ' New in version 2.7.\n' - '\n' - ' viewkeys()\n' - '\n' - " Return a new view of the dictionary's keys. See below " - 'for\n' - ' documentation of view objects.\n' - '\n' - ' New in version 2.7.\n' - '\n' - ' viewvalues()\n' - '\n' - " Return a new view of the dictionary's values. See " - 'below for\n' - ' documentation of view objects.\n' - '\n' - ' New in version 2.7.\n' - '\n' - ' Dictionaries compare equal if and only if they have the ' - 'same "(key,\n' - ' value)" pairs.\n' - '\n' - '\n' - 'Dictionary view objects\n' - '=======================\n' - '\n' - 'The objects returned by "dict.viewkeys()", ' - '"dict.viewvalues()" and\n' - '"dict.viewitems()" are *view objects*. They provide a ' - 'dynamic view on\n' - "the dictionary's entries, which means that when the " - 'dictionary\n' - 'changes, the view reflects these changes.\n' - '\n' - 'Dictionary views can be iterated over to yield their ' - 'respective data,\n' - 'and support membership tests:\n' - '\n' - 'len(dictview)\n' - '\n' - ' Return the number of entries in the dictionary.\n' - '\n' - 'iter(dictview)\n' - '\n' - ' Return an iterator over the keys, values or items ' - '(represented as\n' - ' tuples of "(key, value)") in the dictionary.\n' - '\n' - ' Keys and values are iterated over in an arbitrary order ' - 'which is\n' - ' non-random, varies across Python implementations, and ' - 'depends on\n' - " the dictionary's history of insertions and deletions. If " - 'keys,\n' - ' values and items views are iterated over with no ' - 'intervening\n' - ' modifications to the dictionary, the order of items will ' - 'directly\n' - ' correspond. This allows the creation of "(value, key)" ' - 'pairs using\n' - ' "zip()": "pairs = zip(d.values(), d.keys())". Another ' - 'way to\n' - ' create the same list is "pairs = [(v, k) for (k, v) in ' - 'd.items()]".\n' - '\n' - ' Iterating views while adding or deleting entries in the ' - 'dictionary\n' - ' may raise a "RuntimeError" or fail to iterate over all ' - 'entries.\n' - '\n' - 'x in dictview\n' - '\n' - ' Return "True" if *x* is in the underlying dictionary\'s ' - 'keys, values\n' - ' or items (in the latter case, *x* should be a "(key, ' - 'value)"\n' - ' tuple).\n' - '\n' - 'Keys views are set-like since their entries are unique and ' - 'hashable.\n' - 'If all values are hashable, so that (key, value) pairs are ' - 'unique and\n' - 'hashable, then the items view is also set-like. (Values ' - 'views are not\n' - 'treated as set-like since the entries are generally not ' - 'unique.) Then\n' - 'these set operations are available ("other" refers either to ' - 'another\n' - 'view or a set):\n' - '\n' - 'dictview & other\n' - '\n' - ' Return the intersection of the dictview and the other ' - 'object as a\n' - ' new set.\n' - '\n' - 'dictview | other\n' - '\n' - ' Return the union of the dictview and the other object as ' - 'a new set.\n' - '\n' - 'dictview - other\n' - '\n' - ' Return the difference between the dictview and the other ' - 'object\n' - " (all elements in *dictview* that aren't in *other*) as a " - 'new set.\n' - '\n' - 'dictview ^ other\n' - '\n' - ' Return the symmetric difference (all elements either in ' - '*dictview*\n' - ' or *other*, but not in both) of the dictview and the ' - 'other object\n' - ' as a new set.\n' - '\n' - 'An example of dictionary view usage:\n' - '\n' - " >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, " - "'spam': 500}\n" - ' >>> keys = dishes.viewkeys()\n' - ' >>> values = dishes.viewvalues()\n' - '\n' - ' >>> # iteration\n' - ' >>> n = 0\n' - ' >>> for val in values:\n' - ' ... n += val\n' - ' >>> print(n)\n' - ' 504\n' - '\n' - ' >>> # keys and values are iterated over in the same ' - 'order\n' - ' >>> list(keys)\n' - " ['eggs', 'bacon', 'sausage', 'spam']\n" - ' >>> list(values)\n' - ' [2, 1, 1, 500]\n' - '\n' - ' >>> # view objects are dynamic and reflect dict changes\n' - " >>> del dishes['eggs']\n" - " >>> del dishes['sausage']\n" - ' >>> list(keys)\n' - " ['spam', 'bacon']\n" - '\n' - ' >>> # set operations\n' - " >>> keys & {'eggs', 'bacon', 'salad'}\n" - " {'bacon'}\n", - 'typesmethods': '\n' - 'Methods\n' - '*******\n' - '\n' - 'Methods are functions that are called using the attribute ' - 'notation.\n' - 'There are two flavors: built-in methods (such as "append()" ' - 'on lists)\n' - 'and class instance methods. Built-in methods are described ' - 'with the\n' - 'types that support them.\n' - '\n' - 'The implementation adds two special read-only attributes to ' - 'class\n' - 'instance methods: "m.im_self" is the object on which the ' - 'method\n' - 'operates, and "m.im_func" is the function implementing the ' - 'method.\n' - 'Calling "m(arg-1, arg-2, ..., arg-n)" is completely ' - 'equivalent to\n' - 'calling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n' - '\n' - 'Class instance methods are either *bound* or *unbound*, ' - 'referring to\n' - 'whether the method was accessed through an instance or a ' - 'class,\n' - 'respectively. When a method is unbound, its "im_self" ' - 'attribute will\n' - 'be "None" and if called, an explicit "self" object must be ' - 'passed as\n' - 'the first argument. In this case, "self" must be an ' - 'instance of the\n' - "unbound method's class (or a subclass of that class), " - 'otherwise a\n' - '"TypeError" is raised.\n' - '\n' - 'Like function objects, methods objects support getting ' - 'arbitrary\n' - 'attributes. However, since method attributes are actually ' - 'stored on\n' - 'the underlying function object ("meth.im_func"), setting ' - 'method\n' - 'attributes on either bound or unbound methods is ' - 'disallowed.\n' - 'Attempting to set an attribute on a method results in an\n' - '"AttributeError" being raised. In order to set a method ' - 'attribute,\n' - 'you need to explicitly set it on the underlying function ' - 'object:\n' - '\n' - ' >>> class C:\n' - ' ... def method(self):\n' - ' ... pass\n' - ' ...\n' - ' >>> c = C()\n' - " >>> c.method.whoami = 'my name is method' # can't set on " - 'the method\n' - ' Traceback (most recent call last):\n' - ' File "", line 1, in \n' - " AttributeError: 'instancemethod' object has no attribute " - "'whoami'\n" - " >>> c.method.im_func.whoami = 'my name is method'\n" - ' >>> c.method.whoami\n' - " 'my name is method'\n" - '\n' - 'See The standard type hierarchy for more information.\n', - 'typesmodules': '\n' - 'Modules\n' - '*******\n' - '\n' - 'The only special operation on a module is attribute access: ' - '"m.name",\n' - 'where *m* is a module and *name* accesses a name defined in ' - "*m*'s\n" - 'symbol table. Module attributes can be assigned to. (Note ' - 'that the\n' - '"import" statement is not, strictly speaking, an operation ' - 'on a module\n' - 'object; "import foo" does not require a module object named ' - '*foo* to\n' - 'exist, rather it requires an (external) *definition* for a ' - 'module\n' - 'named *foo* somewhere.)\n' - '\n' - 'A special attribute of every module is "__dict__". This is ' - 'the\n' - "dictionary containing the module's symbol table. Modifying " - 'this\n' - "dictionary will actually change the module's symbol table, " - 'but direct\n' - 'assignment to the "__dict__" attribute is not possible (you ' - 'can write\n' - '"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but ' - "you can't\n" - 'write "m.__dict__ = {}"). Modifying "__dict__" directly is ' - 'not\n' - 'recommended.\n' - '\n' - 'Modules built into the interpreter are written like this: ' - '"". If loaded from a file, they are ' - 'written as\n' - '"".\n', - 'typesseq': '\n' - 'Sequence Types --- "str", "unicode", "list", "tuple", ' - '"bytearray", "buffer", "xrange"\n' - '*************************************************************************************\n' - '\n' - 'There are seven sequence types: strings, Unicode strings, ' - 'lists,\n' - 'tuples, bytearrays, buffers, and xrange objects.\n' - '\n' - 'For other containers see the built in "dict" and "set" classes, ' - 'and\n' - 'the "collections" module.\n' - '\n' - 'String literals are written in single or double quotes: ' - '"\'xyzzy\'",\n' - '""frobozz"". See String literals for more about string ' - 'literals.\n' - 'Unicode strings are much like strings, but are specified in the ' - 'syntax\n' - 'using a preceding "\'u\'" character: "u\'abc\'", "u"def"". In ' - 'addition to\n' - 'the functionality described here, there are also ' - 'string-specific\n' - 'methods described in the String Methods section. Lists are ' - 'constructed\n' - 'with square brackets, separating items with commas: "[a, b, ' - 'c]".\n' - 'Tuples are constructed by the comma operator (not within square\n' - 'brackets), with or without enclosing parentheses, but an empty ' - 'tuple\n' - 'must have the enclosing parentheses, such as "a, b, c" or "()". ' - 'A\n' - 'single item tuple must have a trailing comma, such as "(d,)".\n' - '\n' - 'Bytearray objects are created with the built-in function\n' - '"bytearray()".\n' - '\n' - 'Buffer objects are not directly supported by Python syntax, but ' - 'can be\n' - 'created by calling the built-in function "buffer()". They ' - "don't\n" - 'support concatenation or repetition.\n' - '\n' - 'Objects of type xrange are similar to buffers in that there is ' - 'no\n' - 'specific syntax to create them, but they are created using the\n' - '"xrange()" function. They don\'t support slicing, concatenation ' - 'or\n' - 'repetition, and using "in", "not in", "min()" or "max()" on them ' - 'is\n' - 'inefficient.\n' - '\n' - 'Most sequence types support the following operations. The "in" ' - 'and\n' - '"not in" operations have the same priorities as the comparison\n' - 'operations. The "+" and "*" operations have the same priority ' - 'as the\n' - 'corresponding numeric operations. [3] Additional methods are ' - 'provided\n' - 'for Mutable Sequence Types.\n' - '\n' - 'This table lists the sequence operations sorted in ascending ' - 'priority.\n' - 'In the table, *s* and *t* are sequences of the same type; *n*, ' - '*i* and\n' - '*j* are integers:\n' - '\n' - '+--------------------+----------------------------------+------------+\n' - '| Operation | Result | ' - 'Notes |\n' - '+====================+==================================+============+\n' - '| "x in s" | "True" if an item of *s* is | ' - '(1) |\n' - '| | equal to *x*, else "False" ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "x not in s" | "False" if an item of *s* is | ' - '(1) |\n' - '| | equal to *x*, else "True" ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s + t" | the concatenation of *s* and *t* | ' - '(6) |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s * n, n * s" | equivalent to adding *s* to | ' - '(2) |\n' - '| | itself *n* times ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s[i]" | *i*th item of *s*, origin 0 | ' - '(3) |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s[i:j]" | slice of *s* from *i* to *j* | ' - '(3)(4) |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s[i:j:k]" | slice of *s* from *i* to *j* | ' - '(3)(5) |\n' - '| | with step *k* ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "len(s)" | length of *s* ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "min(s)" | smallest item of *s* ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "max(s)" | largest item of *s* ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s.index(x)" | index of the first occurrence of ' - '| |\n' - '| | *x* in *s* ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '| "s.count(x)" | total number of occurrences of ' - '| |\n' - '| | *x* in *s* ' - '| |\n' - '+--------------------+----------------------------------+------------+\n' - '\n' - 'Sequence types also support comparisons. In particular, tuples ' - 'and\n' - 'lists are compared lexicographically by comparing corresponding\n' - 'elements. This means that to compare equal, every element must ' - 'compare\n' - 'equal and the two sequences must be of the same type and have ' - 'the same\n' - 'length. (For full details see Comparisons in the language ' - 'reference.)\n' - '\n' - 'Notes:\n' - '\n' - '1. When *s* is a string or Unicode string object the "in" and ' - '"not\n' - ' in" operations act like a substring test. In Python ' - 'versions\n' - ' before 2.3, *x* had to be a string of length 1. In Python 2.3 ' - 'and\n' - ' beyond, *x* may be a string of any length.\n' - '\n' - '2. Values of *n* less than "0" are treated as "0" (which yields ' - 'an\n' - ' empty sequence of the same type as *s*). Note that items in ' - 'the\n' - ' sequence *s* are not copied; they are referenced multiple ' - 'times.\n' - ' This often haunts new Python programmers; consider:\n' - '\n' - ' >>> lists = [[]] * 3\n' - ' >>> lists\n' - ' [[], [], []]\n' - ' >>> lists[0].append(3)\n' - ' >>> lists\n' - ' [[3], [3], [3]]\n' - '\n' - ' What has happened is that "[[]]" is a one-element list ' - 'containing\n' - ' an empty list, so all three elements of "[[]] * 3" are ' - 'references\n' - ' to this single empty list. Modifying any of the elements of\n' - ' "lists" modifies this single list. You can create a list of\n' - ' different lists this way:\n' - '\n' - ' >>> lists = [[] for i in range(3)]\n' - ' >>> lists[0].append(3)\n' - ' >>> lists[1].append(5)\n' - ' >>> lists[2].append(7)\n' - ' >>> lists\n' - ' [[3], [5], [7]]\n' - '\n' - ' Further explanation is available in the FAQ entry How do I ' - 'create a\n' - ' multidimensional list?.\n' - '\n' - '3. If *i* or *j* is negative, the index is relative to the end ' - 'of\n' - ' the string: "len(s) + i" or "len(s) + j" is substituted. But ' - 'note\n' - ' that "-0" is still "0".\n' - '\n' - '4. The slice of *s* from *i* to *j* is defined as the sequence ' - 'of\n' - ' items with index *k* such that "i <= k < j". If *i* or *j* ' - 'is\n' - ' greater than "len(s)", use "len(s)". If *i* is omitted or ' - '"None",\n' - ' use "0". If *j* is omitted or "None", use "len(s)". If *i* ' - 'is\n' - ' greater than or equal to *j*, the slice is empty.\n' - '\n' - '5. The slice of *s* from *i* to *j* with step *k* is defined as ' - 'the\n' - ' sequence of items with index "x = i + n*k" such that "0 <= n ' - '<\n' - ' (j-i)/k". In other words, the indices are "i", "i+k", ' - '"i+2*k",\n' - ' "i+3*k" and so on, stopping when *j* is reached (but never\n' - ' including *j*). If *i* or *j* is greater than "len(s)", use\n' - ' "len(s)". If *i* or *j* are omitted or "None", they become ' - '"end"\n' - ' values (which end depends on the sign of *k*). Note, *k* ' - 'cannot be\n' - ' zero. If *k* is "None", it is treated like "1".\n' - '\n' - '6. **CPython implementation detail:** If *s* and *t* are both\n' - ' strings, some Python implementations such as CPython can ' - 'usually\n' - ' perform an in-place optimization for assignments of the form ' - '"s = s\n' - ' + t" or "s += t". When applicable, this optimization makes\n' - ' quadratic run-time much less likely. This optimization is ' - 'both\n' - ' version and implementation dependent. For performance ' - 'sensitive\n' - ' code, it is preferable to use the "str.join()" method which ' - 'assures\n' - ' consistent linear concatenation performance across versions ' - 'and\n' - ' implementations.\n' - '\n' - ' Changed in version 2.4: Formerly, string concatenation never\n' - ' occurred in-place.\n' - '\n' - '\n' - 'String Methods\n' - '==============\n' - '\n' - 'Below are listed the string methods which both 8-bit strings ' - 'and\n' - 'Unicode objects support. Some of them are also available on\n' - '"bytearray" objects.\n' - '\n' - "In addition, Python's strings support the sequence type methods\n" - 'described in the Sequence Types --- str, unicode, list, tuple,\n' - 'bytearray, buffer, xrange section. To output formatted strings ' - 'use\n' - 'template strings or the "%" operator described in the String\n' - 'Formatting Operations section. Also, see the "re" module for ' - 'string\n' - 'functions based on regular expressions.\n' - '\n' - 'str.capitalize()\n' - '\n' - ' Return a copy of the string with its first character ' - 'capitalized\n' - ' and the rest lowercased.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.center(width[, fillchar])\n' - '\n' - ' Return centered in a string of length *width*. Padding is ' - 'done\n' - ' using the specified *fillchar* (default is a space).\n' - '\n' - ' Changed in version 2.4: Support for the *fillchar* argument.\n' - '\n' - 'str.count(sub[, start[, end]])\n' - '\n' - ' Return the number of non-overlapping occurrences of substring ' - '*sub*\n' - ' in the range [*start*, *end*]. Optional arguments *start* ' - 'and\n' - ' *end* are interpreted as in slice notation.\n' - '\n' - 'str.decode([encoding[, errors]])\n' - '\n' - ' Decodes the string using the codec registered for ' - '*encoding*.\n' - ' *encoding* defaults to the default string encoding. *errors* ' - 'may\n' - ' be given to set a different error handling scheme. The ' - 'default is\n' - ' "\'strict\'", meaning that encoding errors raise ' - '"UnicodeError".\n' - ' Other possible values are "\'ignore\'", "\'replace\'" and any ' - 'other\n' - ' name registered via "codecs.register_error()", see section ' - 'Codec\n' - ' Base Classes.\n' - '\n' - ' New in version 2.2.\n' - '\n' - ' Changed in version 2.3: Support for other error handling ' - 'schemes\n' - ' added.\n' - '\n' - ' Changed in version 2.7: Support for keyword arguments added.\n' - '\n' - 'str.encode([encoding[, errors]])\n' - '\n' - ' Return an encoded version of the string. Default encoding is ' - 'the\n' - ' current default string encoding. *errors* may be given to ' - 'set a\n' - ' different error handling scheme. The default for *errors* ' - 'is\n' - ' "\'strict\'", meaning that encoding errors raise a ' - '"UnicodeError".\n' - ' Other possible values are "\'ignore\'", "\'replace\'",\n' - ' "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other ' - 'name\n' - ' registered via "codecs.register_error()", see section Codec ' - 'Base\n' - ' Classes. For a list of possible encodings, see section ' - 'Standard\n' - ' Encodings.\n' - '\n' - ' New in version 2.0.\n' - '\n' - ' Changed in version 2.3: Support for "\'xmlcharrefreplace\'" ' - 'and\n' - ' "\'backslashreplace\'" and other error handling schemes ' - 'added.\n' - '\n' - ' Changed in version 2.7: Support for keyword arguments added.\n' - '\n' - 'str.endswith(suffix[, start[, end]])\n' - '\n' - ' Return "True" if the string ends with the specified ' - '*suffix*,\n' - ' otherwise return "False". *suffix* can also be a tuple of ' - 'suffixes\n' - ' to look for. With optional *start*, test beginning at that\n' - ' position. With optional *end*, stop comparing at that ' - 'position.\n' - '\n' - ' Changed in version 2.5: Accept tuples as *suffix*.\n' - '\n' - 'str.expandtabs([tabsize])\n' - '\n' - ' Return a copy of the string where all tab characters are ' - 'replaced\n' - ' by one or more spaces, depending on the current column and ' - 'the\n' - ' given tab size. Tab positions occur every *tabsize* ' - 'characters\n' - ' (default is 8, giving tab positions at columns 0, 8, 16 and ' - 'so on).\n' - ' To expand the string, the current column is set to zero and ' - 'the\n' - ' string is examined character by character. If the character ' - 'is a\n' - ' tab ("\\t"), one or more space characters are inserted in the ' - 'result\n' - ' until the current column is equal to the next tab position. ' - '(The\n' - ' tab character itself is not copied.) If the character is a ' - 'newline\n' - ' ("\\n") or return ("\\r"), it is copied and the current ' - 'column is\n' - ' reset to zero. Any other character is copied unchanged and ' - 'the\n' - ' current column is incremented by one regardless of how the\n' - ' character is represented when printed.\n' - '\n' - " >>> '01\\t012\\t0123\\t01234'.expandtabs()\n" - " '01 012 0123 01234'\n" - " >>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" - " '01 012 0123 01234'\n" - '\n' - 'str.find(sub[, start[, end]])\n' - '\n' - ' Return the lowest index in the string where substring *sub* ' - 'is\n' - ' found within the slice "s[start:end]". Optional arguments ' - '*start*\n' - ' and *end* are interpreted as in slice notation. Return "-1" ' - 'if\n' - ' *sub* is not found.\n' - '\n' - ' Note: The "find()" method should be used only if you need to ' - 'know\n' - ' the position of *sub*. To check if *sub* is a substring or ' - 'not,\n' - ' use the "in" operator:\n' - '\n' - " >>> 'Py' in 'Python'\n" - ' True\n' - '\n' - 'str.format(*args, **kwargs)\n' - '\n' - ' Perform a string formatting operation. The string on which ' - 'this\n' - ' method is called can contain literal text or replacement ' - 'fields\n' - ' delimited by braces "{}". Each replacement field contains ' - 'either\n' - ' the numeric index of a positional argument, or the name of a\n' - ' keyword argument. Returns a copy of the string where each\n' - ' replacement field is replaced with the string value of the\n' - ' corresponding argument.\n' - '\n' - ' >>> "The sum of 1 + 2 is {0}".format(1+2)\n' - " 'The sum of 1 + 2 is 3'\n" - '\n' - ' See Format String Syntax for a description of the various\n' - ' formatting options that can be specified in format strings.\n' - '\n' - ' This method of string formatting is the new standard in ' - 'Python 3,\n' - ' and should be preferred to the "%" formatting described in ' - 'String\n' - ' Formatting Operations in new code.\n' - '\n' - ' New in version 2.6.\n' - '\n' - 'str.index(sub[, start[, end]])\n' - '\n' - ' Like "find()", but raise "ValueError" when the substring is ' - 'not\n' - ' found.\n' - '\n' - 'str.isalnum()\n' - '\n' - ' Return true if all characters in the string are alphanumeric ' - 'and\n' - ' there is at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isalpha()\n' - '\n' - ' Return true if all characters in the string are alphabetic ' - 'and\n' - ' there is at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isdigit()\n' - '\n' - ' Return true if all characters in the string are digits and ' - 'there is\n' - ' at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.islower()\n' - '\n' - ' Return true if all cased characters [4] in the string are ' - 'lowercase\n' - ' and there is at least one cased character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isspace()\n' - '\n' - ' Return true if there are only whitespace characters in the ' - 'string\n' - ' and there is at least one character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.istitle()\n' - '\n' - ' Return true if the string is a titlecased string and there is ' - 'at\n' - ' least one character, for example uppercase characters may ' - 'only\n' - ' follow uncased characters and lowercase characters only cased ' - 'ones.\n' - ' Return false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.isupper()\n' - '\n' - ' Return true if all cased characters [4] in the string are ' - 'uppercase\n' - ' and there is at least one cased character, false otherwise.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.join(iterable)\n' - '\n' - ' Return a string which is the concatenation of the strings in ' - 'the\n' - ' *iterable* *iterable*. The separator between elements is ' - 'the\n' - ' string providing this method.\n' - '\n' - 'str.ljust(width[, fillchar])\n' - '\n' - ' Return the string left justified in a string of length ' - '*width*.\n' - ' Padding is done using the specified *fillchar* (default is a\n' - ' space). The original string is returned if *width* is less ' - 'than or\n' - ' equal to "len(s)".\n' - '\n' - ' Changed in version 2.4: Support for the *fillchar* argument.\n' - '\n' - 'str.lower()\n' - '\n' - ' Return a copy of the string with all the cased characters ' - '[4]\n' - ' converted to lowercase.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.lstrip([chars])\n' - '\n' - ' Return a copy of the string with leading characters removed. ' - 'The\n' - ' *chars* argument is a string specifying the set of characters ' - 'to be\n' - ' removed. If omitted or "None", the *chars* argument defaults ' - 'to\n' - ' removing whitespace. The *chars* argument is not a prefix; ' - 'rather,\n' - ' all combinations of its values are stripped:\n' - '\n' - " >>> ' spacious '.lstrip()\n" - " 'spacious '\n" - " >>> 'www.example.com'.lstrip('cmowz.')\n" - " 'example.com'\n" - '\n' - ' Changed in version 2.2.2: Support for the *chars* argument.\n' - '\n' - 'str.partition(sep)\n' - '\n' - ' Split the string at the first occurrence of *sep*, and return ' - 'a\n' - ' 3-tuple containing the part before the separator, the ' - 'separator\n' - ' itself, and the part after the separator. If the separator ' - 'is not\n' - ' found, return a 3-tuple containing the string itself, ' - 'followed by\n' - ' two empty strings.\n' - '\n' - ' New in version 2.5.\n' - '\n' - 'str.replace(old, new[, count])\n' - '\n' - ' Return a copy of the string with all occurrences of substring ' - '*old*\n' - ' replaced by *new*. If the optional argument *count* is ' - 'given, only\n' - ' the first *count* occurrences are replaced.\n' - '\n' - 'str.rfind(sub[, start[, end]])\n' - '\n' - ' Return the highest index in the string where substring *sub* ' - 'is\n' - ' found, such that *sub* is contained within "s[start:end]".\n' - ' Optional arguments *start* and *end* are interpreted as in ' - 'slice\n' - ' notation. Return "-1" on failure.\n' - '\n' - 'str.rindex(sub[, start[, end]])\n' - '\n' - ' Like "rfind()" but raises "ValueError" when the substring ' - '*sub* is\n' - ' not found.\n' - '\n' - 'str.rjust(width[, fillchar])\n' - '\n' - ' Return the string right justified in a string of length ' - '*width*.\n' - ' Padding is done using the specified *fillchar* (default is a\n' - ' space). The original string is returned if *width* is less ' - 'than or\n' - ' equal to "len(s)".\n' - '\n' - ' Changed in version 2.4: Support for the *fillchar* argument.\n' - '\n' - 'str.rpartition(sep)\n' - '\n' - ' Split the string at the last occurrence of *sep*, and return ' - 'a\n' - ' 3-tuple containing the part before the separator, the ' - 'separator\n' - ' itself, and the part after the separator. If the separator ' - 'is not\n' - ' found, return a 3-tuple containing two empty strings, ' - 'followed by\n' - ' the string itself.\n' - '\n' - ' New in version 2.5.\n' - '\n' - 'str.rsplit([sep[, maxsplit]])\n' - '\n' - ' Return a list of the words in the string, using *sep* as the\n' - ' delimiter string. If *maxsplit* is given, at most *maxsplit* ' - 'splits\n' - ' are done, the *rightmost* ones. If *sep* is not specified ' - 'or\n' - ' "None", any whitespace string is a separator. Except for ' - 'splitting\n' - ' from the right, "rsplit()" behaves like "split()" which is\n' - ' described in detail below.\n' - '\n' - ' New in version 2.4.\n' - '\n' - 'str.rstrip([chars])\n' - '\n' - ' Return a copy of the string with trailing characters ' - 'removed. The\n' - ' *chars* argument is a string specifying the set of characters ' - 'to be\n' - ' removed. If omitted or "None", the *chars* argument defaults ' - 'to\n' - ' removing whitespace. The *chars* argument is not a suffix; ' - 'rather,\n' - ' all combinations of its values are stripped:\n' - '\n' - " >>> ' spacious '.rstrip()\n" - " ' spacious'\n" - " >>> 'mississippi'.rstrip('ipz')\n" - " 'mississ'\n" - '\n' - ' Changed in version 2.2.2: Support for the *chars* argument.\n' - '\n' - 'str.split([sep[, maxsplit]])\n' - '\n' - ' Return a list of the words in the string, using *sep* as the\n' - ' delimiter string. If *maxsplit* is given, at most ' - '*maxsplit*\n' - ' splits are done (thus, the list will have at most ' - '"maxsplit+1"\n' - ' elements). If *maxsplit* is not specified or "-1", then ' - 'there is\n' - ' no limit on the number of splits (all possible splits are ' - 'made).\n' - '\n' - ' If *sep* is given, consecutive delimiters are not grouped ' - 'together\n' - ' and are deemed to delimit empty strings (for example,\n' - ' "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The ' - '*sep* argument\n' - ' may consist of multiple characters (for example,\n' - ' "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). ' - 'Splitting an\n' - ' empty string with a specified separator returns "[\'\']".\n' - '\n' - ' If *sep* is not specified or is "None", a different ' - 'splitting\n' - ' algorithm is applied: runs of consecutive whitespace are ' - 'regarded\n' - ' as a single separator, and the result will contain no empty ' - 'strings\n' - ' at the start or end if the string has leading or trailing\n' - ' whitespace. Consequently, splitting an empty string or a ' - 'string\n' - ' consisting of just whitespace with a "None" separator returns ' - '"[]".\n' - '\n' - ' For example, "\' 1 2 3 \'.split()" returns "[\'1\', ' - '\'2\', \'3\']", and\n' - ' "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 ' - '\']".\n' - '\n' - 'str.splitlines([keepends])\n' - '\n' - ' Return a list of the lines in the string, breaking at line\n' - ' boundaries. This method uses the *universal newlines* ' - 'approach to\n' - ' splitting lines. Line breaks are not included in the ' - 'resulting list\n' - ' unless *keepends* is given and true.\n' - '\n' - ' For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" ' - 'returns "[\'ab\n' - ' c\', \'\', \'de fg\', \'kl\']", while the same call with\n' - ' "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de ' - 'fg\\r\', \'kl\\r\\n\']".\n' - '\n' - ' Unlike "split()" when a delimiter string *sep* is given, ' - 'this\n' - ' method returns an empty list for the empty string, and a ' - 'terminal\n' - ' line break does not result in an extra line.\n' - '\n' - 'str.startswith(prefix[, start[, end]])\n' - '\n' - ' Return "True" if string starts with the *prefix*, otherwise ' - 'return\n' - ' "False". *prefix* can also be a tuple of prefixes to look ' - 'for.\n' - ' With optional *start*, test string beginning at that ' - 'position.\n' - ' With optional *end*, stop comparing string at that position.\n' - '\n' - ' Changed in version 2.5: Accept tuples as *prefix*.\n' - '\n' - 'str.strip([chars])\n' - '\n' - ' Return a copy of the string with the leading and trailing\n' - ' characters removed. The *chars* argument is a string ' - 'specifying the\n' - ' set of characters to be removed. If omitted or "None", the ' - '*chars*\n' - ' argument defaults to removing whitespace. The *chars* ' - 'argument is\n' - ' not a prefix or suffix; rather, all combinations of its ' - 'values are\n' - ' stripped:\n' - '\n' - " >>> ' spacious '.strip()\n" - " 'spacious'\n" - " >>> 'www.example.com'.strip('cmowz.')\n" - " 'example'\n" - '\n' - ' Changed in version 2.2.2: Support for the *chars* argument.\n' - '\n' - 'str.swapcase()\n' - '\n' - ' Return a copy of the string with uppercase characters ' - 'converted to\n' - ' lowercase and vice versa.\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.title()\n' - '\n' - ' Return a titlecased version of the string where words start ' - 'with an\n' - ' uppercase character and the remaining characters are ' - 'lowercase.\n' - '\n' - ' The algorithm uses a simple language-independent definition ' - 'of a\n' - ' word as groups of consecutive letters. The definition works ' - 'in\n' - ' many contexts but it means that apostrophes in contractions ' - 'and\n' - ' possessives form word boundaries, which may not be the ' - 'desired\n' - ' result:\n' - '\n' - ' >>> "they\'re bill\'s friends from the UK".title()\n' - ' "They\'Re Bill\'S Friends From The Uk"\n' - '\n' - ' A workaround for apostrophes can be constructed using ' - 'regular\n' - ' expressions:\n' - '\n' - ' >>> import re\n' - ' >>> def titlecase(s):\n' - ' ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n' - ' ... lambda mo: mo.group(0)[0].upper() +\n' - ' ... mo.group(0)[1:].lower(),\n' - ' ... s)\n' - ' ...\n' - ' >>> titlecase("they\'re bill\'s friends.")\n' - ' "They\'re Bill\'s Friends."\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.translate(table[, deletechars])\n' - '\n' - ' Return a copy of the string where all characters occurring in ' - 'the\n' - ' optional argument *deletechars* are removed, and the ' - 'remaining\n' - ' characters have been mapped through the given translation ' - 'table,\n' - ' which must be a string of length 256.\n' - '\n' - ' You can use the "maketrans()" helper function in the ' - '"string"\n' - ' module to create a translation table. For string objects, set ' - 'the\n' - ' *table* argument to "None" for translations that only delete\n' - ' characters:\n' - '\n' - " >>> 'read this short text'.translate(None, 'aeiou')\n" - " 'rd ths shrt txt'\n" - '\n' - ' New in version 2.6: Support for a "None" *table* argument.\n' - '\n' - ' For Unicode objects, the "translate()" method does not accept ' - 'the\n' - ' optional *deletechars* argument. Instead, it returns a copy ' - 'of the\n' - ' *s* where all characters have been mapped through the given\n' - ' translation table which must be a mapping of Unicode ordinals ' - 'to\n' - ' Unicode ordinals, Unicode strings or "None". Unmapped ' - 'characters\n' - ' are left untouched. Characters mapped to "None" are deleted. ' - 'Note,\n' - ' a more flexible approach is to create a custom character ' - 'mapping\n' - ' codec using the "codecs" module (see "encodings.cp1251" for ' - 'an\n' - ' example).\n' - '\n' - 'str.upper()\n' - '\n' - ' Return a copy of the string with all the cased characters ' - '[4]\n' - ' converted to uppercase. Note that "str.upper().isupper()" ' - 'might be\n' - ' "False" if "s" contains uncased characters or if the Unicode\n' - ' category of the resulting character(s) is not "Lu" (Letter,\n' - ' uppercase), but e.g. "Lt" (Letter, titlecase).\n' - '\n' - ' For 8-bit strings, this method is locale-dependent.\n' - '\n' - 'str.zfill(width)\n' - '\n' - ' Return the numeric string left filled with zeros in a string ' - 'of\n' - ' length *width*. A sign prefix is handled correctly. The ' - 'original\n' - ' string is returned if *width* is less than or equal to ' - '"len(s)".\n' - '\n' - ' New in version 2.2.2.\n' - '\n' - 'The following methods are present only on unicode objects:\n' - '\n' - 'unicode.isnumeric()\n' - '\n' - ' Return "True" if there are only numeric characters in S, ' - '"False"\n' - ' otherwise. Numeric characters include digit characters, and ' - 'all\n' - ' characters that have the Unicode numeric value property, ' - 'e.g.\n' - ' U+2155, VULGAR FRACTION ONE FIFTH.\n' - '\n' - 'unicode.isdecimal()\n' - '\n' - ' Return "True" if there are only decimal characters in S, ' - '"False"\n' - ' otherwise. Decimal characters include digit characters, and ' - 'all\n' - ' characters that can be used to form decimal-radix numbers, ' - 'e.g.\n' - ' U+0660, ARABIC-INDIC DIGIT ZERO.\n' - '\n' - '\n' - 'String Formatting Operations\n' - '============================\n' - '\n' - 'String and Unicode objects have one unique built-in operation: ' - 'the "%"\n' - 'operator (modulo). This is also known as the string ' - '*formatting* or\n' - '*interpolation* operator. Given "format % values" (where ' - '*format* is\n' - 'a string or Unicode object), "%" conversion specifications in ' - '*format*\n' - 'are replaced with zero or more elements of *values*. The effect ' - 'is\n' - 'similar to the using "sprintf()" in the C language. If *format* ' - 'is a\n' - 'Unicode object, or if any of the objects being converted using ' - 'the\n' - '"%s" conversion are Unicode objects, the result will also be a ' - 'Unicode\n' - 'object.\n' - '\n' - 'If *format* requires a single argument, *values* may be a single ' - 'non-\n' - 'tuple object. [5] Otherwise, *values* must be a tuple with ' - 'exactly\n' - 'the number of items specified by the format string, or a single\n' - 'mapping object (for example, a dictionary).\n' - '\n' - 'A conversion specifier contains two or more characters and has ' - 'the\n' - 'following components, which must occur in this order:\n' - '\n' - '1. The "\'%\'" character, which marks the start of the ' - 'specifier.\n' - '\n' - '2. Mapping key (optional), consisting of a parenthesised ' - 'sequence\n' - ' of characters (for example, "(somename)").\n' - '\n' - '3. Conversion flags (optional), which affect the result of some\n' - ' conversion types.\n' - '\n' - '4. Minimum field width (optional). If specified as an "\'*\'"\n' - ' (asterisk), the actual width is read from the next element of ' - 'the\n' - ' tuple in *values*, and the object to convert comes after the\n' - ' minimum field width and optional precision.\n' - '\n' - '5. Precision (optional), given as a "\'.\'" (dot) followed by ' - 'the\n' - ' precision. If specified as "\'*\'" (an asterisk), the actual ' - 'width\n' - ' is read from the next element of the tuple in *values*, and ' - 'the\n' - ' value to convert comes after the precision.\n' - '\n' - '6. Length modifier (optional).\n' - '\n' - '7. Conversion type.\n' - '\n' - 'When the right argument is a dictionary (or other mapping type), ' - 'then\n' - 'the formats in the string *must* include a parenthesised mapping ' - 'key\n' - 'into that dictionary inserted immediately after the "\'%\'" ' - 'character.\n' - 'The mapping key selects the value to be formatted from the ' - 'mapping.\n' - 'For example:\n' - '\n' - ">>> print '%(language)s has %(number)03d quote types.' % \\\n" - '... {"language": "Python", "number": 2}\n' - 'Python has 002 quote types.\n' - '\n' - 'In this case no "*" specifiers may occur in a format (since ' - 'they\n' - 'require a sequential parameter list).\n' - '\n' - 'The conversion flag characters are:\n' - '\n' - '+-----------+-----------------------------------------------------------------------+\n' - '| Flag | ' - 'Meaning ' - '|\n' - '+===========+=======================================================================+\n' - '| "\'#\'" | The value conversion will use the "alternate ' - 'form" (where defined |\n' - '| | ' - 'below). ' - '|\n' - '+-----------+-----------------------------------------------------------------------+\n' - '| "\'0\'" | The conversion will be zero padded for numeric ' - 'values. |\n' - '+-----------+-----------------------------------------------------------------------+\n' - '| "\'-\'" | The converted value is left adjusted (overrides ' - 'the "\'0\'" conversion |\n' - '| | if both are ' - 'given). |\n' - '+-----------+-----------------------------------------------------------------------+\n' - '| "\' \'" | (a space) A blank should be left before a ' - 'positive number (or empty |\n' - '| | string) produced by a signed ' - 'conversion. |\n' - '+-----------+-----------------------------------------------------------------------+\n' - '| "\'+\'" | A sign character ("\'+\'" or "\'-\'") will ' - 'precede the conversion |\n' - '| | (overrides a "space" ' - 'flag). |\n' - '+-----------+-----------------------------------------------------------------------+\n' - '\n' - 'A length modifier ("h", "l", or "L") may be present, but is ' - 'ignored as\n' - 'it is not necessary for Python -- so e.g. "%ld" is identical to ' - '"%d".\n' - '\n' - 'The conversion types are:\n' - '\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| Conversion | ' - 'Meaning | Notes ' - '|\n' - '+==============+=======================================================+=========+\n' - '| "\'d\'" | Signed integer ' - 'decimal. | |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'i\'" | Signed integer ' - 'decimal. | |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'o\'" | Signed octal ' - 'value. | (1) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'u\'" | Obsolete type -- it is identical to ' - '"\'d\'". | (7) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'x\'" | Signed hexadecimal ' - '(lowercase). | (2) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'X\'" | Signed hexadecimal ' - '(uppercase). | (2) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'e\'" | Floating point exponential format ' - '(lowercase). | (3) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'E\'" | Floating point exponential format ' - '(uppercase). | (3) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'f\'" | Floating point decimal ' - 'format. | (3) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'F\'" | Floating point decimal ' - 'format. | (3) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'g\'" | Floating point format. Uses lowercase ' - 'exponential | (4) |\n' - '| | format if exponent is less than -4 or not less ' - 'than | |\n' - '| | precision, decimal format ' - 'otherwise. | |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'G\'" | Floating point format. Uses uppercase ' - 'exponential | (4) |\n' - '| | format if exponent is less than -4 or not less ' - 'than | |\n' - '| | precision, decimal format ' - 'otherwise. | |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'c\'" | Single character (accepts integer or single ' - 'character | |\n' - '| | ' - 'string). | ' - '|\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'r\'" | String (converts any Python object using ' - 'repr()). | (5) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'s\'" | String (converts any Python object using ' - '"str()"). | (6) |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '| "\'%\'" | No argument is converted, results in a ' - '"\'%\'" | |\n' - '| | character in the ' - 'result. | |\n' - '+--------------+-------------------------------------------------------+---------+\n' - '\n' - 'Notes:\n' - '\n' - '1. The alternate form causes a leading zero ("\'0\'") to be ' - 'inserted\n' - ' between left-hand padding and the formatting of the number if ' - 'the\n' - ' leading character of the result is not already a zero.\n' - '\n' - '2. The alternate form causes a leading "\'0x\'" or "\'0X\'" ' - '(depending\n' - ' on whether the "\'x\'" or "\'X\'" format was used) to be ' - 'inserted\n' - ' between left-hand padding and the formatting of the number if ' - 'the\n' - ' leading character of the result is not already a zero.\n' - '\n' - '3. The alternate form causes the result to always contain a ' - 'decimal\n' - ' point, even if no digits follow it.\n' - '\n' - ' The precision determines the number of digits after the ' - 'decimal\n' - ' point and defaults to 6.\n' - '\n' - '4. The alternate form causes the result to always contain a ' - 'decimal\n' - ' point, and trailing zeroes are not removed as they would ' - 'otherwise\n' - ' be.\n' - '\n' - ' The precision determines the number of significant digits ' - 'before\n' - ' and after the decimal point and defaults to 6.\n' - '\n' - '5. The "%r" conversion was added in Python 2.0.\n' - '\n' - ' The precision determines the maximal number of characters ' - 'used.\n' - '\n' - '6. If the object or format provided is a "unicode" string, the\n' - ' resulting string will also be "unicode".\n' - '\n' - ' The precision determines the maximal number of characters ' - 'used.\n' - '\n' - '7. See **PEP 237**.\n' - '\n' - 'Since Python strings have an explicit length, "%s" conversions ' - 'do not\n' - 'assume that "\'\\0\'" is the end of the string.\n' - '\n' - 'Changed in version 2.7: "%f" conversions for numbers whose ' - 'absolute\n' - 'value is over 1e50 are no longer replaced by "%g" conversions.\n' - '\n' - 'Additional string operations are defined in standard modules ' - '"string"\n' - 'and "re".\n' - '\n' - '\n' - 'XRange Type\n' - '===========\n' - '\n' - 'The "xrange" type is an immutable sequence which is commonly ' - 'used for\n' - 'looping. The advantage of the "xrange" type is that an ' - '"xrange"\n' - 'object will always take the same amount of memory, no matter the ' - 'size\n' - 'of the range it represents. There are no consistent ' - 'performance\n' - 'advantages.\n' - '\n' - 'XRange objects have very little behavior: they only support ' - 'indexing,\n' - 'iteration, and the "len()" function.\n' - '\n' - '\n' - 'Mutable Sequence Types\n' - '======================\n' - '\n' - 'List and "bytearray" objects support additional operations that ' - 'allow\n' - 'in-place modification of the object. Other mutable sequence ' - 'types\n' - '(when added to the language) should also support these ' - 'operations.\n' - 'Strings and tuples are immutable sequence types: such objects ' - 'cannot\n' - 'be modified once created. The following operations are defined ' - 'on\n' - 'mutable sequence types (where *x* is an arbitrary object):\n' - '\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| Operation | ' - 'Result | Notes |\n' - '+================================+==================================+=======================+\n' - '| "s[i] = x" | item *i* of *s* is replaced ' - 'by | |\n' - '| | ' - '*x* | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s[i:j] = t" | slice of *s* from *i* to *j* ' - 'is | |\n' - '| | replaced by the contents of ' - 'the | |\n' - '| | iterable ' - '*t* | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "del s[i:j]" | same as "s[i:j] = ' - '[]" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s[i:j:k] = t" | the elements of "s[i:j:k]" ' - 'are | (1) |\n' - '| | replaced by those of ' - '*t* | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "del s[i:j:k]" | removes the elements ' - 'of | |\n' - '| | "s[i:j:k]" from the ' - 'list | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.append(x)" | same as "s[len(s):len(s)] = ' - '[x]" | (2) |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.extend(x)" or "s += t" | for the most part the same ' - 'as | (3) |\n' - '| | "s[len(s):len(s)] = ' - 'x" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s *= n" | updates *s* with its ' - 'contents | (11) |\n' - '| | repeated *n* ' - 'times | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.count(x)" | return number of *i*\'s for ' - 'which | |\n' - '| | "s[i] == ' - 'x" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.index(x[, i[, j]])" | return smallest *k* such ' - 'that | (4) |\n' - '| | "s[k] == x" and "i <= k < ' - 'j" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.insert(i, x)" | same as "s[i:i] = ' - '[x]" | (5) |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.pop([i])" | same as "x = s[i]; del ' - 's[i]; | (6) |\n' - '| | return ' - 'x" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.remove(x)" | same as "del ' - 's[s.index(x)]" | (4) |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.reverse()" | reverses the items of *s* ' - 'in | (7) |\n' - '| | ' - 'place | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.sort([cmp[, key[, | sort the items of *s* in ' - 'place | (7)(8)(9)(10) |\n' - '| reverse]]])" ' - '| | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '\n' - 'Notes:\n' - '\n' - '1. *t* must have the same length as the slice it is replacing.\n' - '\n' - '2. The C implementation of Python has historically accepted\n' - ' multiple parameters and implicitly joined them into a tuple; ' - 'this\n' - ' no longer works in Python 2.0. Use of this misfeature has ' - 'been\n' - ' deprecated since Python 1.4.\n' - '\n' - '3. *x* can be any iterable object.\n' - '\n' - '4. Raises "ValueError" when *x* is not found in *s*. When a\n' - ' negative index is passed as the second or third parameter to ' - 'the\n' - ' "index()" method, the list length is added, as for slice ' - 'indices.\n' - ' If it is still negative, it is truncated to zero, as for ' - 'slice\n' - ' indices.\n' - '\n' - ' Changed in version 2.3: Previously, "index()" didn\'t have ' - 'arguments\n' - ' for specifying start and stop positions.\n' - '\n' - '5. When a negative index is passed as the first parameter to ' - 'the\n' - ' "insert()" method, the list length is added, as for slice ' - 'indices.\n' - ' If it is still negative, it is truncated to zero, as for ' - 'slice\n' - ' indices.\n' - '\n' - ' Changed in version 2.3: Previously, all negative indices ' - 'were\n' - ' truncated to zero.\n' - '\n' - '6. The "pop()" method\'s optional argument *i* defaults to "-1", ' - 'so\n' - ' that by default the last item is removed and returned.\n' - '\n' - '7. The "sort()" and "reverse()" methods modify the list in ' - 'place\n' - ' for economy of space when sorting or reversing a large list. ' - 'To\n' - " remind you that they operate by side effect, they don't " - 'return the\n' - ' sorted or reversed list.\n' - '\n' - '8. The "sort()" method takes optional arguments for controlling ' - 'the\n' - ' comparisons.\n' - '\n' - ' *cmp* specifies a custom comparison function of two arguments ' - '(list\n' - ' items) which should return a negative, zero or positive ' - 'number\n' - ' depending on whether the first argument is considered smaller ' - 'than,\n' - ' equal to, or larger than the second argument: "cmp=lambda ' - 'x,y:\n' - ' cmp(x.lower(), y.lower())". The default value is "None".\n' - '\n' - ' *key* specifies a function of one argument that is used to ' - 'extract\n' - ' a comparison key from each list element: "key=str.lower". ' - 'The\n' - ' default value is "None".\n' - '\n' - ' *reverse* is a boolean value. If set to "True", then the ' - 'list\n' - ' elements are sorted as if each comparison were reversed.\n' - '\n' - ' In general, the *key* and *reverse* conversion processes are ' - 'much\n' - ' faster than specifying an equivalent *cmp* function. This ' - 'is\n' - ' because *cmp* is called multiple times for each list element ' - 'while\n' - ' *key* and *reverse* touch each element only once. Use\n' - ' "functools.cmp_to_key()" to convert an old-style *cmp* ' - 'function to\n' - ' a *key* function.\n' - '\n' - ' Changed in version 2.3: Support for "None" as an equivalent ' - 'to\n' - ' omitting *cmp* was added.\n' - '\n' - ' Changed in version 2.4: Support for *key* and *reverse* was ' - 'added.\n' - '\n' - '9. Starting with Python 2.3, the "sort()" method is guaranteed ' - 'to\n' - ' be stable. A sort is stable if it guarantees not to change ' - 'the\n' - ' relative order of elements that compare equal --- this is ' - 'helpful\n' - ' for sorting in multiple passes (for example, sort by ' - 'department,\n' - ' then by salary grade).\n' - '\n' - '10. **CPython implementation detail:** While a list is being\n' - ' sorted, the effect of attempting to mutate, or even inspect, ' - 'the\n' - ' list is undefined. The C implementation of Python 2.3 and ' - 'newer\n' - ' makes the list appear empty for the duration, and raises\n' - ' "ValueError" if it can detect that the list has been ' - 'mutated\n' - ' during a sort.\n' - '\n' - '11. The value *n* is an integer, or an object implementing\n' - ' "__index__()". Zero and negative values of *n* clear the\n' - ' sequence. Items in the sequence are not copied; they are\n' - ' referenced multiple times, as explained for "s * n" under ' - 'Sequence\n' - ' Types --- str, unicode, list, tuple, bytearray, buffer, ' - 'xrange.\n', - 'typesseq-mutable': '\n' - 'Mutable Sequence Types\n' - '**********************\n' - '\n' - 'List and "bytearray" objects support additional ' - 'operations that allow\n' - 'in-place modification of the object. Other mutable ' - 'sequence types\n' - '(when added to the language) should also support these ' - 'operations.\n' - 'Strings and tuples are immutable sequence types: such ' - 'objects cannot\n' - 'be modified once created. The following operations are ' - 'defined on\n' - 'mutable sequence types (where *x* is an arbitrary ' - 'object):\n' - '\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| Operation | ' - 'Result | Notes ' - '|\n' - '+================================+==================================+=======================+\n' - '| "s[i] = x" | item *i* of *s* is ' - 'replaced by | |\n' - '| | ' - '*x* | ' - '|\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s[i:j] = t" | slice of *s* from *i* ' - 'to *j* is | |\n' - '| | replaced by the ' - 'contents of the | |\n' - '| | iterable ' - '*t* | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "del s[i:j]" | same as "s[i:j] = ' - '[]" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s[i:j:k] = t" | the elements of ' - '"s[i:j:k]" are | (1) |\n' - '| | replaced by those of ' - '*t* | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "del s[i:j:k]" | removes the elements ' - 'of | |\n' - '| | "s[i:j:k]" from the ' - 'list | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.append(x)" | same as ' - '"s[len(s):len(s)] = [x]" | (2) |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.extend(x)" or "s += t" | for the most part the ' - 'same as | (3) |\n' - '| | "s[len(s):len(s)] = ' - 'x" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s *= n" | updates *s* with its ' - 'contents | (11) |\n' - '| | repeated *n* ' - 'times | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.count(x)" | return number of ' - "*i*'s for which | |\n" - '| | "s[i] == ' - 'x" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.index(x[, i[, j]])" | return smallest *k* ' - 'such that | (4) |\n' - '| | "s[k] == x" and "i <= ' - 'k < j" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.insert(i, x)" | same as "s[i:i] = ' - '[x]" | (5) |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.pop([i])" | same as "x = s[i]; ' - 'del s[i]; | (6) |\n' - '| | return ' - 'x" | |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.remove(x)" | same as "del ' - 's[s.index(x)]" | (4) |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.reverse()" | reverses the items of ' - '*s* in | (7) |\n' - '| | ' - 'place | ' - '|\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '| "s.sort([cmp[, key[, | sort the items of *s* ' - 'in place | (7)(8)(9)(10) |\n' - '| reverse]]])" ' - '| ' - '| |\n' - '+--------------------------------+----------------------------------+-----------------------+\n' - '\n' - 'Notes:\n' - '\n' - '1. *t* must have the same length as the slice it is ' - 'replacing.\n' - '\n' - '2. The C implementation of Python has historically ' - 'accepted\n' - ' multiple parameters and implicitly joined them into a ' - 'tuple; this\n' - ' no longer works in Python 2.0. Use of this ' - 'misfeature has been\n' - ' deprecated since Python 1.4.\n' - '\n' - '3. *x* can be any iterable object.\n' - '\n' - '4. Raises "ValueError" when *x* is not found in *s*. ' - 'When a\n' - ' negative index is passed as the second or third ' - 'parameter to the\n' - ' "index()" method, the list length is added, as for ' - 'slice indices.\n' - ' If it is still negative, it is truncated to zero, as ' - 'for slice\n' - ' indices.\n' - '\n' - ' Changed in version 2.3: Previously, "index()" didn\'t ' - 'have arguments\n' - ' for specifying start and stop positions.\n' - '\n' - '5. When a negative index is passed as the first ' - 'parameter to the\n' - ' "insert()" method, the list length is added, as for ' - 'slice indices.\n' - ' If it is still negative, it is truncated to zero, as ' - 'for slice\n' - ' indices.\n' - '\n' - ' Changed in version 2.3: Previously, all negative ' - 'indices were\n' - ' truncated to zero.\n' - '\n' - '6. The "pop()" method\'s optional argument *i* defaults ' - 'to "-1", so\n' - ' that by default the last item is removed and ' - 'returned.\n' - '\n' - '7. The "sort()" and "reverse()" methods modify the list ' - 'in place\n' - ' for economy of space when sorting or reversing a ' - 'large list. To\n' - ' remind you that they operate by side effect, they ' - "don't return the\n" - ' sorted or reversed list.\n' - '\n' - '8. The "sort()" method takes optional arguments for ' - 'controlling the\n' - ' comparisons.\n' - '\n' - ' *cmp* specifies a custom comparison function of two ' - 'arguments (list\n' - ' items) which should return a negative, zero or ' - 'positive number\n' - ' depending on whether the first argument is considered ' - 'smaller than,\n' - ' equal to, or larger than the second argument: ' - '"cmp=lambda x,y:\n' - ' cmp(x.lower(), y.lower())". The default value is ' - '"None".\n' - '\n' - ' *key* specifies a function of one argument that is ' - 'used to extract\n' - ' a comparison key from each list element: ' - '"key=str.lower". The\n' - ' default value is "None".\n' - '\n' - ' *reverse* is a boolean value. If set to "True", then ' - 'the list\n' - ' elements are sorted as if each comparison were ' - 'reversed.\n' - '\n' - ' In general, the *key* and *reverse* conversion ' - 'processes are much\n' - ' faster than specifying an equivalent *cmp* function. ' - 'This is\n' - ' because *cmp* is called multiple times for each list ' - 'element while\n' - ' *key* and *reverse* touch each element only once. ' - 'Use\n' - ' "functools.cmp_to_key()" to convert an old-style ' - '*cmp* function to\n' - ' a *key* function.\n' - '\n' - ' Changed in version 2.3: Support for "None" as an ' - 'equivalent to\n' - ' omitting *cmp* was added.\n' - '\n' - ' Changed in version 2.4: Support for *key* and ' - '*reverse* was added.\n' - '\n' - '9. Starting with Python 2.3, the "sort()" method is ' - 'guaranteed to\n' - ' be stable. A sort is stable if it guarantees not to ' - 'change the\n' - ' relative order of elements that compare equal --- ' - 'this is helpful\n' - ' for sorting in multiple passes (for example, sort by ' - 'department,\n' - ' then by salary grade).\n' - '\n' - '10. **CPython implementation detail:** While a list is ' - 'being\n' - ' sorted, the effect of attempting to mutate, or even ' - 'inspect, the\n' - ' list is undefined. The C implementation of Python ' - '2.3 and newer\n' - ' makes the list appear empty for the duration, and ' - 'raises\n' - ' "ValueError" if it can detect that the list has been ' - 'mutated\n' - ' during a sort.\n' - '\n' - '11. The value *n* is an integer, or an object ' - 'implementing\n' - ' "__index__()". Zero and negative values of *n* ' - 'clear the\n' - ' sequence. Items in the sequence are not copied; ' - 'they are\n' - ' referenced multiple times, as explained for "s * n" ' - 'under Sequence\n' - ' Types --- str, unicode, list, tuple, bytearray, ' - 'buffer, xrange.\n', - 'unary': '\n' - 'Unary arithmetic and bitwise operations\n' - '***************************************\n' - '\n' - 'All unary arithmetic and bitwise operations have the same ' - 'priority:\n' - '\n' - ' u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n' - '\n' - 'The unary "-" (minus) operator yields the negation of its numeric\n' - 'argument.\n' - '\n' - 'The unary "+" (plus) operator yields its numeric argument ' - 'unchanged.\n' - '\n' - 'The unary "~" (invert) operator yields the bitwise inversion of ' - 'its\n' - 'plain or long integer argument. The bitwise inversion of "x" is\n' - 'defined as "-(x+1)". It only applies to integral numbers.\n' - '\n' - 'In all three cases, if the argument does not have the proper type, ' - 'a\n' - '"TypeError" exception is raised.\n', - 'while': '\n' - 'The "while" statement\n' - '*********************\n' - '\n' - 'The "while" statement is used for repeated execution as long as an\n' - 'expression is true:\n' - '\n' - ' while_stmt ::= "while" expression ":" suite\n' - ' ["else" ":" suite]\n' - '\n' - 'This repeatedly tests the expression and, if it is true, executes ' - 'the\n' - 'first suite; if the expression is false (which may be the first ' - 'time\n' - 'it is tested) the suite of the "else" clause, if present, is ' - 'executed\n' - 'and the loop terminates.\n' - '\n' - 'A "break" statement executed in the first suite terminates the ' - 'loop\n' - 'without executing the "else" clause\'s suite. A "continue" ' - 'statement\n' - 'executed in the first suite skips the rest of the suite and goes ' - 'back\n' - 'to testing the expression.\n', - 'with': '\n' - 'The "with" statement\n' - '********************\n' - '\n' - 'New in version 2.5.\n' - '\n' - 'The "with" statement is used to wrap the execution of a block with\n' - 'methods defined by a context manager (see section With Statement\n' - 'Context Managers). This allows common "try"..."except"..."finally"\n' - 'usage patterns to be encapsulated for convenient reuse.\n' - '\n' - ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n' - ' with_item ::= expression ["as" target]\n' - '\n' - 'The execution of the "with" statement with one "item" proceeds as\n' - 'follows:\n' - '\n' - '1. The context expression (the expression given in the "with_item")\n' - ' is evaluated to obtain a context manager.\n' - '\n' - '2. The context manager\'s "__exit__()" is loaded for later use.\n' - '\n' - '3. The context manager\'s "__enter__()" method is invoked.\n' - '\n' - '4. If a target was included in the "with" statement, the return\n' - ' value from "__enter__()" is assigned to it.\n' - '\n' - ' Note: The "with" statement guarantees that if the "__enter__()"\n' - ' method returns without an error, then "__exit__()" will always ' - 'be\n' - ' called. Thus, if an error occurs during the assignment to the\n' - ' target list, it will be treated the same as an error occurring\n' - ' within the suite would be. See step 6 below.\n' - '\n' - '5. The suite is executed.\n' - '\n' - '6. The context manager\'s "__exit__()" method is invoked. If an\n' - ' exception caused the suite to be exited, its type, value, and\n' - ' traceback are passed as arguments to "__exit__()". Otherwise, ' - 'three\n' - ' "None" arguments are supplied.\n' - '\n' - ' If the suite was exited due to an exception, and the return ' - 'value\n' - ' from the "__exit__()" method was false, the exception is ' - 'reraised.\n' - ' If the return value was true, the exception is suppressed, and\n' - ' execution continues with the statement following the "with"\n' - ' statement.\n' - '\n' - ' If the suite was exited for any reason other than an exception, ' - 'the\n' - ' return value from "__exit__()" is ignored, and execution ' - 'proceeds\n' - ' at the normal location for the kind of exit that was taken.\n' - '\n' - 'With more than one item, the context managers are processed as if\n' - 'multiple "with" statements were nested:\n' - '\n' - ' with A() as a, B() as b:\n' - ' suite\n' - '\n' - 'is equivalent to\n' - '\n' - ' with A() as a:\n' - ' with B() as b:\n' - ' suite\n' - '\n' - 'Note: In Python 2.5, the "with" statement is only allowed when the\n' - ' "with_statement" feature has been enabled. It is always enabled ' - 'in\n' - ' Python 2.6.\n' - '\n' - 'Changed in version 2.7: Support for multiple context expressions.\n' - '\n' - 'See also:\n' - '\n' - ' **PEP 343** - The "with" statement\n' - ' The specification, background, and examples for the Python ' - '"with"\n' - ' statement.\n', - 'yield': '\n' - 'The "yield" statement\n' - '*********************\n' - '\n' - ' yield_stmt ::= yield_expression\n' - '\n' - 'The "yield" statement is only used when defining a generator ' - 'function,\n' - 'and is only used in the body of the generator function. Using a\n' - '"yield" statement in a function definition is sufficient to cause ' - 'that\n' - 'definition to create a generator function instead of a normal\n' - 'function.\n' - '\n' - 'When a generator function is called, it returns an iterator known ' - 'as a\n' - 'generator iterator, or more commonly, a generator. The body of ' - 'the\n' - "generator function is executed by calling the generator's " - '"next()"\n' - 'method repeatedly until it raises an exception.\n' - '\n' - 'When a "yield" statement is executed, the state of the generator ' - 'is\n' - 'frozen and the value of "expression_list" is returned to ' - '"next()"\'s\n' - 'caller. By "frozen" we mean that all local state is retained,\n' - 'including the current bindings of local variables, the instruction\n' - 'pointer, and the internal evaluation stack: enough information is\n' - 'saved so that the next time "next()" is invoked, the function can\n' - 'proceed exactly as if the "yield" statement were just another ' - 'external\n' - 'call.\n' - '\n' - 'As of Python version 2.5, the "yield" statement is now allowed in ' - 'the\n' - '"try" clause of a "try" ... "finally" construct. If the generator ' - 'is\n' - 'not resumed before it is finalized (by reaching a zero reference ' - 'count\n' - "or by being garbage collected), the generator-iterator's " - '"close()"\n' - 'method will be called, allowing any pending "finally" clauses to\n' - 'execute.\n' - '\n' - 'For full details of "yield" semantics, refer to the Yield ' - 'expressions\n' - 'section.\n' - '\n' - 'Note: In Python 2.2, the "yield" statement was only allowed when ' - 'the\n' - ' "generators" feature has been enabled. This "__future__" import\n' - ' statement was used to enable the feature:\n' - '\n' - ' from __future__ import generators\n' - '\n' - 'See also:\n' - '\n' - ' **PEP 255** - Simple Generators\n' - ' The proposal for adding generators and the "yield" statement ' - 'to\n' - ' Python.\n' - '\n' - ' **PEP 342** - Coroutines via Enhanced Generators\n' - ' The proposal that, among other generator enhancements, ' - 'proposed\n' - ' allowing "yield" to appear inside a "try" ... "finally" ' - 'block.\n'} +# Autogenerated by Sphinx on Sat Dec 3 12:36:20 2016 +topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', + 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" [target_list] "]"\n | attributeref\n | subscription\n | slicing\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section The standard type\nhierarchy).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" statement in the\n current code block: the name is bound to the object in the current\n local namespace.\n\n * Otherwise: the name is bound to the object in the current global\n namespace.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield a plain integer. If it is negative, the\n sequence\'s length is added to it. The resulting value must be a\n nonnegative integer less than the sequence\'s length, and the\n sequence is asked to assign the assigned object to its item with\n that index. If the index is out of range, "IndexError" is raised\n (assignment to a subscripted sequence cannot add new items to a\n list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to (small) integers.\n If either bound is negative, the sequence\'s length is added to it.\n The resulting bounds are clipped to lie between zero and the\n sequence\'s length, inclusive. Finally, the sequence object is asked\n to replace the slice with the items of the assigned sequence. The\n length of the slice may be different from the length of the assigned\n sequence, thus changing the length of the target sequence, if the\n object allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints "[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n', + 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section Identifiers\nand keywords for lexical definition and section Naming and binding for\ndocumentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', + 'atom-literals': u"\nLiterals\n********\n\nPython supports string literals and various numeric literals:\n\n literal ::= stringliteral | integer | longinteger\n | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\ninteger, long integer, floating point number, complex number) with the\ngiven value. The value may be approximated in the case of floating\npoint and imaginary (complex) literals. See section Literals for\ndetails.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n", + 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n===========================================\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (Implementing Descriptors) for each variable name. As a\n result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n', + 'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\n attributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, e.g., a module, list, or an instance. This\nobject is then asked to produce the attribute whose name is the\nidentifier. If this attribute is not available, the exception\n"AttributeError" is raised. Otherwise, the type and value of the\nobject produced is determined by the object. Multiple evaluations of\nthe same attribute reference may yield different objects.\n', + 'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n', + 'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels. Note that some of these operations also apply to certain non-\nnumeric types. Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\n m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr\n | m_expr "%" u_expr\n a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe "*" (multiplication) operator yields the product of its arguments.\nThe arguments must either both be numbers, or one argument must be an\ninteger (plain or long) and the other must be a sequence. In the\nformer case, the numbers are converted to a common type and then\nmultiplied together. In the latter case, sequence repetition is\nperformed; a negative repetition factor yields an empty sequence.\n\nThe "/" (division) and "//" (floor division) operators yield the\nquotient of their arguments. The numeric arguments are first\nconverted to a common type. Plain or long integer division yields an\ninteger of the same type; the result is that of mathematical division\nwith the \'floor\' function applied to the result. Division by zero\nraises the "ZeroDivisionError" exception.\n\nThe "%" (modulo) operator yields the remainder from the division of\nthe first argument by the second. The numeric arguments are first\nconverted to a common type. A zero right argument raises the\n"ZeroDivisionError" exception. The arguments may be floating point\nnumbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals "4*0.7 +\n0.34".) The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand [2].\n\nThe integer division and modulo operators are connected by the\nfollowing identity: "x == (x/y)*y + (x%y)". Integer division and\nmodulo are also connected with the built-in function "divmod()":\n"divmod(x, y) == (x/y, x%y)". These identities don\'t hold for\nfloating point numbers; there similar identities hold approximately\nwhere "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n\nIn addition to performing the modulo operation on numbers, the "%"\noperator is also overloaded by string and unicode objects to perform\nstring formatting (also known as interpolation). The syntax for string\nformatting is described in the Python Library Reference, section\nString Formatting Operations.\n\nDeprecated since version 2.3: The floor division operator, the modulo\noperator, and the "divmod()" function are no longer defined for\ncomplex numbers. Instead, convert to a floating point number using\nthe "abs()" function if appropriate.\n\nThe "+" (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both sequences of the same\ntype. In the former case, the numbers are converted to a common type\nand then added together. In the latter case, the sequences are\nconcatenated.\n\nThe "-" (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n', + 'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\n and_expr ::= shift_expr | and_expr "&" shift_expr\n xor_expr ::= and_expr | xor_expr "^" and_expr\n or_expr ::= xor_expr | or_expr "|" xor_expr\n\nThe "&" operator yields the bitwise AND of its arguments, which must\nbe plain or long integers. The arguments are converted to a common\ntype.\n\nThe "^" operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be plain or long integers. The arguments are\nconverted to a common type.\n\nThe "|" operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be plain or long integers. The arguments are converted to\na common type.\n', + 'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment. Code objects are returned by the built-\nin "compile()" function and can be extracted from function objects\nthrough their "func_code" attribute. See also the "code" module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the "exec" statement or the built-in "eval()"\nfunction.\n\nSee The standard type hierarchy for more information.\n', + 'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is used by extended slice notation (see Slicings). It\nsupports no special operations. There is exactly one ellipsis object,\nnamed "Ellipsis" (a built-in name).\n\nIt is written as "Ellipsis". When in a subscript, it can also be\nwritten as "...", for example "seq[...]".\n', + 'bltin-file-objects': u'\nFile Objects\n************\n\nFile objects are implemented using C\'s "stdio" package and can be\ncreated with the built-in "open()" function. File objects are also\nreturned by some other built-in functions and methods, such as\n"os.popen()" and "os.fdopen()" and the "makefile()" method of socket\nobjects. Temporary files can be created using the "tempfile" module,\nand high-level file operations such as copying, moving, and deleting\nfiles and directories can be achieved with the "shutil" module.\n\nWhen a file operation fails for an I/O-related reason, the exception\n"IOError" is raised. This includes situations where the operation is\nnot defined for some reason, like "seek()" on a tty device or writing\na file opened for reading.\n\nFiles have the following methods:\n\nfile.close()\n\n Close the file. A closed file cannot be read or written any more.\n Any operation which requires that the file be open will raise a\n "ValueError" after the file has been closed. Calling "close()"\n more than once is allowed.\n\n As of Python 2.5, you can avoid having to call this method\n explicitly if you use the "with" statement. For example, the\n following code will automatically close *f* when the "with" block\n is exited:\n\n from __future__ import with_statement # This isn\'t required in Python 2.6\n\n with open("hello.txt") as f:\n for line in f:\n print line,\n\n In older versions of Python, you would have needed to do this to\n get the same effect:\n\n f = open("hello.txt")\n try:\n for line in f:\n print line,\n finally:\n f.close()\n\n Note: Not all "file-like" types in Python support use as a\n context manager for the "with" statement. If your code is\n intended to work with any file-like object, you can use the\n function "contextlib.closing()" instead of using the object\n directly.\n\nfile.flush()\n\n Flush the internal buffer, like "stdio"\'s "fflush()". This may be\n a no-op on some file-like objects.\n\n Note: "flush()" does not necessarily write the file\'s data to\n disk. Use "flush()" followed by "os.fsync()" to ensure this\n behavior.\n\nfile.fileno()\n\n Return the integer "file descriptor" that is used by the underlying\n implementation to request I/O operations from the operating system.\n This can be useful for other, lower level interfaces that use file\n descriptors, such as the "fcntl" module or "os.read()" and friends.\n\n Note: File-like objects which do not have a real file descriptor\n should *not* provide this method!\n\nfile.isatty()\n\n Return "True" if the file is connected to a tty(-like) device, else\n "False".\n\n Note: If a file-like object is not associated with a real file,\n this method should *not* be implemented.\n\nfile.next()\n\n A file object is its own iterator, for example "iter(f)" returns\n *f* (unless *f* is closed). When a file is used as an iterator,\n typically in a "for" loop (for example, "for line in f: print\n line.strip()"), the "next()" method is called repeatedly. This\n method returns the next input line, or raises "StopIteration" when\n EOF is hit when the file is open for reading (behavior is undefined\n when the file is open for writing). In order to make a "for" loop\n the most efficient way of looping over the lines of a file (a very\n common operation), the "next()" method uses a hidden read-ahead\n buffer. As a consequence of using a read-ahead buffer, combining\n "next()" with other file methods (like "readline()") does not work\n right. However, using "seek()" to reposition the file to an\n absolute position will flush the read-ahead buffer.\n\n New in version 2.3.\n\nfile.read([size])\n\n Read at most *size* bytes from the file (less if the read hits EOF\n before obtaining *size* bytes). If the *size* argument is negative\n or omitted, read all data until EOF is reached. The bytes are\n returned as a string object. An empty string is returned when EOF\n is encountered immediately. (For certain files, like ttys, it\n makes sense to continue reading after an EOF is hit.) Note that\n this method may call the underlying C function "fread()" more than\n once in an effort to acquire as close to *size* bytes as possible.\n Also note that when in non-blocking mode, less data than was\n requested may be returned, even if no *size* parameter was given.\n\n Note: This function is simply a wrapper for the underlying\n "fread()" C function, and will behave the same in corner cases,\n such as whether the EOF value is cached.\n\nfile.readline([size])\n\n Read one entire line from the file. A trailing newline character\n is kept in the string (but may be absent when a file ends with an\n incomplete line). [6] If the *size* argument is present and non-\n negative, it is a maximum byte count (including the trailing\n newline) and an incomplete line may be returned. When *size* is not\n 0, an empty string is returned *only* when EOF is encountered\n immediately.\n\n Note: Unlike "stdio"\'s "fgets()", the returned string contains\n null characters ("\'\\0\'") if they occurred in the input.\n\nfile.readlines([sizehint])\n\n Read until EOF using "readline()" and return a list containing the\n lines thus read. If the optional *sizehint* argument is present,\n instead of reading up to EOF, whole lines totalling approximately\n *sizehint* bytes (possibly after rounding up to an internal buffer\n size) are read. Objects implementing a file-like interface may\n choose to ignore *sizehint* if it cannot be implemented, or cannot\n be implemented efficiently.\n\nfile.xreadlines()\n\n This method returns the same thing as "iter(f)".\n\n New in version 2.1.\n\n Deprecated since version 2.3: Use "for line in file" instead.\n\nfile.seek(offset[, whence])\n\n Set the file\'s current position, like "stdio"\'s "fseek()". The\n *whence* argument is optional and defaults to "os.SEEK_SET" or "0"\n (absolute file positioning); other values are "os.SEEK_CUR" or "1"\n (seek relative to the current position) and "os.SEEK_END" or "2"\n (seek relative to the file\'s end). There is no return value.\n\n For example, "f.seek(2, os.SEEK_CUR)" advances the position by two\n and "f.seek(-3, os.SEEK_END)" sets the position to the third to\n last.\n\n Note that if the file is opened for appending (mode "\'a\'" or\n "\'a+\'"), any "seek()" operations will be undone at the next write.\n If the file is only opened for writing in append mode (mode "\'a\'"),\n this method is essentially a no-op, but it remains useful for files\n opened in append mode with reading enabled (mode "\'a+\'"). If the\n file is opened in text mode (without "\'b\'"), only offsets returned\n by "tell()" are legal. Use of other offsets causes undefined\n behavior.\n\n Note that not all file objects are seekable.\n\n Changed in version 2.6: Passing float values as offset has been\n deprecated.\n\nfile.tell()\n\n Return the file\'s current position, like "stdio"\'s "ftell()".\n\n Note: On Windows, "tell()" can return illegal values (after an\n "fgets()") when reading files with Unix-style line-endings. Use\n binary mode ("\'rb\'") to circumvent this problem.\n\nfile.truncate([size])\n\n Truncate the file\'s size. If the optional *size* argument is\n present, the file is truncated to (at most) that size. The size\n defaults to the current position. The current file position is not\n changed. Note that if a specified size exceeds the file\'s current\n size, the result is platform-dependent: possibilities include that\n the file may remain unchanged, increase to the specified size as if\n zero-filled, or increase to the specified size with undefined new\n content. Availability: Windows, many Unix variants.\n\nfile.write(str)\n\n Write a string to the file. There is no return value. Due to\n buffering, the string may not actually show up in the file until\n the "flush()" or "close()" method is called.\n\nfile.writelines(sequence)\n\n Write a sequence of strings to the file. The sequence can be any\n iterable object producing strings, typically a list of strings.\n There is no return value. (The name is intended to match\n "readlines()"; "writelines()" does not add line separators.)\n\nFiles support the iterator protocol. Each iteration returns the same\nresult as "readline()", and iteration ends when the "readline()"\nmethod returns an empty string.\n\nFile objects also offer a number of other interesting attributes.\nThese are not required for file-like objects, but should be\nimplemented if they make sense for the particular object.\n\nfile.closed\n\n bool indicating the current state of the file object. This is a\n read-only attribute; the "close()" method changes the value. It may\n not be available on all file-like objects.\n\nfile.encoding\n\n The encoding that this file uses. When Unicode strings are written\n to a file, they will be converted to byte strings using this\n encoding. In addition, when the file is connected to a terminal,\n the attribute gives the encoding that the terminal is likely to use\n (that information might be incorrect if the user has misconfigured\n the terminal). The attribute is read-only and may not be present\n on all file-like objects. It may also be "None", in which case the\n file uses the system default encoding for converting Unicode\n strings.\n\n New in version 2.3.\n\nfile.errors\n\n The Unicode error handler used along with the encoding.\n\n New in version 2.6.\n\nfile.mode\n\n The I/O mode for the file. If the file was created using the\n "open()" built-in function, this will be the value of the *mode*\n parameter. This is a read-only attribute and may not be present on\n all file-like objects.\n\nfile.name\n\n If the file object was created using "open()", the name of the\n file. Otherwise, some string that indicates the source of the file\n object, of the form "<...>". This is a read-only attribute and may\n not be present on all file-like objects.\n\nfile.newlines\n\n If Python was built with *universal newlines* enabled (the default)\n this read-only attribute exists, and for files opened in universal\n newline read mode it keeps track of the types of newlines\n encountered while reading the file. The values it can take are\n "\'\\r\'", "\'\\n\'", "\'\\r\\n\'", "None" (unknown, no newlines read yet) or\n a tuple containing all the newline types seen, to indicate that\n multiple newline conventions were encountered. For files not opened\n in universal newlines read mode the value of this attribute will be\n "None".\n\nfile.softspace\n\n Boolean that indicates whether a space character needs to be\n printed before another value when using the "print" statement.\n Classes that are trying to simulate a file object should also have\n a writable "softspace" attribute, which should be initialized to\n zero. This will be automatic for most classes implemented in\n Python (care may be needed for objects that override attribute\n access); types implemented in C will have to provide a writable\n "softspace" attribute.\n\n Note: This attribute is not used to control the "print"\n statement, but to allow the implementation of "print" to keep\n track of its internal state.\n', + 'bltin-null-object': u'\nThe Null Object\n***************\n\nThis object is returned by functions that don\'t explicitly return a\nvalue. It supports no special operations. There is exactly one null\nobject, named "None" (a built-in name).\n\nIt is written as "None".\n', + 'bltin-type-objects': u'\nType Objects\n************\n\nType objects represent the various object types. An object\'s type is\naccessed by the built-in function "type()". There are no special\noperations on types. The standard module "types" defines names for\nall standard built-in types.\n\nTypes are written like this: "".\n', + 'booleans': u'\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. (See the "__nonzero__()" special method for a way to change\nthis.)\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value. Because "not" has to invent a\nvalue anyway, it does not bother to return a value of the same type as\nits argument, so e.g., "not \'foo\'" yields "False", not "\'\'".)\n', + 'break': u'\nThe "break" statement\n*********************\n\n break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n', + 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n', + 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","]\n | expression genexpr_for] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section Function definitions for the\nsyntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable. Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print a, b\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax "(sublist)" cannot be used\nas keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n Function definitions. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see Built-in Functions for the\n descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', + 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', + 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. Unicode and 8-bit strings are fully interoperable in\n this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n the same as "cmp(x,y)". If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, "[1,2] <\n [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that either "x is y[i]" or "x == y[i]" is\ntrue.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n', + 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements. Function and class definitions are\nalso syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print" statements are executed:\n\n if x < y < z: print x; print y; print z\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | decorated\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n\n\nThe "with" statement\n====================\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n "with_statement" feature has been enabled. It is always enabled in\n Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also:\n\n **PEP 343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', + 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n', + 'continue': u'\nThe "continue" statement\n************************\n\n continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n', + 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at Coercion rules. If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the\n other is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\n converted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\n necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions can define their own\ncoercions.\n', + 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_traceback" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing "None" in\n "sys.exc_traceback" or "sys.last_traceback". Circular references\n which are garbage are detected when the option cycle detector is\n enabled (it\'s on by default), but can only be cleaned up if there\n are no Python-level "__del__()" methods involved. Refer to the\n documentation for the "gc" module for more information about how\n "__del__()" methods are handled by the cycle detector,\n particularly the description of the "garbage" value.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\n See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function and by string conversions\n (reverse quotes) to compute the "official" string representation of\n an object. If at all possible, this should look like a valid\n Python expression that could be used to recreate an object with the\n same value (given an appropriate environment). If this is not\n possible, a string of the form "<...some useful description...>"\n should be returned. The return value must be a string object. If a\n class defines "__repr__()" but not "__str__()", then "__repr__()"\n is also used when an "informal" string representation of instances\n of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the "str()" built-in function and by the "print"\n statement to compute the "informal" string representation of an\n object. This differs from "__repr__()" in that it does not have to\n be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to "__cmp__()" below. The\n correspondence between operator symbols and method names is as\n follows: "xy" call "x.__ne__(y)",\n "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if "self < other",\n zero if "self == other", a positive integer if "self > other". If\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n class instances are compared by object identity ("address"). See\n also the description of "__hash__()" for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by "__cmp__()" has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a "__cmp__()" or "__eq__()" method it\n should not define a "__hash__()" operation either; if it defines\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n not be usable in hashed collections. If a class defines mutable\n objects and implements a "__cmp__()" or "__eq__()" method, it\n should not implement "__hash__()", since hashable collection\n implementations require that an object\'s hash value is immutable\n (if the object\'s hash value changes, it will be in the wrong hash\n bucket).\n\n User-defined classes have "__cmp__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns a result derived from\n "id(x)".\n\n Classes which inherit a "__hash__()" method from a parent class but\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\n value returned is no longer appropriate (e.g. by switching to a\n value-based concept of equality instead of the default identity\n based equality) can explicitly flag themselves as being unhashable\n by setting "__hash__ = None" in the class definition. Doing so\n means that not only will instances of the class raise an\n appropriate "TypeError" when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable)"\n (unlike classes which define their own "__hash__()" to explicitly\n raise "TypeError").\n\n Changed in version 2.5: "__hash__()" may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: "__hash__" may now be set to "None" to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True", or their integer\n equivalents "0" or "1". When this method is not defined,\n "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__nonzero__()", all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement "unicode()" built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n', + 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible --- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 2.4: Restarting post-mortem behavior added.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "c" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print spam\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print spam\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement[, globals[, locals]])\n\n Execute the *statement* (given as a string) under debugger control.\n The debugger prompt appears before any code is executed; you can\n set breakpoints and type "continue", or you can step through the\n statement using "step" or "next" (all these commands are explained\n below). The optional *globals* and *locals* arguments specify the\n environment in which the code is executed; by default the\n dictionary of the module "__main__" is used. (See the explanation\n of the "exec" statement or the "eval()" built-in function.)\n\npdb.runeval(expression[, globals[, locals]])\n\n Evaluate the *expression* (given as a string) under debugger\n control. When "runeval()" returns, it returns the value of the\n expression. Otherwise this function is similar to "run()".\n\npdb.runcall(function[, argument, ...])\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem([traceback])\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 2.7: The *skip* argument.\n\n run(statement[, globals[, locals]])\n runeval(expression[, globals[, locals]])\n runcall(function[, argument, ...])\n set_trace()\n\n See the documentation for the functions explained above.\n', + 'del': u'\nThe "del" statement\n*******************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nIt is illegal to delete a name from the local namespace if it occurs\nas a free variable in a nested block.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n', + 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection The standard type hierarchy. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', + 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', + 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', + 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', + 'exec': u'\nThe "exec" statement\n********************\n\n exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n\nThis statement supports dynamic execution of Python code. The first\nexpression should evaluate to either a Unicode string, a *Latin-1*\nencoded string, an open file object, a code object, or a tuple. If it\nis a string, the string is parsed as a suite of Python statements\nwhich is then executed (unless a syntax error occurs). [1] If it is an\nopen file, the file is parsed until EOF and executed. If it is a code\nobject, it is simply executed. For the interpretation of a tuple, see\nbelow. In all cases, the code that\'s executed is expected to be valid\nas file input (see section File input). Be aware that the "return"\nand "yield" statements may not be used outside of function definitions\neven within the context of code passed to the "exec" statement.\n\nIn all cases, if the optional parts are omitted, the code is executed\nin the current scope. If only the first expression after "in" is\nspecified, it should be a dictionary, which will be used for both the\nglobal and the local variables. If two expressions are given, they\nare used for the global and local variables, respectively. If\nprovided, *locals* can be any mapping object. Remember that at module\nlevel, globals and locals are the same dictionary. If two separate\nobjects are given as *globals* and *locals*, the code will be executed\nas if it were embedded in a class definition.\n\nThe first expression may also be a tuple of length 2 or 3. In this\ncase, the optional parts must be omitted. The form "exec(expr,\nglobals)" is equivalent to "exec expr in globals", while the form\n"exec(expr, globals, locals)" is equivalent to "exec expr in globals,\nlocals". The tuple form of "exec" provides compatibility with Python\n3, where "exec" is a function rather than a statement.\n\nChanged in version 2.4: Formerly, *locals* was required to be a\ndictionary.\n\nAs a side effect, an implementation may insert additional keys into\nthe dictionaries given besides those corresponding to variable names\nset by the executed code. For example, the current implementation may\nadd a reference to the dictionary of the built-in module "__builtin__"\nunder the key "__builtins__" (!).\n\n**Programmer\'s hints:** dynamic evaluation of expressions is supported\nby the built-in function "eval()". The built-in functions "globals()"\nand "locals()" return the current global and local dictionary,\nrespectively, which may be useful to pass around for use by "exec".\n\n-[ Footnotes ]-\n\n[1] Note that the parser only accepts the Unix-style end of line\n convention. If you are reading the code from a file, make sure to\n use *universal newlines* mode to convert Windows or Mac-style\n newlines.\n', + 'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', + 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n', + 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10. For\nexample, "077e010" is legal, and denotes the same number as "77e10".\nThe allowed range of floating point literals is implementation-\ndependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n', + 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', + 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the Format Specification Mini-Language section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nTwo conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, and "\'!r\'" which calls "repr()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields may contain a field name,\nconversion flag and format specification, but deeper nesting is not\nallowed. The replacement fields within the format_spec are\nsubstituted before the *format_spec* string is interpreted. This\nallows the formatting of a value to be dynamically specified.\n\nSee the Format examples section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see Format String Syntax). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. It is not possible to use a literal curly brace (""{"" or\n""}"") as the *fill* character when using the "str.format()" method.\nHowever, it is possible to insert a curly brace with a nested\nreplacement field. This limitation doesn\'t affect the "format()"\nfunction.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. It becomes the default when \'0\' |\n | | immediately precedes the field width. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", respectively.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 2.7: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nWhen no explicit alignment is given, preceding the *width* field by a\nzero ("\'0\'") character enables sign-aware zero-padding for numeric\ntypes. This is equivalent to a *fill* character of "\'0\'" with an\n*alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand "None"). When doing so, "float()" is used to convert the integer\nto a floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'g\'". |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the "str.format()" syntax and\ncomparison with the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 2.7+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point(object):\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19.5\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12):\n ... for base in \'dXob\':\n ... print \'{0:{width}{base}}\'.format(num, base=base, width=width),\n ... print\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', + 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n', + 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the latter two restrictions, but programs should not abuse\nthis freedom, as future implementations may enforce them or silently\nchange the meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in an "exec"\nstatement does not affect the code block *containing* the "exec"\nstatement, and code contained in an "exec" statement is unaffected by\n"global" statements in the code containing the "exec" statement. The\nsame applies to the "eval()", "execfile()" and "compile()" functions.\n', + 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "__builtin__" module. When\n not in interactive mode, "_" has no special meaning and is not\n defined. See section The import statement.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the Special method names section and\n elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section Identifiers (Names).\n', + 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\n identifier ::= (letter|"_") (letter | digit | "_")*\n letter ::= lowercase | uppercase\n lowercase ::= "a"..."z"\n uppercase ::= "A"..."Z"\n digit ::= "0"..."9"\n\nIdentifiers are unlimited in length. Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n and del from not while\n as elif global or with\n assert else if pass yield\n break except import print\n class exec in raise\n continue finally is return\n def for lambda try\n\nChanged in version 2.4: "None" became a constant and is now recognized\nby the compiler as a name for the built-in object "None". Although it\nis not a keyword, you cannot assign a different object to it.\n\nChanged in version 2.5: Using "as" and "with" as identifiers triggers\na warning. To use them as keywords, enable the "with_statement"\nfuture feature .\n\nChanged in version 2.6: "as" and "with" are full keywords.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "__builtin__" module. When\n not in interactive mode, "_" has no special meaning and is not\n defined. See section The import statement.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the Special method names section and\n elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section Identifiers (Names).\n', + 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', + 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', + 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the "import" statement occurs). The\nstatement comes in two forms differing on whether it uses the "from"\nkeyword. The first form (without "from") repeats these steps for each\nidentifier in the list. The form with "from" performs step (1) once,\nand then performs step (2) repeatedly.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n"sys.modules", the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then "sys.meta_path" is\nsearched (the specification for "sys.meta_path" can be found in **PEP\n302**). The object is a list of *finder* objects which are queried in\norder as to whether they know how to load the module by calling their\n"find_module()" method with the name of the module. If the module\nhappens to be contained within a package (as denoted by the existence\nof a dot in the name), then a second argument to "find_module()" is\ngiven as the value of the "__path__" attribute from the parent package\n(everything up to the last dot in the name of the module being\nimported). If a finder can find the module it returns a *loader*\n(discussed later) or returns "None".\n\nIf none of the finders on "sys.meta_path" are able to find the module\nthen some implicitly defined finders are queried. Implementations of\nPython vary in what implicit meta path finders are defined. The one\nthey all do define, though, is one that handles "sys.path_hooks",\n"sys.path_importer_cache", and "sys.path".\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to "find_module()",\n"__path__" on the parent package, is used as the source of paths. If\nthe module is not contained in a package then "sys.path" is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n"sys.path_importer_cache" caches finders for paths and is checked for\na finder. If the path does not have a finder cached then\n"sys.path_hooks" is searched by calling each object in the list with a\nsingle argument of the path, returning a finder or raises\n"ImportError". If a finder is returned then it is cached in\n"sys.path_importer_cache" and then used for that path entry. If no\nfinder can be found but the path exists then a value of "None" is\nstored in "sys.path_importer_cache" to signify that an implicit, file-\nbased finder that handles modules stored as individual files should be\nused for that path. If the path does not exist then a finder which\nalways returns "None" is placed in the cache for the path.\n\nIf no finder can find the module then "ImportError" is raised.\nOtherwise some finder returned a loader whose "load_module()" method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin "sys.modules" (a possibility if the loader is called outside of the\nimport machinery) then it is to use that module for initialization and\nnot a new module. But if the module does not exist in "sys.modules"\nthen it is to be added to that dict before initialization begins. If\nan error occurs during loading of the module and it was added to\n"sys.modules" it is to be removed from the dict. If an error occurs\nbut the module was already in "sys.modules" it is left in the dict.\n\nThe loader must set several attributes on the module. "__name__" is to\nbe set to the name of the module. "__file__" is to be the "path" to\nthe file unless the module is built-in (and thus listed in\n"sys.builtin_module_names") in which case the attribute is not set. If\nwhat is being imported is a package then "__path__" is to be set to a\nlist of paths to be searched when looking for modules and packages\ncontained within the package being imported. "__package__" is optional\nbut should be set to the name of package that contains the module or\npackage (the empty string is used for module not contained in a\npackage). "__loader__" is also optional but should be set to the\nloader object that is loading the module.\n\nIf an error occurs during loading then the loader raises "ImportError"\nif some other exception is not already being propagated. Otherwise the\nloader returns the module that was loaded and initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of "import" statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by "as", the\nname following "as" is used as the local name for the module.\n\nThe "from" form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of "import", an alternate local name\ncan be supplied by specifying ""as" localname". If a name is not\nfound, "ImportError" is raised. If the list of identifiers is\nreplaced by a star ("\'*\'"), all public names defined in the module are\nbound in the local namespace of the "import" statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe "from" form with "*" may only occur in a module scope. If the\nwild card form of import --- "import *" --- is used in a function and\nthe function contains or is a nested block with free variables, the\ncompiler will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine which modules need to be loaded dynamically.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 2.6 are "unicode_literals",\n"print_function", "absolute_import", "division", "generators",\n"nested_scopes" and "with_statement". "generators", "with_statement",\n"nested_scopes" are redundant in Python version 2.6 and above because\nthey are always enabled.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by an "exec" statement or calls to the built-in\nfunctions "compile()" and "execfile()" that occur in a module "M"\ncontaining a future statement will, by default, use the new syntax or\nsemantics associated with the future statement. This can, starting\nwith Python 2.2 be controlled by optional arguments to "compile()" ---\nsee the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the "-i" option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also:\n\n **PEP 236** - Back to the __future__\n The original proposal for the __future__ mechanism.\n', + 'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. Unicode and 8-bit strings are fully interoperable in\n this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n the same as "cmp(x,y)". If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, "[1,2] <\n [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that either "x is y[i]" or "x == y[i]" is\ntrue.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n', + 'integers': u'\nInteger and long integer literals\n*********************************\n\nInteger and long integer literals are described by the following\nlexical definitions:\n\n longinteger ::= integer ("l" | "L")\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"\n octinteger ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n nonzerodigit ::= "1"..."9"\n octdigit ::= "0"..."7"\n bindigit ::= "0" | "1"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n\nAlthough both lower case "\'l\'" and upper case "\'L\'" are allowed as\nsuffix for long integers, it is strongly recommended to always use\n"\'L\'", since the letter "\'l\'" looks too much like the digit "\'1\'".\n\nPlain integer literals that are above the largest representable plain\ninteger (e.g., 2147483647 when using 32-bit arithmetic) are accepted\nas if they were long integers instead. [1] There is no limit for long\ninteger literals apart from what can be stored in available memory.\n\nSome examples of plain integer literals (first row) and long integer\nliterals (second and third rows):\n\n 7 2147483647 0177\n 3L 79228162514264337593543950336L 0377L 0x100000000L\n 79228162514264337593543950336 0xdeadbeef\n', + 'lambda': u'\nLambdas\n*******\n\n lambda_expr ::= "lambda" [parameter_list]: expression\n old_lambda_expr ::= "lambda" [parameter_list]: old_expression\n\nLambda expressions (sometimes called lambda forms) have the same\nsyntactic position as expressions. They are a shorthand to create\nanonymous functions; the expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with\n\n def name(arguments):\n return expression\n\nSee section Function definitions for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements.\n', + 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [expression_list | list_comprehension] "]"\n list_comprehension ::= expression list_for\n list_for ::= "for" target_list "in" old_expression_list [list_iter]\n old_expression_list ::= old_expression [("," old_expression)+ [","]]\n old_expression ::= or_test | old_lambda_expr\n list_iter ::= list_for | list_if\n list_if ::= "if" old_expression [list_iter]\n\nA list display yields a new list object. Its contents are specified\nby providing either a list of expressions or a list comprehension.\nWhen a comma-separated list of expressions is supplied, its elements\nare evaluated from left to right and placed into the list object in\nthat order. When a list comprehension is supplied, it consists of a\nsingle expression followed by at least one "for" clause and zero or\nmore "for" or "if" clauses. In this case, the elements of the new\nlist are those that would be produced by considering each of the "for"\nor "if" clauses a block, nesting from left to right, and evaluating\nthe expression to produce a list element each time the innermost block\nis reached [1].\n', + 'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', + 'numbers': u'\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers. There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n', + 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()" (described\n below). Note that "__pow__()" should be defined to accept an\n optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator ("/") is implemented by these methods. The\n "__truediv__()" method is used when "__future__.division" is in\n effect, otherwise "__div__()" is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, to execute the statement "x += y", where\n *x* is an instance of a class that has an "__iadd__()" method,\n "x.__iadd__(y)" is called. If *x* is an instance of a class that\n does not define a "__iadd__()" method, "x.__add__(y)" and\n "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions "complex()", "int()",\n "long()", and "float()". Should return a value of the appropriate\n type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions "oct()" and "hex()".\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement "operator.index()". Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or "None" if conversion is impossible. When\n the common type would be the type of "other", it is sufficient to\n return "None", since the interpreter will also ask the other object\n to attempt a coercion (but sometimes, if the implementation of the\n other type cannot be changed, it is useful to do the conversion to\n the other type here). A return value of "NotImplemented" is\n equivalent to returning "None".\n', + 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'"is"\' operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The "type()" function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (ex:\nalways close files).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects. The\n\'"try"..."finally"\' statement provides a convenient way to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n', + 'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section Comparisons --- and exponentiation, which groups from\nright to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| "lambda" | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else" | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| "or" | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| "and" | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x" | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership |\n| ">=", "<>", "!=", "==" | tests and identity tests |\n+-------------------------------------------------+---------------------------------------+\n| "|" | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| "^" | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| "&" | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>" | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-" | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| "*", "/", "//", "%" | Multiplication, division, remainder |\n| | [8] |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x" | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| "**" | Exponentiation [9] |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]", | Subscription, slicing, call, |\n| "x(arguments...)", "x.attribute" | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key: | Binding or tuple display, list |\n| value...}", "`expressions...`" | display, dictionary display, string |\n| | conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks"\n the control variables of each "for" it contains into the\n containing scope. However, this behavior is deprecated, and\n relying on it will not work in Python 3.\n\n[2] While "abs(x%y) < abs(y)" is true mathematically, for floats\n it may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that "-1e-100 % 1e100" have the same\n sign as "1e100", the computed result is "-1e-100 + 1e100", which\n is numerically exactly equal to "1e100". The function\n "math.fmod()" returns a result whose sign matches the sign of the\n first argument instead, and so returns "-1e-100" in this case.\n Which approach is more appropriate depends on the application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n possible for "floor(x/y)" to be one larger than "(x-x%y)/y" due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that "divmod(x,y)[0] * y + x % y" be very close\n to "x".\n\n[4] While comparisons between unicode strings make sense at the\n byte level, they may be counter-intuitive to users. For example,\n the strings "u"\\u00C7"" and "u"\\u0043\\u0327"" compare differently,\n even though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using "unicodedata.normalize()".\n\n[5] The implementation computes this efficiently, without\n constructing lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of\n the sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to "{}".\n\n[7] Due to automatic garbage-collection, free lists, and the\n dynamic nature of descriptors, you may notice seemingly unusual\n behaviour in certain uses of the "is" operator, like those\n involving comparisons between instance methods, or constants.\n Check their documentation for more info.\n\n[8] The "%" operator is also used for string formatting; the same\n precedence applies.\n\n[9] The power operator "**" binds less tightly than an arithmetic\n or bitwise unary operator on its right, that is, "2**-1" is "0.5".\n', + 'pass': u'\nThe "pass" statement\n********************\n\n pass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', + 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type. The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, "10**2" returns "100", but\n"10**-2" returns "0.01". (This last feature was added in Python 2.2.\nIn Python 2.1 and before, if both arguments were of integer types and\nthe second argument was negative, an exception was raised).\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a\n"ValueError".\n', + 'print': u'\nThe "print" statement\n*********************\n\n print_stmt ::= "print" ([expression ("," expression)* [","]]\n | ">>" expression [("," expression)+ [","]])\n\n"print" evaluates each expression in turn and writes the resulting\nobject to standard output (see below). If an object is not a string,\nit is first converted to a string using the rules for string\nconversions. The (resulting or original) string is then written. A\nspace is written before each object is (converted and) written, unless\nthe output system believes it is positioned at the beginning of a\nline. This is the case (1) when no characters have yet been written\nto standard output, (2) when the last character written to standard\noutput is a whitespace character except "\' \'", or (3) when the last\nwrite operation on standard output was not a "print" statement. (In\nsome cases it may be functional to write an empty string to standard\noutput for this reason.)\n\nNote: Objects which act like file objects but which are not the\n built-in file objects often do not properly emulate this aspect of\n the file object\'s behavior, so it is best not to rely on this.\n\nA "\'\\n\'" character is written at the end, unless the "print" statement\nends with a comma. This is the only action if the statement contains\njust the keyword "print".\n\nStandard output is defined as the file object named "stdout" in the\nbuilt-in module "sys". If no such object exists, or if it does not\nhave a "write()" method, a "RuntimeError" exception is raised.\n\n"print" also has an extended form, defined by the second portion of\nthe syntax described above. This form is sometimes referred to as\n""print" chevron." In this form, the first expression after the ">>"\nmust evaluate to a "file-like" object, specifically an object that has\na "write()" method as described above. With this extended form, the\nsubsequent expressions are printed to this file object. If the first\nexpression evaluates to "None", then "sys.stdout" is used as the file\nfor output.\n', + 'raise': u'\nThe "raise" statement\n*********************\n\n raise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "TypeError" exception is raised indicating that\nthis is an error (if running under IDLE, a "Queue.Empty" exception is\nraised instead).\n\nOtherwise, "raise" evaluates the expressions to get three objects,\nusing "None" as the value of omitted expressions. The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be "None".\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is "None", an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor. The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not "None", it must be a traceback\nobject (see section The standard type hierarchy), and it is\nsubstituted instead of the current location as the place where the\nexception occurred. If the third object is present and not a\ntraceback object or "None", a "TypeError" exception is raised. The\nthree-expression form of "raise" is useful to re-raise an exception\ntransparently in an except clause, but "raise" with no expressions\nshould be preferred if the exception to be re-raised was the most\nrecently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\nExceptions, and information about handling exceptions is in section\nThe try statement.\n', + 'return': u'\nThe "return" statement\n**********************\n\n return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement is not allowed to\ninclude an "expression_list". In that context, a bare "return"\nindicates that the generator is done and will cause "StopIteration" to\nbe raised.\n', + 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__nonzero__()" method and whose "__len__()"\n method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method "iterkeys()".\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\n New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see this section in the\n language reference.\n', + 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments. The\narguments are converted to a common type. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by "pow(2, n)". A\nleft shift by *n* bits is defined as multiplication with "pow(2, n)".\nNegative shift counts raise a "ValueError" exception.\n\nNote: In the current implementation, the right-hand operand is\n required to be at most "sys.maxsize". If the right-hand operand is\n larger than "sys.maxsize" an "OverflowError" exception is raised.\n', + 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= simple_slicing | extended_slicing\n simple_slicing ::= primary "[" short_slice "]"\n extended_slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice | ellipsis\n proper_slice ::= short_slice | long_slice\n short_slice ::= [lower_bound] ":" [upper_bound]\n long_slice ::= short_slice ":" [stride]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n ellipsis ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses). Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows. The primary must\nevaluate to a sequence object. The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n"sys.maxint", respectively. If either bound is negative, the\nsequence\'s length is added to it. The slicing now selects all items\nwith index *k* such that "i <= k < j" where *i* and *j* are the\nspecified lower and upper bounds. This may be an empty sequence. It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows. The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows. If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of an ellipsis slice\nitem is the built-in "Ellipsis" object. The conversion of a proper\nslice is a slice object (see section The standard type hierarchy)\nwhose "start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n', + 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\nobject.__methods__\n\n Deprecated since version 2.2: Use the built-in function "dir()" to\n get a list of an object\'s attributes. This attribute is no longer\n available.\n\nobject.__members__\n\n Deprecated since version 2.2: Use the built-in function "dir()" to\n get a list of an object\'s attributes. This attribute is no longer\n available.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\ndefinition.__name__\n\n The name of the class, type, function, method, descriptor, or\n generator instance.\n\nThe following attributes are only supported by *new-style class*es.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each new-style class keeps a list of weak references to its\n immediate subclasses. This method returns a list of all those\n references still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (Basic customization).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n\n[6] The advantage of leaving the newline on is that returning an\n empty string is then an unambiguous EOF indication. It is also\n possible (in cases where it might matter, for example, if you want\n to make an exact copy of a file while scanning its lines) to tell\n whether the last line of a file ended in a newline or not (yes\n this happens!).\n', + 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "x.__getitem__(i)" for old-style\nclasses and "type(x).__getitem__(x, i)" for new-style classes. Except\nwhere mentioned, attempts to execute an operation raise an exception\nwhen no appropriate method is defined (typically "AttributeError" or\n"TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_traceback" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing "None" in\n "sys.exc_traceback" or "sys.last_traceback". Circular references\n which are garbage are detected when the option cycle detector is\n enabled (it\'s on by default), but can only be cleaned up if there\n are no Python-level "__del__()" methods involved. Refer to the\n documentation for the "gc" module for more information about how\n "__del__()" methods are handled by the cycle detector,\n particularly the description of the "garbage" value.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\n See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function and by string conversions\n (reverse quotes) to compute the "official" string representation of\n an object. If at all possible, this should look like a valid\n Python expression that could be used to recreate an object with the\n same value (given an appropriate environment). If this is not\n possible, a string of the form "<...some useful description...>"\n should be returned. The return value must be a string object. If a\n class defines "__repr__()" but not "__str__()", then "__repr__()"\n is also used when an "informal" string representation of instances\n of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the "str()" built-in function and by the "print"\n statement to compute the "informal" string representation of an\n object. This differs from "__repr__()" in that it does not have to\n be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to "__cmp__()" below. The\n correspondence between operator symbols and method names is as\n follows: "xy" call "x.__ne__(y)",\n "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if "self < other",\n zero if "self == other", a positive integer if "self > other". If\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n class instances are compared by object identity ("address"). See\n also the description of "__hash__()" for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by "__cmp__()" has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a "__cmp__()" or "__eq__()" method it\n should not define a "__hash__()" operation either; if it defines\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n not be usable in hashed collections. If a class defines mutable\n objects and implements a "__cmp__()" or "__eq__()" method, it\n should not implement "__hash__()", since hashable collection\n implementations require that an object\'s hash value is immutable\n (if the object\'s hash value changes, it will be in the wrong hash\n bucket).\n\n User-defined classes have "__cmp__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns a result derived from\n "id(x)".\n\n Classes which inherit a "__hash__()" method from a parent class but\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\n value returned is no longer appropriate (e.g. by switching to a\n value-based concept of equality instead of the default identity\n based equality) can explicitly flag themselves as being unhashable\n by setting "__hash__ = None" in the class definition. Doing so\n means that not only will instances of the class raise an\n appropriate "TypeError" when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable)"\n (unlike classes which define their own "__hash__()" to explicitly\n raise "TypeError").\n\n Changed in version 2.5: "__hash__()" may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: "__hash__" may now be set to "None" to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True", or their integer\n equivalents "0" or "1". When this method is not defined,\n "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__nonzero__()", all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement "unicode()" built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (Implementing Descriptors) for each variable name. As a\n result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using "type()". A class\ndefinition is read into a separate namespace and the value of class\nname is bound to the result of "type(name, bases, dict)".\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of "type()". This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing\n the role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s "__new__()"\nmethod -- "type.__new__()" can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\n class metacls(type):\n def __new__(mcs, name, bases, dict):\n dict[\'foo\'] = \'metacls was here\'\n return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom "__call__()" method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n This variable can be any callable accepting arguments for "name",\n "bases", and "dict". Upon class creation, the callable is used\n instead of the built-in "type()".\n\n New in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If "dict[\'__metaclass__\']" exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n used (this looks for a *__class__* attribute first and if not found,\n uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also:\n\n **PEP 3119** - Introducing Abstract Base Classes\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__nonzero__()" method and whose "__len__()"\n method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method "iterkeys()".\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\n New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see this section in the\n language reference.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine "__getslice__()"; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated since version 2.0: Support slice objects as parameters\n to the "__getitem__()" method. (However, built-in types in CPython\n currently still implement "__getslice__()". Therefore, you have to\n override it in derived classes when implementing slicing.)\n\n Called to implement evaluation of "self[i:j]". The returned object\n should be of the same type as *self*. Note that missing *i* or *j*\n in the slice expression are replaced by zero or "sys.maxsize",\n respectively. If negative indexes are used in the slice, the\n length of the sequence is added to that index. If the instance does\n not implement the "__len__()" method, an "AttributeError" is\n raised. No guarantee is made that indexes adjusted this way are not\n still negative. Indexes which are greater than the length of the\n sequence are not modified. If no "__getslice__()" is found, a slice\n object is created instead, and passed to "__getitem__()" instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to "self[i:j]". Same notes for *i*\n and *j* as for "__getslice__()".\n\n This method is deprecated. If no "__setslice__()" is found, or for\n extended slicing of the form "self[i:j:k]", a slice object is\n created, and passed to "__setitem__()", instead of "__setslice__()"\n being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of "self[i:j]". Same notes for *i* and\n *j* as for "__getslice__()". This method is deprecated. If no\n "__delslice__()" is found, or for extended slicing of the form\n "self[i:j:k]", a slice object is created, and passed to\n "__delitem__()", instead of "__delslice__()" being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, "__getitem__()", "__setitem__()" or "__delitem__()" is\ncalled with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n"__getitem__()", "__setitem__()" and "__delitem__()" support slice\nobjects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to "max()"; these are necessary because of the handling\nof negative indices before the "__*slice__()" methods are called.\nWhen negative indexes are used, the "__*item__()" methods receive them\nas provided, but the "__*slice__()" methods get a "cooked" form of the\nindex values. For each negative index value, the length of the\nsequence is added to the index before calling the method (which may\nstill result in a negative index); this is the customary handling of\nnegative indexes by the built-in sequence types, and the "__*item__()"\nmethods are expected to do this as well. However, since they should\nalready be doing that, negative indexes cannot be passed in; they must\nbe constrained to the bounds of the sequence before being passed to\nthe "__*item__()" methods. Calling "max(0, i)" conveniently returns\nthe proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()" (described\n below). Note that "__pow__()" should be defined to accept an\n optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator ("/") is implemented by these methods. The\n "__truediv__()" method is used when "__future__.division" is in\n effect, otherwise "__div__()" is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, to execute the statement "x += y", where\n *x* is an instance of a class that has an "__iadd__()" method,\n "x.__iadd__(y)" is called. If *x* is an instance of a class that\n does not define a "__iadd__()" method, "x.__add__(y)" and\n "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions "complex()", "int()",\n "long()", and "float()". Should return a value of the appropriate\n type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions "oct()" and "hex()".\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement "operator.index()". Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or "None" if conversion is impossible. When\n the common type would be the type of "other", it is sufficient to\n return "None", since the interpreter will also ask the other object\n to attempt a coercion (but sometimes, if the implementation of the\n other type cannot be changed, it is useful to do the conversion to\n the other type here). A return value of "NotImplemented" is\n equivalent to returning "None".\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don\'t define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from "object") never invoke the\n "__coerce__()" method in response to a binary operator; the only\n time "__coerce__()" is invoked is when the built-in function\n "coerce()" is called.\n\n* For most intents and purposes, an operator that returns\n "NotImplemented" is treated the same as one that is not implemented\n at all.\n\n* Below, "__op__()" and "__rop__()" are used to signify the generic\n method names corresponding to an operator; "__iop__()" is used for\n the corresponding in-place operator. For example, for the operator\n \'"+"\', "__add__()" and "__radd__()" are used for the left and right\n variant of the binary operator, and "__iadd__()" for the in-place\n variant.\n\n* For objects *x* and *y*, first "x.__op__(y)" is tried. If this is\n not implemented or returns "NotImplemented", "y.__rop__(x)" is\n tried. If this is also not implemented or returns "NotImplemented",\n a "TypeError" exception is raised. But see the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base\'s "__rop__()" method, the right operand\'s "__rop__()"\n method is tried *before* the left operand\'s "__op__()" method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand\'s "__op__()" method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is\n called before that type\'s "__op__()" or "__rop__()" method is\n called, but no sooner. If the coercion returns an object of a\n different type for the operand whose coercion is invoked, part of\n the process is redone using the new object.\n\n* When an in-place operator (like \'"+="\') is used, if the left\n operand implements "__iop__()", it is invoked without any coercion.\n When the operation falls back to "__op__()" and/or "__rop__()", the\n normal coercion rules apply.\n\n* In "x + y", if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In "x * y", if one operand is a sequence that implements sequence\n repetition, and the other is an integer ("int" or "long"), sequence\n repetition is invoked.\n\n* Rich comparisons (implemented by methods "__eq__()" and so on)\n never use coercion. Three-way comparison (implemented by\n "__cmp__()") does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types "int",\n "long", "float", and "complex" do not use coercion. All these types\n implement a "__coerce__()" method, for use by the built-in\n "coerce()" function.\n\n Changed in version 2.7: The complex type no longer makes implicit\n calls to the "__coerce__()" method for mixed-type binary arithmetic\n operations.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n"x.__getitem__(i)" or implicitly as in "x[i]".\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n >>> class C:\n ... pass\n ...\n >>> c1 = C()\n >>> c2 = C()\n >>> c1.__len__ = lambda: 5\n >>> c2.__len__ = lambda: 9\n >>> len(c1)\n 5\n >>> len(c2)\n 9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n >>> class C(object):\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print "Metaclass getattribute invoked"\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object):\n ... __metaclass__ = Meta\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print "Class getattribute invoked"\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type,\n under certain controlled conditions. It generally isn\'t a good\n idea though, since it can lead to some very strange behaviour if\n it is handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n reflected method (such as "__add__()") fails the operation is not\n supported, which is why the reflected method is not called.\n', + 'string-methods': u'\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n "\'strict\'", meaning that encoding errors raise "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'" and any other\n name registered via "codecs.register_error()", see section Codec\n Base Classes.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'",\n "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n registered via "codecs.register_error()", see section Codec Base\n Classes. For a list of possible encodings, see section Standard\n Encodings.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n "\'backslashreplace\'" and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See Format String Syntax for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the "%" formatting described in String\n Formatting Operations in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example, "\' 1 2 3 \'.split()" returns "[\'1\', \'2\', \'3\']", and\n "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 \']".\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n Python recognizes ""\\r"", ""\\n"", and ""\\r\\n"" as line boundaries\n for 8-bit strings.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nunicode.splitlines([keepends])\n\n Return a list of the lines in the string, like "str.splitlines()".\n However, the Unicode method splits on the following line\n boundaries, which are a superset of the *universal newlines*\n recognized for 8-bit strings.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 2.7: "\\v" and "\\f" added to list of line\n boundaries.\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the "maketrans()" helper function in the "string"\n module to create a translation table. For string objects, set the\n *table* argument to "None" for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a "None" *table* argument.\n\n For Unicode objects, the "translate()" method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or "None". Unmapped characters\n are left untouched. Characters mapped to "None" are deleted. Note,\n a more flexible approach is to create a custom character mapping\n codec using the "codecs" module (see "encodings.cp1251" for an\n example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to "len(s)".\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return "True" if there are only numeric characters in S, "False"\n otherwise. Numeric characters include digit characters, and all\n characters that have the Unicode numeric value property, e.g.\n U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return "True" if there are only decimal characters in S, "False"\n otherwise. Decimal characters include digit characters, and all\n characters that can be used to form decimal-radix numbers, e.g.\n U+0660, ARABIC-INDIC DIGIT ZERO.\n', + 'strings': u'\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n | "b" | "B" | "br" | "Br" | "bR" | "BR"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'"\n | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | escapeseq\n longstringitem ::= longstringchar | escapeseq\n shortstringchar ::= \n longstringchar ::= \n escapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section Encoding declarations.\n\nIn plain English: String literals can be enclosed in matching single\nquotes ("\'") or double quotes ("""). They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*). The backslash ("\\")\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter "\'r\'" or\n"\'R\'"; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences. A prefix of "\'u\'" or\n"\'U\'" makes the string a Unicode string. Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646. Some additional escape sequences, described below, are\navailable in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ignored in\nPython 2; it indicates that the literal should become a bytes literal\nin Python 3 (e.g. when code is automatically converted with 2to3). A\n"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string. (A "quote" is the character used to open the\nstring, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\N{name}" | Character named *name* in the | |\n| | Unicode database (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (1) |\n| | *xxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (2) |\n| | *xxxxxxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (3,5) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (4,5) |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can\n be encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\n outside the Basic Multilingual Plane (BMP) will be encoded using a\n surrogate pair if Python is compiled to use 16-bit code units (the\n default).\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the\n byte with the given value; it is not necessary that the byte\n encodes a character in the source character set. In a Unicode\n literal, these escapes denote a Unicode character with the given\n value.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an "\'r\'" or "\'R\'" prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*. For example, the string literal\n"r"\\n"" consists of two characters: a backslash and a lowercase "\'n\'".\nString quotes can be escaped with a backslash, but the backslash\nremains in the string; for example, "r"\\""" is a valid string literal\nconsisting of two characters: a backslash and a double quote; "r"\\""\nis not a valid string literal (even a raw string cannot end in an odd\nnumber of backslashes). Specifically, *a raw string cannot end in a\nsingle backslash* (since the backslash would escape the following\nquote character). Note also that a single backslash followed by a\nnewline is interpreted as those two characters as part of the string,\n*not* as a line continuation.\n\nWhen an "\'r\'" or "\'R\'" prefix is used in conjunction with a "\'u\'" or\n"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape sequences are\nprocessed while *all other backslashes are left in the string*. For\nexample, the string literal "ur"\\u0062\\n"" consists of three Unicode\ncharacters: \'LATIN SMALL LETTER B\', \'REVERSE SOLIDUS\', and \'LATIN\nSMALL LETTER N\'. Backslashes can be escaped with a preceding\nbackslash; however, both remain in the string. As a result, "\\uXXXX"\nescape sequences are only recognized when there are an odd number of\nbackslashes.\n', + 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer. If this value is negative, the length of the sequence\nis added to it (so that, e.g., "x[-1]" selects the last item of "x".)\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero).\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', + 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__nonzero__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n', + 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n', + 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name "None". It\n is used to signify the absence of a value in many situations, e.g.,\n it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "NotImplemented". Numeric methods and rich comparison methods may\n return this value if they do not implement the operation for the\n operands provided. (The interpreter will then try the reflected\n operation, or some other fallback, depending on the operator.) Its\n truth value is true.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "Ellipsis". It is used to indicate the presence of the "..." syntax\n in a slice. Its truth value is true.\n\n"numbers.Number"\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n "numbers.Integral"\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are three types of integers:\n\n Plain integers\n These represent numbers in the range -2147483648 through\n 2147483647. (The range may be larger on machines with a\n larger natural word size, but not smaller.) When the result\n of an operation would fall outside this range, the result is\n normally returned as a long integer (in some cases, the\n exception "OverflowError" is raised instead). For the\n purpose of shift and mask operations, integers are assumed to\n have a binary, 2\'s complement notation using 32 or more bits,\n and hiding no bits from the user (i.e., all 4294967296\n different bit patterns correspond to different values).\n\n Long integers\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans\n These represent the truth values False and True. The two\n objects representing the values "False" and "True" are the\n only Boolean objects. The Boolean type is a subtype of plain\n integers, and Boolean values behave like the values 0 and 1,\n respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ""False"" or\n ""True"" are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers and the least surprises when\n switching between the plain and long integer domains. Any\n operation, if it yields a result in the plain integer domain,\n will yield the same result in the long integer domain or when\n using mixed operands. The switch between domains is transparent\n to the programmer.\n\n "numbers.Real" ("float")\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these are\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n "numbers.Complex"\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number "z" can be retrieved through the read-only\n attributes "z.real" and "z.imag".\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function "len()" returns the number of items\n of a sequence. When the length of a sequence is *n*, the index set\n contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\n selected by "a[i]".\n\n Sequences also support slicing: "a[i:j]" selects all items with\n index *k* such that *i* "<=" *k* "<" *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n The items of a string are characters. There is no separate\n character type; a character is represented by a string of one\n item. Characters represent (at least) 8-bit bytes. The\n built-in functions "chr()" and "ord()" convert between\n characters and nonnegative integers representing the byte\n values. Bytes with the values 0--127 usually represent the\n corresponding ASCII values, but the interpretation of values\n is up to the program. The string data type is also used to\n represent arrays of bytes, e.g., to hold data read from a\n file.\n\n (On systems whose native character set is not ASCII, strings\n may use EBCDIC in their internal representation, provided the\n functions "chr()" and "ord()" implement a mapping between\n ASCII and EBCDIC, and string comparison preserves the ASCII\n order. Or perhaps someone can propose a better rule?)\n\n Unicode\n The items of a Unicode object are Unicode code units. A\n Unicode code unit is represented by a Unicode object of one\n item and can hold either a 16-bit or 32-bit value\n representing a Unicode ordinal (the maximum value for the\n ordinal is given in "sys.maxunicode", and depends on how\n Python is configured at compile time). Surrogate pairs may\n be present in the Unicode object, and will be reported as two\n separate items. The built-in functions "unichr()" and\n "ord()" convert between code units and nonnegative integers\n representing the Unicode ordinals as defined in the Unicode\n Standard 3.0. Conversion from and to other encodings are\n possible through the Unicode method "encode()" and the built-\n in function "unicode()".\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and "del" (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in "bytearray()" constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module "array" provides an additional example of a\n mutable sequence type.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function "len()"\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., "1" and\n "1.0"), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n "set()" constructor and can be modified afterwards by several\n methods, such as "add()".\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in "frozenset()" constructor. As a frozenset is immutable\n and *hashable*, it can be used again as an element of another\n set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation "a[k]" selects the item indexed by "k"\n from the mapping "a"; this can be used in expressions and as the\n target of assignments or "del" statements. The built-in function\n "len()" returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., "1" and "1.0")\n then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the "{...}"\n notation (see section Dictionary displays).\n\n The extension modules "dbm", "gdbm", and "bsddb" provide\n additional examples of mapping types.\n\nCallable types\n These are the types to which the function call operation (see\n section Calls) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section Function definitions). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +-------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +=========================+=================================+=============+\n | "__doc__" "func_doc" | The function\'s documentation | Writable |\n | | string, or "None" if | |\n | | unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | "__name__" "func_name" | The function\'s name | Writable |\n +-------------------------+---------------------------------+-------------+\n | "__module__" | The name of the module the | Writable |\n | | function was defined in, or | |\n | | "None" if unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | "__defaults__" | A tuple containing default | Writable |\n | "func_defaults" | argument values for those | |\n | | arguments that have defaults, | |\n | | or "None" if no arguments have | |\n | | a default value. | |\n +-------------------------+---------------------------------+-------------+\n | "__code__" "func_code" | The code object representing | Writable |\n | | the compiled function body. | |\n +-------------------------+---------------------------------+-------------+\n | "__globals__" | A reference to the dictionary | Read-only |\n | "func_globals" | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +-------------------------+---------------------------------+-------------+\n | "__dict__" "func_dict" | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +-------------------------+---------------------------------+-------------+\n | "__closure__" | "None" or a tuple of cells that | Read-only |\n | "func_closure" | contain bindings for the | |\n | | function\'s free variables. | |\n +-------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Changed in version 2.4: "func_name" is now writable.\n\n Changed in version 2.6: The double-underscore attributes\n "__closure__", "__code__", "__defaults__", and "__globals__"\n were introduced as aliases for the corresponding "func_*"\n attributes for forwards compatibility with Python 3.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n User-defined methods\n A user-defined method object combines a class, a class instance\n (or "None") and any callable object (normally a user-defined\n function).\n\n Special read-only attributes: "im_self" is the class instance\n object, "im_func" is the function object; "im_class" is the\n class of "im_self" for bound methods or the class that asked for\n the method for unbound methods; "__doc__" is the method\'s\n documentation (same as "im_func.__doc__"); "__name__" is the\n method name (same as "im_func.__name__"); "__module__" is the\n name of the module the method was defined in, or "None" if\n unavailable.\n\n Changed in version 2.2: "im_self" used to refer to the class\n that defined the method.\n\n Changed in version 2.6: For Python 3 forward-compatibility,\n "im_func" is also available as "__func__", and "im_self" as\n "__self__".\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object, an unbound\n user-defined method object, or a class method object. When the\n attribute is a user-defined method object, a new method object\n is only created if the class from which it is being retrieved is\n the same as, or a derived class of, the class stored in the\n original method object; otherwise, the original method object is\n used as it is.\n\n When a user-defined method object is created by retrieving a\n user-defined function object from a class, its "im_self"\n attribute is "None" and the method object is said to be unbound.\n When one is created by retrieving a user-defined function object\n from a class via one of its instances, its "im_self" attribute\n is the instance, and the method object is said to be bound. In\n either case, the new method\'s "im_class" attribute is the class\n from which the retrieval takes place, and its "im_func"\n attribute is the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the "im_func"\n attribute of the new instance is not the original method object\n but its "im_func" attribute.\n\n When a user-defined method object is created by retrieving a\n class method object from a class or instance, its "im_self"\n attribute is the class itself, and its "im_func" attribute is\n the function object underlying the class method.\n\n When an unbound user-defined method object is called, the\n underlying function ("im_func") is called, with the restriction\n that the first argument must be an instance of the proper class\n ("im_class") or of a derived class thereof.\n\n When a bound user-defined method object is called, the\n underlying function ("im_func") is called, inserting the class\n instance ("im_self") in front of the argument list. For\n instance, when "C" is a class which contains a definition for a\n function "f()", and "x" is an instance of "C", calling "x.f(1)"\n is equivalent to calling "C.f(x, 1)".\n\n When a user-defined method object is derived from a class method\n object, the "class instance" stored in "im_self" will actually\n be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n is equivalent to calling "f(C,1)" where "f" is the underlying\n function.\n\n Note that the transformation from function object to (unbound or\n bound) method object happens each time the attribute is\n retrieved from the class or instance. In some cases, a fruitful\n optimization is to assign the attribute to a local variable and\n call that local variable. Also notice that this transformation\n only happens for user-defined functions; other callable objects\n (and all non-callable objects) are retrieved without\n transformation. It is also important to note that user-defined\n functions which are attributes of a class instance are not\n converted to bound methods; this *only* happens when the\n function is an attribute of the class.\n\n Generator functions\n A function or method which uses the "yield" statement (see\n section The yield statement) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s "next()" method will cause the function to\n execute until it provides a value using the "yield" statement.\n When the function executes a "return" statement or falls off the\n end, a "StopIteration" exception is raised and the iterator will\n have reached the end of the set of values to be returned.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are "len()" and "math.sin()"\n ("math" is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: "__doc__" is the function\'s documentation\n string, or "None" if unavailable; "__name__" is the function\'s\n name; "__self__" is set to "None" (but see the next item);\n "__module__" is the name of the module the function was defined\n in or "None" if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n "alist.append()", assuming *alist* is a list object. In this\n case, the special read-only attribute "__self__" is set to the\n object denoted by *alist*.\n\n Class Types\n Class types, or "new-style classes," are callable. These\n objects normally act as factories for new instances of\n themselves, but variations are possible for class types that\n override "__new__()". The arguments of the call are passed to\n "__new__()" and, in the typical case, to "__init__()" to\n initialize the new instance.\n\n Classic Classes\n Class objects are described below. When a class object is\n called, a new class instance (also described below) is created\n and returned. This implies a call to the class\'s "__init__()"\n method if it has one. Any arguments are passed on to the\n "__init__()" method. If there is no "__init__()" method, the\n class must be called without arguments.\n\n Class instances\n Class instances are described below. Class instances are\n callable only when the class has a "__call__()" method;\n "x(arguments)" is a shorthand for "x.__call__(arguments)".\n\nModules\n Modules are imported by the "import" statement (see section The\n import statement). A module object has a namespace implemented by a\n dictionary object (this is the dictionary referenced by the\n func_globals attribute of functions defined in the module).\n Attribute references are translated to lookups in this dictionary,\n e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\n does not contain the code object used to initialize the module\n (since it isn\'t needed once the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n Special read-only attribute: "__dict__" is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: "__name__" is the module\'s name;\n "__doc__" is the module\'s documentation string, or "None" if\n unavailable; "__file__" is the pathname of the file from which the\n module was loaded, if it was loaded from a file. The "__file__"\n attribute is not present for C modules that are statically linked\n into the interpreter; for extension modules loaded dynamically from\n a shared library, it is the pathname of the shared library file.\n\nClasses\n Both class types (new-style classes) and class objects (old-\n style/classic classes) are typically created by class definitions\n (see section Class definitions). A class has a namespace\n implemented by a dictionary object. Class attribute references are\n translated to lookups in this dictionary, e.g., "C.x" is translated\n to "C.__dict__["x"]" (although for new-style classes in particular\n there are a number of hooks which allow for other means of locating\n attributes). When the attribute name is not found there, the\n attribute search continues in the base classes. For old-style\n classes, the search is depth-first, left-to-right in the order of\n occurrence in the base class list. New-style classes use the more\n complex C3 method resolution order which behaves correctly even in\n the presence of \'diamond\' inheritance structures where there are\n multiple inheritance paths leading back to a common ancestor.\n Additional details on the C3 MRO used by new-style classes can be\n found in the documentation accompanying the 2.3 release at\n https://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class "C", say) would yield a\n user-defined function object or an unbound user-defined method\n object whose associated class is either "C" or one of its base\n classes, it is transformed into an unbound user-defined method\n object whose "im_class" attribute is "C". When it would yield a\n class method object, it is transformed into a bound user-defined\n method object whose "im_self" attribute is "C". When it would\n yield a static method object, it is transformed into the object\n wrapped by the static method object. See section Implementing\n Descriptors for another way in which attributes retrieved from a\n class may differ from those actually contained in its "__dict__"\n (note that only new-style classes support descriptors).\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: "__name__" is the class name; "__module__" is\n the module name in which the class was defined; "__dict__" is the\n dictionary containing the class\'s namespace; "__bases__" is a tuple\n (possibly empty or a singleton) containing the base classes, in the\n order of their occurrence in the base class list; "__doc__" is the\n class\'s documentation string, or "None" if undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object or an unbound user-defined method object whose\n associated class is the class (call it "C") of the instance for\n which the attribute reference was initiated or one of its bases, it\n is transformed into a bound user-defined method object whose\n "im_class" attribute is "C" and whose "im_self" attribute is the\n instance. Static method and class method objects are also\n transformed, as if they had been retrieved from class "C"; see\n above under "Classes". See section Implementing Descriptors for\n another way in which attributes of a class retrieved via its\n instances may differ from the objects actually stored in the\n class\'s "__dict__". If no class attribute is found, and the\n object\'s class has a "__getattr__()" method, that is called to\n satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n "__setattr__()" or "__delattr__()" method, this is called instead\n of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n Special method names.\n\n Special attributes: "__dict__" is the attribute dictionary;\n "__class__" is the instance\'s class.\n\nFiles\n A file object represents an open file. File objects are created by\n the "open()" built-in function, and also by "os.popen()",\n "os.fdopen()", and the "makefile()" method of socket objects (and\n perhaps by other functions or methods provided by extension\n modules). The objects "sys.stdin", "sys.stdout" and "sys.stderr"\n are initialized to file objects corresponding to the interpreter\'s\n standard input, output and error streams. See File Objects for\n complete documentation of file objects.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: "co_name" gives the function name;\n "co_argcount" is the number of positional arguments (including\n arguments with default values); "co_nlocals" is the number of\n local variables used by the function (including arguments);\n "co_varnames" is a tuple containing the names of the local\n variables (starting with the argument names); "co_cellvars" is a\n tuple containing the names of local variables that are\n referenced by nested functions; "co_freevars" is a tuple\n containing the names of free variables; "co_code" is a string\n representing the sequence of bytecode instructions; "co_consts"\n is a tuple containing the literals used by the bytecode;\n "co_names" is a tuple containing the names used by the bytecode;\n "co_filename" is the filename from which the code was compiled;\n "co_firstlineno" is the first line number of the function;\n "co_lnotab" is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); "co_stacksize" is the required stack size\n (including local variables); "co_flags" is an integer encoding a\n number of flags for the interpreter.\n\n The following flag bits are defined for "co_flags": bit "0x04"\n is set if the function uses the "*arguments" syntax to accept an\n arbitrary number of positional arguments; bit "0x08" is set if\n the function uses the "**keywords" syntax to accept arbitrary\n keyword arguments; bit "0x20" is set if the function is a\n generator.\n\n Future feature declarations ("from __future__ import division")\n also use bits in "co_flags" to indicate whether a code object\n was compiled with a particular feature enabled: bit "0x2000" is\n set if the function was compiled with future division enabled;\n bits "0x10" and "0x1000" were used in earlier versions of\n Python.\n\n Other bits in "co_flags" are reserved for internal use.\n\n If a code object represents a function, the first item in\n "co_consts" is the documentation string of the function, or\n "None" if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: "f_back" is to the previous stack\n frame (towards the caller), or "None" if this is the bottom\n stack frame; "f_code" is the code object being executed in this\n frame; "f_locals" is the dictionary used to look up local\n variables; "f_globals" is used for global variables;\n "f_builtins" is used for built-in (intrinsic) names;\n "f_restricted" is a flag indicating whether the function is\n executing in restricted execution mode; "f_lasti" gives the\n precise instruction (this is an index into the bytecode string\n of the code object).\n\n Special writable attributes: "f_trace", if not "None", is a\n function called at the start of each source code line (this is\n used by the debugger); "f_exc_type", "f_exc_value",\n "f_exc_traceback" represent the last exception raised in the\n parent frame provided another exception was ever raised in the\n current frame (in all other cases they are "None"); "f_lineno"\n is the current line number of the frame --- writing to this from\n within a trace function jumps to the given line (only for the\n bottom-most frame). A debugger can implement a Jump command\n (aka Set Next Statement) by writing to f_lineno.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n The try statement.) It is accessible as "sys.exc_traceback", and\n also as the third item of the tuple returned by\n "sys.exc_info()". The latter is the preferred interface, since\n it works correctly when the program is using multiple threads.\n When the program contains no suitable handler, the stack trace\n is written (nicely formatted) to the standard error stream; if\n the interpreter is interactive, it is also made available to the\n user as "sys.last_traceback".\n\n Special read-only attributes: "tb_next" is the next level in the\n stack trace (towards the frame where the exception occurred), or\n "None" if there is no next level; "tb_frame" points to the\n execution frame of the current level; "tb_lineno" gives the line\n number where the exception occurred; "tb_lasti" indicates the\n precise instruction. The line number and last instruction in\n the traceback may differ from the line number of its frame\n object if the exception occurred in a "try" statement with no\n matching except clause or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices when *extended slice\n syntax* is used. This is a slice using two colons, or multiple\n slices or ellipses separated by commas, e.g., "a[i:j:step]",\n "a[i:j, k:l]", or "a[..., i:j]". They are also created by the\n built-in "slice()" function.\n\n Special read-only attributes: "start" is the lower bound; "stop"\n is the upper bound; "step" is the step value; each is "None" if\n omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the extended slice that the slice\n object would describe if applied to a sequence of *length*\n items. It returns a tuple of three integers; respectively\n these are the *start* and *stop* indices and the *step* or\n stride length of the slice. Missing or out-of-bounds indices\n are handled in a manner consistent with regular slices.\n\n New in version 2.3.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n "staticmethod()" constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in "classmethod()" constructor.\n', + 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee Function definitions for more information.\n', + 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass dict(**kwarg)\nclass dict(mapping, **kwarg)\nclass dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterable*\n object. Each item in the iterable must itself be an iterable with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to "{"one": 1, "two": 2, "three": 3}":\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for building a dictionary from\n keyword arguments added.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a "KeyError" if\n *key* is not in the map.\n\n If a subclass of dict defines a method "__missing__()" and *key*\n is not present, the "d[key]" operation calls that method with\n the key *key* as argument. The "d[key]" operation then returns\n or raises whatever is returned or raised by the\n "__missing__(key)" call. No other operations or methods invoke\n "__missing__()". If "__missing__()" is not defined, "KeyError"\n is raised. "__missing__()" must be a method; it cannot be an\n instance variable:\n\n >>> class Counter(dict):\n ... def __missing__(self, key):\n ... return 0\n >>> c = Counter()\n >>> c[\'red\']\n 0\n >>> c[\'red\'] += 1\n >>> c[\'red\']\n 1\n\n The example above shows part of the implementation of\n "collections.Counter". A different "__missing__" method is used\n by "collections.defaultdict".\n\n New in version 2.5: Recognition of __missing__ methods of dict\n subclasses.\n\n d[key] = value\n\n Set "d[key]" to *value*.\n\n del d[key]\n\n Remove "d[key]" from *d*. Raises a "KeyError" if *key* is not\n in the map.\n\n key in d\n\n Return "True" if *d* has a key *key*, else "False".\n\n New in version 2.2.\n\n key not in d\n\n Equivalent to "not key in d".\n\n New in version 2.2.\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for "iterkeys()".\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n "fromkeys()" is a class method that returns a new dictionary.\n *value* defaults to "None".\n\n New in version 2.3.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to "None", so\n that this method never raises a "KeyError".\n\n has_key(key)\n\n Test for the presence of *key* in the dictionary. "has_key()"\n is deprecated in favor of "key in d".\n\n items()\n\n Return a copy of the dictionary\'s list of "(key, value)" pairs.\n\n **CPython implementation detail:** Keys and values are listed in\n an arbitrary order which is non-random, varies across Python\n implementations, and depends on the dictionary\'s history of\n insertions and deletions.\n\n If "items()", "keys()", "values()", "iteritems()", "iterkeys()",\n and "itervalues()" are called with no intervening modifications\n to the dictionary, the lists will directly correspond. This\n allows the creation of "(value, key)" pairs using "zip()":\n "pairs = zip(d.values(), d.keys())". The same relationship\n holds for the "iterkeys()" and "itervalues()" methods: "pairs =\n zip(d.itervalues(), d.iterkeys())" provides the same value for\n "pairs". Another way to create the same list is "pairs = [(v, k)\n for (k, v) in d.iteritems()]".\n\n iteritems()\n\n Return an iterator over the dictionary\'s "(key, value)" pairs.\n See the note for "dict.items()".\n\n Using "iteritems()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n iterkeys()\n\n Return an iterator over the dictionary\'s keys. See the note for\n "dict.items()".\n\n Using "iterkeys()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n itervalues()\n\n Return an iterator over the dictionary\'s values. See the note\n for "dict.items()".\n\n Using "itervalues()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n keys()\n\n Return a copy of the dictionary\'s list of keys. See the note\n for "dict.items()".\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a "KeyError" is raised.\n\n New in version 2.3.\n\n popitem()\n\n Remove and return an arbitrary "(key, value)" pair from the\n dictionary.\n\n "popitem()" is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling "popitem()" raises a "KeyError".\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to "None".\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return "None".\n\n "update()" accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: "d.update(red=1,\n blue=2)".\n\n Changed in version 2.4: Allowed the argument to be an iterable\n of key/value pairs and allowed keyword arguments.\n\n values()\n\n Return a copy of the dictionary\'s list of values. See the note\n for "dict.items()".\n\n viewitems()\n\n Return a new view of the dictionary\'s items ("(key, value)"\n pairs). See below for documentation of view objects.\n\n New in version 2.7.\n\n viewkeys()\n\n Return a new view of the dictionary\'s keys. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n viewvalues()\n\n Return a new view of the dictionary\'s values. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n Dictionaries compare equal if and only if they have the same "(key,\n value)" pairs.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.viewkeys()", "dict.viewvalues()" and\n"dict.viewitems()" are *view objects*. They provide a dynamic view on\nthe dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of "(key, value)") in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of "(value, key)" pairs using\n "zip()": "pairs = zip(d.values(), d.keys())". Another way to\n create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n Return "True" if *x* is in the underlying dictionary\'s keys, values\n or items (in the latter case, *x* should be a "(key, value)"\n tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n Return the intersection of the dictview and the other object as a\n new set.\n\ndictview | other\n\n Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n Return the difference between the dictview and the other object\n (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n Return the symmetric difference (all elements either in *dictview*\n or *other*, but not in both) of the dictview and the other object\n as a new set.\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.viewkeys()\n >>> values = dishes.viewvalues()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n', + 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: "m.im_self" is the object on which the method\noperates, and "m.im_func" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its "im_self" attribute will\nbe "None" and if called, an explicit "self" object must be passed as\nthe first argument. In this case, "self" must be an instance of the\nunbound method\'s class (or a subclass of that class), otherwise a\n"TypeError" is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.im_func"), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set an attribute on a method results in an\n"AttributeError" being raised. In order to set a method attribute,\nyou need to explicitly set it on the underlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "", line 1, in \n AttributeError: \'instancemethod\' object has no attribute \'whoami\'\n >>> c.method.im_func.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee The standard type hierarchy for more information.\n', + 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "". If loaded from a file, they are written as\n"".\n', + 'typesseq': u'\nSequence Types --- "str", "unicode", "list", "tuple", "bytearray", "buffer", "xrange"\n*************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in "dict" and "set" classes, and\nthe "collections" module.\n\nString literals are written in single or double quotes: "\'xyzzy\'",\n""frobozz"". See String literals for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding "\'u\'" character: "u\'abc\'", "u"def"". In addition to\nthe functionality described here, there are also string-specific\nmethods described in the String Methods section. Lists are constructed\nwith square brackets, separating items with commas: "[a, b, c]".\nTuples are constructed by the comma operator (not within square\nbrackets), with or without enclosing parentheses, but an empty tuple\nmust have the enclosing parentheses, such as "a, b, c" or "()". A\nsingle item tuple must have a trailing comma, such as "(d,)".\n\nBytearray objects are created with the built-in function\n"bytearray()".\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function "buffer()". They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n"xrange()" function. They don\'t support slicing, concatenation or\nrepetition, and using "in", "not in", "min()" or "max()" on them is\ninefficient.\n\nMost sequence types support the following operations. The "in" and\n"not in" operations have the same priorities as the comparison\noperations. The "+" and "*" operations have the same priority as the\ncorresponding numeric operations. [3] Additional methods are provided\nfor Mutable Sequence Types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type; *n*, *i* and\n*j* are integers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+--------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+--------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| "s * n, n * s" | equivalent to adding *s* to | (2) |\n| | itself *n* times | |\n+--------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+--------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "s.index(x)" | index of the first occurrence of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see Comparisons in the language reference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the "in" and "not\n in" operations act like a substring test. In Python versions\n before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n beyond, *x* may be a string of any length.\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note that items in the\n sequence *s* are not copied; they are referenced multiple times.\n This often haunts new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are references\n to this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n Further explanation is available in the FAQ entry How do I create a\n multidimensional list?.\n\n3. If *i* or *j* is negative, the index is relative to the end of\n the string: "len(s) + i" or "len(s) + j" is substituted. But note\n that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). If *i* or *j* is greater than "len(s)", use\n "len(s)". If *i* or *j* are omitted or "None", they become "end"\n values (which end depends on the sign of *k*). Note, *k* cannot be\n zero. If *k* is "None", it is treated like "1".\n\n6. **CPython implementation detail:** If *s* and *t* are both\n strings, some Python implementations such as CPython can usually\n perform an in-place optimization for assignments of the form "s = s\n + t" or "s += t". When applicable, this optimization makes\n quadratic run-time much less likely. This optimization is both\n version and implementation dependent. For performance sensitive\n code, it is preferable to use the "str.join()" method which assures\n consistent linear concatenation performance across versions and\n implementations.\n\n Changed in version 2.4: Formerly, string concatenation never\n occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n "\'strict\'", meaning that encoding errors raise "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'" and any other\n name registered via "codecs.register_error()", see section Codec\n Base Classes.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'",\n "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n registered via "codecs.register_error()", see section Codec Base\n Classes. For a list of possible encodings, see section Standard\n Encodings.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n "\'backslashreplace\'" and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See Format String Syntax for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the "%" formatting described in String\n Formatting Operations in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example, "\' 1 2 3 \'.split()" returns "[\'1\', \'2\', \'3\']", and\n "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 \']".\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n Python recognizes ""\\r"", ""\\n"", and ""\\r\\n"" as line boundaries\n for 8-bit strings.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nunicode.splitlines([keepends])\n\n Return a list of the lines in the string, like "str.splitlines()".\n However, the Unicode method splits on the following line\n boundaries, which are a superset of the *universal newlines*\n recognized for 8-bit strings.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 2.7: "\\v" and "\\f" added to list of line\n boundaries.\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the "maketrans()" helper function in the "string"\n module to create a translation table. For string objects, set the\n *table* argument to "None" for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a "None" *table* argument.\n\n For Unicode objects, the "translate()" method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or "None". Unmapped characters\n are left untouched. Characters mapped to "None" are deleted. Note,\n a more flexible approach is to create a custom character mapping\n codec using the "codecs" module (see "encodings.cp1251" for an\n example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to "len(s)".\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return "True" if there are only numeric characters in S, "False"\n otherwise. Numeric characters include digit characters, and all\n characters that have the Unicode numeric value property, e.g.\n U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return "True" if there are only decimal characters in S, "False"\n otherwise. Decimal characters include digit characters, and all\n characters that can be used to form decimal-radix numbers, e.g.\n U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the "%"\noperator (modulo). This is also known as the string *formatting* or\n*interpolation* operator. Given "format % values" (where *format* is\na string or Unicode object), "%" conversion specifications in *format*\nare replaced with zero or more elements of *values*. The effect is\nsimilar to the using "sprintf()" in the C language. If *format* is a\nUnicode object, or if any of the objects being converted using the\n"%s" conversion are Unicode objects, the result will also be a Unicode\nobject.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The "\'%\'" character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence\n of characters (for example, "(somename)").\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an "\'*\'"\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a "\'.\'" (dot) followed by the\n precision. If specified as "\'*\'" (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the "\'%\'" character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(number)03d quote types.\' % \\\n... {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no "*" specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| "\'#\'" | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| "\'0\'" | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| "\'-\'" | The converted value is left adjusted (overrides the "\'0\'" conversion |\n| | if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| "\' \'" | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| "\'+\'" | A sign character ("\'+\'" or "\'-\'") will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier ("h", "l", or "L") may be present, but is ignored as\nit is not necessary for Python -- so e.g. "%ld" is identical to "%d".\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| "\'d\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'i\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'o\'" | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| "\'u\'" | Obsolete type -- it is identical to "\'d\'". | (7) |\n+--------------+-------------------------------------------------------+---------+\n| "\'x\'" | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'X\'" | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'e\'" | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'E\'" | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'f\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'F\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'g\'" | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'G\'" | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'c\'" | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| "\'r\'" | String (converts any Python object using repr()). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| "\'s\'" | String (converts any Python object using "str()"). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| "\'%\'" | No argument is converted, results in a "\'%\'" | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero ("\'0\'") to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading "\'0x\'" or "\'0X\'" (depending\n on whether the "\'x\'" or "\'X\'" format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The "%r" conversion was added in Python 2.0.\n\n The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a "unicode" string, the\n resulting string will also be "unicode".\n\n The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, "%s" conversions do not\nassume that "\'\\0\'" is the end of the string.\n\nChanged in version 2.7: "%f" conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by "%g" conversions.\n\nAdditional string operations are defined in standard modules "string"\nand "re".\n\n\nXRange Type\n===========\n\nThe "xrange" type is an immutable sequence which is commonly used for\nlooping. The advantage of the "xrange" type is that an "xrange"\nobject will always take the same amount of memory, no matter the size\nof the range it represents. There are no consistent performance\nadvantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the "len()" function.\n\n\nMutable Sequence Types\n======================\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | for the most part the same as | (3) |\n| | "s[len(s):len(s)] = t" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (11) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\n multiple parameters and implicitly joined them into a tuple; this\n no longer works in Python 2.0. Use of this misfeature has been\n deprecated since Python 1.4.\n\n3. *t* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n negative index is passed as the second or third parameter to the\n "index()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, "index()" didn\'t have arguments\n for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n "insert()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: "cmp=lambda x,y:\n cmp(x.lower(), y.lower())". The default value is "None".\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: "key=str.lower". The\n default value is "None".\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n "functools.cmp_to_key()" to convert an old-style *cmp* function to\n a *key* function.\n\n Changed in version 2.3: Support for "None" as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n be stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n sorted, the effect of attempting to mutate, or even inspect, the\n list is undefined. The C implementation of Python 2.3 and newer\n makes the list appear empty for the duration, and raises\n "ValueError" if it can detect that the list has been mutated\n during a sort.\n\n11. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the\n sequence. Items in the sequence are not copied; they are\n referenced multiple times, as explained for "s * n" under Sequence\n Types --- str, unicode, list, tuple, bytearray, buffer, xrange.\n', + 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | for the most part the same as | (3) |\n| | "s[len(s):len(s)] = t" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (11) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\n multiple parameters and implicitly joined them into a tuple; this\n no longer works in Python 2.0. Use of this misfeature has been\n deprecated since Python 1.4.\n\n3. *t* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n negative index is passed as the second or third parameter to the\n "index()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, "index()" didn\'t have arguments\n for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n "insert()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: "cmp=lambda x,y:\n cmp(x.lower(), y.lower())". The default value is "None".\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: "key=str.lower". The\n default value is "None".\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n "functools.cmp_to_key()" to convert an old-style *cmp* function to\n a *key* function.\n\n Changed in version 2.3: Support for "None" as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n be stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n sorted, the effect of attempting to mutate, or even inspect, the\n list is undefined. The C implementation of Python 2.3 and newer\n makes the list appear empty for the duration, and raises\n "ValueError" if it can detect that the list has been mutated\n during a sort.\n\n11. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the\n sequence. Items in the sequence are not copied; they are\n referenced multiple times, as explained for "s * n" under Sequence\n Types --- str, unicode, list, tuple, bytearray, buffer, xrange.\n', + 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\nplain or long integer argument. The bitwise inversion of "x" is\ndefined as "-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n', + 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n', + 'with': u'\nThe "with" statement\n********************\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n "with_statement" feature has been enabled. It is always enabled in\n Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also:\n\n **PEP 343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n', + 'yield': u'\nThe "yield" statement\n*********************\n\n yield_stmt ::= yield_expression\n\nThe "yield" statement is only used when defining a generator function,\nand is only used in the body of the generator function. Using a\n"yield" statement in a function definition is sufficient to cause that\ndefinition to create a generator function instead of a normal\nfunction.\n\nWhen a generator function is called, it returns an iterator known as a\ngenerator iterator, or more commonly, a generator. The body of the\ngenerator function is executed by calling the generator\'s "next()"\nmethod repeatedly until it raises an exception.\n\nWhen a "yield" statement is executed, the state of the generator is\nfrozen and the value of "expression_list" is returned to "next()"\'s\ncaller. By "frozen" we mean that all local state is retained,\nincluding the current bindings of local variables, the instruction\npointer, and the internal evaluation stack: enough information is\nsaved so that the next time "next()" is invoked, the function can\nproceed exactly as if the "yield" statement were just another external\ncall.\n\nAs of Python version 2.5, the "yield" statement is now allowed in the\n"try" clause of a "try" ... "finally" construct. If the generator is\nnot resumed before it is finalized (by reaching a zero reference count\nor by being garbage collected), the generator-iterator\'s "close()"\nmethod will be called, allowing any pending "finally" clauses to\nexecute.\n\nFor full details of "yield" semantics, refer to the Yield expressions\nsection.\n\nNote: In Python 2.2, the "yield" statement was only allowed when the\n "generators" feature has been enabled. This "__future__" import\n statement was used to enable the feature:\n\n from __future__ import generators\n\nSee also:\n\n **PEP 255** - Simple Generators\n The proposal for adding generators and the "yield" statement to\n Python.\n\n **PEP 342** - Coroutines via Enhanced Generators\n The proposal that, among other generator enhancements, proposed\n allowing "yield" to appear inside a "try" ... "finally" block.\n'} -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:41:41 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 20:41:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogcHl0aG9uIDIuNy4x?= =?utf-8?q?3rc1?= Message-ID: <20161203204140.28700.84679.3E593625@psf.io> https://hg.python.org/cpython/rev/4d6fd49eeb14 changeset: 105439:4d6fd49eeb14 branch: 2.7 tag: v2.7.13rc1 user: Benjamin Peterson date: Sat Dec 03 12:38:47 2016 -0800 summary: python 2.7.13rc1 files: Include/patchlevel.h | 8 ++++---- Misc/NEWS | 8 ++++---- README | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -22,12 +22,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 -#define PY_MICRO_VERSION 12 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 13 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.7.12+" +#define PY_VERSION "2.7.13rc1" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,10 +2,10 @@ Python News +++++++++++ -What's New in Python 2.7.13? -============================ - -*Release date: XXXX-XX-XX* +What's New in Python 2.7.13 release candidate 1? +================================================ + +*Release date: 2016-12-03* Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 2.7.12 +This is Python version 2.7.13 ============================= Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 15:41:41 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 20:41:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Added_tag_v2?= =?utf-8?q?=2E7=2E13rc1_for_changeset_4d6fd49eeb14?= Message-ID: <20161203204140.29172.59594.59250548@psf.io> https://hg.python.org/cpython/rev/e4dd5d700ef3 changeset: 105440:e4dd5d700ef3 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 12:39:10 2016 -0800 summary: Added tag v2.7.13rc1 for changeset 4d6fd49eeb14 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -174,3 +174,4 @@ 6d1b6a68f775fada9877d295e62958bafa1ca11e v2.7.11 13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 d33e0cf91556723fb8cebefdad1f3bce43b2244d v2.7.12 +4d6fd49eeb14bb47f700325eb90d7989fc9e4020 v2.7.13rc1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 16:05:03 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 21:05:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_do_not_leak_th?= =?utf-8?q?e_FILE_*_pointer_in_error_cases_of_fdopen=28=29?= Message-ID: <20161203210503.93520.18682.C054CCCC@psf.io> https://hg.python.org/cpython/rev/50d4c8b80932 changeset: 105441:50d4c8b80932 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 13:03:18 2016 -0800 summary: do not leak the FILE * pointer in error cases of fdopen() files: Modules/posixmodule.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6906,6 +6906,11 @@ } } #endif + /* The dummy filename used here must be kept in sync with the value + tested against in gzip.GzipFile.__init__() - see issue #13781. */ + f = PyFile_FromFile(NULL, "", orgmode, fclose); + if (f == NULL) + return NULL; Py_BEGIN_ALLOW_THREADS #if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H) if (mode[0] == 'a') { @@ -6926,13 +6931,10 @@ #endif Py_END_ALLOW_THREADS PyMem_FREE(mode); - if (fp == NULL) + if (fp == NULL) { + Py_DECREF(f); return posix_error(); - /* The dummy filename used here must be kept in sync with the value - tested against in gzip.GzipFile.__init__() - see issue #13781. */ - f = PyFile_FromFile(NULL, "", orgmode, fclose); - if (f == NULL) - return NULL; + } /* We now know we will succeed, so initialize the file object. */ ((PyFileObject *)f)->f_fp = fp; PyFile_SetBufSize(f, bufsize); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 16:05:44 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 21:05:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_also_do_not_le?= =?utf-8?q?ak_the_mode_string_if_creating_the_file_fails?= Message-ID: <20161203210543.13398.56379.7BF17084@psf.io> https://hg.python.org/cpython/rev/e47e20edafb5 changeset: 105442:e47e20edafb5 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 13:05:40 2016 -0800 summary: also do not leak the mode string if creating the file fails files: Modules/posixmodule.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6909,8 +6909,10 @@ /* The dummy filename used here must be kept in sync with the value tested against in gzip.GzipFile.__init__() - see issue #13781. */ f = PyFile_FromFile(NULL, "", orgmode, fclose); - if (f == NULL) - return NULL; + if (f == NULL) { + PyMEM_FREE(mode); + return NULL; + } Py_BEGIN_ALLOW_THREADS #if !defined(MS_WINDOWS) && defined(HAVE_FCNTL_H) if (mode[0] == 'a') { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 16:07:51 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 21:07:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_function_n?= =?utf-8?q?ame?= Message-ID: <20161203210751.20890.96377.0C5AC005@psf.io> https://hg.python.org/cpython/rev/2b8df35c5990 changeset: 105443:2b8df35c5990 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 13:07:47 2016 -0800 summary: fix function name files: Modules/posixmodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6910,7 +6910,7 @@ tested against in gzip.GzipFile.__init__() - see issue #13781. */ f = PyFile_FromFile(NULL, "", orgmode, fclose); if (f == NULL) { - PyMEM_FREE(mode); + PyMem_FREE(mode); return NULL; } Py_BEGIN_ALLOW_THREADS -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 16:12:07 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 03 Dec 2016 21:12:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_prepare_for_2?= =?utf-8?b?LjcuMTQgZGV2?= Message-ID: <20161203211207.21246.53788.F498D76B@psf.io> https://hg.python.org/cpython/rev/2df9604bfe01 changeset: 105444:2df9604bfe01 branch: 2.7 user: Benjamin Peterson date: Sat Dec 03 13:12:03 2016 -0800 summary: prepare for 2.7.14 dev files: Include/patchlevel.h | 6 +++--- Misc/NEWS | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,11 +23,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 13 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.13rc1" +#define PY_VERSION "2.7.13+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 2.7.14? +============================ + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 2.7.13 release candidate 1? ================================================ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 18:57:25 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 23:57:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_with_3=2E6?= Message-ID: <20161203235725.14566.37230.474F67A2@psf.io> https://hg.python.org/cpython/rev/954cb987b4dc changeset: 105446:954cb987b4dc parent: 105436:a60767015bed parent: 105445:d84c1b42a8f3 user: Steve Dower date: Sat Dec 03 15:57:15 2016 -0800 summary: Null merge with 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 3 18:57:25 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 03 Dec 2016 23:57:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Revert_uninten?= =?utf-8?q?ded_merge?= Message-ID: <20161203235724.92865.68371.3456331D@psf.io> https://hg.python.org/cpython/rev/d84c1b42a8f3 changeset: 105445:d84c1b42a8f3 branch: 3.6 parent: 105434:d9879b12c627 user: Steve Dower date: Sat Dec 03 15:57:00 2016 -0800 summary: Revert unintended merge files: config.guess | 174 ++++++++++++++------------------------ config.sub | 75 ++++----------- 2 files changed, 88 insertions(+), 161 deletions(-) diff --git a/config.guess b/config.guess --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2016-10-02' +timestamp='2014-03-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -24,12 +24,12 @@ # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# Originally written by Per Bothner. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches at gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` @@ -50,7 +50,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,29 +168,19 @@ # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || \ - echo unknown)` + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. + # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in - earm*) - os=netbsdelf - ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -207,13 +197,6 @@ os=netbsd ;; esac - # Determine ABI tags. - case "${UNAME_MACHINE_ARCH}" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` - ;; - esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -224,13 +207,13 @@ release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}${abi}" + echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -240,10 +223,6 @@ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} - exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -256,9 +235,6 @@ *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; - *:Sortix:*:*) - echo ${UNAME_MACHINE}-unknown-sortix - exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -275,42 +251,42 @@ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; + UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; + UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; + UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; + UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; + UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; + UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; + UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; + UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; + UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -383,16 +359,16 @@ exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH=i386 + SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH=x86_64 + SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -417,7 +393,7 @@ exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -603,9 +579,8 @@ else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -642,13 +617,13 @@ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi @@ -687,11 +662,11 @@ exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = hppa2.0w ] + if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build @@ -704,12 +679,12 @@ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH=hppa2.0w + HP_ARCH="hppa2.0w" else - HP_ARCH=hppa64 + HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -814,14 +789,14 @@ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -903,7 +878,7 @@ exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -926,7 +901,7 @@ EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -957,9 +932,6 @@ crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; - e2k:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -972,9 +944,6 @@ ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; - k1om:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -1000,9 +969,6 @@ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - mips64el:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-${LIBC} exit ;; @@ -1035,9 +1001,6 @@ ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; @@ -1057,7 +1020,7 @@ echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1136,7 +1099,7 @@ # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that + # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1285,9 +1248,6 @@ SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; - SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux${UNAME_RELEASE} - exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1301,9 +1261,9 @@ UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1325,7 +1285,7 @@ exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then + if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1356,7 +1316,7 @@ # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = 386; then + if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1398,7 +1358,7 @@ echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1409,25 +1369,23 @@ x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; - amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; esac cat >&2 < in order to provide the needed +information to handle your system. config.guess timestamp = $timestamp diff --git a/config.sub b/config.sub --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2016 Free Software Foundation, Inc. +# Copyright 1992-2014 Free Software Foundation, Inc. -timestamp='2016-11-19' +timestamp='2014-05-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . +# Please send patches with a ChangeLog entry to config-patches at gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +33,7 @@ # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,7 +53,8 @@ me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS Canonicalize a configuration name. @@ -67,7 +68,7 @@ version="\ GNU config.sub ($timestamp) -Copyright 1992-2016 Free Software Foundation, Inc. +Copyright 1992-2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -116,8 +117,8 @@ case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -254,13 +255,12 @@ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ - | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ @@ -301,12 +301,10 @@ | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ | pyramid \ - | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -314,7 +312,6 @@ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -329,9 +326,6 @@ c6x) basic_machine=tic6x-unknown ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none @@ -377,13 +371,12 @@ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ - | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ + | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -429,15 +422,13 @@ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ | pyramid-* \ - | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -445,7 +436,6 @@ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ - | visium-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -522,9 +512,6 @@ basic_machine=i386-pc os=-aros ;; - asmjs) - basic_machine=asmjs-unknown - ;; aux) basic_machine=m68k-apple os=-aux @@ -645,14 +632,6 @@ basic_machine=m68k-bull os=-sysv3 ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - os=$os"spe" - ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -794,9 +773,6 @@ basic_machine=m68k-isi os=-sysv ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -852,10 +828,6 @@ basic_machine=powerpc-unknown os=-morphos ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; msdos) basic_machine=i386-pc os=-msdos @@ -1032,7 +1004,7 @@ ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle) + ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1042,7 +1014,7 @@ ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little) + ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1388,28 +1360,27 @@ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1541,8 +1512,6 @@ ;; -nacl*) ;; - -ios) - ;; -none) ;; *) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 02:17:10 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 04 Dec 2016 07:17:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_simplify_clean?= =?utf-8?q?up_of_test=5Freplace=5Fparent=5Fin=5Fsys=5Fmodules_=28closes_?= =?utf-8?q?=2328862=29?= Message-ID: <20161204071710.30631.23034.0D8BAE23@psf.io> https://hg.python.org/cpython/rev/6e9939e1f933 changeset: 105447:6e9939e1f933 branch: 2.7 parent: 105444:2df9604bfe01 user: Benjamin Peterson date: Sat Dec 03 23:17:04 2016 -0800 summary: simplify cleanup of test_replace_parent_in_sys_modules (closes #28862) files: Lib/test/test_import.py | 27 +++++++++++++-------------- 1 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -400,20 +400,19 @@ def test_replace_parent_in_sys_modules(self): dir_name = os.path.abspath(TESTFN) os.mkdir(dir_name) - try: - pkg_dir = os.path.join(dir_name, 'sa') - os.mkdir(pkg_dir) - with open(os.path.join(pkg_dir, '__init__.py'), 'w') as init_file: - init_file.write("import v1") - with open(os.path.join(pkg_dir, 'v1.py'), 'w') as v1_file: - v1_file.write("import sys;" - "sys.modules['sa'] = sys.modules[__name__];" - "import sa") - sys.path.insert(0, dir_name) - # a segfault means the test failed! - import sa - finally: - rmtree(dir_name) + self.addCleanup(rmtree, dir_name) + pkg_dir = os.path.join(dir_name, 'sa') + os.mkdir(pkg_dir) + with open(os.path.join(pkg_dir, '__init__.py'), 'w') as init_file: + init_file.write("import v1") + with open(os.path.join(pkg_dir, 'v1.py'), 'w') as v1_file: + v1_file.write("import sys;" + "sys.modules['sa'] = sys.modules[__name__];" + "import sa") + sys.path.insert(0, dir_name) + self.addCleanup(sys.path.pop, 0) + # a segfault means the test failed! + import sa def test_fromlist_type(self): with self.assertRaises(TypeError) as cm: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 03:22:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 08:22:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fixed_double_h?= =?utf-8?q?yphens_that_are_rendered_to_literal_en-dashes_in_the_documenati?= =?utf-8?b?b24u?= Message-ID: <20161204082254.21345.86326.907FCF33@psf.io> https://hg.python.org/cpython/rev/d380474a88aa changeset: 105448:d380474a88aa branch: 2.7 user: Serhiy Storchaka date: Sun Dec 04 10:20:18 2016 +0200 summary: Fixed double hyphens that are rendered to literal en-dashes in the documenation. files: Doc/library/_winreg.rst | 4 ++-- Doc/library/importlib.rst | 4 ++-- Doc/library/msvcrt.rst | 4 ++-- Doc/tutorial/stdlib2.rst | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/_winreg.rst b/Doc/library/_winreg.rst --- a/Doc/library/_winreg.rst +++ b/Doc/library/_winreg.rst @@ -1,5 +1,5 @@ -:mod:`_winreg` -- Windows registry access -========================================= +:mod:`_winreg` --- Windows registry access +========================================== .. module:: _winreg :platform: Windows diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1,5 +1,5 @@ -:mod:`importlib` -- Convenience wrappers for :func:`__import__` -=============================================================== +:mod:`importlib` --- Convenience wrappers for :func:`__import__` +================================================================ .. module:: importlib :synopsis: Convenience wrappers for __import__ diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -1,6 +1,6 @@ -:mod:`msvcrt` -- Useful routines from the MS VC++ runtime -========================================================= +:mod:`msvcrt` --- Useful routines from the MS VC++ runtime +========================================================== .. module:: msvcrt :platform: Windows diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,8 +1,8 @@ .. _tut-brieftourtwo: ********************************************* -Brief Tour of the Standard Library -- Part II -********************************************* +Brief Tour of the Standard Library --- Part II +********************************************** This second tour covers more advanced modules that support professional programming needs. These modules rarely occur in small scripts. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 03:22:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 08:22:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fixed_double_h?= =?utf-8?q?yphens_that_are_rendered_to_literal_en-dashes_in_the_documenati?= =?utf-8?b?b24u?= Message-ID: <20161204082254.21221.4946.6985BE10@psf.io> https://hg.python.org/cpython/rev/979fb6648aad changeset: 105449:979fb6648aad branch: 3.5 parent: 105433:f30d9af3e509 user: Serhiy Storchaka date: Sun Dec 04 10:20:55 2016 +0200 summary: Fixed double hyphens that are rendered to literal en-dashes in the documenation. files: Doc/howto/logging-cookbook.rst | 4 ++-- Doc/library/asyncio.rst | 4 ++-- Doc/library/importlib.rst | 4 ++-- Doc/library/logging.rst | 2 +- Doc/library/msvcrt.rst | 4 ++-- Doc/library/selectors.rst | 4 ++-- Doc/library/winreg.rst | 2 +- Doc/tutorial/stdlib2.rst | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1088,7 +1088,7 @@ formatted log output in place of "%(message)s" or "{message}" or "$message". It's a little unwieldy to use the class names whenever you want to log something, but it's quite palatable if you use an alias such as __ (double -underscore ? not to be confused with _, the single underscore used as a +underscore --- not to be confused with _, the single underscore used as a synonym/alias for :func:`gettext.gettext` or its brethren). The above classes are not included in Python, though they're easy enough to @@ -1209,7 +1209,7 @@ at module level). It's probably one too many things to think about. Developers could also add the filter to a :class:`~logging.NullHandler` attached to their top-level logger, but this would not be invoked if an application developer -attached a handler to a lower-level library logger ? so output from that +attached a handler to a lower-level library logger --- so output from that handler would not reflect the intentions of the library developer. In Python 3.2 and later, :class:`~logging.LogRecord` creation is done through a diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -1,5 +1,5 @@ -:mod:`asyncio` -- Asynchronous I/O, event loop, coroutines and tasks -==================================================================== +:mod:`asyncio` --- Asynchronous I/O, event loop, coroutines and tasks +===================================================================== .. module:: asyncio :synopsis: Asynchronous I/O, event loop, coroutines and tasks. diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1,5 +1,5 @@ -:mod:`importlib` -- The implementation of :keyword:`import` -=========================================================== +:mod:`importlib` --- The implementation of :keyword:`import` +============================================================ .. module:: importlib :synopsis: The implementation of the import machinery. diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -561,7 +561,7 @@ handled by a strptime format string (``'%Y-%m-%d %H:%M:%S'``), and the part after the comma is a millisecond value. Because strptime does not have a format placeholder for milliseconds, the millisecond value is - appended using another format string, ``'%s,%03d'`` ? and both of these + appended using another format string, ``'%s,%03d'`` --- and both of these format strings have been hardcoded into this method. With the change, these strings are defined as class-level attributes which can be overridden at the instance level when desired. The names of the diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -1,5 +1,5 @@ -:mod:`msvcrt` -- Useful routines from the MS VC++ runtime -========================================================= +:mod:`msvcrt` --- Useful routines from the MS VC++ runtime +========================================================== .. module:: msvcrt :platform: Windows diff --git a/Doc/library/selectors.rst b/Doc/library/selectors.rst --- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -1,5 +1,5 @@ -:mod:`selectors` -- High-level I/O multiplexing -=============================================== +:mod:`selectors` --- High-level I/O multiplexing +================================================ .. module:: selectors :synopsis: High-level I/O multiplexing. diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -1,4 +1,4 @@ -:mod:`winreg` -- Windows registry access +:mod:`winreg` --- Windows registry access ========================================= .. module:: winreg diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,8 +1,8 @@ .. _tut-brieftourtwo: ********************************************* -Brief Tour of the Standard Library -- Part II -********************************************* +Brief Tour of the Standard Library --- Part II +********************************************** This second tour covers more advanced modules that support professional programming needs. These modules rarely occur in small scripts. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 03:22:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 08:22:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Fixed_double_hyphens_that_are_rendered_to_literal_en-dashes_in?= =?utf-8?q?_the_documenation=2E?= Message-ID: <20161204082254.93355.71978.431E2283@psf.io> https://hg.python.org/cpython/rev/e646fcfae272 changeset: 105450:e646fcfae272 branch: 3.6 parent: 105445:d84c1b42a8f3 parent: 105449:979fb6648aad user: Serhiy Storchaka date: Sun Dec 04 10:22:09 2016 +0200 summary: Fixed double hyphens that are rendered to literal en-dashes in the documenation. files: Doc/howto/logging-cookbook.rst | 4 ++-- Doc/library/asyncio.rst | 4 ++-- Doc/library/hashlib-blake2.rst | 2 +- Doc/library/importlib.rst | 4 ++-- Doc/library/logging.rst | 2 +- Doc/library/msvcrt.rst | 4 ++-- Doc/library/selectors.rst | 4 ++-- Doc/library/winreg.rst | 2 +- Doc/tutorial/stdlib2.rst | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1088,7 +1088,7 @@ formatted log output in place of "%(message)s" or "{message}" or "$message". It's a little unwieldy to use the class names whenever you want to log something, but it's quite palatable if you use an alias such as __ (double -underscore ? not to be confused with _, the single underscore used as a +underscore --- not to be confused with _, the single underscore used as a synonym/alias for :func:`gettext.gettext` or its brethren). The above classes are not included in Python, though they're easy enough to @@ -1209,7 +1209,7 @@ at module level). It's probably one too many things to think about. Developers could also add the filter to a :class:`~logging.NullHandler` attached to their top-level logger, but this would not be invoked if an application developer -attached a handler to a lower-level library logger ? so output from that +attached a handler to a lower-level library logger --- so output from that handler would not reflect the intentions of the library developer. In Python 3.2 and later, :class:`~logging.LogRecord` creation is done through a diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -1,5 +1,5 @@ -:mod:`asyncio` -- Asynchronous I/O, event loop, coroutines and tasks -==================================================================== +:mod:`asyncio` --- Asynchronous I/O, event loop, coroutines and tasks +===================================================================== .. module:: asyncio :synopsis: Asynchronous I/O, event loop, coroutines and tasks. diff --git a/Doc/library/hashlib-blake2.rst b/Doc/library/hashlib-blake2.rst --- a/Doc/library/hashlib-blake2.rst +++ b/Doc/library/hashlib-blake2.rst @@ -280,7 +280,7 @@ function providing less collision resistance than expected. Randomized hashing offers the signer additional protection by reducing the likelihood that a preparer can generate two or more messages that ultimately yield the - same hash value during the digital signature generation process ? even if + same hash value during the digital signature generation process --- even if it is practical to find collisions for the hash function. However, the use of randomized hashing may reduce the amount of security provided by a digital signature when all portions of the message are prepared diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1,5 +1,5 @@ -:mod:`importlib` -- The implementation of :keyword:`import` -=========================================================== +:mod:`importlib` --- The implementation of :keyword:`import` +============================================================ .. module:: importlib :synopsis: The implementation of the import machinery. diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -561,7 +561,7 @@ handled by a strptime format string (``'%Y-%m-%d %H:%M:%S'``), and the part after the comma is a millisecond value. Because strptime does not have a format placeholder for milliseconds, the millisecond value is - appended using another format string, ``'%s,%03d'`` ? and both of these + appended using another format string, ``'%s,%03d'`` --- and both of these format strings have been hardcoded into this method. With the change, these strings are defined as class-level attributes which can be overridden at the instance level when desired. The names of the diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -1,5 +1,5 @@ -:mod:`msvcrt` -- Useful routines from the MS VC++ runtime -========================================================= +:mod:`msvcrt` --- Useful routines from the MS VC++ runtime +========================================================== .. module:: msvcrt :platform: Windows diff --git a/Doc/library/selectors.rst b/Doc/library/selectors.rst --- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -1,5 +1,5 @@ -:mod:`selectors` -- High-level I/O multiplexing -=============================================== +:mod:`selectors` --- High-level I/O multiplexing +================================================ .. module:: selectors :synopsis: High-level I/O multiplexing. diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -1,4 +1,4 @@ -:mod:`winreg` -- Windows registry access +:mod:`winreg` --- Windows registry access ========================================= .. module:: winreg diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,8 +1,8 @@ .. _tut-brieftourtwo: ********************************************* -Brief Tour of the Standard Library -- Part II -********************************************* +Brief Tour of the Standard Library --- Part II +********************************************** This second tour covers more advanced modules that support professional programming needs. These modules rarely occur in small scripts. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 03:22:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 08:22:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Fixed_double_hyphens_that_are_rendered_to_literal_en-das?= =?utf-8?q?hes_in_the_documenation=2E?= Message-ID: <20161204082254.14308.15310.82C3616E@psf.io> https://hg.python.org/cpython/rev/16350c1f81a1 changeset: 105451:16350c1f81a1 parent: 105446:954cb987b4dc parent: 105450:e646fcfae272 user: Serhiy Storchaka date: Sun Dec 04 10:22:36 2016 +0200 summary: Fixed double hyphens that are rendered to literal en-dashes in the documenation. files: Doc/howto/logging-cookbook.rst | 4 ++-- Doc/library/asyncio.rst | 4 ++-- Doc/library/hashlib-blake2.rst | 2 +- Doc/library/importlib.rst | 4 ++-- Doc/library/logging.rst | 2 +- Doc/library/msvcrt.rst | 4 ++-- Doc/library/selectors.rst | 4 ++-- Doc/library/winreg.rst | 2 +- Doc/tutorial/stdlib2.rst | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Doc/howto/logging-cookbook.rst b/Doc/howto/logging-cookbook.rst --- a/Doc/howto/logging-cookbook.rst +++ b/Doc/howto/logging-cookbook.rst @@ -1088,7 +1088,7 @@ formatted log output in place of "%(message)s" or "{message}" or "$message". It's a little unwieldy to use the class names whenever you want to log something, but it's quite palatable if you use an alias such as __ (double -underscore ? not to be confused with _, the single underscore used as a +underscore --- not to be confused with _, the single underscore used as a synonym/alias for :func:`gettext.gettext` or its brethren). The above classes are not included in Python, though they're easy enough to @@ -1209,7 +1209,7 @@ at module level). It's probably one too many things to think about. Developers could also add the filter to a :class:`~logging.NullHandler` attached to their top-level logger, but this would not be invoked if an application developer -attached a handler to a lower-level library logger ? so output from that +attached a handler to a lower-level library logger --- so output from that handler would not reflect the intentions of the library developer. In Python 3.2 and later, :class:`~logging.LogRecord` creation is done through a diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -1,5 +1,5 @@ -:mod:`asyncio` -- Asynchronous I/O, event loop, coroutines and tasks -==================================================================== +:mod:`asyncio` --- Asynchronous I/O, event loop, coroutines and tasks +===================================================================== .. module:: asyncio :synopsis: Asynchronous I/O, event loop, coroutines and tasks. diff --git a/Doc/library/hashlib-blake2.rst b/Doc/library/hashlib-blake2.rst --- a/Doc/library/hashlib-blake2.rst +++ b/Doc/library/hashlib-blake2.rst @@ -280,7 +280,7 @@ function providing less collision resistance than expected. Randomized hashing offers the signer additional protection by reducing the likelihood that a preparer can generate two or more messages that ultimately yield the - same hash value during the digital signature generation process ? even if + same hash value during the digital signature generation process --- even if it is practical to find collisions for the hash function. However, the use of randomized hashing may reduce the amount of security provided by a digital signature when all portions of the message are prepared diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1,5 +1,5 @@ -:mod:`importlib` -- The implementation of :keyword:`import` -=========================================================== +:mod:`importlib` --- The implementation of :keyword:`import` +============================================================ .. module:: importlib :synopsis: The implementation of the import machinery. diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -561,7 +561,7 @@ handled by a strptime format string (``'%Y-%m-%d %H:%M:%S'``), and the part after the comma is a millisecond value. Because strptime does not have a format placeholder for milliseconds, the millisecond value is - appended using another format string, ``'%s,%03d'`` ? and both of these + appended using another format string, ``'%s,%03d'`` --- and both of these format strings have been hardcoded into this method. With the change, these strings are defined as class-level attributes which can be overridden at the instance level when desired. The names of the diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -1,5 +1,5 @@ -:mod:`msvcrt` -- Useful routines from the MS VC++ runtime -========================================================= +:mod:`msvcrt` --- Useful routines from the MS VC++ runtime +========================================================== .. module:: msvcrt :platform: Windows diff --git a/Doc/library/selectors.rst b/Doc/library/selectors.rst --- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -1,5 +1,5 @@ -:mod:`selectors` -- High-level I/O multiplexing -=============================================== +:mod:`selectors` --- High-level I/O multiplexing +================================================ .. module:: selectors :synopsis: High-level I/O multiplexing. diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -1,4 +1,4 @@ -:mod:`winreg` -- Windows registry access +:mod:`winreg` --- Windows registry access ========================================= .. module:: winreg diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,8 +1,8 @@ .. _tut-brieftourtwo: ********************************************* -Brief Tour of the Standard Library -- Part II -********************************************* +Brief Tour of the Standard Library --- Part II +********************************************** This second tour covers more advanced modules that support professional programming needs. These modules rarely occur in small scripts. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Dec 4 04:06:50 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 04 Dec 2016 09:06:50 +0000 Subject: [Python-checkins] Daily reference leaks (954cb987b4dc): sum=11 Message-ID: <20161204090650.21305.48708.5E6EB466@psf.io> results for 954cb987b4dc on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] 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/reflogMjmgc6', '--timeout', '7200'] From python-checkins at python.org Sun Dec 4 08:44:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 13:44:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Fixed_mismatching_title_overline=2E?= Message-ID: <20161204134416.28552.79024.ABF2CAB4@psf.io> https://hg.python.org/cpython/rev/352915c85e1e changeset: 105454:352915c85e1e branch: 3.6 parent: 105450:e646fcfae272 parent: 105452:dee2a4ca62f7 user: Serhiy Storchaka date: Sun Dec 04 15:43:37 2016 +0200 summary: Fixed mismatching title overline. files: Doc/tutorial/stdlib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,6 +1,6 @@ .. _tut-brieftourtwo: -********************************************* +********************************************** Brief Tour of the Standard Library --- Part II ********************************************** -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 08:44:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 13:44:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Fixed_mismatching_title_overline=2E?= Message-ID: <20161204134416.93093.31263.FD504164@psf.io> https://hg.python.org/cpython/rev/cd822205d37b changeset: 105455:cd822205d37b parent: 105451:16350c1f81a1 parent: 105454:352915c85e1e user: Serhiy Storchaka date: Sun Dec 04 15:43:57 2016 +0200 summary: Fixed mismatching title overline. files: Doc/tutorial/stdlib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,6 +1,6 @@ .. _tut-brieftourtwo: -********************************************* +********************************************** Brief Tour of the Standard Library --- Part II ********************************************** -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 08:44:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 13:44:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fixed_mismatch?= =?utf-8?q?ing_title_overline=2E?= Message-ID: <20161204134416.28558.21553.C82135FD@psf.io> https://hg.python.org/cpython/rev/baf972859ec5 changeset: 105453:baf972859ec5 branch: 2.7 parent: 105448:d380474a88aa user: Serhiy Storchaka date: Sun Dec 04 15:42:13 2016 +0200 summary: Fixed mismatching title overline. files: Doc/tutorial/stdlib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,6 +1,6 @@ .. _tut-brieftourtwo: -********************************************* +********************************************** Brief Tour of the Standard Library --- Part II ********************************************** -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 08:44:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 04 Dec 2016 13:44:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fixed_mismatch?= =?utf-8?q?ing_title_overline=2E?= Message-ID: <20161204134415.21221.89413.2C274EEF@psf.io> https://hg.python.org/cpython/rev/dee2a4ca62f7 changeset: 105452:dee2a4ca62f7 branch: 3.5 parent: 105449:979fb6648aad user: Serhiy Storchaka date: Sun Dec 04 15:42:13 2016 +0200 summary: Fixed mismatching title overline. files: Doc/tutorial/stdlib2.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -1,6 +1,6 @@ .. _tut-brieftourtwo: -********************************************* +********************************************** Brief Tour of the Standard Library --- Part II ********************************************** -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 14:01:04 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 04 Dec 2016 19:01:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Neaten-up_and_?= =?utf-8?q?extend_the_examples_in_the_random_module_docs=2E?= Message-ID: <20161204190103.21590.56389.AB5AD17F@psf.io> https://hg.python.org/cpython/rev/b966b3426bd1 changeset: 105456:b966b3426bd1 branch: 3.6 parent: 105454:352915c85e1e user: Raymond Hettinger date: Sun Dec 04 11:00:34 2016 -0800 summary: Neaten-up and extend the examples in the random module docs. files: Doc/library/random.rst | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Doc/library/random.rst b/Doc/library/random.rst --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -364,25 +364,29 @@ Simulations:: - # Six roulette wheel spins (weighted sampling with replacement) + >>> # Six roulette wheel spins (weighted sampling with replacement) >>> choices(['red', 'black', 'green'], [18, 18, 2], k=6) ['red', 'green', 'black', 'black', 'red', 'black'] - # Deal 20 cards without replacement from a deck of 52 playing cards - # and determine the proportion of cards with a ten-value (i.e. a ten, - # jack, queen, or king). + >>> # Deal 20 cards without replacement from a deck of 52 playing cards + >>> # and determine the proportion of cards with a ten-value + >>> # (a ten, jack, queen, or king). >>> deck = collections.Counter(tens=16, low_cards=36) >>> seen = sample(list(deck.elements()), k=20) - >>> print(seen.count('tens') / 20) + >>> seen.count('tens') / 20 0.15 - # Estimate the probability of getting 5 or more heads from 7 spins - # of a biased coin that settles on heads 60% of the time. - >>> n = 10000 - >>> cw = [0.60, 1.00] - >>> sum(choices('HT', cum_weights=cw, k=7).count('H') >= 5 for i in range(n)) / n + >>> # Estimate the probability of getting 5 or more heads from 7 spins + >>> # of a biased coin that settles on heads 60% of the time. + >>> trial = lambda: choices('HT', cum_weights=(0.60, 1.00), k=7).count('H') >= 5 + >>> sum(trial() for i in range(10000)) / 10000 0.4169 + >>> # Probability of the median of 5 samples being in middle two quartiles + >>> trial = lambda : 2500 <= sorted(choices(range(10000), k=5))[2] < 7500 + >>> sum(trial() for i in range(10000)) / 10000 + 0.7958 + Example of `statistical bootstrapping `_ using resampling with replacement to estimate a confidence interval for the mean of a sample of -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 14:01:04 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 04 Dec 2016 19:01:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161204190103.22090.31728.3B87BE6A@psf.io> https://hg.python.org/cpython/rev/fd1bd563d2f3 changeset: 105457:fd1bd563d2f3 parent: 105455:cd822205d37b parent: 105456:b966b3426bd1 user: Raymond Hettinger date: Sun Dec 04 11:00:57 2016 -0800 summary: merge files: Doc/library/random.rst | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Doc/library/random.rst b/Doc/library/random.rst --- a/Doc/library/random.rst +++ b/Doc/library/random.rst @@ -364,25 +364,29 @@ Simulations:: - # Six roulette wheel spins (weighted sampling with replacement) + >>> # Six roulette wheel spins (weighted sampling with replacement) >>> choices(['red', 'black', 'green'], [18, 18, 2], k=6) ['red', 'green', 'black', 'black', 'red', 'black'] - # Deal 20 cards without replacement from a deck of 52 playing cards - # and determine the proportion of cards with a ten-value (i.e. a ten, - # jack, queen, or king). + >>> # Deal 20 cards without replacement from a deck of 52 playing cards + >>> # and determine the proportion of cards with a ten-value + >>> # (a ten, jack, queen, or king). >>> deck = collections.Counter(tens=16, low_cards=36) >>> seen = sample(list(deck.elements()), k=20) - >>> print(seen.count('tens') / 20) + >>> seen.count('tens') / 20 0.15 - # Estimate the probability of getting 5 or more heads from 7 spins - # of a biased coin that settles on heads 60% of the time. - >>> n = 10000 - >>> cw = [0.60, 1.00] - >>> sum(choices('HT', cum_weights=cw, k=7).count('H') >= 5 for i in range(n)) / n + >>> # Estimate the probability of getting 5 or more heads from 7 spins + >>> # of a biased coin that settles on heads 60% of the time. + >>> trial = lambda: choices('HT', cum_weights=(0.60, 1.00), k=7).count('H') >= 5 + >>> sum(trial() for i in range(10000)) / 10000 0.4169 + >>> # Probability of the median of 5 samples being in middle two quartiles + >>> trial = lambda : 2500 <= sorted(choices(range(10000), k=5))[2] < 7500 + >>> sum(trial() for i in range(10000)) / 10000 + 0.7958 + Example of `statistical bootstrapping `_ using resampling with replacement to estimate a confidence interval for the mean of a sample of -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 4 17:00:14 2016 From: python-checkins at python.org (victor.stinner) Date: Sun, 04 Dec 2016 22:00:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Backed_out_changeset_b9c96?= =?utf-8?q?91c72c5?= Message-ID: <20161204220014.28450.909.FBA1886C@psf.io> https://hg.python.org/cpython/rev/d35fc6e58a70 changeset: 105458:d35fc6e58a70 user: Victor Stinner date: Sun Dec 04 22:59:09 2016 +0100 summary: Backed out changeset b9c9691c72c5 Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs(). files: Modules/_asynciomodule.c | 12 +++++++----- Modules/_csv.c | 2 +- Modules/_elementtree.c | 2 +- Modules/_json.c | 12 ++++++------ Modules/_ssl.c | 2 +- Modules/_struct.c | 2 +- Modules/_testbuffer.c | 10 +++++----- Modules/gcmodule.c | 2 +- Modules/itertoolsmodule.c | 10 +++++----- Modules/mathmodule.c | 6 +++--- Modules/posixmodule.c | 4 ++-- Objects/abstract.c | 8 ++++---- Objects/bytearrayobject.c | 6 ++++-- Objects/bytesobject.c | 7 ++++--- Objects/complexobject.c | 2 +- Objects/descrobject.c | 2 +- Objects/dictobject.c | 3 ++- Objects/enumobject.c | 2 +- Objects/floatobject.c | 2 +- Objects/genobject.c | 4 ++-- Objects/listobject.c | 3 ++- Objects/longobject.c | 3 ++- Objects/memoryobject.c | 4 ++-- Objects/object.c | 4 ++-- Objects/odictobject.c | 2 +- Objects/typeobject.c | 6 ++++-- Objects/unicodeobject.c | 10 ++++++---- Objects/weakrefobject.c | 2 +- Python/_warnings.c | 2 +- Python/bltinmodule.c | 8 ++++---- Python/ceval.c | 6 +++--- Python/import.c | 2 +- Python/sysmodule.c | 2 +- 33 files changed, 83 insertions(+), 71 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -721,7 +721,8 @@ _asyncio_Future__repr_info_impl(FutureObj *self) /*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/ { - return _PyObject_CallArg1(asyncio_future_repr_info_func, self); + return PyObject_CallFunctionObjArgs( + asyncio_future_repr_info_func, self, NULL); } /*[clinic input] @@ -1536,7 +1537,8 @@ _asyncio_Task__repr_info_impl(TaskObj *self) /*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/ { - return _PyObject_CallArg1(asyncio_task_repr_info_func, self); + return PyObject_CallFunctionObjArgs( + asyncio_task_repr_info_func, self, NULL); } /*[clinic input] @@ -1896,7 +1898,7 @@ return NULL; } - PyObject *e = _PyObject_CallArg1(et, msg); + PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL); Py_DECREF(msg); if (e == NULL) { return NULL; @@ -1946,7 +1948,7 @@ if (!exc) { /* exc was not a CancelledError */ - exc = _PyObject_CallNoArg(asyncio_CancelledError); + exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL); if (!exc) { goto fail; } @@ -2179,7 +2181,7 @@ } /* Check if `result` is a generator */ - o = _PyObject_CallArg1(inspect_isgenerator, result); + o = PyObject_CallFunctionObjArgs(inspect_isgenerator, result, NULL); if (o == NULL) { /* An exception in inspect.isgenerator */ goto fail; diff --git a/Modules/_csv.c b/Modules/_csv.c --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -1259,7 +1259,7 @@ (void *) self->rec, self->rec_len); if (line == NULL) return NULL; - result = _PyObject_CallArg1(self->writeline, line); + result = PyObject_CallFunctionObjArgs(self->writeline, line, NULL); Py_DECREF(line); return result; } diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2457,7 +2457,7 @@ PyObject *event = PyTuple_Pack(2, action, node); if (event == NULL) return -1; - res = _PyObject_CallArg1(self->events_append, event); + res = PyObject_CallFunctionObjArgs(self->events_append, event, NULL); Py_DECREF(event); if (res == NULL) return -1; diff --git a/Modules/_json.c b/Modules/_json.c --- a/Modules/_json.c +++ b/Modules/_json.c @@ -813,14 +813,14 @@ *next_idx_ptr = idx + 1; if (has_pairs_hook) { - val = _PyObject_CallArg1(s->object_pairs_hook, rval); + val = PyObject_CallFunctionObjArgs(s->object_pairs_hook, rval, NULL); Py_DECREF(rval); return val; } /* if object_hook is not None: rval = object_hook(rval) */ if (s->object_hook != Py_None) { - val = _PyObject_CallArg1(s->object_hook, rval); + val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL); Py_DECREF(rval); return val; } @@ -924,7 +924,7 @@ return NULL; /* rval = parse_constant(constant) */ - rval = _PyObject_CallArg1(s->parse_constant, cstr); + rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL); idx += PyUnicode_GET_LENGTH(cstr); Py_DECREF(cstr); *next_idx_ptr = idx; @@ -1023,7 +1023,7 @@ idx - start); if (numstr == NULL) return NULL; - rval = _PyObject_CallArg1(custom_func, numstr); + rval = PyObject_CallFunctionObjArgs(custom_func, numstr, NULL); } else { Py_ssize_t i, n; @@ -1475,7 +1475,7 @@ if (s->fast_encode) return s->fast_encode(NULL, obj); else - return _PyObject_CallArg1(s->encoder, obj); + return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL); } static int @@ -1553,7 +1553,7 @@ return -1; } } - newobj = _PyObject_CallArg1(s->defaultfn, obj); + newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL); if (newobj == NULL) { Py_XDECREF(ident); return -1; diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3197,7 +3197,7 @@ PySSL_END_ALLOW_THREADS_S(pw_info->thread_state); if (pw_info->callable) { - fn_ret = _PyObject_CallNoArg(pw_info->callable); + fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL); if (!fn_ret) { /* TODO: It would be nice to move _ctypes_add_traceback() into the core python API, so we could use it to add a frame here */ diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2046,7 +2046,7 @@ return s_object; } - s_object = _PyObject_CallArg1((PyObject *)(&PyStructType), fmt); + s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); if (s_object != NULL) { if (PyDict_Size(cache) >= MAXCACHE) PyDict_Clear(cache); diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c --- a/Modules/_testbuffer.c +++ b/Modules/_testbuffer.c @@ -312,7 +312,7 @@ assert(PyObject_CheckBuffer(obj)); assert(PyList_Check(items) || PyTuple_Check(items)); - structobj = _PyObject_CallArg1(Struct, format); + structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); if (structobj == NULL) return -1; @@ -406,7 +406,7 @@ if (format == NULL) goto out; - structobj = _PyObject_CallArg1(Struct, format); + structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); if (structobj == NULL) goto out; @@ -620,7 +620,7 @@ if (ndim == 0) { memcpy(item, ptr, itemsize); - x = _PyObject_CallArg1(unpack_from, mview); + x = PyObject_CallFunctionObjArgs(unpack_from, mview, NULL); if (x == NULL) return NULL; if (PyTuple_GET_SIZE(x) == 1) { @@ -696,7 +696,7 @@ if (format == NULL) goto out; - structobj = _PyObject_CallArg1(Struct, format); + structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); Py_DECREF(format); if (structobj == NULL) goto out; @@ -788,7 +788,7 @@ PyObject *tmp; Py_ssize_t itemsize; - tmp = _PyObject_CallArg1(calcsize, format); + tmp = PyObject_CallFunctionObjArgs(calcsize, format, NULL); if (tmp == NULL) return -1; itemsize = PyLong_AsSsize_t(tmp); diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -709,7 +709,7 @@ assert(callback != NULL); /* copy-paste of weakrefobject.c's handle_callback() */ - temp = _PyObject_CallArg1(callback, wr); + temp = PyObject_CallFunctionObjArgs(callback, wr, NULL); if (temp == NULL) PyErr_WriteUnraisable(callback); else diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -101,7 +101,7 @@ newkey = newvalue; Py_INCREF(newvalue); } else { - newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue); + newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); if (newkey == NULL) { Py_DECREF(newvalue); return NULL; @@ -293,7 +293,7 @@ newkey = newvalue; Py_INCREF(newvalue); } else { - newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue); + newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); if (newkey == NULL) { Py_DECREF(newvalue); return NULL; @@ -1130,7 +1130,7 @@ if (lz->start == 1) return item; - good = _PyObject_CallArg1(lz->func, item); + good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); if (good == NULL) { Py_DECREF(item); return NULL; @@ -1296,7 +1296,7 @@ if (item == NULL) return NULL; - good = _PyObject_CallArg1(lz->func, item); + good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); if (good == NULL) { Py_DECREF(item); return NULL; @@ -3824,7 +3824,7 @@ ok = PyObject_IsTrue(item); } else { PyObject *good; - good = _PyObject_CallArg1(lz->func, item); + good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); if (good == NULL) { Py_DECREF(item); return NULL; diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -951,7 +951,7 @@ return NULL; return math_1_to_int(number, ceil, 0); } - result = _PyObject_CallNoArg(method); + result = PyObject_CallFunctionObjArgs(method, NULL); Py_DECREF(method); return result; } @@ -991,7 +991,7 @@ return NULL; return math_1_to_int(number, floor, 0); } - result = _PyObject_CallNoArg(method); + result = PyObject_CallFunctionObjArgs(method, NULL); Py_DECREF(method); return result; } @@ -1542,7 +1542,7 @@ Py_TYPE(number)->tp_name); return NULL; } - result = _PyObject_CallNoArg(trunc); + result = PyObject_CallFunctionObjArgs(trunc, NULL); Py_DECREF(trunc); return result; } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -902,7 +902,7 @@ goto error_exit; } - o = to_cleanup = _PyObject_CallNoArg(func); + o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); if (NULL == o) { goto error_exit; @@ -12041,7 +12041,7 @@ Py_TYPE(path)->tp_name); } - path_repr = _PyObject_CallNoArg(func); + path_repr = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); if (NULL == path_repr) { return NULL; diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -103,7 +103,7 @@ } return defaultvalue; } - result = _PyObject_CallNoArg(hint); + result = PyObject_CallFunctionObjArgs(hint, NULL); Py_DECREF(hint); if (result == NULL) { if (PyErr_ExceptionMatches(PyExc_TypeError)) { @@ -716,7 +716,7 @@ } /* And call it. */ - result = _PyObject_CallArg1(meth, format_spec); + result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL); Py_DECREF(meth); if (result && !PyUnicode_Check(result)) { @@ -3011,7 +3011,7 @@ Py_DECREF(checker); return ok; } - res = _PyObject_CallArg1(checker, inst); + res = PyObject_CallFunctionObjArgs(checker, inst, NULL); Py_LeaveRecursiveCall(); Py_DECREF(checker); if (res != NULL) { @@ -3085,7 +3085,7 @@ Py_DECREF(checker); return ok; } - res = _PyObject_CallArg1(checker, derived); + res = PyObject_CallFunctionObjArgs(checker, derived, NULL); Py_LeaveRecursiveCall(); Py_DECREF(checker); if (res != NULL) { diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -98,7 +98,8 @@ PyObject * PyByteArray_FromObject(PyObject *input) { - return _PyObject_CallArg1((PyObject *)&PyByteArray_Type, input); + return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type, + input, NULL); } PyObject * @@ -1984,7 +1985,8 @@ { PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type); if (type != &PyByteArray_Type && result != NULL) { - Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result)); + Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, + result, NULL)); } return result; } diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -549,7 +549,7 @@ /* does it support __bytes__? */ func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { - result = _PyObject_CallNoArg(func); + result = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); if (result == NULL) return NULL; @@ -2331,7 +2331,8 @@ { PyObject *result = _PyBytes_FromHex(string, 0); if (type != &PyBytes_Type && result != NULL) { - Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result)); + Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, + result, NULL)); } return result; } @@ -2568,7 +2569,7 @@ PyObject_Bytes doesn't do. */ func = _PyObject_LookupSpecial(x, &PyId___bytes__); if (func != NULL) { - new = _PyObject_CallNoArg(func); + new = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); if (new == NULL) return NULL; diff --git a/Objects/complexobject.c b/Objects/complexobject.c --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -273,7 +273,7 @@ f = _PyObject_LookupSpecial(op, &PyId___complex__); if (f) { - PyObject *res = _PyObject_CallNoArg(f); + PyObject *res = PyObject_CallFunctionObjArgs(f, NULL); Py_DECREF(f); if (res != NULL && !PyComplex_Check(res)) { PyErr_SetString(PyExc_TypeError, diff --git a/Objects/descrobject.c b/Objects/descrobject.c --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1414,7 +1414,7 @@ return -1; } if (value == NULL) - res = _PyObject_CallArg1(func, obj); + res = PyObject_CallFunctionObjArgs(func, obj, NULL); else res = PyObject_CallFunctionObjArgs(func, obj, value, NULL); if (res == NULL) diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2066,7 +2066,8 @@ _Py_IDENTIFIER(__missing__); missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__); if (missing != NULL) { - res = _PyObject_CallArg1(missing, key); + res = PyObject_CallFunctionObjArgs(missing, + key, NULL); Py_DECREF(missing); return res; } diff --git a/Objects/enumobject.c b/Objects/enumobject.c --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -258,7 +258,7 @@ return NULL; } if (reversed_meth != NULL) { - PyObject *res = _PyObject_CallNoArg(reversed_meth); + PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL); Py_DECREF(reversed_meth); return res; } diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -1439,7 +1439,7 @@ goto parse_error; result = PyFloat_FromDouble(negate ? -x : x); if (cls != (PyObject *)&PyFloat_Type && result != NULL) { - Py_SETREF(result, _PyObject_CallArg1(cls, result)); + Py_SETREF(result, PyObject_CallFunctionObjArgs(cls, result, NULL)); } return result; diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -43,7 +43,7 @@ /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); - res = _PyObject_CallArg1(finalizer, self); + res = PyObject_CallFunctionObjArgs(finalizer, self, NULL); if (res == NULL) { PyErr_WriteUnraisable(self); @@ -591,7 +591,7 @@ * * (See PyErr_SetObject/_PyErr_CreateException code for details.) */ - e = _PyObject_CallArg1(PyExc_StopIteration, value); + e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL); if (e == NULL) { return -1; } diff --git a/Objects/listobject.c b/Objects/listobject.c --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -1970,7 +1970,8 @@ } for (i = 0; i < saved_ob_size ; i++) { - keys[i] = _PyObject_CallArg1(keyfunc, saved_ob_item[i]); + keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i], + NULL); if (keys[i] == NULL) { for (i=i-1 ; i>=0 ; i--) Py_DECREF(keys[i]); diff --git a/Objects/longobject.c b/Objects/longobject.c --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -5282,7 +5282,8 @@ Py_DECREF(bytes); if (type != &PyLong_Type) { - Py_SETREF(long_obj, _PyObject_CallArg1((PyObject *)type, long_obj)); + Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type, + long_obj, NULL)); } return long_obj; diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -1939,7 +1939,7 @@ if (format == NULL) goto error; - structobj = _PyObject_CallArg1(Struct, format); + structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL); if (structobj == NULL) goto error; @@ -1978,7 +1978,7 @@ PyObject *v; memcpy(x->item, ptr, x->itemsize); - v = _PyObject_CallArg1(x->unpack_from, x->mview); + v = PyObject_CallFunctionObjArgs(x->unpack_from, x->mview, NULL); if (v == NULL) return NULL; diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -596,7 +596,7 @@ func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { - result = _PyObject_CallNoArg(func); + result = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); if (result == NULL) return NULL; @@ -1314,7 +1314,7 @@ return NULL; } /* use __dir__ */ - result = _PyObject_CallNoArg(dirfunc); + result = PyObject_CallFunctionObjArgs(dirfunc, NULL); Py_DECREF(dirfunc); if (result == NULL) return NULL; diff --git a/Objects/odictobject.c b/Objects/odictobject.c --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1256,7 +1256,7 @@ if (PyODict_CheckExact(od)) od_copy = PyODict_New(); else - od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od)); + od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL); if (od_copy == NULL) return NULL; diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3487,7 +3487,9 @@ sorted = _PyDict_GetItemId(builtins, &PyId_sorted); if (sorted == NULL) goto error; - sorted_methods = _PyObject_CallArg1(sorted, abstract_methods); + sorted_methods = PyObject_CallFunctionObjArgs(sorted, + abstract_methods, + NULL); if (sorted_methods == NULL) goto error; comma = _PyUnicode_FromId(&comma_id); @@ -6191,7 +6193,7 @@ else attr = descr; } - res = _PyObject_CallArg1(attr, name); + res = PyObject_CallFunctionObjArgs(attr, name, NULL); Py_XDECREF(descr); return res; } diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4269,7 +4269,7 @@ if (*exceptionObject == NULL) goto onError; - restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); + restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL); if (restuple == NULL) goto onError; if (!PyTuple_Check(restuple)) { @@ -4368,7 +4368,7 @@ if (*exceptionObject == NULL) goto onError; - restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); + restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL); if (restuple == NULL) goto onError; if (!PyTuple_Check(restuple)) { @@ -6649,7 +6649,8 @@ if (*exceptionObject == NULL) return NULL; - restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); + restuple = PyObject_CallFunctionObjArgs( + *errorHandler, *exceptionObject, NULL); if (restuple == NULL) return NULL; if (!PyTuple_Check(restuple)) { @@ -8643,7 +8644,8 @@ if (*exceptionObject == NULL) return NULL; - restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject); + restuple = PyObject_CallFunctionObjArgs( + *errorHandler, *exceptionObject, NULL); if (restuple == NULL) return NULL; if (!PyTuple_Check(restuple)) { diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c --- a/Objects/weakrefobject.c +++ b/Objects/weakrefobject.c @@ -867,7 +867,7 @@ static void handle_callback(PyWeakReference *ref, PyObject *callback) { - PyObject *cbresult = _PyObject_CallArg1(callback, ref); + PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL); if (cbresult == NULL) PyErr_WriteUnraisable(callback); diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -415,7 +415,7 @@ if (msg == NULL) goto error; - res = _PyObject_CallArg1(show_fn, msg); + res = PyObject_CallFunctionObjArgs(show_fn, msg, NULL); Py_DECREF(show_fn); Py_DECREF(msg); diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -469,7 +469,7 @@ ok = PyObject_IsTrue(item); } else { PyObject *good; - good = _PyObject_CallArg1(lz->func, item); + good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); if (good == NULL) { Py_DECREF(item); return NULL; @@ -1519,7 +1519,7 @@ while (( item = PyIter_Next(it) )) { /* get the value from the key function */ if (keyfunc != NULL) { - val = _PyObject_CallArg1(keyfunc, item); + val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); if (val == NULL) goto Fail_it_item; } @@ -2044,9 +2044,9 @@ } if (ndigits == NULL || ndigits == Py_None) - result = _PyObject_CallNoArg(round); + result = PyObject_CallFunctionObjArgs(round, NULL); else - result = _PyObject_CallArg1(round, ndigits); + result = PyObject_CallFunctionObjArgs(round, ndigits, NULL); Py_DECREF(round); return result; } diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1756,7 +1756,7 @@ Py_DECREF(value); goto error; } - res = _PyObject_CallArg1(hook, value); + res = PyObject_CallFunctionObjArgs(hook, value, NULL); Py_DECREF(value); if (res == NULL) goto error; @@ -3062,7 +3062,7 @@ Py_DECREF(mgr); if (enter == NULL) goto error; - res = _PyObject_CallNoArg(enter); + res = PyObject_CallFunctionObjArgs(enter, NULL); Py_DECREF(enter); if (res == NULL) goto error; @@ -3096,7 +3096,7 @@ } SET_TOP(exit); Py_DECREF(mgr); - res = _PyObject_CallNoArg(enter); + res = PyObject_CallFunctionObjArgs(enter, NULL); Py_DECREF(enter); if (res == NULL) goto error; diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -985,7 +985,7 @@ PyObject *hook = PyList_GetItem(path_hooks, j); if (hook == NULL) return NULL; - importer = _PyObject_CallArg1(hook, p); + importer = PyObject_CallFunctionObjArgs(hook, p, NULL); if (importer != NULL) break; diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1098,7 +1098,7 @@ Py_TYPE(o)->tp_name); } else { - res = _PyObject_CallNoArg(method); + res = PyObject_CallFunctionObjArgs(method, NULL); Py_DECREF(method); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 01:59:34 2016 From: python-checkins at python.org (nick.coghlan) Date: Mon, 05 Dec 2016 06:59:34 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzIzNzIy?= =?utf-8?q?=3A_improve_=5F=5Fclasscell=5F=5F_compatibility?= Message-ID: <20161205065933.22090.12783.15E895BB@psf.io> https://hg.python.org/cpython/rev/e33245800f1a changeset: 105459:e33245800f1a branch: 3.6 parent: 105456:b966b3426bd1 user: Nick Coghlan date: Mon Dec 05 16:47:55 2016 +1000 summary: Issue #23722: improve __classcell__ compatibility Handling zero-argument super() in __init_subclass__ and __set_name__ involved moving __class__ initialisation to type.__new__. This requires cooperation from custom metaclasses to ensure that the new __classcell__ entry is passed along appropriately. The initial implementation of that change resulted in abruptly broken zero-argument super() support in metaclasses that didn't adhere to the new requirements (such as Django's metaclass for Model definitions). The updated approach adopted here instead emits a deprecation warning for those cases, and makes them work the same way they did in Python 3.5. This patch also improves the related class machinery documentation to cover these details and to include more reader-friendly cross-references and index entries. files: Doc/reference/datamodel.rst | 43 +- Doc/whatsnew/3.6.rst | 10 + Lib/importlib/_bootstrap_external.py | 3 +- Lib/test/test_super.py | 125 +- Misc/NEWS | 12 + Objects/typeobject.c | 11 +- Python/bltinmodule.c | 40 +- Python/compile.c | 8 +- Python/importlib_external.h | 2358 +++++++------- 9 files changed, 1397 insertions(+), 1213 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1700,6 +1700,10 @@ Metaclasses ^^^^^^^^^^^ +.. index:: + single: metaclass + builtin: type + By default, classes are constructed using :func:`type`. The class body is executed in a new namespace and the class name is bound locally to the result of ``type(name, bases, namespace)``. @@ -1730,6 +1734,8 @@ Determining the appropriate metaclass ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: metaclass hint The appropriate metaclass for a class definition is determined as follows: @@ -1751,6 +1757,9 @@ Preparing the class namespace ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: __prepare__ (metaclass method) + Once the appropriate metaclass has been identified, then the class namespace is prepared. If the metaclass has a ``__prepare__`` attribute, it is called as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the @@ -1768,6 +1777,9 @@ Executing the class body ^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: class; body + The class body is executed (approximately) as ``exec(body, globals(), namespace)``. The key difference from a normal call to :func:`exec` is that lexical scoping allows the class body (including @@ -1777,12 +1789,19 @@ However, even when the class definition occurs inside the function, methods defined inside the class still cannot see names defined at the class scope. Class variables must be accessed through the first parameter of instance or -class methods, and cannot be accessed at all from static methods. - +class methods, or through the implicit lexically scoped ``__class__`` reference +described in the next section. + +.. _class-object-creation: Creating the class object ^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: __class__ (method cell) + single: __classcell__ (class namespace entry) + + Once the class namespace has been populated by executing the class body, the class object is created by calling ``metaclass(name, bases, namespace, **kwds)`` (the additional keywords @@ -1796,6 +1815,26 @@ lexical scoping, while the class or instance that was used to make the current call is identified based on the first argument passed to the method. +.. impl-detail:: + + In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass + as a ``__classcell__`` entry in the class namespace. If present, this must + be propagated up to the ``type.__new__`` call in order for the class to be + initialised correctly. + Failing to do so will result in a :exc:`DeprecationWarning` in Python 3.6, + and a :exc:`RuntimeWarning` in the future. + +When using the default metaclass :class:`type`, or any metaclass that ultimately +calls ``type.__new__``, the following additional customisation steps are +invoked after creating the class object: + +* first, ``type.__new__`` collects all of the descriptors in the class + namespace that define a :meth:`~object.__set_name__` method; +* second, all of these ``__set_name__`` methods are called with the class + being defined and the assigned name of that particular descriptor; and +* finally, the :meth:`~object.__init_subclass__` hook is called on the + immediate parent of the new class in its method resolution order. + After the class object is created, it is passed to the class decorators included in the class definition (if any) and the resulting object is bound in the local namespace as the defined class. diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -351,6 +351,11 @@ class Plugin2(PluginBase): pass +In order to allow zero-argument :func:`super` calls to work correctly from +:meth:`~object.__init_subclass__` implementations, custom metaclasses must +ensure that the new ``__classcell__`` namespace entry is propagated to +``type.__new__`` (as described in :ref:`class-object-creation`). + .. seealso:: :pep:`487` -- Simpler customization of class creation @@ -2235,6 +2240,11 @@ on a ZipFile created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` was raised in those scenarios. +* when custom metaclasses are combined with zero-argument :func:`super` or + direct references from methods to the implicit ``__class__`` closure + variable, the implicit ``__classcell__`` namespace entry must now be passed + up to ``type.__new__`` for initialisation. Failing to do so will result in + a :exc:`DeprecationWarning` in 3.6 and a :exc:`RuntimeWarning` in the future. Changes in the C API -------------------- diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -239,6 +239,7 @@ # Python 3.6b1 3376 (simplify CALL_FUNCTIONs & BUILD_MAP_UNPACK_WITH_CALL) # Python 3.6b1 3377 (set __class__ cell from type.__new__ #23722) # Python 3.6b2 3378 (add BUILD_TUPLE_UNPACK_WITH_CALL #28257) +# Python 3.6rc1 3379 (more thorough __class__ validation #23722) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -247,7 +248,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3378).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3379).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -1,7 +1,9 @@ -"""Unit tests for new super() implementation.""" +"""Unit tests for zero-argument super() & related machinery.""" import sys import unittest +import warnings +from test.support import check_warnings class A: @@ -144,6 +146,8 @@ self.assertIs(X.f(), X) def test___class___new(self): + # See issue #23722 + # Ensure zero-arg super() works as soon as type.__new__() is completed test_class = None class Meta(type): @@ -161,6 +165,7 @@ self.assertIs(test_class, A) def test___class___delayed(self): + # See issue #23722 test_namespace = None class Meta(type): @@ -169,10 +174,14 @@ test_namespace = namespace return None - class A(metaclass=Meta): - @staticmethod - def f(): - return __class__ + # This case shouldn't trigger the __classcell__ deprecation warning + with check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + class A(metaclass=Meta): + @staticmethod + def f(): + return __class__ + self.assertEqual(w.warnings, []) self.assertIs(A, None) @@ -180,6 +189,7 @@ self.assertIs(B.f(), B) def test___class___mro(self): + # See issue #23722 test_class = None class Meta(type): @@ -195,34 +205,105 @@ self.assertIs(test_class, A) - def test___classcell___deleted(self): + def test___classcell___expected_behaviour(self): + # See issue #23722 class Meta(type): def __new__(cls, name, bases, namespace): - del namespace['__classcell__'] + nonlocal namespace_snapshot + namespace_snapshot = namespace.copy() return super().__new__(cls, name, bases, namespace) - class A(metaclass=Meta): - @staticmethod - def f(): - __class__ + # __classcell__ is injected into the class namespace by the compiler + # when at least one method needs it, and should be omitted otherwise + namespace_snapshot = None + class WithoutClassRef(metaclass=Meta): + pass + self.assertNotIn("__classcell__", namespace_snapshot) - with self.assertRaises(NameError): - A.f() + # With zero-arg super() or an explicit __class__ reference, + # __classcell__ is the exact cell reference to be populated by + # type.__new__ + namespace_snapshot = None + class WithClassRef(metaclass=Meta): + def f(self): + return __class__ - def test___classcell___reset(self): + class_cell = namespace_snapshot["__classcell__"] + method_closure = WithClassRef.f.__closure__ + self.assertEqual(len(method_closure), 1) + self.assertIs(class_cell, method_closure[0]) + # Ensure the cell reference *doesn't* get turned into an attribute + with self.assertRaises(AttributeError): + WithClassRef.__classcell__ + + def test___classcell___missing(self): + # See issue #23722 + # Some metaclasses may not pass the original namespace to type.__new__ + # We test that case here by forcibly deleting __classcell__ class Meta(type): def __new__(cls, name, bases, namespace): - namespace['__classcell__'] = 0 + namespace.pop('__classcell__', None) return super().__new__(cls, name, bases, namespace) - class A(metaclass=Meta): - @staticmethod - def f(): - __class__ + # The default case should continue to work without any warnings + with check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + class WithoutClassRef(metaclass=Meta): + pass + self.assertEqual(w.warnings, []) - with self.assertRaises(NameError): - A.f() - self.assertEqual(A.__classcell__, 0) + # With zero-arg super() or an explicit __class__ reference, we expect + # __build_class__ to emit a DeprecationWarning complaining that + # __class__ was not set, and asking if __classcell__ was propagated + # to type.__new__. + # In Python 3.7, that warning will become a RuntimeError. + expected_warning = ( + '__class__ not set.*__classcell__ propagated', + DeprecationWarning + ) + with check_warnings(expected_warning): + warnings.simplefilter("always", DeprecationWarning) + class WithClassRef(metaclass=Meta): + def f(self): + return __class__ + # Check __class__ still gets set despite the warning + self.assertIs(WithClassRef().f(), WithClassRef) + + # Check the warning is turned into an error as expected + with warnings.catch_warnings(): + warnings.simplefilter("error", DeprecationWarning) + with self.assertRaises(DeprecationWarning): + class WithClassRef(metaclass=Meta): + def f(self): + return __class__ + + def test___classcell___overwrite(self): + # See issue #23722 + # Overwriting __classcell__ with nonsense is explicitly prohibited + class Meta(type): + def __new__(cls, name, bases, namespace, cell): + namespace['__classcell__'] = cell + return super().__new__(cls, name, bases, namespace) + + for bad_cell in (None, 0, "", object()): + with self.subTest(bad_cell=bad_cell): + with self.assertRaises(TypeError): + class A(metaclass=Meta, cell=bad_cell): + pass + + def test___classcell___wrong_cell(self): + # See issue #23722 + # Pointing the cell reference at the wrong class is also prohibited + class Meta(type): + def __new__(cls, name, bases, namespace): + cls = super().__new__(cls, name, bases, namespace) + B = type("B", (), namespace) + return cls + + with self.assertRaises(TypeError): + class A(metaclass=Meta): + def f(self): + return __class__ def test_obscure_super_errors(self): def f(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ Core and Builtins ----------------- +- Issue #23722: Rather than silently producing a class that doesn't support + zero-argument ``super()`` in methods, failing to pass the new + ``__classcell__`` namespace entry up to ``type.__new__`` now results in a + ``DeprecationWarning`` and a class that supports zero-argument ``super()``. + - Issue #28797: Modifying the class __dict__ inside the __set_name__ method of a descriptor that is used inside that class no longer prevents calling the __set_name__ method of other descriptors. @@ -31,6 +36,13 @@ - Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. +Documentation +------------- + +- Issue #23722: The data model reference and the porting section in the What's + New guide now cover the additional ``__classcell__`` handling needed for + custom metaclasses to fully support PEP 487 and zero-argument ``super()``. + Tools/Demos ----------- diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2687,9 +2687,16 @@ else type->tp_free = PyObject_Del; - /* store type in class' cell */ + /* store type in class' cell if one is supplied */ cell = _PyDict_GetItemId(dict, &PyId___classcell__); - if (cell != NULL && PyCell_Check(cell)) { + if (cell != NULL) { + /* At least one method requires a reference to its defining class */ + if (!PyCell_Check(cell)) { + PyErr_Format(PyExc_TypeError, + "__classcell__ must be a nonlocal cell, not %.200R", + Py_TYPE(cell)); + goto error; + } PyCell_Set(cell, (PyObject *) type); _PyDict_DelItemId(dict, &PyId___classcell__); PyErr_Clear(); diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -54,8 +54,8 @@ static PyObject * builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds) { - PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns, *none; - PyObject *cls = NULL; + PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns; + PyObject *cls = NULL, *cell = NULL; Py_ssize_t nargs; int isclass = 0; /* initialize to prevent gcc warning */ @@ -167,14 +167,44 @@ Py_DECREF(bases); return NULL; } - none = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns, + cell = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns, NULL, 0, NULL, 0, NULL, 0, NULL, PyFunction_GET_CLOSURE(func)); - if (none != NULL) { + if (cell != NULL) { PyObject *margs[3] = {name, bases, ns}; cls = _PyObject_FastCallDict(meta, margs, 3, mkw); - Py_DECREF(none); + if (cls != NULL && PyType_Check(cls) && PyCell_Check(cell)) { + PyObject *cell_cls = PyCell_GET(cell); + if (cell_cls != cls) { + /* TODO: In 3.7, DeprecationWarning will become RuntimeError. + * At that point, cell_error won't be needed. + */ + int cell_error; + if (cell_cls == NULL) { + const char *msg = + "__class__ not set defining %.200R as %.200R. " + "Was __classcell__ propagated to type.__new__?"; + cell_error = PyErr_WarnFormat( + PyExc_DeprecationWarning, 1, msg, name, cls); + } else { + const char *msg = + "__class__ set to %.200R defining %.200R as %.200R"; + PyErr_Format(PyExc_TypeError, msg, cell_cls, name, cls); + cell_error = 1; + } + if (cell_error) { + Py_DECREF(cls); + cls = NULL; + goto error; + } else { + /* Fill in the cell, since type.__new__ didn't do it */ + PyCell_Set(cell, cls); + } + } + } } +error: + Py_XDECREF(cell); Py_DECREF(ns); Py_DECREF(meta); Py_XDECREF(mkw); diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1967,8 +1967,9 @@ compiler_exit_scope(c); return 0; } + /* Return __classcell__ if it is referenced, otherwise return None */ if (c->u->u_ste->ste_needs_class_closure) { - /* store __classcell__ into class namespace */ + /* Store __classcell__ into class namespace & return it */ str = PyUnicode_InternFromString("__class__"); if (str == NULL) { compiler_exit_scope(c); @@ -1983,6 +1984,7 @@ assert(i == 0); ADDOP_I(c, LOAD_CLOSURE, i); + ADDOP(c, DUP_TOP); str = PyUnicode_InternFromString("__classcell__"); if (!str || !compiler_nameop(c, str, Store)) { Py_XDECREF(str); @@ -1992,9 +1994,11 @@ Py_DECREF(str); } else { - /* This happens when nobody references the cell. */ + /* No methods referenced __class__, so just return None */ assert(PyDict_Size(c->u->u_cellvars) == 0); + ADDOP_O(c, LOAD_CONST, Py_None, consts); } + ADDOP_IN_SCOPE(c, RETURN_VALUE); /* create the code object */ co = assemble(c, 1); } diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -242,7 +242,7 @@ 101,95,97,116,111,109,105,99,106,0,0,0,115,26,0,0, 0,0,5,16,1,6,1,26,1,2,3,14,1,20,1,16, 1,14,1,2,1,14,1,14,1,6,1,114,58,0,0,0, - 105,50,13,0,0,233,2,0,0,0,114,15,0,0,0,115, + 105,51,13,0,0,233,2,0,0,0,114,15,0,0,0,115, 2,0,0,0,13,10,90,11,95,95,112,121,99,97,99,104, 101,95,95,122,4,111,112,116,45,122,3,46,112,121,122,4, 46,112,121,99,78,41,1,218,12,111,112,116,105,109,105,122, @@ -346,7 +346,7 @@ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,6,0,0, 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,6,1,0,0,115,48,0,0,0,0,18,8, + 117,114,99,101,7,1,0,0,115,48,0,0,0,0,18,8, 1,6,1,6,1,8,1,4,1,8,1,12,1,10,1,12, 1,16,1,8,1,8,1,8,1,24,1,8,1,12,1,6, 2,8,1,8,1,8,1,8,1,14,1,14,1,114,83,0, @@ -420,7 +420,7 @@ 112,116,95,108,101,118,101,108,90,13,98,97,115,101,95,102, 105,108,101,110,97,109,101,114,4,0,0,0,114,4,0,0, 0,114,6,0,0,0,218,17,115,111,117,114,99,101,95,102, - 114,111,109,95,99,97,99,104,101,51,1,0,0,115,46,0, + 114,111,109,95,99,97,99,104,101,52,1,0,0,115,46,0, 0,0,0,9,12,1,8,1,10,1,12,1,12,1,8,1, 6,1,10,1,10,1,8,1,6,1,10,1,8,1,16,1, 10,1,6,1,8,1,16,1,8,1,6,1,8,1,14,1, @@ -456,7 +456,7 @@ 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116, 104,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108, - 101,85,1,0,0,115,20,0,0,0,0,7,12,1,4,1, + 101,86,1,0,0,115,20,0,0,0,0,7,12,1,4,1, 16,1,26,1,4,1,2,1,12,1,18,1,18,1,114,95, 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, 11,0,0,0,67,0,0,0,115,72,0,0,0,124,0,106, @@ -469,7 +469,7 @@ 114,83,0,0,0,114,70,0,0,0,114,78,0,0,0,41, 1,218,8,102,105,108,101,110,97,109,101,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,11,95,103,101,116, - 95,99,97,99,104,101,100,104,1,0,0,115,16,0,0,0, + 95,99,97,99,104,101,100,105,1,0,0,115,16,0,0,0, 0,1,14,1,2,1,8,1,14,1,8,1,14,1,4,2, 114,99,0,0,0,99,1,0,0,0,0,0,0,0,2,0, 0,0,11,0,0,0,67,0,0,0,115,52,0,0,0,121, @@ -483,7 +483,7 @@ 128,0,0,0,41,3,114,41,0,0,0,114,43,0,0,0, 114,42,0,0,0,41,2,114,37,0,0,0,114,44,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,95,99,97,108,99,95,109,111,100,101,116,1,0,0, + 218,10,95,99,97,108,99,95,109,111,100,101,117,1,0,0, 115,12,0,0,0,0,2,2,1,14,1,14,1,10,3,8, 1,114,101,0,0,0,99,1,0,0,0,0,0,0,0,3, 0,0,0,11,0,0,0,3,0,0,0,115,68,0,0,0, @@ -521,7 +521,7 @@ 114,103,115,90,6,107,119,97,114,103,115,41,1,218,6,109, 101,116,104,111,100,114,4,0,0,0,114,6,0,0,0,218, 19,95,99,104,101,99,107,95,110,97,109,101,95,119,114,97, - 112,112,101,114,136,1,0,0,115,12,0,0,0,0,1,8, + 112,112,101,114,137,1,0,0,115,12,0,0,0,0,1,8, 1,8,1,10,1,4,1,18,1,122,40,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, @@ -540,7 +540,7 @@ 100,105,99,116,95,95,218,6,117,112,100,97,116,101,41,3, 90,3,110,101,119,90,3,111,108,100,114,55,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,5, - 95,119,114,97,112,147,1,0,0,115,8,0,0,0,0,1, + 95,119,114,97,112,148,1,0,0,115,8,0,0,0,0,1, 10,1,10,1,22,1,122,26,95,99,104,101,99,107,95,110, 97,109,101,46,60,108,111,99,97,108,115,62,46,95,119,114, 97,112,41,1,78,41,3,218,10,95,98,111,111,116,115,116, @@ -548,7 +548,7 @@ 114,111,114,41,3,114,106,0,0,0,114,107,0,0,0,114, 117,0,0,0,114,4,0,0,0,41,1,114,106,0,0,0, 114,6,0,0,0,218,11,95,99,104,101,99,107,95,110,97, - 109,101,128,1,0,0,115,14,0,0,0,0,8,14,7,2, + 109,101,129,1,0,0,115,14,0,0,0,0,8,14,7,2, 1,10,1,14,2,14,5,10,1,114,120,0,0,0,99,2, 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, 0,0,0,115,60,0,0,0,124,0,106,0,124,1,131,1, @@ -576,7 +576,7 @@ 101,114,218,8,112,111,114,116,105,111,110,115,218,3,109,115, 103,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, 218,17,95,102,105,110,100,95,109,111,100,117,108,101,95,115, - 104,105,109,156,1,0,0,115,10,0,0,0,0,10,14,1, + 104,105,109,157,1,0,0,115,10,0,0,0,0,10,14,1, 16,1,4,1,22,1,114,127,0,0,0,99,4,0,0,0, 0,0,0,0,11,0,0,0,22,0,0,0,67,0,0,0, 115,136,1,0,0,105,0,125,4,124,2,100,1,107,9,114, @@ -656,7 +656,7 @@ 115,111,117,114,99,101,95,115,105,122,101,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,25,95,118,97,108, 105,100,97,116,101,95,98,121,116,101,99,111,100,101,95,104, - 101,97,100,101,114,173,1,0,0,115,76,0,0,0,0,11, + 101,97,100,101,114,174,1,0,0,115,76,0,0,0,0,11, 4,1,8,1,10,3,4,1,8,1,8,1,12,1,12,1, 12,1,8,1,12,1,12,1,14,1,12,1,10,1,12,1, 10,1,12,1,10,1,12,1,8,1,10,1,2,1,16,1, @@ -685,7 +685,7 @@ 0,0,0,114,102,0,0,0,114,93,0,0,0,114,94,0, 0,0,218,4,99,111,100,101,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,17,95,99,111,109,112,105,108, - 101,95,98,121,116,101,99,111,100,101,228,1,0,0,115,16, + 101,95,98,121,116,101,99,111,100,101,229,1,0,0,115,16, 0,0,0,0,2,10,1,10,1,12,1,8,1,12,1,4, 2,10,1,114,145,0,0,0,114,62,0,0,0,99,3,0, 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, @@ -704,7 +704,7 @@ 114,144,0,0,0,114,130,0,0,0,114,138,0,0,0,114, 56,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,98,121, - 116,101,99,111,100,101,240,1,0,0,115,10,0,0,0,0, + 116,101,99,111,100,101,241,1,0,0,115,10,0,0,0,0, 3,8,1,14,1,14,1,16,1,114,148,0,0,0,99,1, 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, 0,0,0,115,62,0,0,0,100,1,100,2,108,0,125,1, @@ -731,7 +731,7 @@ 101,110,99,111,100,105,110,103,90,15,110,101,119,108,105,110, 101,95,100,101,99,111,100,101,114,114,4,0,0,0,114,4, 0,0,0,114,6,0,0,0,218,13,100,101,99,111,100,101, - 95,115,111,117,114,99,101,250,1,0,0,115,10,0,0,0, + 95,115,111,117,114,99,101,251,1,0,0,115,10,0,0,0, 0,5,8,1,12,1,10,1,12,1,114,153,0,0,0,41, 2,114,124,0,0,0,218,26,115,117,98,109,111,100,117,108, 101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,111, @@ -793,7 +793,7 @@ 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,23,115,112,101,99,95,102,114, 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 11,2,0,0,115,62,0,0,0,0,12,8,4,4,1,10, + 12,2,0,0,115,62,0,0,0,0,12,8,4,4,1,10, 2,2,1,14,1,14,1,8,2,10,8,16,1,6,3,8, 1,16,1,14,1,10,1,6,1,6,2,4,3,8,2,10, 1,2,1,14,1,14,1,6,2,4,1,8,2,6,1,12, @@ -829,7 +829,7 @@ 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, 2,218,3,99,108,115,114,5,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,91,2,0,0,115,8, + 110,95,114,101,103,105,115,116,114,121,92,2,0,0,115,8, 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, @@ -855,7 +855,7 @@ 121,114,5,0,0,0,90,4,104,107,101,121,218,8,102,105, 108,101,112,97,116,104,114,4,0,0,0,114,4,0,0,0, 114,6,0,0,0,218,16,95,115,101,97,114,99,104,95,114, - 101,103,105,115,116,114,121,98,2,0,0,115,22,0,0,0, + 101,103,105,115,116,114,121,99,2,0,0,115,22,0,0,0, 0,2,6,1,8,2,6,1,6,1,22,1,2,1,12,1, 26,1,14,1,6,1,122,38,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,115, @@ -877,7 +877,7 @@ 0,0,0,218,6,116,97,114,103,101,116,114,174,0,0,0, 114,124,0,0,0,114,164,0,0,0,114,162,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,9, - 102,105,110,100,95,115,112,101,99,113,2,0,0,115,26,0, + 102,105,110,100,95,115,112,101,99,114,2,0,0,115,26,0, 0,0,0,2,10,1,8,1,4,1,2,1,12,1,14,1, 6,1,16,1,14,1,6,1,8,1,8,1,122,31,87,105, 110,100,111,119,115,82,101,103,105,115,116,114,121,70,105,110, @@ -896,7 +896,7 @@ 0,114,124,0,0,0,41,4,114,168,0,0,0,114,123,0, 0,0,114,37,0,0,0,114,162,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,6,0,0,0,218,11,102,105,110, - 100,95,109,111,100,117,108,101,129,2,0,0,115,8,0,0, + 100,95,109,111,100,117,108,101,130,2,0,0,115,8,0,0, 0,0,7,12,1,8,1,6,2,122,33,87,105,110,100,111, 119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,114, 46,102,105,110,100,95,109,111,100,117,108,101,41,2,78,78, @@ -906,7 +906,7 @@ 101,116,104,111,100,114,169,0,0,0,114,175,0,0,0,114, 178,0,0,0,114,179,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,166,0, - 0,0,79,2,0,0,115,20,0,0,0,8,2,4,3,4, + 0,0,80,2,0,0,115,20,0,0,0,8,2,4,3,4, 3,4,2,4,2,12,7,12,15,2,1,12,15,2,1,114, 166,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,64,0,0,0,115,48,0,0,0,101,0, @@ -941,7 +941,7 @@ 98,0,0,0,90,13,102,105,108,101,110,97,109,101,95,98, 97,115,101,90,9,116,97,105,108,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,157,0, - 0,0,148,2,0,0,115,8,0,0,0,0,3,18,1,16, + 0,0,149,2,0,0,115,8,0,0,0,0,3,18,1,16, 1,14,1,122,24,95,76,111,97,100,101,114,66,97,115,105, 99,115,46,105,115,95,112,97,99,107,97,103,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, @@ -951,7 +951,7 @@ 99,114,101,97,116,105,111,110,46,78,114,4,0,0,0,41, 2,114,104,0,0,0,114,162,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,13,99,114,101,97, - 116,101,95,109,111,100,117,108,101,156,2,0,0,115,0,0, + 116,101,95,109,111,100,117,108,101,157,2,0,0,115,0,0, 0,0,122,27,95,76,111,97,100,101,114,66,97,115,105,99, 115,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0, @@ -971,7 +971,7 @@ 114,115,0,0,0,41,3,114,104,0,0,0,218,6,109,111, 100,117,108,101,114,144,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,6,0,0,0,218,11,101,120,101,99,95,109, - 111,100,117,108,101,159,2,0,0,115,10,0,0,0,0,2, + 111,100,117,108,101,160,2,0,0,115,10,0,0,0,0,2, 12,1,8,1,6,1,10,1,122,25,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,101,120,101,99,95,109,111,100, 117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -982,14 +982,14 @@ 95,108,111,97,100,95,109,111,100,117,108,101,95,115,104,105, 109,41,2,114,104,0,0,0,114,123,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,218,11,108,111, - 97,100,95,109,111,100,117,108,101,167,2,0,0,115,2,0, + 97,100,95,109,111,100,117,108,101,168,2,0,0,115,2,0, 0,0,0,2,122,25,95,76,111,97,100,101,114,66,97,115, 105,99,115,46,108,111,97,100,95,109,111,100,117,108,101,78, 41,8,114,109,0,0,0,114,108,0,0,0,114,110,0,0, 0,114,111,0,0,0,114,157,0,0,0,114,183,0,0,0, 114,188,0,0,0,114,190,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,181, - 0,0,0,143,2,0,0,115,10,0,0,0,8,3,4,2, + 0,0,0,144,2,0,0,115,10,0,0,0,8,3,4,2, 8,8,8,3,8,8,114,181,0,0,0,99,0,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,64,0,0,0, 115,74,0,0,0,101,0,90,1,100,0,90,2,100,1,100, @@ -1014,7 +1014,7 @@ 32,32,32,32,32,32,32,78,41,1,218,7,73,79,69,114, 114,111,114,41,2,114,104,0,0,0,114,37,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,109,116,105,109,101,174,2,0,0,115,2, + 112,97,116,104,95,109,116,105,109,101,175,2,0,0,115,2, 0,0,0,0,6,122,23,83,111,117,114,99,101,76,111,97, 100,101,114,46,112,97,116,104,95,109,116,105,109,101,99,2, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1049,7 +1049,7 @@ 32,32,32,32,32,32,32,114,130,0,0,0,41,1,114,193, 0,0,0,41,2,114,104,0,0,0,114,37,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,115,116,97,116,115,182,2,0,0,115,2, + 112,97,116,104,95,115,116,97,116,115,183,2,0,0,115,2, 0,0,0,0,11,122,23,83,111,117,114,99,101,76,111,97, 100,101,114,46,112,97,116,104,95,115,116,97,116,115,99,4, 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, @@ -1073,7 +1073,7 @@ 94,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104, 114,56,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 6,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116, - 101,99,111,100,101,195,2,0,0,115,2,0,0,0,0,8, + 101,99,111,100,101,196,2,0,0,115,2,0,0,0,0,8, 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95, 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3, 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67, @@ -1090,7 +1090,7 @@ 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,104, 0,0,0,114,37,0,0,0,114,56,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,195,0,0, - 0,205,2,0,0,115,0,0,0,0,122,21,83,111,117,114, + 0,206,2,0,0,115,0,0,0,0,122,21,83,111,117,114, 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116, 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0, 0,0,67,0,0,0,115,82,0,0,0,124,0,106,0,124, @@ -1110,7 +1110,7 @@ 0,114,153,0,0,0,41,5,114,104,0,0,0,114,123,0, 0,0,114,37,0,0,0,114,151,0,0,0,218,3,101,120, 99,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,103,101,116,95,115,111,117,114,99,101,212,2,0,0, + 218,10,103,101,116,95,115,111,117,114,99,101,213,2,0,0, 115,14,0,0,0,0,2,10,1,2,1,14,1,16,1,4, 1,28,1,122,23,83,111,117,114,99,101,76,111,97,100,101, 114,46,103,101,116,95,115,111,117,114,99,101,114,31,0,0, @@ -1132,7 +1132,7 @@ 112,105,108,101,41,4,114,104,0,0,0,114,56,0,0,0, 114,37,0,0,0,114,200,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,6,0,0,0,218,14,115,111,117,114,99, - 101,95,116,111,95,99,111,100,101,222,2,0,0,115,4,0, + 101,95,116,111,95,99,111,100,101,223,2,0,0,115,4,0, 0,0,0,5,12,1,122,27,83,111,117,114,99,101,76,111, 97,100,101,114,46,115,111,117,114,99,101,95,116,111,95,99, 111,100,101,99,2,0,0,0,0,0,0,0,10,0,0,0, @@ -1189,7 +1189,7 @@ 10,98,121,116,101,115,95,100,97,116,97,114,151,0,0,0, 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,184,0,0, - 0,230,2,0,0,115,78,0,0,0,0,7,10,1,4,1, + 0,231,2,0,0,115,78,0,0,0,0,7,10,1,4,1, 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, 12,1,2,1,14,1,14,1,6,2,2,1,4,1,4,1, 12,1,18,1,6,2,8,1,6,1,6,1,2,1,8,1, @@ -1201,7 +1201,7 @@ 114,196,0,0,0,114,195,0,0,0,114,199,0,0,0,114, 203,0,0,0,114,184,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,191,0, - 0,0,172,2,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,173,2,0,0,115,14,0,0,0,8,2,8,8,8, 13,8,10,8,7,8,10,14,8,114,191,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2, @@ -1209,7 +1209,7 @@ 132,0,90,5,100,6,100,7,132,0,90,6,101,7,135,0, 102,1,100,8,100,9,132,8,131,1,90,8,101,7,100,10, 100,11,132,0,131,1,90,9,100,12,100,13,132,0,90,10, - 135,0,90,11,100,14,83,0,41,15,218,10,70,105,108,101, + 135,0,4,0,90,11,83,0,41,14,218,10,70,105,108,101, 76,111,97,100,101,114,122,103,66,97,115,101,32,102,105,108, 101,32,108,111,97,100,101,114,32,99,108,97,115,115,32,119, 104,105,99,104,32,105,109,112,108,101,109,101,110,116,115,32, @@ -1227,7 +1227,7 @@ 32,102,105,110,100,101,114,46,78,41,2,114,102,0,0,0, 114,37,0,0,0,41,3,114,104,0,0,0,114,123,0,0, 0,114,37,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,182,0,0,0,31,3,0,0,115,4, + 114,6,0,0,0,114,182,0,0,0,32,3,0,0,115,4, 0,0,0,0,3,6,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,95,95,105,110,105,116,95,95,99,2,0,0, 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, @@ -1236,7 +1236,7 @@ 78,41,2,218,9,95,95,99,108,97,115,115,95,95,114,115, 0,0,0,41,2,114,104,0,0,0,218,5,111,116,104,101, 114,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,6,95,95,101,113,95,95,37,3,0,0,115,4,0,0, + 218,6,95,95,101,113,95,95,38,3,0,0,115,4,0,0, 0,0,1,12,1,122,17,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, 0,1,0,0,0,3,0,0,0,67,0,0,0,115,20,0, @@ -1244,7 +1244,7 @@ 131,1,65,0,83,0,41,1,78,41,3,218,4,104,97,115, 104,114,102,0,0,0,114,37,0,0,0,41,1,114,104,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,8,95,95,104,97,115,104,95,95,41,3,0,0,115, + 0,218,8,95,95,104,97,115,104,95,95,42,3,0,0,115, 2,0,0,0,0,1,122,19,70,105,108,101,76,111,97,100, 101,114,46,95,95,104,97,115,104,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0, @@ -1259,7 +1259,7 @@ 5,115,117,112,101,114,114,207,0,0,0,114,190,0,0,0, 41,2,114,104,0,0,0,114,123,0,0,0,41,1,114,208, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,190,0, - 0,0,44,3,0,0,115,2,0,0,0,0,10,122,22,70, + 0,0,45,3,0,0,115,2,0,0,0,0,10,122,22,70, 105,108,101,76,111,97,100,101,114,46,108,111,97,100,95,109, 111,100,117,108,101,99,2,0,0,0,0,0,0,0,2,0, 0,0,1,0,0,0,67,0,0,0,115,6,0,0,0,124, @@ -1269,7 +1269,7 @@ 111,117,110,100,32,98,121,32,116,104,101,32,102,105,110,100, 101,114,46,41,1,114,37,0,0,0,41,2,114,104,0,0, 0,114,123,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,155,0,0,0,56,3,0,0,115,2, + 114,6,0,0,0,114,155,0,0,0,57,3,0,0,115,2, 0,0,0,0,3,122,23,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,102,105,108,101,110,97,109,101,99,2, 0,0,0,0,0,0,0,3,0,0,0,9,0,0,0,67, @@ -1281,1156 +1281,1156 @@ 101,115,46,218,1,114,78,41,3,114,52,0,0,0,114,53, 0,0,0,90,4,114,101,97,100,41,3,114,104,0,0,0, 114,37,0,0,0,114,57,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,197,0,0,0,61,3, + 4,0,0,0,114,6,0,0,0,114,197,0,0,0,62,3, 0,0,115,4,0,0,0,0,2,14,1,122,19,70,105,108, 101,76,111,97,100,101,114,46,103,101,116,95,100,97,116,97, - 78,41,12,114,109,0,0,0,114,108,0,0,0,114,110,0, - 0,0,114,111,0,0,0,114,182,0,0,0,114,210,0,0, - 0,114,212,0,0,0,114,120,0,0,0,114,190,0,0,0, - 114,155,0,0,0,114,197,0,0,0,90,13,95,95,99,108, - 97,115,115,99,101,108,108,95,95,114,4,0,0,0,114,4, - 0,0,0,41,1,114,208,0,0,0,114,6,0,0,0,114, - 207,0,0,0,26,3,0,0,115,14,0,0,0,8,3,4, - 2,8,6,8,4,8,3,16,12,12,5,114,207,0,0,0, - 99,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,64,0,0,0,115,46,0,0,0,101,0,90,1,100,0, - 90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,4, - 100,5,132,0,90,5,100,6,100,7,156,1,100,8,100,9, - 132,2,90,6,100,10,83,0,41,11,218,16,83,111,117,114, - 99,101,70,105,108,101,76,111,97,100,101,114,122,62,67,111, - 110,99,114,101,116,101,32,105,109,112,108,101,109,101,110,116, - 97,116,105,111,110,32,111,102,32,83,111,117,114,99,101,76, - 111,97,100,101,114,32,117,115,105,110,103,32,116,104,101,32, - 102,105,108,101,32,115,121,115,116,101,109,46,99,2,0,0, - 0,0,0,0,0,3,0,0,0,3,0,0,0,67,0,0, - 0,115,22,0,0,0,116,0,124,1,131,1,125,2,124,2, - 106,1,124,2,106,2,100,1,156,2,83,0,41,2,122,33, - 82,101,116,117,114,110,32,116,104,101,32,109,101,116,97,100, - 97,116,97,32,102,111,114,32,116,104,101,32,112,97,116,104, - 46,41,2,114,130,0,0,0,114,131,0,0,0,41,3,114, - 41,0,0,0,218,8,115,116,95,109,116,105,109,101,90,7, - 115,116,95,115,105,122,101,41,3,114,104,0,0,0,114,37, - 0,0,0,114,205,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,194,0,0,0,71,3,0,0, - 115,4,0,0,0,0,2,8,1,122,27,83,111,117,114,99, - 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, - 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,5, - 0,0,0,5,0,0,0,67,0,0,0,115,24,0,0,0, - 116,0,124,1,131,1,125,4,124,0,106,1,124,2,124,3, - 124,4,100,1,141,3,83,0,41,2,78,41,1,218,5,95, - 109,111,100,101,41,2,114,101,0,0,0,114,195,0,0,0, - 41,5,114,104,0,0,0,114,94,0,0,0,114,93,0,0, - 0,114,56,0,0,0,114,44,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,196,0,0,0,76, - 3,0,0,115,4,0,0,0,0,2,8,1,122,32,83,111, - 117,114,99,101,70,105,108,101,76,111,97,100,101,114,46,95, - 99,97,99,104,101,95,98,121,116,101,99,111,100,101,105,182, - 1,0,0,41,1,114,217,0,0,0,99,3,0,0,0,1, - 0,0,0,9,0,0,0,17,0,0,0,67,0,0,0,115, - 250,0,0,0,116,0,124,1,131,1,92,2,125,4,125,5, - 103,0,125,6,120,40,124,4,114,56,116,1,124,4,131,1, - 12,0,114,56,116,0,124,4,131,1,92,2,125,4,125,7, - 124,6,106,2,124,7,131,1,1,0,113,18,87,0,120,108, - 116,3,124,6,131,1,68,0,93,96,125,7,116,4,124,4, - 124,7,131,2,125,4,121,14,116,5,106,6,124,4,131,1, - 1,0,87,0,113,68,4,0,116,7,107,10,114,118,1,0, - 1,0,1,0,119,68,89,0,113,68,4,0,116,8,107,10, - 114,162,1,0,125,8,1,0,122,18,116,9,106,10,100,1, - 124,4,124,8,131,3,1,0,100,2,83,0,100,2,125,8, - 126,8,88,0,113,68,88,0,113,68,87,0,121,28,116,11, - 124,1,124,2,124,3,131,3,1,0,116,9,106,10,100,3, - 124,1,131,2,1,0,87,0,110,48,4,0,116,8,107,10, - 114,244,1,0,125,8,1,0,122,20,116,9,106,10,100,1, - 124,1,124,8,131,3,1,0,87,0,89,0,100,2,100,2, - 125,8,126,8,88,0,110,2,88,0,100,2,83,0,41,4, - 122,27,87,114,105,116,101,32,98,121,116,101,115,32,100,97, - 116,97,32,116,111,32,97,32,102,105,108,101,46,122,27,99, - 111,117,108,100,32,110,111,116,32,99,114,101,97,116,101,32, - 123,33,114,125,58,32,123,33,114,125,78,122,12,99,114,101, - 97,116,101,100,32,123,33,114,125,41,12,114,40,0,0,0, - 114,48,0,0,0,114,161,0,0,0,114,35,0,0,0,114, - 30,0,0,0,114,3,0,0,0,90,5,109,107,100,105,114, - 218,15,70,105,108,101,69,120,105,115,116,115,69,114,114,111, - 114,114,42,0,0,0,114,118,0,0,0,114,133,0,0,0, - 114,58,0,0,0,41,9,114,104,0,0,0,114,37,0,0, - 0,114,56,0,0,0,114,217,0,0,0,218,6,112,97,114, - 101,110,116,114,98,0,0,0,114,29,0,0,0,114,25,0, - 0,0,114,198,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,195,0,0,0,81,3,0,0,115, - 42,0,0,0,0,2,12,1,4,2,16,1,12,1,14,2, - 14,1,10,1,2,1,14,1,14,2,6,1,16,3,6,1, - 8,1,20,1,2,1,12,1,16,1,16,2,8,1,122,25, - 83,111,117,114,99,101,70,105,108,101,76,111,97,100,101,114, - 46,115,101,116,95,100,97,116,97,78,41,7,114,109,0,0, - 0,114,108,0,0,0,114,110,0,0,0,114,111,0,0,0, - 114,194,0,0,0,114,196,0,0,0,114,195,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,215,0,0,0,67,3,0,0,115,8,0,0, - 0,8,2,4,2,8,5,8,5,114,215,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, - 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, - 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, - 132,0,90,5,100,6,83,0,41,7,218,20,83,111,117,114, - 99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,114, - 122,45,76,111,97,100,101,114,32,119,104,105,99,104,32,104, - 97,110,100,108,101,115,32,115,111,117,114,99,101,108,101,115, - 115,32,102,105,108,101,32,105,109,112,111,114,116,115,46,99, - 2,0,0,0,0,0,0,0,5,0,0,0,5,0,0,0, - 67,0,0,0,115,48,0,0,0,124,0,106,0,124,1,131, - 1,125,2,124,0,106,1,124,2,131,1,125,3,116,2,124, - 3,124,1,124,2,100,1,141,3,125,4,116,3,124,4,124, - 1,124,2,100,2,141,3,83,0,41,3,78,41,2,114,102, - 0,0,0,114,37,0,0,0,41,2,114,102,0,0,0,114, - 93,0,0,0,41,4,114,155,0,0,0,114,197,0,0,0, - 114,139,0,0,0,114,145,0,0,0,41,5,114,104,0,0, - 0,114,123,0,0,0,114,37,0,0,0,114,56,0,0,0, - 114,206,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,184,0,0,0,116,3,0,0,115,8,0, - 0,0,0,1,10,1,10,1,14,1,122,29,83,111,117,114, - 99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,114, - 46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,39,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,116,104,101,114,101,32, - 105,115,32,110,111,32,115,111,117,114,99,101,32,99,111,100, - 101,46,78,114,4,0,0,0,41,2,114,104,0,0,0,114, - 123,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,199,0,0,0,122,3,0,0,115,2,0,0, - 0,0,2,122,31,83,111,117,114,99,101,108,101,115,115,70, - 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, - 117,114,99,101,78,41,6,114,109,0,0,0,114,108,0,0, - 0,114,110,0,0,0,114,111,0,0,0,114,184,0,0,0, - 114,199,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,220,0,0,0,112,3, - 0,0,115,6,0,0,0,8,2,4,2,8,6,114,220,0, - 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, - 0,0,0,64,0,0,0,115,92,0,0,0,101,0,90,1, - 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, - 100,4,100,5,132,0,90,5,100,6,100,7,132,0,90,6, - 100,8,100,9,132,0,90,7,100,10,100,11,132,0,90,8, - 100,12,100,13,132,0,90,9,100,14,100,15,132,0,90,10, - 100,16,100,17,132,0,90,11,101,12,100,18,100,19,132,0, - 131,1,90,13,100,20,83,0,41,21,218,19,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,122, - 93,76,111,97,100,101,114,32,102,111,114,32,101,120,116,101, - 110,115,105,111,110,32,109,111,100,117,108,101,115,46,10,10, - 32,32,32,32,84,104,101,32,99,111,110,115,116,114,117,99, - 116,111,114,32,105,115,32,100,101,115,105,103,110,101,100,32, - 116,111,32,119,111,114,107,32,119,105,116,104,32,70,105,108, - 101,70,105,110,100,101,114,46,10,10,32,32,32,32,99,3, - 0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,67, - 0,0,0,115,16,0,0,0,124,1,124,0,95,0,124,2, - 124,0,95,1,100,0,83,0,41,1,78,41,2,114,102,0, - 0,0,114,37,0,0,0,41,3,114,104,0,0,0,114,102, - 0,0,0,114,37,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,182,0,0,0,139,3,0,0, - 115,4,0,0,0,0,1,6,1,122,28,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, + 41,12,114,109,0,0,0,114,108,0,0,0,114,110,0,0, + 0,114,111,0,0,0,114,182,0,0,0,114,210,0,0,0, + 114,212,0,0,0,114,120,0,0,0,114,190,0,0,0,114, + 155,0,0,0,114,197,0,0,0,90,13,95,95,99,108,97, + 115,115,99,101,108,108,95,95,114,4,0,0,0,114,4,0, + 0,0,41,1,114,208,0,0,0,114,6,0,0,0,114,207, + 0,0,0,27,3,0,0,115,14,0,0,0,8,3,4,2, + 8,6,8,4,8,3,16,12,12,5,114,207,0,0,0,99, + 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 64,0,0,0,115,46,0,0,0,101,0,90,1,100,0,90, + 2,100,1,90,3,100,2,100,3,132,0,90,4,100,4,100, + 5,132,0,90,5,100,6,100,7,156,1,100,8,100,9,132, + 2,90,6,100,10,83,0,41,11,218,16,83,111,117,114,99, + 101,70,105,108,101,76,111,97,100,101,114,122,62,67,111,110, + 99,114,101,116,101,32,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,32,111,102,32,83,111,117,114,99,101,76,111, + 97,100,101,114,32,117,115,105,110,103,32,116,104,101,32,102, + 105,108,101,32,115,121,115,116,101,109,46,99,2,0,0,0, + 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, + 115,22,0,0,0,116,0,124,1,131,1,125,2,124,2,106, + 1,124,2,106,2,100,1,156,2,83,0,41,2,122,33,82, + 101,116,117,114,110,32,116,104,101,32,109,101,116,97,100,97, + 116,97,32,102,111,114,32,116,104,101,32,112,97,116,104,46, + 41,2,114,130,0,0,0,114,131,0,0,0,41,3,114,41, + 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, + 116,95,115,105,122,101,41,3,114,104,0,0,0,114,37,0, + 0,0,114,205,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,194,0,0,0,72,3,0,0,115, + 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, + 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, + 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, + 0,0,5,0,0,0,67,0,0,0,115,24,0,0,0,116, + 0,124,1,131,1,125,4,124,0,106,1,124,2,124,3,124, + 4,100,1,141,3,83,0,41,2,78,41,1,218,5,95,109, + 111,100,101,41,2,114,101,0,0,0,114,195,0,0,0,41, + 5,114,104,0,0,0,114,94,0,0,0,114,93,0,0,0, + 114,56,0,0,0,114,44,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,196,0,0,0,77,3, + 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, + 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, + 97,99,104,101,95,98,121,116,101,99,111,100,101,105,182,1, + 0,0,41,1,114,217,0,0,0,99,3,0,0,0,1,0, + 0,0,9,0,0,0,17,0,0,0,67,0,0,0,115,250, + 0,0,0,116,0,124,1,131,1,92,2,125,4,125,5,103, + 0,125,6,120,40,124,4,114,56,116,1,124,4,131,1,12, + 0,114,56,116,0,124,4,131,1,92,2,125,4,125,7,124, + 6,106,2,124,7,131,1,1,0,113,18,87,0,120,108,116, + 3,124,6,131,1,68,0,93,96,125,7,116,4,124,4,124, + 7,131,2,125,4,121,14,116,5,106,6,124,4,131,1,1, + 0,87,0,113,68,4,0,116,7,107,10,114,118,1,0,1, + 0,1,0,119,68,89,0,113,68,4,0,116,8,107,10,114, + 162,1,0,125,8,1,0,122,18,116,9,106,10,100,1,124, + 4,124,8,131,3,1,0,100,2,83,0,100,2,125,8,126, + 8,88,0,113,68,88,0,113,68,87,0,121,28,116,11,124, + 1,124,2,124,3,131,3,1,0,116,9,106,10,100,3,124, + 1,131,2,1,0,87,0,110,48,4,0,116,8,107,10,114, + 244,1,0,125,8,1,0,122,20,116,9,106,10,100,1,124, + 1,124,8,131,3,1,0,87,0,89,0,100,2,100,2,125, + 8,126,8,88,0,110,2,88,0,100,2,83,0,41,4,122, + 27,87,114,105,116,101,32,98,121,116,101,115,32,100,97,116, + 97,32,116,111,32,97,32,102,105,108,101,46,122,27,99,111, + 117,108,100,32,110,111,116,32,99,114,101,97,116,101,32,123, + 33,114,125,58,32,123,33,114,125,78,122,12,99,114,101,97, + 116,101,100,32,123,33,114,125,41,12,114,40,0,0,0,114, + 48,0,0,0,114,161,0,0,0,114,35,0,0,0,114,30, + 0,0,0,114,3,0,0,0,90,5,109,107,100,105,114,218, + 15,70,105,108,101,69,120,105,115,116,115,69,114,114,111,114, + 114,42,0,0,0,114,118,0,0,0,114,133,0,0,0,114, + 58,0,0,0,41,9,114,104,0,0,0,114,37,0,0,0, + 114,56,0,0,0,114,217,0,0,0,218,6,112,97,114,101, + 110,116,114,98,0,0,0,114,29,0,0,0,114,25,0,0, + 0,114,198,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,195,0,0,0,82,3,0,0,115,42, + 0,0,0,0,2,12,1,4,2,16,1,12,1,14,2,14, + 1,10,1,2,1,14,1,14,2,6,1,16,3,6,1,8, + 1,20,1,2,1,12,1,16,1,16,2,8,1,122,25,83, + 111,117,114,99,101,70,105,108,101,76,111,97,100,101,114,46, + 115,101,116,95,100,97,116,97,78,41,7,114,109,0,0,0, + 114,108,0,0,0,114,110,0,0,0,114,111,0,0,0,114, + 194,0,0,0,114,196,0,0,0,114,195,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,215,0,0,0,68,3,0,0,115,8,0,0,0, + 8,2,4,2,8,5,8,5,114,215,0,0,0,99,0,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,0, + 0,0,115,32,0,0,0,101,0,90,1,100,0,90,2,100, + 1,90,3,100,2,100,3,132,0,90,4,100,4,100,5,132, + 0,90,5,100,6,83,0,41,7,218,20,83,111,117,114,99, + 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,122, + 45,76,111,97,100,101,114,32,119,104,105,99,104,32,104,97, + 110,100,108,101,115,32,115,111,117,114,99,101,108,101,115,115, + 32,102,105,108,101,32,105,109,112,111,114,116,115,46,99,2, + 0,0,0,0,0,0,0,5,0,0,0,5,0,0,0,67, + 0,0,0,115,48,0,0,0,124,0,106,0,124,1,131,1, + 125,2,124,0,106,1,124,2,131,1,125,3,116,2,124,3, + 124,1,124,2,100,1,141,3,125,4,116,3,124,4,124,1, + 124,2,100,2,141,3,83,0,41,3,78,41,2,114,102,0, + 0,0,114,37,0,0,0,41,2,114,102,0,0,0,114,93, + 0,0,0,41,4,114,155,0,0,0,114,197,0,0,0,114, + 139,0,0,0,114,145,0,0,0,41,5,114,104,0,0,0, + 114,123,0,0,0,114,37,0,0,0,114,56,0,0,0,114, + 206,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,184,0,0,0,117,3,0,0,115,8,0,0, + 0,0,1,10,1,10,1,14,1,122,29,83,111,117,114,99, + 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, + 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,83,0,41,2,122,39,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,116,104,101,114,101,32,105, + 115,32,110,111,32,115,111,117,114,99,101,32,99,111,100,101, + 46,78,114,4,0,0,0,41,2,114,104,0,0,0,114,123, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,199,0,0,0,123,3,0,0,115,2,0,0,0, + 0,2,122,31,83,111,117,114,99,101,108,101,115,115,70,105, + 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, + 114,99,101,78,41,6,114,109,0,0,0,114,108,0,0,0, + 114,110,0,0,0,114,111,0,0,0,114,184,0,0,0,114, + 199,0,0,0,114,4,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,6,0,0,0,114,220,0,0,0,113,3,0, + 0,115,6,0,0,0,8,2,4,2,8,6,114,220,0,0, + 0,99,0,0,0,0,0,0,0,0,0,0,0,0,3,0, + 0,0,64,0,0,0,115,92,0,0,0,101,0,90,1,100, + 0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100, + 4,100,5,132,0,90,5,100,6,100,7,132,0,90,6,100, + 8,100,9,132,0,90,7,100,10,100,11,132,0,90,8,100, + 12,100,13,132,0,90,9,100,14,100,15,132,0,90,10,100, + 16,100,17,132,0,90,11,101,12,100,18,100,19,132,0,131, + 1,90,13,100,20,83,0,41,21,218,19,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,122,93, + 76,111,97,100,101,114,32,102,111,114,32,101,120,116,101,110, + 115,105,111,110,32,109,111,100,117,108,101,115,46,10,10,32, + 32,32,32,84,104,101,32,99,111,110,115,116,114,117,99,116, + 111,114,32,105,115,32,100,101,115,105,103,110,101,100,32,116, + 111,32,119,111,114,107,32,119,105,116,104,32,70,105,108,101, + 70,105,110,100,101,114,46,10,10,32,32,32,32,99,3,0, + 0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,0, + 0,0,115,16,0,0,0,124,1,124,0,95,0,124,2,124, + 0,95,1,100,0,83,0,41,1,78,41,2,114,102,0,0, + 0,114,37,0,0,0,41,3,114,104,0,0,0,114,102,0, + 0,0,114,37,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,182,0,0,0,140,3,0,0,115, + 4,0,0,0,0,1,6,1,122,28,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, + 105,110,105,116,95,95,99,2,0,0,0,0,0,0,0,2, + 0,0,0,2,0,0,0,67,0,0,0,115,24,0,0,0, + 124,0,106,0,124,1,106,0,107,2,111,22,124,0,106,1, + 124,1,106,1,107,2,83,0,41,1,78,41,2,114,208,0, + 0,0,114,115,0,0,0,41,2,114,104,0,0,0,114,209, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,210,0,0,0,144,3,0,0,115,4,0,0,0, + 0,1,12,1,122,26,69,120,116,101,110,115,105,111,110,70, + 105,108,101,76,111,97,100,101,114,46,95,95,101,113,95,95, + 99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0, + 0,67,0,0,0,115,20,0,0,0,116,0,124,0,106,1, + 131,1,116,0,124,0,106,2,131,1,65,0,83,0,41,1, + 78,41,3,114,211,0,0,0,114,102,0,0,0,114,37,0, + 0,0,41,1,114,104,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,6,0,0,0,114,212,0,0,0,148,3,0, + 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, + 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,3, + 0,0,0,4,0,0,0,67,0,0,0,115,36,0,0,0, + 116,0,106,1,116,2,106,3,124,1,131,2,125,2,116,0, + 106,4,100,1,124,1,106,5,124,0,106,6,131,3,1,0, + 124,2,83,0,41,2,122,38,67,114,101,97,116,101,32,97, + 110,32,117,110,105,116,105,97,108,105,122,101,100,32,101,120, + 116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,38, + 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, + 32,123,33,114,125,32,108,111,97,100,101,100,32,102,114,111, + 109,32,123,33,114,125,41,7,114,118,0,0,0,114,185,0, + 0,0,114,143,0,0,0,90,14,99,114,101,97,116,101,95, + 100,121,110,97,109,105,99,114,133,0,0,0,114,102,0,0, + 0,114,37,0,0,0,41,3,114,104,0,0,0,114,162,0, + 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,183,0,0,0,151,3,0,0,115, + 10,0,0,0,0,2,4,1,10,1,6,1,12,1,122,33, + 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97, + 100,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108, + 101,99,2,0,0,0,0,0,0,0,2,0,0,0,4,0, + 0,0,67,0,0,0,115,36,0,0,0,116,0,106,1,116, + 2,106,3,124,1,131,2,1,0,116,0,106,4,100,1,124, + 0,106,5,124,0,106,6,131,3,1,0,100,2,83,0,41, + 3,122,30,73,110,105,116,105,97,108,105,122,101,32,97,110, + 32,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, + 101,122,40,101,120,116,101,110,115,105,111,110,32,109,111,100, + 117,108,101,32,123,33,114,125,32,101,120,101,99,117,116,101, + 100,32,102,114,111,109,32,123,33,114,125,78,41,7,114,118, + 0,0,0,114,185,0,0,0,114,143,0,0,0,90,12,101, + 120,101,99,95,100,121,110,97,109,105,99,114,133,0,0,0, + 114,102,0,0,0,114,37,0,0,0,41,2,114,104,0,0, + 0,114,187,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,188,0,0,0,159,3,0,0,115,6, + 0,0,0,0,2,14,1,6,1,122,31,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,101, + 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0, + 0,0,0,2,0,0,0,4,0,0,0,3,0,0,0,115, + 36,0,0,0,116,0,124,0,106,1,131,1,100,1,25,0, + 137,0,116,2,135,0,102,1,100,2,100,3,132,8,116,3, + 68,0,131,1,131,1,83,0,41,4,122,49,82,101,116,117, + 114,110,32,84,114,117,101,32,105,102,32,116,104,101,32,101, + 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,32, + 105,115,32,97,32,112,97,99,107,97,103,101,46,114,31,0, + 0,0,99,1,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,51,0,0,0,115,26,0,0,0,124,0,93,18, + 125,1,136,0,100,0,124,1,23,0,107,2,86,0,1,0, + 113,2,100,1,83,0,41,2,114,182,0,0,0,78,114,4, + 0,0,0,41,2,114,24,0,0,0,218,6,115,117,102,102, + 105,120,41,1,218,9,102,105,108,101,95,110,97,109,101,114, + 4,0,0,0,114,6,0,0,0,250,9,60,103,101,110,101, + 120,112,114,62,168,3,0,0,115,2,0,0,0,4,1,122, + 49,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, + 97,100,101,114,46,105,115,95,112,97,99,107,97,103,101,46, + 60,108,111,99,97,108,115,62,46,60,103,101,110,101,120,112, + 114,62,41,4,114,40,0,0,0,114,37,0,0,0,218,3, + 97,110,121,218,18,69,88,84,69,78,83,73,79,78,95,83, + 85,70,70,73,88,69,83,41,2,114,104,0,0,0,114,123, + 0,0,0,114,4,0,0,0,41,1,114,223,0,0,0,114, + 6,0,0,0,114,157,0,0,0,165,3,0,0,115,6,0, + 0,0,0,2,14,1,12,1,122,30,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,115, + 95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,83,0,41,2,122,63,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,97,110,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,32,99,97,110, + 110,111,116,32,99,114,101,97,116,101,32,97,32,99,111,100, + 101,32,111,98,106,101,99,116,46,78,114,4,0,0,0,41, + 2,114,104,0,0,0,114,123,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,6,0,0,0,114,184,0,0,0,171, + 3,0,0,115,2,0,0,0,0,2,122,28,69,120,116,101, + 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, + 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,83,0,41,2,122,53,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,101,120,116,101,110,115,105, + 111,110,32,109,111,100,117,108,101,115,32,104,97,118,101,32, + 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, + 114,4,0,0,0,41,2,114,104,0,0,0,114,123,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,199,0,0,0,175,3,0,0,115,2,0,0,0,0,2, + 122,30,69,120,116,101,110,115,105,111,110,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, + 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, + 0,67,0,0,0,115,6,0,0,0,124,0,106,0,83,0, + 41,1,122,58,82,101,116,117,114,110,32,116,104,101,32,112, + 97,116,104,32,116,111,32,116,104,101,32,115,111,117,114,99, + 101,32,102,105,108,101,32,97,115,32,102,111,117,110,100,32, + 98,121,32,116,104,101,32,102,105,110,100,101,114,46,41,1, + 114,37,0,0,0,41,2,114,104,0,0,0,114,123,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,155,0,0,0,179,3,0,0,115,2,0,0,0,0,3, + 122,32,69,120,116,101,110,115,105,111,110,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,102,105,108,101,110,97, + 109,101,78,41,14,114,109,0,0,0,114,108,0,0,0,114, + 110,0,0,0,114,111,0,0,0,114,182,0,0,0,114,210, + 0,0,0,114,212,0,0,0,114,183,0,0,0,114,188,0, + 0,0,114,157,0,0,0,114,184,0,0,0,114,199,0,0, + 0,114,120,0,0,0,114,155,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 221,0,0,0,132,3,0,0,115,20,0,0,0,8,6,4, + 2,8,4,8,4,8,3,8,8,8,6,8,6,8,4,8, + 4,114,221,0,0,0,99,0,0,0,0,0,0,0,0,0, + 0,0,0,2,0,0,0,64,0,0,0,115,96,0,0,0, + 101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3, + 132,0,90,4,100,4,100,5,132,0,90,5,100,6,100,7, + 132,0,90,6,100,8,100,9,132,0,90,7,100,10,100,11, + 132,0,90,8,100,12,100,13,132,0,90,9,100,14,100,15, + 132,0,90,10,100,16,100,17,132,0,90,11,100,18,100,19, + 132,0,90,12,100,20,100,21,132,0,90,13,100,22,83,0, + 41,23,218,14,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,97,38,1,0,0,82,101,112,114,101,115,101,110,116, + 115,32,97,32,110,97,109,101,115,112,97,99,101,32,112,97, + 99,107,97,103,101,39,115,32,112,97,116,104,46,32,32,73, + 116,32,117,115,101,115,32,116,104,101,32,109,111,100,117,108, + 101,32,110,97,109,101,10,32,32,32,32,116,111,32,102,105, + 110,100,32,105,116,115,32,112,97,114,101,110,116,32,109,111, + 100,117,108,101,44,32,97,110,100,32,102,114,111,109,32,116, + 104,101,114,101,32,105,116,32,108,111,111,107,115,32,117,112, + 32,116,104,101,32,112,97,114,101,110,116,39,115,10,32,32, + 32,32,95,95,112,97,116,104,95,95,46,32,32,87,104,101, + 110,32,116,104,105,115,32,99,104,97,110,103,101,115,44,32, + 116,104,101,32,109,111,100,117,108,101,39,115,32,111,119,110, + 32,112,97,116,104,32,105,115,32,114,101,99,111,109,112,117, + 116,101,100,44,10,32,32,32,32,117,115,105,110,103,32,112, + 97,116,104,95,102,105,110,100,101,114,46,32,32,70,111,114, + 32,116,111,112,45,108,101,118,101,108,32,109,111,100,117,108, + 101,115,44,32,116,104,101,32,112,97,114,101,110,116,32,109, + 111,100,117,108,101,39,115,32,112,97,116,104,10,32,32,32, + 32,105,115,32,115,121,115,46,112,97,116,104,46,99,4,0, + 0,0,0,0,0,0,4,0,0,0,2,0,0,0,67,0, + 0,0,115,36,0,0,0,124,1,124,0,95,0,124,2,124, + 0,95,1,116,2,124,0,106,3,131,0,131,1,124,0,95, + 4,124,3,124,0,95,5,100,0,83,0,41,1,78,41,6, + 218,5,95,110,97,109,101,218,5,95,112,97,116,104,114,97, + 0,0,0,218,16,95,103,101,116,95,112,97,114,101,110,116, + 95,112,97,116,104,218,17,95,108,97,115,116,95,112,97,114, + 101,110,116,95,112,97,116,104,218,12,95,112,97,116,104,95, + 102,105,110,100,101,114,41,4,114,104,0,0,0,114,102,0, + 0,0,114,37,0,0,0,218,11,112,97,116,104,95,102,105, + 110,100,101,114,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,182,0,0,0,192,3,0,0,115,8,0,0, + 0,0,1,6,1,6,1,14,1,122,23,95,78,97,109,101, + 115,112,97,99,101,80,97,116,104,46,95,95,105,110,105,116, + 95,95,99,1,0,0,0,0,0,0,0,4,0,0,0,3, + 0,0,0,67,0,0,0,115,38,0,0,0,124,0,106,0, + 106,1,100,1,131,1,92,3,125,1,125,2,125,3,124,2, + 100,2,107,2,114,30,100,6,83,0,124,1,100,5,102,2, + 83,0,41,7,122,62,82,101,116,117,114,110,115,32,97,32, + 116,117,112,108,101,32,111,102,32,40,112,97,114,101,110,116, + 45,109,111,100,117,108,101,45,110,97,109,101,44,32,112,97, + 114,101,110,116,45,112,97,116,104,45,97,116,116,114,45,110, + 97,109,101,41,114,61,0,0,0,114,32,0,0,0,114,8, + 0,0,0,114,37,0,0,0,90,8,95,95,112,97,116,104, + 95,95,41,2,114,8,0,0,0,114,37,0,0,0,41,2, + 114,228,0,0,0,114,34,0,0,0,41,4,114,104,0,0, + 0,114,219,0,0,0,218,3,100,111,116,90,2,109,101,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,23, + 95,102,105,110,100,95,112,97,114,101,110,116,95,112,97,116, + 104,95,110,97,109,101,115,198,3,0,0,115,8,0,0,0, + 0,2,18,1,8,2,4,3,122,38,95,78,97,109,101,115, + 112,97,99,101,80,97,116,104,46,95,102,105,110,100,95,112, + 97,114,101,110,116,95,112,97,116,104,95,110,97,109,101,115, + 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, + 0,67,0,0,0,115,28,0,0,0,124,0,106,0,131,0, + 92,2,125,1,125,2,116,1,116,2,106,3,124,1,25,0, + 124,2,131,2,83,0,41,1,78,41,4,114,235,0,0,0, + 114,114,0,0,0,114,8,0,0,0,218,7,109,111,100,117, + 108,101,115,41,3,114,104,0,0,0,90,18,112,97,114,101, + 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14, + 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,230,0, + 0,0,208,3,0,0,115,4,0,0,0,0,1,12,1,122, + 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, + 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104, + 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, + 0,67,0,0,0,115,80,0,0,0,116,0,124,0,106,1, + 131,0,131,1,125,1,124,1,124,0,106,2,107,3,114,74, + 124,0,106,3,124,0,106,4,124,1,131,2,125,2,124,2, + 100,0,107,9,114,68,124,2,106,5,100,0,107,8,114,68, + 124,2,106,6,114,68,124,2,106,6,124,0,95,7,124,1, + 124,0,95,2,124,0,106,7,83,0,41,1,78,41,8,114, + 97,0,0,0,114,230,0,0,0,114,231,0,0,0,114,232, + 0,0,0,114,228,0,0,0,114,124,0,0,0,114,154,0, + 0,0,114,229,0,0,0,41,3,114,104,0,0,0,90,11, + 112,97,114,101,110,116,95,112,97,116,104,114,162,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, + 12,95,114,101,99,97,108,99,117,108,97,116,101,212,3,0, + 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, + 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, + 97,116,101,99,1,0,0,0,0,0,0,0,1,0,0,0, + 2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,124, + 0,106,1,131,0,131,1,83,0,41,1,78,41,2,218,4, + 105,116,101,114,114,237,0,0,0,41,1,114,104,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, + 8,95,95,105,116,101,114,95,95,225,3,0,0,115,2,0, + 0,0,0,1,122,23,95,78,97,109,101,115,112,97,99,101, + 80,97,116,104,46,95,95,105,116,101,114,95,95,99,3,0, + 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, + 0,0,115,14,0,0,0,124,2,124,0,106,0,124,1,60, + 0,100,0,83,0,41,1,78,41,1,114,229,0,0,0,41, + 3,114,104,0,0,0,218,5,105,110,100,101,120,114,37,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,11,95,95,115,101,116,105,116,101,109,95,95,228,3, + 0,0,115,2,0,0,0,0,1,122,26,95,78,97,109,101, + 115,112,97,99,101,80,97,116,104,46,95,95,115,101,116,105, + 116,101,109,95,95,99,1,0,0,0,0,0,0,0,1,0, + 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116, + 0,124,0,106,1,131,0,131,1,83,0,41,1,78,41,2, + 114,33,0,0,0,114,237,0,0,0,41,1,114,104,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 218,7,95,95,108,101,110,95,95,231,3,0,0,115,2,0, + 0,0,0,1,122,22,95,78,97,109,101,115,112,97,99,101, + 80,97,116,104,46,95,95,108,101,110,95,95,99,1,0,0, + 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, + 0,115,12,0,0,0,100,1,106,0,124,0,106,1,131,1, + 83,0,41,2,78,122,20,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,40,123,33,114,125,41,41,2,114,50,0, + 0,0,114,229,0,0,0,41,1,114,104,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,95, + 95,114,101,112,114,95,95,234,3,0,0,115,2,0,0,0, + 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,114,101,112,114,95,95,99,2,0,0,0, + 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, + 115,12,0,0,0,124,1,124,0,106,0,131,0,107,6,83, + 0,41,1,78,41,1,114,237,0,0,0,41,2,114,104,0, + 0,0,218,4,105,116,101,109,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,218,12,95,95,99,111,110,116,97, + 105,110,115,95,95,237,3,0,0,115,2,0,0,0,0,1, + 122,27,95,78,97,109,101,115,112,97,99,101,80,97,116,104, + 46,95,95,99,111,110,116,97,105,110,115,95,95,99,2,0, + 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, + 0,0,115,16,0,0,0,124,0,106,0,106,1,124,1,131, + 1,1,0,100,0,83,0,41,1,78,41,2,114,229,0,0, + 0,114,161,0,0,0,41,2,114,104,0,0,0,114,244,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,114,161,0,0,0,240,3,0,0,115,2,0,0,0,0, + 1,122,21,95,78,97,109,101,115,112,97,99,101,80,97,116, + 104,46,97,112,112,101,110,100,78,41,14,114,109,0,0,0, + 114,108,0,0,0,114,110,0,0,0,114,111,0,0,0,114, + 182,0,0,0,114,235,0,0,0,114,230,0,0,0,114,237, + 0,0,0,114,239,0,0,0,114,241,0,0,0,114,242,0, + 0,0,114,243,0,0,0,114,245,0,0,0,114,161,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,227,0,0,0,185,3,0,0,115,22, + 0,0,0,8,5,4,2,8,6,8,10,8,4,8,13,8, + 3,8,3,8,3,8,3,8,3,114,227,0,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, + 0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2, + 100,1,100,2,132,0,90,3,101,4,100,3,100,4,132,0, + 131,1,90,5,100,5,100,6,132,0,90,6,100,7,100,8, + 132,0,90,7,100,9,100,10,132,0,90,8,100,11,100,12, + 132,0,90,9,100,13,100,14,132,0,90,10,100,15,100,16, + 132,0,90,11,100,17,83,0,41,18,218,16,95,78,97,109, + 101,115,112,97,99,101,76,111,97,100,101,114,99,4,0,0, + 0,0,0,0,0,4,0,0,0,4,0,0,0,67,0,0, + 0,115,18,0,0,0,116,0,124,1,124,2,124,3,131,3, + 124,0,95,1,100,0,83,0,41,1,78,41,2,114,227,0, + 0,0,114,229,0,0,0,41,4,114,104,0,0,0,114,102, + 0,0,0,114,37,0,0,0,114,233,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,182,0,0, + 0,246,3,0,0,115,2,0,0,0,0,1,122,25,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,95, 95,105,110,105,116,95,95,99,2,0,0,0,0,0,0,0, - 2,0,0,0,2,0,0,0,67,0,0,0,115,24,0,0, - 0,124,0,106,0,124,1,106,0,107,2,111,22,124,0,106, - 1,124,1,106,1,107,2,83,0,41,1,78,41,2,114,208, - 0,0,0,114,115,0,0,0,41,2,114,104,0,0,0,114, - 209,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,210,0,0,0,143,3,0,0,115,4,0,0, - 0,0,1,12,1,122,26,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,46,95,95,101,113,95, - 95,99,1,0,0,0,0,0,0,0,1,0,0,0,3,0, - 0,0,67,0,0,0,115,20,0,0,0,116,0,124,0,106, - 1,131,1,116,0,124,0,106,2,131,1,65,0,83,0,41, - 1,78,41,3,114,211,0,0,0,114,102,0,0,0,114,37, - 0,0,0,41,1,114,104,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,212,0,0,0,147,3, - 0,0,115,2,0,0,0,0,1,122,28,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, - 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, - 3,0,0,0,4,0,0,0,67,0,0,0,115,36,0,0, - 0,116,0,106,1,116,2,106,3,124,1,131,2,125,2,116, - 0,106,4,100,1,124,1,106,5,124,0,106,6,131,3,1, - 0,124,2,83,0,41,2,122,38,67,114,101,97,116,101,32, - 97,110,32,117,110,105,116,105,97,108,105,122,101,100,32,101, - 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,122, - 38,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, - 101,32,123,33,114,125,32,108,111,97,100,101,100,32,102,114, - 111,109,32,123,33,114,125,41,7,114,118,0,0,0,114,185, - 0,0,0,114,143,0,0,0,90,14,99,114,101,97,116,101, - 95,100,121,110,97,109,105,99,114,133,0,0,0,114,102,0, - 0,0,114,37,0,0,0,41,3,114,104,0,0,0,114,162, - 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,183,0,0,0,150,3,0,0, - 115,10,0,0,0,0,2,4,1,10,1,6,1,12,1,122, - 33,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, - 97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,117, - 108,101,99,2,0,0,0,0,0,0,0,2,0,0,0,4, - 0,0,0,67,0,0,0,115,36,0,0,0,116,0,106,1, - 116,2,106,3,124,1,131,2,1,0,116,0,106,4,100,1, - 124,0,106,5,124,0,106,6,131,3,1,0,100,2,83,0, - 41,3,122,30,73,110,105,116,105,97,108,105,122,101,32,97, - 110,32,101,120,116,101,110,115,105,111,110,32,109,111,100,117, - 108,101,122,40,101,120,116,101,110,115,105,111,110,32,109,111, - 100,117,108,101,32,123,33,114,125,32,101,120,101,99,117,116, - 101,100,32,102,114,111,109,32,123,33,114,125,78,41,7,114, - 118,0,0,0,114,185,0,0,0,114,143,0,0,0,90,12, - 101,120,101,99,95,100,121,110,97,109,105,99,114,133,0,0, - 0,114,102,0,0,0,114,37,0,0,0,41,2,114,104,0, + 2,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, + 0,100,1,106,0,124,1,106,1,131,1,83,0,41,2,122, + 115,82,101,116,117,114,110,32,114,101,112,114,32,102,111,114, + 32,116,104,101,32,109,111,100,117,108,101,46,10,10,32,32, + 32,32,32,32,32,32,84,104,101,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,84,104,101,32,105,109,112,111,114,116,32,109,97,99,104, + 105,110,101,114,121,32,100,111,101,115,32,116,104,101,32,106, + 111,98,32,105,116,115,101,108,102,46,10,10,32,32,32,32, + 32,32,32,32,122,25,60,109,111,100,117,108,101,32,123,33, + 114,125,32,40,110,97,109,101,115,112,97,99,101,41,62,41, + 2,114,50,0,0,0,114,109,0,0,0,41,2,114,168,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,188,0,0,0,158,3,0,0,115, - 6,0,0,0,0,2,14,1,6,1,122,31,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, - 101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,0, - 0,0,0,0,2,0,0,0,4,0,0,0,3,0,0,0, - 115,36,0,0,0,116,0,124,0,106,1,131,1,100,1,25, - 0,137,0,116,2,135,0,102,1,100,2,100,3,132,8,116, - 3,68,0,131,1,131,1,83,0,41,4,122,49,82,101,116, - 117,114,110,32,84,114,117,101,32,105,102,32,116,104,101,32, - 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, - 32,105,115,32,97,32,112,97,99,107,97,103,101,46,114,31, - 0,0,0,99,1,0,0,0,0,0,0,0,2,0,0,0, - 4,0,0,0,51,0,0,0,115,26,0,0,0,124,0,93, - 18,125,1,136,0,100,0,124,1,23,0,107,2,86,0,1, - 0,113,2,100,1,83,0,41,2,114,182,0,0,0,78,114, - 4,0,0,0,41,2,114,24,0,0,0,218,6,115,117,102, - 102,105,120,41,1,218,9,102,105,108,101,95,110,97,109,101, - 114,4,0,0,0,114,6,0,0,0,250,9,60,103,101,110, - 101,120,112,114,62,167,3,0,0,115,2,0,0,0,4,1, - 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, - 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, - 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, - 112,114,62,41,4,114,40,0,0,0,114,37,0,0,0,218, - 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, - 83,85,70,70,73,88,69,83,41,2,114,104,0,0,0,114, - 123,0,0,0,114,4,0,0,0,41,1,114,223,0,0,0, - 114,6,0,0,0,114,157,0,0,0,164,3,0,0,115,6, - 0,0,0,0,2,14,1,12,1,122,30,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,105, - 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,63,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,97,110,32,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,32,99,97, - 110,110,111,116,32,99,114,101,97,116,101,32,97,32,99,111, - 100,101,32,111,98,106,101,99,116,46,78,114,4,0,0,0, - 41,2,114,104,0,0,0,114,123,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,114,184,0,0,0, - 170,3,0,0,115,2,0,0,0,0,2,122,28,69,120,116, - 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, - 46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,53,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,101,120,116,101,110,115, - 105,111,110,32,109,111,100,117,108,101,115,32,104,97,118,101, - 32,110,111,32,115,111,117,114,99,101,32,99,111,100,101,46, - 78,114,4,0,0,0,41,2,114,104,0,0,0,114,123,0, + 0,114,6,0,0,0,218,11,109,111,100,117,108,101,95,114, + 101,112,114,249,3,0,0,115,2,0,0,0,0,7,122,28, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,109,111,100,117,108,101,95,114,101,112,114,99,2,0,0, + 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, + 0,115,4,0,0,0,100,1,83,0,41,2,78,84,114,4, + 0,0,0,41,2,114,104,0,0,0,114,123,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,157, + 0,0,0,2,4,0,0,115,2,0,0,0,0,1,122,27, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, + 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, + 115,4,0,0,0,100,1,83,0,41,2,78,114,32,0,0, + 0,114,4,0,0,0,41,2,114,104,0,0,0,114,123,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,199,0,0,0,174,3,0,0,115,2,0,0,0,0, - 2,122,30,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99, - 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, - 0,0,67,0,0,0,115,6,0,0,0,124,0,106,0,83, - 0,41,1,122,58,82,101,116,117,114,110,32,116,104,101,32, - 112,97,116,104,32,116,111,32,116,104,101,32,115,111,117,114, - 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, - 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, - 1,114,37,0,0,0,41,2,114,104,0,0,0,114,123,0, + 0,114,199,0,0,0,5,4,0,0,115,2,0,0,0,0, + 1,122,27,95,78,97,109,101,115,112,97,99,101,76,111,97, + 100,101,114,46,103,101,116,95,115,111,117,114,99,101,99,2, + 0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,67, + 0,0,0,115,16,0,0,0,116,0,100,1,100,2,100,3, + 100,4,100,5,141,4,83,0,41,6,78,114,32,0,0,0, + 122,8,60,115,116,114,105,110,103,62,114,186,0,0,0,84, + 41,1,114,201,0,0,0,41,1,114,202,0,0,0,41,2, + 114,104,0,0,0,114,123,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,184,0,0,0,8,4, + 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101, + 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, + 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, + 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1, + 83,0,41,2,122,42,85,115,101,32,100,101,102,97,117,108, + 116,32,115,101,109,97,110,116,105,99,115,32,102,111,114,32, + 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46, + 78,114,4,0,0,0,41,2,114,104,0,0,0,114,162,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,155,0,0,0,178,3,0,0,115,2,0,0,0,0, - 3,122,32,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,103,101,116,95,102,105,108,101,110, - 97,109,101,78,41,14,114,109,0,0,0,114,108,0,0,0, - 114,110,0,0,0,114,111,0,0,0,114,182,0,0,0,114, - 210,0,0,0,114,212,0,0,0,114,183,0,0,0,114,188, - 0,0,0,114,157,0,0,0,114,184,0,0,0,114,199,0, - 0,0,114,120,0,0,0,114,155,0,0,0,114,4,0,0, + 0,114,183,0,0,0,11,4,0,0,115,0,0,0,0,122, + 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, + 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, + 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, + 67,0,0,0,115,4,0,0,0,100,0,83,0,41,1,78, + 114,4,0,0,0,41,2,114,104,0,0,0,114,187,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,221,0,0,0,131,3,0,0,115,20,0,0,0,8,6, - 4,2,8,4,8,4,8,3,8,8,8,6,8,6,8,4, - 8,4,114,221,0,0,0,99,0,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,64,0,0,0,115,96,0,0, - 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100, - 3,132,0,90,4,100,4,100,5,132,0,90,5,100,6,100, - 7,132,0,90,6,100,8,100,9,132,0,90,7,100,10,100, - 11,132,0,90,8,100,12,100,13,132,0,90,9,100,14,100, - 15,132,0,90,10,100,16,100,17,132,0,90,11,100,18,100, - 19,132,0,90,12,100,20,100,21,132,0,90,13,100,22,83, - 0,41,23,218,14,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,97,38,1,0,0,82,101,112,114,101,115,101,110, - 116,115,32,97,32,110,97,109,101,115,112,97,99,101,32,112, - 97,99,107,97,103,101,39,115,32,112,97,116,104,46,32,32, - 73,116,32,117,115,101,115,32,116,104,101,32,109,111,100,117, - 108,101,32,110,97,109,101,10,32,32,32,32,116,111,32,102, - 105,110,100,32,105,116,115,32,112,97,114,101,110,116,32,109, - 111,100,117,108,101,44,32,97,110,100,32,102,114,111,109,32, - 116,104,101,114,101,32,105,116,32,108,111,111,107,115,32,117, - 112,32,116,104,101,32,112,97,114,101,110,116,39,115,10,32, - 32,32,32,95,95,112,97,116,104,95,95,46,32,32,87,104, - 101,110,32,116,104,105,115,32,99,104,97,110,103,101,115,44, - 32,116,104,101,32,109,111,100,117,108,101,39,115,32,111,119, - 110,32,112,97,116,104,32,105,115,32,114,101,99,111,109,112, - 117,116,101,100,44,10,32,32,32,32,117,115,105,110,103,32, - 112,97,116,104,95,102,105,110,100,101,114,46,32,32,70,111, - 114,32,116,111,112,45,108,101,118,101,108,32,109,111,100,117, - 108,101,115,44,32,116,104,101,32,112,97,114,101,110,116,32, - 109,111,100,117,108,101,39,115,32,112,97,116,104,10,32,32, - 32,32,105,115,32,115,121,115,46,112,97,116,104,46,99,4, - 0,0,0,0,0,0,0,4,0,0,0,2,0,0,0,67, - 0,0,0,115,36,0,0,0,124,1,124,0,95,0,124,2, - 124,0,95,1,116,2,124,0,106,3,131,0,131,1,124,0, - 95,4,124,3,124,0,95,5,100,0,83,0,41,1,78,41, - 6,218,5,95,110,97,109,101,218,5,95,112,97,116,104,114, - 97,0,0,0,218,16,95,103,101,116,95,112,97,114,101,110, - 116,95,112,97,116,104,218,17,95,108,97,115,116,95,112,97, - 114,101,110,116,95,112,97,116,104,218,12,95,112,97,116,104, - 95,102,105,110,100,101,114,41,4,114,104,0,0,0,114,102, - 0,0,0,114,37,0,0,0,218,11,112,97,116,104,95,102, - 105,110,100,101,114,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,182,0,0,0,191,3,0,0,115,8,0, - 0,0,0,1,6,1,6,1,14,1,122,23,95,78,97,109, - 101,115,112,97,99,101,80,97,116,104,46,95,95,105,110,105, - 116,95,95,99,1,0,0,0,0,0,0,0,4,0,0,0, - 3,0,0,0,67,0,0,0,115,38,0,0,0,124,0,106, - 0,106,1,100,1,131,1,92,3,125,1,125,2,125,3,124, - 2,100,2,107,2,114,30,100,6,83,0,124,1,100,5,102, - 2,83,0,41,7,122,62,82,101,116,117,114,110,115,32,97, - 32,116,117,112,108,101,32,111,102,32,40,112,97,114,101,110, - 116,45,109,111,100,117,108,101,45,110,97,109,101,44,32,112, - 97,114,101,110,116,45,112,97,116,104,45,97,116,116,114,45, - 110,97,109,101,41,114,61,0,0,0,114,32,0,0,0,114, - 8,0,0,0,114,37,0,0,0,90,8,95,95,112,97,116, - 104,95,95,41,2,114,8,0,0,0,114,37,0,0,0,41, - 2,114,228,0,0,0,114,34,0,0,0,41,4,114,104,0, - 0,0,114,219,0,0,0,218,3,100,111,116,90,2,109,101, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 23,95,102,105,110,100,95,112,97,114,101,110,116,95,112,97, - 116,104,95,110,97,109,101,115,197,3,0,0,115,8,0,0, - 0,0,2,18,1,8,2,4,3,122,38,95,78,97,109,101, - 115,112,97,99,101,80,97,116,104,46,95,102,105,110,100,95, - 112,97,114,101,110,116,95,112,97,116,104,95,110,97,109,101, - 115,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,67,0,0,0,115,28,0,0,0,124,0,106,0,131, - 0,92,2,125,1,125,2,116,1,116,2,106,3,124,1,25, - 0,124,2,131,2,83,0,41,1,78,41,4,114,235,0,0, - 0,114,114,0,0,0,114,8,0,0,0,218,7,109,111,100, - 117,108,101,115,41,3,114,104,0,0,0,90,18,112,97,114, - 101,110,116,95,109,111,100,117,108,101,95,110,97,109,101,90, - 14,112,97,116,104,95,97,116,116,114,95,110,97,109,101,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,230, - 0,0,0,207,3,0,0,115,4,0,0,0,0,1,12,1, - 122,31,95,78,97,109,101,115,112,97,99,101,80,97,116,104, - 46,95,103,101,116,95,112,97,114,101,110,116,95,112,97,116, - 104,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,67,0,0,0,115,80,0,0,0,116,0,124,0,106, - 1,131,0,131,1,125,1,124,1,124,0,106,2,107,3,114, - 74,124,0,106,3,124,0,106,4,124,1,131,2,125,2,124, - 2,100,0,107,9,114,68,124,2,106,5,100,0,107,8,114, - 68,124,2,106,6,114,68,124,2,106,6,124,0,95,7,124, - 1,124,0,95,2,124,0,106,7,83,0,41,1,78,41,8, - 114,97,0,0,0,114,230,0,0,0,114,231,0,0,0,114, - 232,0,0,0,114,228,0,0,0,114,124,0,0,0,114,154, - 0,0,0,114,229,0,0,0,41,3,114,104,0,0,0,90, - 11,112,97,114,101,110,116,95,112,97,116,104,114,162,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,12,95,114,101,99,97,108,99,117,108,97,116,101,211,3, - 0,0,115,16,0,0,0,0,2,12,1,10,1,14,3,18, - 1,6,1,8,1,6,1,122,27,95,78,97,109,101,115,112, - 97,99,101,80,97,116,104,46,95,114,101,99,97,108,99,117, - 108,97,116,101,99,1,0,0,0,0,0,0,0,1,0,0, - 0,2,0,0,0,67,0,0,0,115,12,0,0,0,116,0, - 124,0,106,1,131,0,131,1,83,0,41,1,78,41,2,218, - 4,105,116,101,114,114,237,0,0,0,41,1,114,104,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,8,95,95,105,116,101,114,95,95,224,3,0,0,115,2, - 0,0,0,0,1,122,23,95,78,97,109,101,115,112,97,99, - 101,80,97,116,104,46,95,95,105,116,101,114,95,95,99,3, - 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, - 0,0,0,115,14,0,0,0,124,2,124,0,106,0,124,1, - 60,0,100,0,83,0,41,1,78,41,1,114,229,0,0,0, - 41,3,114,104,0,0,0,218,5,105,110,100,101,120,114,37, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,11,95,95,115,101,116,105,116,101,109,95,95,227, - 3,0,0,115,2,0,0,0,0,1,122,26,95,78,97,109, - 101,115,112,97,99,101,80,97,116,104,46,95,95,115,101,116, - 105,116,101,109,95,95,99,1,0,0,0,0,0,0,0,1, - 0,0,0,2,0,0,0,67,0,0,0,115,12,0,0,0, - 116,0,124,0,106,1,131,0,131,1,83,0,41,1,78,41, - 2,114,33,0,0,0,114,237,0,0,0,41,1,114,104,0, + 114,188,0,0,0,14,4,0,0,115,2,0,0,0,0,1, + 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, + 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2, + 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, + 0,0,0,115,26,0,0,0,116,0,106,1,100,1,124,0, + 106,2,131,2,1,0,116,0,106,3,124,0,124,1,131,2, + 83,0,41,2,122,98,76,111,97,100,32,97,32,110,97,109, + 101,115,112,97,99,101,32,109,111,100,117,108,101,46,10,10, + 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116, + 104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101, + 100,46,32,32,85,115,101,32,101,120,101,99,95,109,111,100, + 117,108,101,40,41,32,105,110,115,116,101,97,100,46,10,10, + 32,32,32,32,32,32,32,32,122,38,110,97,109,101,115,112, + 97,99,101,32,109,111,100,117,108,101,32,108,111,97,100,101, + 100,32,119,105,116,104,32,112,97,116,104,32,123,33,114,125, + 41,4,114,118,0,0,0,114,133,0,0,0,114,229,0,0, + 0,114,189,0,0,0,41,2,114,104,0,0,0,114,123,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,7,95,95,108,101,110,95,95,230,3,0,0,115,2, - 0,0,0,0,1,122,22,95,78,97,109,101,115,112,97,99, - 101,80,97,116,104,46,95,95,108,101,110,95,95,99,1,0, + 0,114,190,0,0,0,17,4,0,0,115,6,0,0,0,0, + 7,6,1,8,1,122,28,95,78,97,109,101,115,112,97,99, + 101,76,111,97,100,101,114,46,108,111,97,100,95,109,111,100, + 117,108,101,78,41,12,114,109,0,0,0,114,108,0,0,0, + 114,110,0,0,0,114,182,0,0,0,114,180,0,0,0,114, + 247,0,0,0,114,157,0,0,0,114,199,0,0,0,114,184, + 0,0,0,114,183,0,0,0,114,188,0,0,0,114,190,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,246,0,0,0,245,3,0,0,115, + 16,0,0,0,8,1,8,3,12,9,8,3,8,3,8,3, + 8,3,8,3,114,246,0,0,0,99,0,0,0,0,0,0, + 0,0,0,0,0,0,4,0,0,0,64,0,0,0,115,106, + 0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,101, + 4,100,2,100,3,132,0,131,1,90,5,101,4,100,4,100, + 5,132,0,131,1,90,6,101,4,100,6,100,7,132,0,131, + 1,90,7,101,4,100,8,100,9,132,0,131,1,90,8,101, + 4,100,17,100,11,100,12,132,1,131,1,90,9,101,4,100, + 18,100,13,100,14,132,1,131,1,90,10,101,4,100,19,100, + 15,100,16,132,1,131,1,90,11,100,10,83,0,41,20,218, + 10,80,97,116,104,70,105,110,100,101,114,122,62,77,101,116, + 97,32,112,97,116,104,32,102,105,110,100,101,114,32,102,111, + 114,32,115,121,115,46,112,97,116,104,32,97,110,100,32,112, + 97,99,107,97,103,101,32,95,95,112,97,116,104,95,95,32, + 97,116,116,114,105,98,117,116,101,115,46,99,1,0,0,0, + 0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,0, + 115,42,0,0,0,120,36,116,0,106,1,106,2,131,0,68, + 0,93,22,125,1,116,3,124,1,100,1,131,2,114,12,124, + 1,106,4,131,0,1,0,113,12,87,0,100,2,83,0,41, + 3,122,125,67,97,108,108,32,116,104,101,32,105,110,118,97, + 108,105,100,97,116,101,95,99,97,99,104,101,115,40,41,32, + 109,101,116,104,111,100,32,111,110,32,97,108,108,32,112,97, + 116,104,32,101,110,116,114,121,32,102,105,110,100,101,114,115, + 10,32,32,32,32,32,32,32,32,115,116,111,114,101,100,32, + 105,110,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,115,32,40,119,104,101, + 114,101,32,105,109,112,108,101,109,101,110,116,101,100,41,46, + 218,17,105,110,118,97,108,105,100,97,116,101,95,99,97,99, + 104,101,115,78,41,5,114,8,0,0,0,218,19,112,97,116, + 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, + 218,6,118,97,108,117,101,115,114,112,0,0,0,114,249,0, + 0,0,41,2,114,168,0,0,0,218,6,102,105,110,100,101, + 114,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,249,0,0,0,35,4,0,0,115,6,0,0,0,0,4, + 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, + 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, + 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, + 0,0,0,67,0,0,0,115,86,0,0,0,116,0,106,1, + 100,1,107,9,114,30,116,0,106,1,12,0,114,30,116,2, + 106,3,100,2,116,4,131,2,1,0,120,50,116,0,106,1, + 68,0,93,36,125,2,121,8,124,2,124,1,131,1,83,0, + 4,0,116,5,107,10,114,72,1,0,1,0,1,0,119,38, + 89,0,113,38,88,0,113,38,87,0,100,1,83,0,100,1, + 83,0,41,3,122,46,83,101,97,114,99,104,32,115,121,115, + 46,112,97,116,104,95,104,111,111,107,115,32,102,111,114,32, + 97,32,102,105,110,100,101,114,32,102,111,114,32,39,112,97, + 116,104,39,46,78,122,23,115,121,115,46,112,97,116,104,95, + 104,111,111,107,115,32,105,115,32,101,109,112,116,121,41,6, + 114,8,0,0,0,218,10,112,97,116,104,95,104,111,111,107, + 115,114,63,0,0,0,114,64,0,0,0,114,122,0,0,0, + 114,103,0,0,0,41,3,114,168,0,0,0,114,37,0,0, + 0,90,4,104,111,111,107,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,218,11,95,112,97,116,104,95,104,111, + 111,107,115,43,4,0,0,115,16,0,0,0,0,3,18,1, + 12,1,12,1,2,1,8,1,14,1,12,2,122,22,80,97, + 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,104, + 111,111,107,115,99,2,0,0,0,0,0,0,0,3,0,0, + 0,19,0,0,0,67,0,0,0,115,102,0,0,0,124,1, + 100,1,107,2,114,42,121,12,116,0,106,1,131,0,125,1, + 87,0,110,20,4,0,116,2,107,10,114,40,1,0,1,0, + 1,0,100,2,83,0,88,0,121,14,116,3,106,4,124,1, + 25,0,125,2,87,0,110,40,4,0,116,5,107,10,114,96, + 1,0,1,0,1,0,124,0,106,6,124,1,131,1,125,2, + 124,2,116,3,106,4,124,1,60,0,89,0,110,2,88,0, + 124,2,83,0,41,3,122,210,71,101,116,32,116,104,101,32, + 102,105,110,100,101,114,32,102,111,114,32,116,104,101,32,112, + 97,116,104,32,101,110,116,114,121,32,102,114,111,109,32,115, + 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, + 95,99,97,99,104,101,46,10,10,32,32,32,32,32,32,32, + 32,73,102,32,116,104,101,32,112,97,116,104,32,101,110,116, + 114,121,32,105,115,32,110,111,116,32,105,110,32,116,104,101, + 32,99,97,99,104,101,44,32,102,105,110,100,32,116,104,101, + 32,97,112,112,114,111,112,114,105,97,116,101,32,102,105,110, + 100,101,114,10,32,32,32,32,32,32,32,32,97,110,100,32, + 99,97,99,104,101,32,105,116,46,32,73,102,32,110,111,32, + 102,105,110,100,101,114,32,105,115,32,97,118,97,105,108,97, + 98,108,101,44,32,115,116,111,114,101,32,78,111,110,101,46, + 10,10,32,32,32,32,32,32,32,32,114,32,0,0,0,78, + 41,7,114,3,0,0,0,114,47,0,0,0,218,17,70,105, + 108,101,78,111,116,70,111,117,110,100,69,114,114,111,114,114, + 8,0,0,0,114,250,0,0,0,114,135,0,0,0,114,254, + 0,0,0,41,3,114,168,0,0,0,114,37,0,0,0,114, + 252,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,56,4,0,0,115,22,0, + 0,0,0,8,8,1,2,1,12,1,14,3,6,1,2,1, + 14,1,14,1,10,1,16,1,122,31,80,97,116,104,70,105, + 110,100,101,114,46,95,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,99,3,0,0,0,0,0, + 0,0,6,0,0,0,3,0,0,0,67,0,0,0,115,82, + 0,0,0,116,0,124,2,100,1,131,2,114,26,124,2,106, + 1,124,1,131,1,92,2,125,3,125,4,110,14,124,2,106, + 2,124,1,131,1,125,3,103,0,125,4,124,3,100,0,107, + 9,114,60,116,3,106,4,124,1,124,3,131,2,83,0,116, + 3,106,5,124,1,100,0,131,2,125,5,124,4,124,5,95, + 6,124,5,83,0,41,2,78,114,121,0,0,0,41,7,114, + 112,0,0,0,114,121,0,0,0,114,179,0,0,0,114,118, + 0,0,0,114,176,0,0,0,114,158,0,0,0,114,154,0, + 0,0,41,6,114,168,0,0,0,114,123,0,0,0,114,252, + 0,0,0,114,124,0,0,0,114,125,0,0,0,114,162,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,16,95,108,101,103,97,99,121,95,103,101,116,95,115, + 112,101,99,78,4,0,0,115,18,0,0,0,0,4,10,1, + 16,2,10,1,4,1,8,1,12,1,12,1,6,1,122,27, + 80,97,116,104,70,105,110,100,101,114,46,95,108,101,103,97, + 99,121,95,103,101,116,95,115,112,101,99,78,99,4,0,0, + 0,0,0,0,0,9,0,0,0,5,0,0,0,67,0,0, + 0,115,170,0,0,0,103,0,125,4,120,160,124,2,68,0, + 93,130,125,5,116,0,124,5,116,1,116,2,102,2,131,2, + 115,30,113,10,124,0,106,3,124,5,131,1,125,6,124,6, + 100,1,107,9,114,10,116,4,124,6,100,2,131,2,114,72, + 124,6,106,5,124,1,124,3,131,2,125,7,110,12,124,0, + 106,6,124,1,124,6,131,2,125,7,124,7,100,1,107,8, + 114,94,113,10,124,7,106,7,100,1,107,9,114,108,124,7, + 83,0,124,7,106,8,125,8,124,8,100,1,107,8,114,130, + 116,9,100,3,131,1,130,1,124,4,106,10,124,8,131,1, + 1,0,113,10,87,0,116,11,106,12,124,1,100,1,131,2, + 125,7,124,4,124,7,95,8,124,7,83,0,100,1,83,0, + 41,4,122,63,70,105,110,100,32,116,104,101,32,108,111,97, + 100,101,114,32,111,114,32,110,97,109,101,115,112,97,99,101, + 95,112,97,116,104,32,102,111,114,32,116,104,105,115,32,109, + 111,100,117,108,101,47,112,97,99,107,97,103,101,32,110,97, + 109,101,46,78,114,178,0,0,0,122,19,115,112,101,99,32, + 109,105,115,115,105,110,103,32,108,111,97,100,101,114,41,13, + 114,141,0,0,0,114,73,0,0,0,218,5,98,121,116,101, + 115,114,0,1,0,0,114,112,0,0,0,114,178,0,0,0, + 114,1,1,0,0,114,124,0,0,0,114,154,0,0,0,114, + 103,0,0,0,114,147,0,0,0,114,118,0,0,0,114,158, + 0,0,0,41,9,114,168,0,0,0,114,123,0,0,0,114, + 37,0,0,0,114,177,0,0,0,218,14,110,97,109,101,115, + 112,97,99,101,95,112,97,116,104,90,5,101,110,116,114,121, + 114,252,0,0,0,114,162,0,0,0,114,125,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,9, + 95,103,101,116,95,115,112,101,99,93,4,0,0,115,40,0, + 0,0,0,5,4,1,10,1,14,1,2,1,10,1,8,1, + 10,1,14,2,12,1,8,1,2,1,10,1,4,1,6,1, + 8,1,8,5,14,2,12,1,6,1,122,20,80,97,116,104, + 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, + 99,4,0,0,0,0,0,0,0,6,0,0,0,4,0,0, + 0,67,0,0,0,115,100,0,0,0,124,2,100,1,107,8, + 114,14,116,0,106,1,125,2,124,0,106,2,124,1,124,2, + 124,3,131,3,125,4,124,4,100,1,107,8,114,40,100,1, + 83,0,124,4,106,3,100,1,107,8,114,92,124,4,106,4, + 125,5,124,5,114,86,100,2,124,4,95,5,116,6,124,1, + 124,5,124,0,106,2,131,3,124,4,95,4,124,4,83,0, + 100,1,83,0,110,4,124,4,83,0,100,1,83,0,41,3, + 122,141,84,114,121,32,116,111,32,102,105,110,100,32,97,32, + 115,112,101,99,32,102,111,114,32,39,102,117,108,108,110,97, + 109,101,39,32,111,110,32,115,121,115,46,112,97,116,104,32, + 111,114,32,39,112,97,116,104,39,46,10,10,32,32,32,32, + 32,32,32,32,84,104,101,32,115,101,97,114,99,104,32,105, + 115,32,98,97,115,101,100,32,111,110,32,115,121,115,46,112, + 97,116,104,95,104,111,111,107,115,32,97,110,100,32,115,121, + 115,46,112,97,116,104,95,105,109,112,111,114,116,101,114,95, + 99,97,99,104,101,46,10,32,32,32,32,32,32,32,32,78, + 90,9,110,97,109,101,115,112,97,99,101,41,7,114,8,0, + 0,0,114,37,0,0,0,114,4,1,0,0,114,124,0,0, + 0,114,154,0,0,0,114,156,0,0,0,114,227,0,0,0, + 41,6,114,168,0,0,0,114,123,0,0,0,114,37,0,0, + 0,114,177,0,0,0,114,162,0,0,0,114,3,1,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 178,0,0,0,125,4,0,0,115,26,0,0,0,0,6,8, + 1,6,1,14,1,8,1,4,1,10,1,6,1,4,3,6, + 1,16,1,4,2,6,2,122,20,80,97,116,104,70,105,110, + 100,101,114,46,102,105,110,100,95,115,112,101,99,99,3,0, + 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, + 0,0,115,30,0,0,0,124,0,106,0,124,1,124,2,131, + 2,125,3,124,3,100,1,107,8,114,24,100,1,83,0,124, + 3,106,1,83,0,41,2,122,170,102,105,110,100,32,116,104, + 101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,46, + 112,97,116,104,32,111,114,32,39,112,97,116,104,39,32,98, + 97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,104, + 95,104,111,111,107,115,32,97,110,100,10,32,32,32,32,32, + 32,32,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,32, + 32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,85,115,101,32,102,105,110,100,95,115,112,101,99,40,41, + 32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,32, + 32,32,32,78,41,2,114,178,0,0,0,114,124,0,0,0, + 41,4,114,168,0,0,0,114,123,0,0,0,114,37,0,0, + 0,114,162,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,179,0,0,0,149,4,0,0,115,8, + 0,0,0,0,8,12,1,8,1,4,1,122,22,80,97,116, + 104,70,105,110,100,101,114,46,102,105,110,100,95,109,111,100, + 117,108,101,41,1,78,41,2,78,78,41,1,78,41,12,114, + 109,0,0,0,114,108,0,0,0,114,110,0,0,0,114,111, + 0,0,0,114,180,0,0,0,114,249,0,0,0,114,254,0, + 0,0,114,0,1,0,0,114,1,1,0,0,114,4,1,0, + 0,114,178,0,0,0,114,179,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 248,0,0,0,31,4,0,0,115,22,0,0,0,8,2,4, + 2,12,8,12,13,12,22,12,15,2,1,12,31,2,1,12, + 23,2,1,114,248,0,0,0,99,0,0,0,0,0,0,0, + 0,0,0,0,0,3,0,0,0,64,0,0,0,115,90,0, + 0,0,101,0,90,1,100,0,90,2,100,1,90,3,100,2, + 100,3,132,0,90,4,100,4,100,5,132,0,90,5,101,6, + 90,7,100,6,100,7,132,0,90,8,100,8,100,9,132,0, + 90,9,100,19,100,11,100,12,132,1,90,10,100,13,100,14, + 132,0,90,11,101,12,100,15,100,16,132,0,131,1,90,13, + 100,17,100,18,132,0,90,14,100,10,83,0,41,20,218,10, + 70,105,108,101,70,105,110,100,101,114,122,172,70,105,108,101, + 45,98,97,115,101,100,32,102,105,110,100,101,114,46,10,10, + 32,32,32,32,73,110,116,101,114,97,99,116,105,111,110,115, + 32,119,105,116,104,32,116,104,101,32,102,105,108,101,32,115, + 121,115,116,101,109,32,97,114,101,32,99,97,99,104,101,100, + 32,102,111,114,32,112,101,114,102,111,114,109,97,110,99,101, + 44,32,98,101,105,110,103,10,32,32,32,32,114,101,102,114, + 101,115,104,101,100,32,119,104,101,110,32,116,104,101,32,100, + 105,114,101,99,116,111,114,121,32,116,104,101,32,102,105,110, + 100,101,114,32,105,115,32,104,97,110,100,108,105,110,103,32, + 104,97,115,32,98,101,101,110,32,109,111,100,105,102,105,101, + 100,46,10,10,32,32,32,32,99,2,0,0,0,0,0,0, + 0,5,0,0,0,5,0,0,0,7,0,0,0,115,88,0, + 0,0,103,0,125,3,120,40,124,2,68,0,93,32,92,2, + 137,0,125,4,124,3,106,0,135,0,102,1,100,1,100,2, + 132,8,124,4,68,0,131,1,131,1,1,0,113,10,87,0, + 124,3,124,0,95,1,124,1,112,58,100,3,124,0,95,2, + 100,6,124,0,95,3,116,4,131,0,124,0,95,5,116,4, + 131,0,124,0,95,6,100,5,83,0,41,7,122,154,73,110, + 105,116,105,97,108,105,122,101,32,119,105,116,104,32,116,104, + 101,32,112,97,116,104,32,116,111,32,115,101,97,114,99,104, + 32,111,110,32,97,110,100,32,97,32,118,97,114,105,97,98, + 108,101,32,110,117,109,98,101,114,32,111,102,10,32,32,32, + 32,32,32,32,32,50,45,116,117,112,108,101,115,32,99,111, + 110,116,97,105,110,105,110,103,32,116,104,101,32,108,111,97, + 100,101,114,32,97,110,100,32,116,104,101,32,102,105,108,101, + 32,115,117,102,102,105,120,101,115,32,116,104,101,32,108,111, + 97,100,101,114,10,32,32,32,32,32,32,32,32,114,101,99, + 111,103,110,105,122,101,115,46,99,1,0,0,0,0,0,0, + 0,2,0,0,0,3,0,0,0,51,0,0,0,115,22,0, + 0,0,124,0,93,14,125,1,124,1,136,0,102,2,86,0, + 1,0,113,2,100,0,83,0,41,1,78,114,4,0,0,0, + 41,2,114,24,0,0,0,114,222,0,0,0,41,1,114,124, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,224,0, + 0,0,178,4,0,0,115,2,0,0,0,4,0,122,38,70, + 105,108,101,70,105,110,100,101,114,46,95,95,105,110,105,116, + 95,95,46,60,108,111,99,97,108,115,62,46,60,103,101,110, + 101,120,112,114,62,114,61,0,0,0,114,31,0,0,0,78, + 114,91,0,0,0,41,7,114,147,0,0,0,218,8,95,108, + 111,97,100,101,114,115,114,37,0,0,0,218,11,95,112,97, + 116,104,95,109,116,105,109,101,218,3,115,101,116,218,11,95, + 112,97,116,104,95,99,97,99,104,101,218,19,95,114,101,108, + 97,120,101,100,95,112,97,116,104,95,99,97,99,104,101,41, + 5,114,104,0,0,0,114,37,0,0,0,218,14,108,111,97, + 100,101,114,95,100,101,116,97,105,108,115,90,7,108,111,97, + 100,101,114,115,114,164,0,0,0,114,4,0,0,0,41,1, + 114,124,0,0,0,114,6,0,0,0,114,182,0,0,0,172, + 4,0,0,115,16,0,0,0,0,4,4,1,14,1,28,1, + 6,2,10,1,6,1,8,1,122,19,70,105,108,101,70,105, + 110,100,101,114,46,95,95,105,110,105,116,95,95,99,1,0, 0,0,0,0,0,0,1,0,0,0,2,0,0,0,67,0, - 0,0,115,12,0,0,0,100,1,106,0,124,0,106,1,131, - 1,83,0,41,2,78,122,20,95,78,97,109,101,115,112,97, - 99,101,80,97,116,104,40,123,33,114,125,41,41,2,114,50, - 0,0,0,114,229,0,0,0,41,1,114,104,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,8, - 95,95,114,101,112,114,95,95,233,3,0,0,115,2,0,0, - 0,0,1,122,23,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,46,95,95,114,101,112,114,95,95,99,2,0,0, - 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, - 0,115,12,0,0,0,124,1,124,0,106,0,131,0,107,6, - 83,0,41,1,78,41,1,114,237,0,0,0,41,2,114,104, - 0,0,0,218,4,105,116,101,109,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,12,95,95,99,111,110,116, - 97,105,110,115,95,95,236,3,0,0,115,2,0,0,0,0, - 1,122,27,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,95,99,111,110,116,97,105,110,115,95,95,99,2, - 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, - 0,0,0,115,16,0,0,0,124,0,106,0,106,1,124,1, - 131,1,1,0,100,0,83,0,41,1,78,41,2,114,229,0, - 0,0,114,161,0,0,0,41,2,114,104,0,0,0,114,244, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,161,0,0,0,239,3,0,0,115,2,0,0,0, - 0,1,122,21,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,46,97,112,112,101,110,100,78,41,14,114,109,0,0, - 0,114,108,0,0,0,114,110,0,0,0,114,111,0,0,0, - 114,182,0,0,0,114,235,0,0,0,114,230,0,0,0,114, - 237,0,0,0,114,239,0,0,0,114,241,0,0,0,114,242, - 0,0,0,114,243,0,0,0,114,245,0,0,0,114,161,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,227,0,0,0,184,3,0,0,115, - 22,0,0,0,8,5,4,2,8,6,8,10,8,4,8,13, - 8,3,8,3,8,3,8,3,8,3,114,227,0,0,0,99, - 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, - 64,0,0,0,115,80,0,0,0,101,0,90,1,100,0,90, - 2,100,1,100,2,132,0,90,3,101,4,100,3,100,4,132, - 0,131,1,90,5,100,5,100,6,132,0,90,6,100,7,100, - 8,132,0,90,7,100,9,100,10,132,0,90,8,100,11,100, - 12,132,0,90,9,100,13,100,14,132,0,90,10,100,15,100, - 16,132,0,90,11,100,17,83,0,41,18,218,16,95,78,97, - 109,101,115,112,97,99,101,76,111,97,100,101,114,99,4,0, - 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, - 0,0,115,18,0,0,0,116,0,124,1,124,2,124,3,131, - 3,124,0,95,1,100,0,83,0,41,1,78,41,2,114,227, - 0,0,0,114,229,0,0,0,41,4,114,104,0,0,0,114, - 102,0,0,0,114,37,0,0,0,114,233,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,182,0, - 0,0,245,3,0,0,115,2,0,0,0,0,1,122,25,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, - 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,12,0, - 0,0,100,1,106,0,124,1,106,1,131,1,83,0,41,2, - 122,115,82,101,116,117,114,110,32,114,101,112,114,32,102,111, - 114,32,116,104,101,32,109,111,100,117,108,101,46,10,10,32, - 32,32,32,32,32,32,32,84,104,101,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,84,104,101,32,105,109,112,111,114,116,32,109,97,99, - 104,105,110,101,114,121,32,100,111,101,115,32,116,104,101,32, - 106,111,98,32,105,116,115,101,108,102,46,10,10,32,32,32, - 32,32,32,32,32,122,25,60,109,111,100,117,108,101,32,123, - 33,114,125,32,40,110,97,109,101,115,112,97,99,101,41,62, - 41,2,114,50,0,0,0,114,109,0,0,0,41,2,114,168, - 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,11,109,111,100,117,108,101,95, - 114,101,112,114,248,3,0,0,115,2,0,0,0,0,7,122, - 28,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, - 114,46,109,111,100,117,108,101,95,114,101,112,114,99,2,0, - 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, - 0,0,115,4,0,0,0,100,1,83,0,41,2,78,84,114, - 4,0,0,0,41,2,114,104,0,0,0,114,123,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 157,0,0,0,1,4,0,0,115,2,0,0,0,0,1,122, - 27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, - 114,46,105,115,95,112,97,99,107,97,103,101,99,2,0,0, - 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, - 0,115,4,0,0,0,100,1,83,0,41,2,78,114,32,0, - 0,0,114,4,0,0,0,41,2,114,104,0,0,0,114,123, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,199,0,0,0,4,4,0,0,115,2,0,0,0, - 0,1,122,27,95,78,97,109,101,115,112,97,99,101,76,111, - 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,6,0,0,0, - 67,0,0,0,115,16,0,0,0,116,0,100,1,100,2,100, - 3,100,4,100,5,141,4,83,0,41,6,78,114,32,0,0, - 0,122,8,60,115,116,114,105,110,103,62,114,186,0,0,0, - 84,41,1,114,201,0,0,0,41,1,114,202,0,0,0,41, - 2,114,104,0,0,0,114,123,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,184,0,0,0,7, - 4,0,0,115,2,0,0,0,0,1,122,25,95,78,97,109, - 101,115,112,97,99,101,76,111,97,100,101,114,46,103,101,116, - 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, - 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, - 1,83,0,41,2,122,42,85,115,101,32,100,101,102,97,117, - 108,116,32,115,101,109,97,110,116,105,99,115,32,102,111,114, - 32,109,111,100,117,108,101,32,99,114,101,97,116,105,111,110, - 46,78,114,4,0,0,0,41,2,114,104,0,0,0,114,162, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,183,0,0,0,10,4,0,0,115,0,0,0,0, - 122,30,95,78,97,109,101,115,112,97,99,101,76,111,97,100, - 101,114,46,99,114,101,97,116,101,95,109,111,100,117,108,101, - 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, - 0,67,0,0,0,115,4,0,0,0,100,0,83,0,41,1, - 78,114,4,0,0,0,41,2,114,104,0,0,0,114,187,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,188,0,0,0,13,4,0,0,115,2,0,0,0,0, - 1,122,28,95,78,97,109,101,115,112,97,99,101,76,111,97, - 100,101,114,46,101,120,101,99,95,109,111,100,117,108,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, - 67,0,0,0,115,26,0,0,0,116,0,106,1,100,1,124, - 0,106,2,131,2,1,0,116,0,106,3,124,0,124,1,131, - 2,83,0,41,2,122,98,76,111,97,100,32,97,32,110,97, - 109,101,115,112,97,99,101,32,109,111,100,117,108,101,46,10, + 0,0,115,10,0,0,0,100,3,124,0,95,0,100,2,83, + 0,41,4,122,31,73,110,118,97,108,105,100,97,116,101,32, + 116,104,101,32,100,105,114,101,99,116,111,114,121,32,109,116, + 105,109,101,46,114,31,0,0,0,78,114,91,0,0,0,41, + 1,114,7,1,0,0,41,1,114,104,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,249,0,0, + 0,186,4,0,0,115,2,0,0,0,0,2,122,28,70,105, + 108,101,70,105,110,100,101,114,46,105,110,118,97,108,105,100, + 97,116,101,95,99,97,99,104,101,115,99,2,0,0,0,0, + 0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115, + 42,0,0,0,124,0,106,0,124,1,131,1,125,2,124,2, + 100,1,107,8,114,26,100,1,103,0,102,2,83,0,124,2, + 106,1,124,2,106,2,112,38,103,0,102,2,83,0,41,2, + 122,197,84,114,121,32,116,111,32,102,105,110,100,32,97,32, + 108,111,97,100,101,114,32,102,111,114,32,116,104,101,32,115, + 112,101,99,105,102,105,101,100,32,109,111,100,117,108,101,44, + 32,111,114,32,116,104,101,32,110,97,109,101,115,112,97,99, + 101,10,32,32,32,32,32,32,32,32,112,97,99,107,97,103, + 101,32,112,111,114,116,105,111,110,115,46,32,82,101,116,117, + 114,110,115,32,40,108,111,97,100,101,114,44,32,108,105,115, + 116,45,111,102,45,112,111,114,116,105,111,110,115,41,46,10, 10,32,32,32,32,32,32,32,32,84,104,105,115,32,109,101, 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,85,115,101,32,101,120,101,99,95,109,111, - 100,117,108,101,40,41,32,105,110,115,116,101,97,100,46,10, - 10,32,32,32,32,32,32,32,32,122,38,110,97,109,101,115, - 112,97,99,101,32,109,111,100,117,108,101,32,108,111,97,100, - 101,100,32,119,105,116,104,32,112,97,116,104,32,123,33,114, - 125,41,4,114,118,0,0,0,114,133,0,0,0,114,229,0, - 0,0,114,189,0,0,0,41,2,114,104,0,0,0,114,123, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,190,0,0,0,16,4,0,0,115,6,0,0,0, - 0,7,6,1,8,1,122,28,95,78,97,109,101,115,112,97, - 99,101,76,111,97,100,101,114,46,108,111,97,100,95,109,111, - 100,117,108,101,78,41,12,114,109,0,0,0,114,108,0,0, - 0,114,110,0,0,0,114,182,0,0,0,114,180,0,0,0, - 114,247,0,0,0,114,157,0,0,0,114,199,0,0,0,114, - 184,0,0,0,114,183,0,0,0,114,188,0,0,0,114,190, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,246,0,0,0,244,3,0,0, - 115,16,0,0,0,8,1,8,3,12,9,8,3,8,3,8, - 3,8,3,8,3,114,246,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,4,0,0,0,64,0,0,0,115, - 106,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, - 101,4,100,2,100,3,132,0,131,1,90,5,101,4,100,4, - 100,5,132,0,131,1,90,6,101,4,100,6,100,7,132,0, - 131,1,90,7,101,4,100,8,100,9,132,0,131,1,90,8, - 101,4,100,17,100,11,100,12,132,1,131,1,90,9,101,4, - 100,18,100,13,100,14,132,1,131,1,90,10,101,4,100,19, - 100,15,100,16,132,1,131,1,90,11,100,10,83,0,41,20, - 218,10,80,97,116,104,70,105,110,100,101,114,122,62,77,101, - 116,97,32,112,97,116,104,32,102,105,110,100,101,114,32,102, - 111,114,32,115,121,115,46,112,97,116,104,32,97,110,100,32, - 112,97,99,107,97,103,101,32,95,95,112,97,116,104,95,95, - 32,97,116,116,114,105,98,117,116,101,115,46,99,1,0,0, - 0,0,0,0,0,2,0,0,0,4,0,0,0,67,0,0, - 0,115,42,0,0,0,120,36,116,0,106,1,106,2,131,0, - 68,0,93,22,125,1,116,3,124,1,100,1,131,2,114,12, - 124,1,106,4,131,0,1,0,113,12,87,0,100,2,83,0, - 41,3,122,125,67,97,108,108,32,116,104,101,32,105,110,118, - 97,108,105,100,97,116,101,95,99,97,99,104,101,115,40,41, - 32,109,101,116,104,111,100,32,111,110,32,97,108,108,32,112, - 97,116,104,32,101,110,116,114,121,32,102,105,110,100,101,114, - 115,10,32,32,32,32,32,32,32,32,115,116,111,114,101,100, - 32,105,110,32,115,121,115,46,112,97,116,104,95,105,109,112, - 111,114,116,101,114,95,99,97,99,104,101,115,32,40,119,104, - 101,114,101,32,105,109,112,108,101,109,101,110,116,101,100,41, - 46,218,17,105,110,118,97,108,105,100,97,116,101,95,99,97, - 99,104,101,115,78,41,5,114,8,0,0,0,218,19,112,97, - 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,218,6,118,97,108,117,101,115,114,112,0,0,0,114,249, - 0,0,0,41,2,114,168,0,0,0,218,6,102,105,110,100, - 101,114,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,249,0,0,0,34,4,0,0,115,6,0,0,0,0, - 4,16,1,10,1,122,28,80,97,116,104,70,105,110,100,101, - 114,46,105,110,118,97,108,105,100,97,116,101,95,99,97,99, - 104,101,115,99,2,0,0,0,0,0,0,0,3,0,0,0, - 12,0,0,0,67,0,0,0,115,86,0,0,0,116,0,106, - 1,100,1,107,9,114,30,116,0,106,1,12,0,114,30,116, - 2,106,3,100,2,116,4,131,2,1,0,120,50,116,0,106, - 1,68,0,93,36,125,2,121,8,124,2,124,1,131,1,83, - 0,4,0,116,5,107,10,114,72,1,0,1,0,1,0,119, - 38,89,0,113,38,88,0,113,38,87,0,100,1,83,0,100, - 1,83,0,41,3,122,46,83,101,97,114,99,104,32,115,121, - 115,46,112,97,116,104,95,104,111,111,107,115,32,102,111,114, - 32,97,32,102,105,110,100,101,114,32,102,111,114,32,39,112, - 97,116,104,39,46,78,122,23,115,121,115,46,112,97,116,104, - 95,104,111,111,107,115,32,105,115,32,101,109,112,116,121,41, - 6,114,8,0,0,0,218,10,112,97,116,104,95,104,111,111, - 107,115,114,63,0,0,0,114,64,0,0,0,114,122,0,0, - 0,114,103,0,0,0,41,3,114,168,0,0,0,114,37,0, - 0,0,90,4,104,111,111,107,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,11,95,112,97,116,104,95,104, - 111,111,107,115,42,4,0,0,115,16,0,0,0,0,3,18, - 1,12,1,12,1,2,1,8,1,14,1,12,2,122,22,80, - 97,116,104,70,105,110,100,101,114,46,95,112,97,116,104,95, - 104,111,111,107,115,99,2,0,0,0,0,0,0,0,3,0, - 0,0,19,0,0,0,67,0,0,0,115,102,0,0,0,124, - 1,100,1,107,2,114,42,121,12,116,0,106,1,131,0,125, - 1,87,0,110,20,4,0,116,2,107,10,114,40,1,0,1, - 0,1,0,100,2,83,0,88,0,121,14,116,3,106,4,124, - 1,25,0,125,2,87,0,110,40,4,0,116,5,107,10,114, - 96,1,0,1,0,1,0,124,0,106,6,124,1,131,1,125, - 2,124,2,116,3,106,4,124,1,60,0,89,0,110,2,88, - 0,124,2,83,0,41,3,122,210,71,101,116,32,116,104,101, - 32,102,105,110,100,101,114,32,102,111,114,32,116,104,101,32, - 112,97,116,104,32,101,110,116,114,121,32,102,114,111,109,32, - 115,121,115,46,112,97,116,104,95,105,109,112,111,114,116,101, - 114,95,99,97,99,104,101,46,10,10,32,32,32,32,32,32, - 32,32,73,102,32,116,104,101,32,112,97,116,104,32,101,110, - 116,114,121,32,105,115,32,110,111,116,32,105,110,32,116,104, - 101,32,99,97,99,104,101,44,32,102,105,110,100,32,116,104, - 101,32,97,112,112,114,111,112,114,105,97,116,101,32,102,105, - 110,100,101,114,10,32,32,32,32,32,32,32,32,97,110,100, - 32,99,97,99,104,101,32,105,116,46,32,73,102,32,110,111, - 32,102,105,110,100,101,114,32,105,115,32,97,118,97,105,108, - 97,98,108,101,44,32,115,116,111,114,101,32,78,111,110,101, - 46,10,10,32,32,32,32,32,32,32,32,114,32,0,0,0, - 78,41,7,114,3,0,0,0,114,47,0,0,0,218,17,70, - 105,108,101,78,111,116,70,111,117,110,100,69,114,114,111,114, - 114,8,0,0,0,114,250,0,0,0,114,135,0,0,0,114, - 254,0,0,0,41,3,114,168,0,0,0,114,37,0,0,0, - 114,252,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,218,20,95,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,55,4,0,0,115,22, - 0,0,0,0,8,8,1,2,1,12,1,14,3,6,1,2, - 1,14,1,14,1,10,1,16,1,122,31,80,97,116,104,70, - 105,110,100,101,114,46,95,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,99,3,0,0,0,0, - 0,0,0,6,0,0,0,3,0,0,0,67,0,0,0,115, - 82,0,0,0,116,0,124,2,100,1,131,2,114,26,124,2, - 106,1,124,1,131,1,92,2,125,3,125,4,110,14,124,2, - 106,2,124,1,131,1,125,3,103,0,125,4,124,3,100,0, - 107,9,114,60,116,3,106,4,124,1,124,3,131,2,83,0, - 116,3,106,5,124,1,100,0,131,2,125,5,124,4,124,5, - 95,6,124,5,83,0,41,2,78,114,121,0,0,0,41,7, - 114,112,0,0,0,114,121,0,0,0,114,179,0,0,0,114, - 118,0,0,0,114,176,0,0,0,114,158,0,0,0,114,154, - 0,0,0,41,6,114,168,0,0,0,114,123,0,0,0,114, - 252,0,0,0,114,124,0,0,0,114,125,0,0,0,114,162, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,16,95,108,101,103,97,99,121,95,103,101,116,95, - 115,112,101,99,77,4,0,0,115,18,0,0,0,0,4,10, - 1,16,2,10,1,4,1,8,1,12,1,12,1,6,1,122, - 27,80,97,116,104,70,105,110,100,101,114,46,95,108,101,103, - 97,99,121,95,103,101,116,95,115,112,101,99,78,99,4,0, - 0,0,0,0,0,0,9,0,0,0,5,0,0,0,67,0, - 0,0,115,170,0,0,0,103,0,125,4,120,160,124,2,68, - 0,93,130,125,5,116,0,124,5,116,1,116,2,102,2,131, - 2,115,30,113,10,124,0,106,3,124,5,131,1,125,6,124, - 6,100,1,107,9,114,10,116,4,124,6,100,2,131,2,114, - 72,124,6,106,5,124,1,124,3,131,2,125,7,110,12,124, - 0,106,6,124,1,124,6,131,2,125,7,124,7,100,1,107, - 8,114,94,113,10,124,7,106,7,100,1,107,9,114,108,124, - 7,83,0,124,7,106,8,125,8,124,8,100,1,107,8,114, - 130,116,9,100,3,131,1,130,1,124,4,106,10,124,8,131, - 1,1,0,113,10,87,0,116,11,106,12,124,1,100,1,131, - 2,125,7,124,4,124,7,95,8,124,7,83,0,100,1,83, - 0,41,4,122,63,70,105,110,100,32,116,104,101,32,108,111, - 97,100,101,114,32,111,114,32,110,97,109,101,115,112,97,99, - 101,95,112,97,116,104,32,102,111,114,32,116,104,105,115,32, - 109,111,100,117,108,101,47,112,97,99,107,97,103,101,32,110, - 97,109,101,46,78,114,178,0,0,0,122,19,115,112,101,99, - 32,109,105,115,115,105,110,103,32,108,111,97,100,101,114,41, - 13,114,141,0,0,0,114,73,0,0,0,218,5,98,121,116, - 101,115,114,0,1,0,0,114,112,0,0,0,114,178,0,0, - 0,114,1,1,0,0,114,124,0,0,0,114,154,0,0,0, - 114,103,0,0,0,114,147,0,0,0,114,118,0,0,0,114, - 158,0,0,0,41,9,114,168,0,0,0,114,123,0,0,0, - 114,37,0,0,0,114,177,0,0,0,218,14,110,97,109,101, - 115,112,97,99,101,95,112,97,116,104,90,5,101,110,116,114, - 121,114,252,0,0,0,114,162,0,0,0,114,125,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 9,95,103,101,116,95,115,112,101,99,92,4,0,0,115,40, - 0,0,0,0,5,4,1,10,1,14,1,2,1,10,1,8, - 1,10,1,14,2,12,1,8,1,2,1,10,1,4,1,6, - 1,8,1,8,5,14,2,12,1,6,1,122,20,80,97,116, - 104,70,105,110,100,101,114,46,95,103,101,116,95,115,112,101, - 99,99,4,0,0,0,0,0,0,0,6,0,0,0,4,0, - 0,0,67,0,0,0,115,100,0,0,0,124,2,100,1,107, - 8,114,14,116,0,106,1,125,2,124,0,106,2,124,1,124, - 2,124,3,131,3,125,4,124,4,100,1,107,8,114,40,100, - 1,83,0,124,4,106,3,100,1,107,8,114,92,124,4,106, - 4,125,5,124,5,114,86,100,2,124,4,95,5,116,6,124, - 1,124,5,124,0,106,2,131,3,124,4,95,4,124,4,83, - 0,100,1,83,0,110,4,124,4,83,0,100,1,83,0,41, - 3,122,141,84,114,121,32,116,111,32,102,105,110,100,32,97, - 32,115,112,101,99,32,102,111,114,32,39,102,117,108,108,110, - 97,109,101,39,32,111,110,32,115,121,115,46,112,97,116,104, - 32,111,114,32,39,112,97,116,104,39,46,10,10,32,32,32, - 32,32,32,32,32,84,104,101,32,115,101,97,114,99,104,32, - 105,115,32,98,97,115,101,100,32,111,110,32,115,121,115,46, - 112,97,116,104,95,104,111,111,107,115,32,97,110,100,32,115, - 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, - 95,99,97,99,104,101,46,10,32,32,32,32,32,32,32,32, - 78,90,9,110,97,109,101,115,112,97,99,101,41,7,114,8, - 0,0,0,114,37,0,0,0,114,4,1,0,0,114,124,0, - 0,0,114,154,0,0,0,114,156,0,0,0,114,227,0,0, - 0,41,6,114,168,0,0,0,114,123,0,0,0,114,37,0, - 0,0,114,177,0,0,0,114,162,0,0,0,114,3,1,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,178,0,0,0,124,4,0,0,115,26,0,0,0,0,6, - 8,1,6,1,14,1,8,1,4,1,10,1,6,1,4,3, - 6,1,16,1,4,2,6,2,122,20,80,97,116,104,70,105, - 110,100,101,114,46,102,105,110,100,95,115,112,101,99,99,3, - 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, - 0,0,0,115,30,0,0,0,124,0,106,0,124,1,124,2, - 131,2,125,3,124,3,100,1,107,8,114,24,100,1,83,0, - 124,3,106,1,83,0,41,2,122,170,102,105,110,100,32,116, - 104,101,32,109,111,100,117,108,101,32,111,110,32,115,121,115, - 46,112,97,116,104,32,111,114,32,39,112,97,116,104,39,32, - 98,97,115,101,100,32,111,110,32,115,121,115,46,112,97,116, - 104,95,104,111,111,107,115,32,97,110,100,10,32,32,32,32, - 32,32,32,32,115,121,115,46,112,97,116,104,95,105,109,112, - 111,114,116,101,114,95,99,97,99,104,101,46,10,10,32,32, - 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,85,115,101,32,102,105,110,100,95,115,112,101,99,40, - 41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32, - 32,32,32,32,78,41,2,114,178,0,0,0,114,124,0,0, - 0,41,4,114,168,0,0,0,114,123,0,0,0,114,37,0, - 0,0,114,162,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,179,0,0,0,148,4,0,0,115, - 8,0,0,0,0,8,12,1,8,1,4,1,122,22,80,97, - 116,104,70,105,110,100,101,114,46,102,105,110,100,95,109,111, - 100,117,108,101,41,1,78,41,2,78,78,41,1,78,41,12, - 114,109,0,0,0,114,108,0,0,0,114,110,0,0,0,114, - 111,0,0,0,114,180,0,0,0,114,249,0,0,0,114,254, - 0,0,0,114,0,1,0,0,114,1,1,0,0,114,4,1, - 0,0,114,178,0,0,0,114,179,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,248,0,0,0,30,4,0,0,115,22,0,0,0,8,2, - 4,2,12,8,12,13,12,22,12,15,2,1,12,31,2,1, - 12,23,2,1,114,248,0,0,0,99,0,0,0,0,0,0, - 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,90, - 0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,100, - 2,100,3,132,0,90,4,100,4,100,5,132,0,90,5,101, - 6,90,7,100,6,100,7,132,0,90,8,100,8,100,9,132, - 0,90,9,100,19,100,11,100,12,132,1,90,10,100,13,100, - 14,132,0,90,11,101,12,100,15,100,16,132,0,131,1,90, - 13,100,17,100,18,132,0,90,14,100,10,83,0,41,20,218, - 10,70,105,108,101,70,105,110,100,101,114,122,172,70,105,108, - 101,45,98,97,115,101,100,32,102,105,110,100,101,114,46,10, - 10,32,32,32,32,73,110,116,101,114,97,99,116,105,111,110, - 115,32,119,105,116,104,32,116,104,101,32,102,105,108,101,32, - 115,121,115,116,101,109,32,97,114,101,32,99,97,99,104,101, - 100,32,102,111,114,32,112,101,114,102,111,114,109,97,110,99, - 101,44,32,98,101,105,110,103,10,32,32,32,32,114,101,102, - 114,101,115,104,101,100,32,119,104,101,110,32,116,104,101,32, - 100,105,114,101,99,116,111,114,121,32,116,104,101,32,102,105, - 110,100,101,114,32,105,115,32,104,97,110,100,108,105,110,103, - 32,104,97,115,32,98,101,101,110,32,109,111,100,105,102,105, - 101,100,46,10,10,32,32,32,32,99,2,0,0,0,0,0, - 0,0,5,0,0,0,5,0,0,0,7,0,0,0,115,88, - 0,0,0,103,0,125,3,120,40,124,2,68,0,93,32,92, - 2,137,0,125,4,124,3,106,0,135,0,102,1,100,1,100, - 2,132,8,124,4,68,0,131,1,131,1,1,0,113,10,87, - 0,124,3,124,0,95,1,124,1,112,58,100,3,124,0,95, - 2,100,6,124,0,95,3,116,4,131,0,124,0,95,5,116, - 4,131,0,124,0,95,6,100,5,83,0,41,7,122,154,73, - 110,105,116,105,97,108,105,122,101,32,119,105,116,104,32,116, - 104,101,32,112,97,116,104,32,116,111,32,115,101,97,114,99, - 104,32,111,110,32,97,110,100,32,97,32,118,97,114,105,97, - 98,108,101,32,110,117,109,98,101,114,32,111,102,10,32,32, - 32,32,32,32,32,32,50,45,116,117,112,108,101,115,32,99, - 111,110,116,97,105,110,105,110,103,32,116,104,101,32,108,111, - 97,100,101,114,32,97,110,100,32,116,104,101,32,102,105,108, - 101,32,115,117,102,102,105,120,101,115,32,116,104,101,32,108, - 111,97,100,101,114,10,32,32,32,32,32,32,32,32,114,101, - 99,111,103,110,105,122,101,115,46,99,1,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,51,0,0,0,115,22, - 0,0,0,124,0,93,14,125,1,124,1,136,0,102,2,86, - 0,1,0,113,2,100,0,83,0,41,1,78,114,4,0,0, - 0,41,2,114,24,0,0,0,114,222,0,0,0,41,1,114, - 124,0,0,0,114,4,0,0,0,114,6,0,0,0,114,224, - 0,0,0,177,4,0,0,115,2,0,0,0,4,0,122,38, - 70,105,108,101,70,105,110,100,101,114,46,95,95,105,110,105, - 116,95,95,46,60,108,111,99,97,108,115,62,46,60,103,101, - 110,101,120,112,114,62,114,61,0,0,0,114,31,0,0,0, - 78,114,91,0,0,0,41,7,114,147,0,0,0,218,8,95, - 108,111,97,100,101,114,115,114,37,0,0,0,218,11,95,112, - 97,116,104,95,109,116,105,109,101,218,3,115,101,116,218,11, - 95,112,97,116,104,95,99,97,99,104,101,218,19,95,114,101, - 108,97,120,101,100,95,112,97,116,104,95,99,97,99,104,101, - 41,5,114,104,0,0,0,114,37,0,0,0,218,14,108,111, - 97,100,101,114,95,100,101,116,97,105,108,115,90,7,108,111, - 97,100,101,114,115,114,164,0,0,0,114,4,0,0,0,41, - 1,114,124,0,0,0,114,6,0,0,0,114,182,0,0,0, - 171,4,0,0,115,16,0,0,0,0,4,4,1,14,1,28, - 1,6,2,10,1,6,1,8,1,122,19,70,105,108,101,70, - 105,110,100,101,114,46,95,95,105,110,105,116,95,95,99,1, - 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67, - 0,0,0,115,10,0,0,0,100,3,124,0,95,0,100,2, - 83,0,41,4,122,31,73,110,118,97,108,105,100,97,116,101, - 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, - 116,105,109,101,46,114,31,0,0,0,78,114,91,0,0,0, - 41,1,114,7,1,0,0,41,1,114,104,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,249,0, - 0,0,185,4,0,0,115,2,0,0,0,0,2,122,28,70, - 105,108,101,70,105,110,100,101,114,46,105,110,118,97,108,105, - 100,97,116,101,95,99,97,99,104,101,115,99,2,0,0,0, - 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0, - 115,42,0,0,0,124,0,106,0,124,1,131,1,125,2,124, - 2,100,1,107,8,114,26,100,1,103,0,102,2,83,0,124, - 2,106,1,124,2,106,2,112,38,103,0,102,2,83,0,41, - 2,122,197,84,114,121,32,116,111,32,102,105,110,100,32,97, - 32,108,111,97,100,101,114,32,102,111,114,32,116,104,101,32, - 115,112,101,99,105,102,105,101,100,32,109,111,100,117,108,101, - 44,32,111,114,32,116,104,101,32,110,97,109,101,115,112,97, - 99,101,10,32,32,32,32,32,32,32,32,112,97,99,107,97, - 103,101,32,112,111,114,116,105,111,110,115,46,32,82,101,116, - 117,114,110,115,32,40,108,111,97,100,101,114,44,32,108,105, - 115,116,45,111,102,45,112,111,114,116,105,111,110,115,41,46, - 10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109, - 101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97, - 116,101,100,46,32,32,85,115,101,32,102,105,110,100,95,115, - 112,101,99,40,41,32,105,110,115,116,101,97,100,46,10,10, - 32,32,32,32,32,32,32,32,78,41,3,114,178,0,0,0, - 114,124,0,0,0,114,154,0,0,0,41,3,114,104,0,0, - 0,114,123,0,0,0,114,162,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,121,0,0,0,191, - 4,0,0,115,8,0,0,0,0,7,10,1,8,1,8,1, - 122,22,70,105,108,101,70,105,110,100,101,114,46,102,105,110, - 100,95,108,111,97,100,101,114,99,6,0,0,0,0,0,0, - 0,7,0,0,0,6,0,0,0,67,0,0,0,115,26,0, - 0,0,124,1,124,2,124,3,131,2,125,6,116,0,124,2, - 124,3,124,6,124,4,100,1,141,4,83,0,41,2,78,41, - 2,114,124,0,0,0,114,154,0,0,0,41,1,114,165,0, - 0,0,41,7,114,104,0,0,0,114,163,0,0,0,114,123, - 0,0,0,114,37,0,0,0,90,4,115,109,115,108,114,177, - 0,0,0,114,124,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,4,1,0,0,203,4,0,0, - 115,6,0,0,0,0,1,10,1,8,1,122,20,70,105,108, - 101,70,105,110,100,101,114,46,95,103,101,116,95,115,112,101, - 99,78,99,3,0,0,0,0,0,0,0,14,0,0,0,15, - 0,0,0,67,0,0,0,115,98,1,0,0,100,1,125,3, - 124,1,106,0,100,2,131,1,100,3,25,0,125,4,121,24, - 116,1,124,0,106,2,112,34,116,3,106,4,131,0,131,1, - 106,5,125,5,87,0,110,24,4,0,116,6,107,10,114,66, - 1,0,1,0,1,0,100,10,125,5,89,0,110,2,88,0, - 124,5,124,0,106,7,107,3,114,92,124,0,106,8,131,0, - 1,0,124,5,124,0,95,7,116,9,131,0,114,114,124,0, - 106,10,125,6,124,4,106,11,131,0,125,7,110,10,124,0, - 106,12,125,6,124,4,125,7,124,7,124,6,107,6,114,218, - 116,13,124,0,106,2,124,4,131,2,125,8,120,72,124,0, - 106,14,68,0,93,54,92,2,125,9,125,10,100,5,124,9, - 23,0,125,11,116,13,124,8,124,11,131,2,125,12,116,15, - 124,12,131,1,114,152,124,0,106,16,124,10,124,1,124,12, - 124,8,103,1,124,2,131,5,83,0,113,152,87,0,116,17, - 124,8,131,1,125,3,120,88,124,0,106,14,68,0,93,78, - 92,2,125,9,125,10,116,13,124,0,106,2,124,4,124,9, - 23,0,131,2,125,12,116,18,106,19,100,6,124,12,100,3, - 100,7,141,3,1,0,124,7,124,9,23,0,124,6,107,6, - 114,226,116,15,124,12,131,1,114,226,124,0,106,16,124,10, - 124,1,124,12,100,8,124,2,131,5,83,0,113,226,87,0, - 124,3,144,1,114,94,116,18,106,19,100,9,124,8,131,2, - 1,0,116,18,106,20,124,1,100,8,131,2,125,13,124,8, - 103,1,124,13,95,21,124,13,83,0,100,8,83,0,41,11, - 122,111,84,114,121,32,116,111,32,102,105,110,100,32,97,32, - 115,112,101,99,32,102,111,114,32,116,104,101,32,115,112,101, - 99,105,102,105,101,100,32,109,111,100,117,108,101,46,10,10, - 32,32,32,32,32,32,32,32,82,101,116,117,114,110,115,32, - 116,104,101,32,109,97,116,99,104,105,110,103,32,115,112,101, - 99,44,32,111,114,32,78,111,110,101,32,105,102,32,110,111, - 116,32,102,111,117,110,100,46,10,32,32,32,32,32,32,32, - 32,70,114,61,0,0,0,114,59,0,0,0,114,31,0,0, - 0,114,182,0,0,0,122,9,116,114,121,105,110,103,32,123, - 125,41,1,90,9,118,101,114,98,111,115,105,116,121,78,122, - 25,112,111,115,115,105,98,108,101,32,110,97,109,101,115,112, - 97,99,101,32,102,111,114,32,123,125,114,91,0,0,0,41, - 22,114,34,0,0,0,114,41,0,0,0,114,37,0,0,0, - 114,3,0,0,0,114,47,0,0,0,114,216,0,0,0,114, - 42,0,0,0,114,7,1,0,0,218,11,95,102,105,108,108, - 95,99,97,99,104,101,114,7,0,0,0,114,10,1,0,0, - 114,92,0,0,0,114,9,1,0,0,114,30,0,0,0,114, - 6,1,0,0,114,46,0,0,0,114,4,1,0,0,114,48, - 0,0,0,114,118,0,0,0,114,133,0,0,0,114,158,0, - 0,0,114,154,0,0,0,41,14,114,104,0,0,0,114,123, - 0,0,0,114,177,0,0,0,90,12,105,115,95,110,97,109, - 101,115,112,97,99,101,90,11,116,97,105,108,95,109,111,100, - 117,108,101,114,130,0,0,0,90,5,99,97,99,104,101,90, - 12,99,97,99,104,101,95,109,111,100,117,108,101,90,9,98, - 97,115,101,95,112,97,116,104,114,222,0,0,0,114,163,0, - 0,0,90,13,105,110,105,116,95,102,105,108,101,110,97,109, - 101,90,9,102,117,108,108,95,112,97,116,104,114,162,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,178,0,0,0,208,4,0,0,115,70,0,0,0,0,5, - 4,1,14,1,2,1,24,1,14,1,10,1,10,1,8,1, - 6,2,6,1,6,1,10,2,6,1,4,2,8,1,12,1, - 16,1,8,1,10,1,8,1,24,4,8,2,16,1,16,1, - 16,1,12,1,8,1,10,1,12,1,6,1,12,1,12,1, - 8,1,4,1,122,20,70,105,108,101,70,105,110,100,101,114, - 46,102,105,110,100,95,115,112,101,99,99,1,0,0,0,0, - 0,0,0,9,0,0,0,13,0,0,0,67,0,0,0,115, - 194,0,0,0,124,0,106,0,125,1,121,22,116,1,106,2, - 124,1,112,22,116,1,106,3,131,0,131,1,125,2,87,0, - 110,30,4,0,116,4,116,5,116,6,102,3,107,10,114,58, - 1,0,1,0,1,0,103,0,125,2,89,0,110,2,88,0, - 116,7,106,8,106,9,100,1,131,1,115,84,116,10,124,2, - 131,1,124,0,95,11,110,78,116,10,131,0,125,3,120,64, - 124,2,68,0,93,56,125,4,124,4,106,12,100,2,131,1, - 92,3,125,5,125,6,125,7,124,6,114,138,100,3,106,13, - 124,5,124,7,106,14,131,0,131,2,125,8,110,4,124,5, - 125,8,124,3,106,15,124,8,131,1,1,0,113,96,87,0, - 124,3,124,0,95,11,116,7,106,8,106,9,116,16,131,1, - 114,190,100,4,100,5,132,0,124,2,68,0,131,1,124,0, - 95,17,100,6,83,0,41,7,122,68,70,105,108,108,32,116, - 104,101,32,99,97,99,104,101,32,111,102,32,112,111,116,101, - 110,116,105,97,108,32,109,111,100,117,108,101,115,32,97,110, - 100,32,112,97,99,107,97,103,101,115,32,102,111,114,32,116, - 104,105,115,32,100,105,114,101,99,116,111,114,121,46,114,0, - 0,0,0,114,61,0,0,0,122,5,123,125,46,123,125,99, - 1,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, - 83,0,0,0,115,20,0,0,0,104,0,124,0,93,12,125, - 1,124,1,106,0,131,0,146,2,113,4,83,0,114,4,0, - 0,0,41,1,114,92,0,0,0,41,2,114,24,0,0,0, - 90,2,102,110,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,250,9,60,115,101,116,99,111,109,112,62,29,5, - 0,0,115,2,0,0,0,6,0,122,41,70,105,108,101,70, + 101,100,46,32,32,85,115,101,32,102,105,110,100,95,115,112, + 101,99,40,41,32,105,110,115,116,101,97,100,46,10,10,32, + 32,32,32,32,32,32,32,78,41,3,114,178,0,0,0,114, + 124,0,0,0,114,154,0,0,0,41,3,114,104,0,0,0, + 114,123,0,0,0,114,162,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,121,0,0,0,192,4, + 0,0,115,8,0,0,0,0,7,10,1,8,1,8,1,122, + 22,70,105,108,101,70,105,110,100,101,114,46,102,105,110,100, + 95,108,111,97,100,101,114,99,6,0,0,0,0,0,0,0, + 7,0,0,0,6,0,0,0,67,0,0,0,115,26,0,0, + 0,124,1,124,2,124,3,131,2,125,6,116,0,124,2,124, + 3,124,6,124,4,100,1,141,4,83,0,41,2,78,41,2, + 114,124,0,0,0,114,154,0,0,0,41,1,114,165,0,0, + 0,41,7,114,104,0,0,0,114,163,0,0,0,114,123,0, + 0,0,114,37,0,0,0,90,4,115,109,115,108,114,177,0, + 0,0,114,124,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,4,1,0,0,204,4,0,0,115, + 6,0,0,0,0,1,10,1,8,1,122,20,70,105,108,101, + 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, + 78,99,3,0,0,0,0,0,0,0,14,0,0,0,15,0, + 0,0,67,0,0,0,115,98,1,0,0,100,1,125,3,124, + 1,106,0,100,2,131,1,100,3,25,0,125,4,121,24,116, + 1,124,0,106,2,112,34,116,3,106,4,131,0,131,1,106, + 5,125,5,87,0,110,24,4,0,116,6,107,10,114,66,1, + 0,1,0,1,0,100,10,125,5,89,0,110,2,88,0,124, + 5,124,0,106,7,107,3,114,92,124,0,106,8,131,0,1, + 0,124,5,124,0,95,7,116,9,131,0,114,114,124,0,106, + 10,125,6,124,4,106,11,131,0,125,7,110,10,124,0,106, + 12,125,6,124,4,125,7,124,7,124,6,107,6,114,218,116, + 13,124,0,106,2,124,4,131,2,125,8,120,72,124,0,106, + 14,68,0,93,54,92,2,125,9,125,10,100,5,124,9,23, + 0,125,11,116,13,124,8,124,11,131,2,125,12,116,15,124, + 12,131,1,114,152,124,0,106,16,124,10,124,1,124,12,124, + 8,103,1,124,2,131,5,83,0,113,152,87,0,116,17,124, + 8,131,1,125,3,120,88,124,0,106,14,68,0,93,78,92, + 2,125,9,125,10,116,13,124,0,106,2,124,4,124,9,23, + 0,131,2,125,12,116,18,106,19,100,6,124,12,100,3,100, + 7,141,3,1,0,124,7,124,9,23,0,124,6,107,6,114, + 226,116,15,124,12,131,1,114,226,124,0,106,16,124,10,124, + 1,124,12,100,8,124,2,131,5,83,0,113,226,87,0,124, + 3,144,1,114,94,116,18,106,19,100,9,124,8,131,2,1, + 0,116,18,106,20,124,1,100,8,131,2,125,13,124,8,103, + 1,124,13,95,21,124,13,83,0,100,8,83,0,41,11,122, + 111,84,114,121,32,116,111,32,102,105,110,100,32,97,32,115, + 112,101,99,32,102,111,114,32,116,104,101,32,115,112,101,99, + 105,102,105,101,100,32,109,111,100,117,108,101,46,10,10,32, + 32,32,32,32,32,32,32,82,101,116,117,114,110,115,32,116, + 104,101,32,109,97,116,99,104,105,110,103,32,115,112,101,99, + 44,32,111,114,32,78,111,110,101,32,105,102,32,110,111,116, + 32,102,111,117,110,100,46,10,32,32,32,32,32,32,32,32, + 70,114,61,0,0,0,114,59,0,0,0,114,31,0,0,0, + 114,182,0,0,0,122,9,116,114,121,105,110,103,32,123,125, + 41,1,90,9,118,101,114,98,111,115,105,116,121,78,122,25, + 112,111,115,115,105,98,108,101,32,110,97,109,101,115,112,97, + 99,101,32,102,111,114,32,123,125,114,91,0,0,0,41,22, + 114,34,0,0,0,114,41,0,0,0,114,37,0,0,0,114, + 3,0,0,0,114,47,0,0,0,114,216,0,0,0,114,42, + 0,0,0,114,7,1,0,0,218,11,95,102,105,108,108,95, + 99,97,99,104,101,114,7,0,0,0,114,10,1,0,0,114, + 92,0,0,0,114,9,1,0,0,114,30,0,0,0,114,6, + 1,0,0,114,46,0,0,0,114,4,1,0,0,114,48,0, + 0,0,114,118,0,0,0,114,133,0,0,0,114,158,0,0, + 0,114,154,0,0,0,41,14,114,104,0,0,0,114,123,0, + 0,0,114,177,0,0,0,90,12,105,115,95,110,97,109,101, + 115,112,97,99,101,90,11,116,97,105,108,95,109,111,100,117, + 108,101,114,130,0,0,0,90,5,99,97,99,104,101,90,12, + 99,97,99,104,101,95,109,111,100,117,108,101,90,9,98,97, + 115,101,95,112,97,116,104,114,222,0,0,0,114,163,0,0, + 0,90,13,105,110,105,116,95,102,105,108,101,110,97,109,101, + 90,9,102,117,108,108,95,112,97,116,104,114,162,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 178,0,0,0,209,4,0,0,115,70,0,0,0,0,5,4, + 1,14,1,2,1,24,1,14,1,10,1,10,1,8,1,6, + 2,6,1,6,1,10,2,6,1,4,2,8,1,12,1,16, + 1,8,1,10,1,8,1,24,4,8,2,16,1,16,1,16, + 1,12,1,8,1,10,1,12,1,6,1,12,1,12,1,8, + 1,4,1,122,20,70,105,108,101,70,105,110,100,101,114,46, + 102,105,110,100,95,115,112,101,99,99,1,0,0,0,0,0, + 0,0,9,0,0,0,13,0,0,0,67,0,0,0,115,194, + 0,0,0,124,0,106,0,125,1,121,22,116,1,106,2,124, + 1,112,22,116,1,106,3,131,0,131,1,125,2,87,0,110, + 30,4,0,116,4,116,5,116,6,102,3,107,10,114,58,1, + 0,1,0,1,0,103,0,125,2,89,0,110,2,88,0,116, + 7,106,8,106,9,100,1,131,1,115,84,116,10,124,2,131, + 1,124,0,95,11,110,78,116,10,131,0,125,3,120,64,124, + 2,68,0,93,56,125,4,124,4,106,12,100,2,131,1,92, + 3,125,5,125,6,125,7,124,6,114,138,100,3,106,13,124, + 5,124,7,106,14,131,0,131,2,125,8,110,4,124,5,125, + 8,124,3,106,15,124,8,131,1,1,0,113,96,87,0,124, + 3,124,0,95,11,116,7,106,8,106,9,116,16,131,1,114, + 190,100,4,100,5,132,0,124,2,68,0,131,1,124,0,95, + 17,100,6,83,0,41,7,122,68,70,105,108,108,32,116,104, + 101,32,99,97,99,104,101,32,111,102,32,112,111,116,101,110, + 116,105,97,108,32,109,111,100,117,108,101,115,32,97,110,100, + 32,112,97,99,107,97,103,101,115,32,102,111,114,32,116,104, + 105,115,32,100,105,114,101,99,116,111,114,121,46,114,0,0, + 0,0,114,61,0,0,0,122,5,123,125,46,123,125,99,1, + 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,83, + 0,0,0,115,20,0,0,0,104,0,124,0,93,12,125,1, + 124,1,106,0,131,0,146,2,113,4,83,0,114,4,0,0, + 0,41,1,114,92,0,0,0,41,2,114,24,0,0,0,90, + 2,102,110,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,250,9,60,115,101,116,99,111,109,112,62,30,5,0, + 0,115,2,0,0,0,6,0,122,41,70,105,108,101,70,105, + 110,100,101,114,46,95,102,105,108,108,95,99,97,99,104,101, + 46,60,108,111,99,97,108,115,62,46,60,115,101,116,99,111, + 109,112,62,78,41,18,114,37,0,0,0,114,3,0,0,0, + 90,7,108,105,115,116,100,105,114,114,47,0,0,0,114,255, + 0,0,0,218,15,80,101,114,109,105,115,115,105,111,110,69, + 114,114,111,114,218,18,78,111,116,65,68,105,114,101,99,116, + 111,114,121,69,114,114,111,114,114,8,0,0,0,114,9,0, + 0,0,114,10,0,0,0,114,8,1,0,0,114,9,1,0, + 0,114,87,0,0,0,114,50,0,0,0,114,92,0,0,0, + 218,3,97,100,100,114,11,0,0,0,114,10,1,0,0,41, + 9,114,104,0,0,0,114,37,0,0,0,90,8,99,111,110, + 116,101,110,116,115,90,21,108,111,119,101,114,95,115,117,102, + 102,105,120,95,99,111,110,116,101,110,116,115,114,244,0,0, + 0,114,102,0,0,0,114,234,0,0,0,114,222,0,0,0, + 90,8,110,101,119,95,110,97,109,101,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,12,1,0,0,1,5, + 0,0,115,34,0,0,0,0,2,6,1,2,1,22,1,20, + 3,10,3,12,1,12,7,6,1,10,1,16,1,4,1,18, + 2,4,1,14,1,6,1,12,1,122,22,70,105,108,101,70, 105,110,100,101,114,46,95,102,105,108,108,95,99,97,99,104, - 101,46,60,108,111,99,97,108,115,62,46,60,115,101,116,99, - 111,109,112,62,78,41,18,114,37,0,0,0,114,3,0,0, - 0,90,7,108,105,115,116,100,105,114,114,47,0,0,0,114, - 255,0,0,0,218,15,80,101,114,109,105,115,115,105,111,110, - 69,114,114,111,114,218,18,78,111,116,65,68,105,114,101,99, - 116,111,114,121,69,114,114,111,114,114,8,0,0,0,114,9, - 0,0,0,114,10,0,0,0,114,8,1,0,0,114,9,1, - 0,0,114,87,0,0,0,114,50,0,0,0,114,92,0,0, - 0,218,3,97,100,100,114,11,0,0,0,114,10,1,0,0, - 41,9,114,104,0,0,0,114,37,0,0,0,90,8,99,111, - 110,116,101,110,116,115,90,21,108,111,119,101,114,95,115,117, - 102,102,105,120,95,99,111,110,116,101,110,116,115,114,244,0, - 0,0,114,102,0,0,0,114,234,0,0,0,114,222,0,0, - 0,90,8,110,101,119,95,110,97,109,101,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,12,1,0,0,0, - 5,0,0,115,34,0,0,0,0,2,6,1,2,1,22,1, - 20,3,10,3,12,1,12,7,6,1,10,1,16,1,4,1, - 18,2,4,1,14,1,6,1,12,1,122,22,70,105,108,101, - 70,105,110,100,101,114,46,95,102,105,108,108,95,99,97,99, - 104,101,99,1,0,0,0,0,0,0,0,3,0,0,0,3, - 0,0,0,7,0,0,0,115,18,0,0,0,135,0,135,1, - 102,2,100,1,100,2,132,8,125,2,124,2,83,0,41,3, - 97,20,1,0,0,65,32,99,108,97,115,115,32,109,101,116, - 104,111,100,32,119,104,105,99,104,32,114,101,116,117,114,110, - 115,32,97,32,99,108,111,115,117,114,101,32,116,111,32,117, - 115,101,32,111,110,32,115,121,115,46,112,97,116,104,95,104, - 111,111,107,10,32,32,32,32,32,32,32,32,119,104,105,99, - 104,32,119,105,108,108,32,114,101,116,117,114,110,32,97,110, - 32,105,110,115,116,97,110,99,101,32,117,115,105,110,103,32, - 116,104,101,32,115,112,101,99,105,102,105,101,100,32,108,111, - 97,100,101,114,115,32,97,110,100,32,116,104,101,32,112,97, - 116,104,10,32,32,32,32,32,32,32,32,99,97,108,108,101, - 100,32,111,110,32,116,104,101,32,99,108,111,115,117,114,101, - 46,10,10,32,32,32,32,32,32,32,32,73,102,32,116,104, - 101,32,112,97,116,104,32,99,97,108,108,101,100,32,111,110, - 32,116,104,101,32,99,108,111,115,117,114,101,32,105,115,32, - 110,111,116,32,97,32,100,105,114,101,99,116,111,114,121,44, - 32,73,109,112,111,114,116,69,114,114,111,114,32,105,115,10, - 32,32,32,32,32,32,32,32,114,97,105,115,101,100,46,10, - 10,32,32,32,32,32,32,32,32,99,1,0,0,0,0,0, - 0,0,1,0,0,0,4,0,0,0,19,0,0,0,115,34, - 0,0,0,116,0,124,0,131,1,115,20,116,1,100,1,124, - 0,100,2,141,2,130,1,136,0,124,0,102,1,136,1,158, - 2,142,0,83,0,41,3,122,45,80,97,116,104,32,104,111, - 111,107,32,102,111,114,32,105,109,112,111,114,116,108,105,98, - 46,109,97,99,104,105,110,101,114,121,46,70,105,108,101,70, - 105,110,100,101,114,46,122,30,111,110,108,121,32,100,105,114, - 101,99,116,111,114,105,101,115,32,97,114,101,32,115,117,112, - 112,111,114,116,101,100,41,1,114,37,0,0,0,41,2,114, - 48,0,0,0,114,103,0,0,0,41,1,114,37,0,0,0, - 41,2,114,168,0,0,0,114,11,1,0,0,114,4,0,0, - 0,114,6,0,0,0,218,24,112,97,116,104,95,104,111,111, - 107,95,102,111,114,95,70,105,108,101,70,105,110,100,101,114, - 41,5,0,0,115,6,0,0,0,0,2,8,1,12,1,122, - 54,70,105,108,101,70,105,110,100,101,114,46,112,97,116,104, - 95,104,111,111,107,46,60,108,111,99,97,108,115,62,46,112, - 97,116,104,95,104,111,111,107,95,102,111,114,95,70,105,108, - 101,70,105,110,100,101,114,114,4,0,0,0,41,3,114,168, - 0,0,0,114,11,1,0,0,114,17,1,0,0,114,4,0, - 0,0,41,2,114,168,0,0,0,114,11,1,0,0,114,6, - 0,0,0,218,9,112,97,116,104,95,104,111,111,107,31,5, - 0,0,115,4,0,0,0,0,10,14,6,122,20,70,105,108, - 101,70,105,110,100,101,114,46,112,97,116,104,95,104,111,111, - 107,99,1,0,0,0,0,0,0,0,1,0,0,0,2,0, - 0,0,67,0,0,0,115,12,0,0,0,100,1,106,0,124, - 0,106,1,131,1,83,0,41,2,78,122,16,70,105,108,101, - 70,105,110,100,101,114,40,123,33,114,125,41,41,2,114,50, - 0,0,0,114,37,0,0,0,41,1,114,104,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,243, - 0,0,0,49,5,0,0,115,2,0,0,0,0,1,122,19, - 70,105,108,101,70,105,110,100,101,114,46,95,95,114,101,112, - 114,95,95,41,1,78,41,15,114,109,0,0,0,114,108,0, - 0,0,114,110,0,0,0,114,111,0,0,0,114,182,0,0, - 0,114,249,0,0,0,114,127,0,0,0,114,179,0,0,0, - 114,121,0,0,0,114,4,1,0,0,114,178,0,0,0,114, - 12,1,0,0,114,180,0,0,0,114,18,1,0,0,114,243, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,5,1,0,0,162,4,0,0, - 115,20,0,0,0,8,7,4,2,8,14,8,4,4,2,8, - 12,8,5,10,48,8,31,12,18,114,5,1,0,0,99,4, - 0,0,0,0,0,0,0,6,0,0,0,11,0,0,0,67, - 0,0,0,115,146,0,0,0,124,0,106,0,100,1,131,1, - 125,4,124,0,106,0,100,2,131,1,125,5,124,4,115,66, - 124,5,114,36,124,5,106,1,125,4,110,30,124,2,124,3, - 107,2,114,56,116,2,124,1,124,2,131,2,125,4,110,10, - 116,3,124,1,124,2,131,2,125,4,124,5,115,84,116,4, - 124,1,124,2,124,4,100,3,141,3,125,5,121,36,124,5, - 124,0,100,2,60,0,124,4,124,0,100,1,60,0,124,2, - 124,0,100,4,60,0,124,3,124,0,100,5,60,0,87,0, - 110,20,4,0,116,5,107,10,114,140,1,0,1,0,1,0, - 89,0,110,2,88,0,100,0,83,0,41,6,78,218,10,95, - 95,108,111,97,100,101,114,95,95,218,8,95,95,115,112,101, - 99,95,95,41,1,114,124,0,0,0,90,8,95,95,102,105, - 108,101,95,95,90,10,95,95,99,97,99,104,101,100,95,95, - 41,6,218,3,103,101,116,114,124,0,0,0,114,220,0,0, - 0,114,215,0,0,0,114,165,0,0,0,218,9,69,120,99, - 101,112,116,105,111,110,41,6,90,2,110,115,114,102,0,0, - 0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,97, - 116,104,110,97,109,101,114,124,0,0,0,114,162,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,55, - 5,0,0,115,34,0,0,0,0,2,10,1,10,1,4,1, - 4,1,8,1,8,1,12,2,10,1,4,1,14,1,2,1, - 8,1,8,1,8,1,12,1,14,2,114,23,1,0,0,99, - 0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, - 67,0,0,0,115,38,0,0,0,116,0,116,1,106,2,131, - 0,102,2,125,0,116,3,116,4,102,2,125,1,116,5,116, - 6,102,2,125,2,124,0,124,1,124,2,103,3,83,0,41, - 1,122,95,82,101,116,117,114,110,115,32,97,32,108,105,115, - 116,32,111,102,32,102,105,108,101,45,98,97,115,101,100,32, - 109,111,100,117,108,101,32,108,111,97,100,101,114,115,46,10, - 10,32,32,32,32,69,97,99,104,32,105,116,101,109,32,105, - 115,32,97,32,116,117,112,108,101,32,40,108,111,97,100,101, - 114,44,32,115,117,102,102,105,120,101,115,41,46,10,32,32, - 32,32,41,7,114,221,0,0,0,114,143,0,0,0,218,18, - 101,120,116,101,110,115,105,111,110,95,115,117,102,102,105,120, - 101,115,114,215,0,0,0,114,88,0,0,0,114,220,0,0, - 0,114,78,0,0,0,41,3,90,10,101,120,116,101,110,115, - 105,111,110,115,90,6,115,111,117,114,99,101,90,8,98,121, - 116,101,99,111,100,101,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,159,0,0,0,78,5,0,0,115,8, - 0,0,0,0,5,12,1,8,1,8,1,114,159,0,0,0, - 99,1,0,0,0,0,0,0,0,12,0,0,0,12,0,0, - 0,67,0,0,0,115,188,1,0,0,124,0,97,0,116,0, - 106,1,97,1,116,0,106,2,97,2,116,1,106,3,116,4, - 25,0,125,1,120,56,100,26,68,0,93,48,125,2,124,2, - 116,1,106,3,107,7,114,58,116,0,106,5,124,2,131,1, - 125,3,110,10,116,1,106,3,124,2,25,0,125,3,116,6, - 124,1,124,2,124,3,131,3,1,0,113,32,87,0,100,5, - 100,6,103,1,102,2,100,7,100,8,100,6,103,2,102,2, - 102,2,125,4,120,118,124,4,68,0,93,102,92,2,125,5, - 125,6,116,7,100,9,100,10,132,0,124,6,68,0,131,1, - 131,1,115,142,116,8,130,1,124,6,100,11,25,0,125,7, - 124,5,116,1,106,3,107,6,114,174,116,1,106,3,124,5, - 25,0,125,8,80,0,113,112,121,16,116,0,106,5,124,5, - 131,1,125,8,80,0,87,0,113,112,4,0,116,9,107,10, - 114,212,1,0,1,0,1,0,119,112,89,0,113,112,88,0, - 113,112,87,0,116,9,100,12,131,1,130,1,116,6,124,1, - 100,13,124,8,131,3,1,0,116,6,124,1,100,14,124,7, - 131,3,1,0,116,6,124,1,100,15,100,16,106,10,124,6, - 131,1,131,3,1,0,121,14,116,0,106,5,100,17,131,1, - 125,9,87,0,110,26,4,0,116,9,107,10,144,1,114,52, - 1,0,1,0,1,0,100,18,125,9,89,0,110,2,88,0, - 116,6,124,1,100,17,124,9,131,3,1,0,116,0,106,5, - 100,19,131,1,125,10,116,6,124,1,100,19,124,10,131,3, - 1,0,124,5,100,7,107,2,144,1,114,120,116,0,106,5, - 100,20,131,1,125,11,116,6,124,1,100,21,124,11,131,3, - 1,0,116,6,124,1,100,22,116,11,131,0,131,3,1,0, - 116,12,106,13,116,2,106,14,131,0,131,1,1,0,124,5, - 100,7,107,2,144,1,114,184,116,15,106,16,100,23,131,1, - 1,0,100,24,116,12,107,6,144,1,114,184,100,25,116,17, - 95,18,100,18,83,0,41,27,122,205,83,101,116,117,112,32, - 116,104,101,32,112,97,116,104,45,98,97,115,101,100,32,105, - 109,112,111,114,116,101,114,115,32,102,111,114,32,105,109,112, - 111,114,116,108,105,98,32,98,121,32,105,109,112,111,114,116, - 105,110,103,32,110,101,101,100,101,100,10,32,32,32,32,98, - 117,105,108,116,45,105,110,32,109,111,100,117,108,101,115,32, - 97,110,100,32,105,110,106,101,99,116,105,110,103,32,116,104, - 101,109,32,105,110,116,111,32,116,104,101,32,103,108,111,98, - 97,108,32,110,97,109,101,115,112,97,99,101,46,10,10,32, - 32,32,32,79,116,104,101,114,32,99,111,109,112,111,110,101, - 110,116,115,32,97,114,101,32,101,120,116,114,97,99,116,101, - 100,32,102,114,111,109,32,116,104,101,32,99,111,114,101,32, - 98,111,111,116,115,116,114,97,112,32,109,111,100,117,108,101, - 46,10,10,32,32,32,32,114,52,0,0,0,114,63,0,0, - 0,218,8,98,117,105,108,116,105,110,115,114,140,0,0,0, - 90,5,112,111,115,105,120,250,1,47,218,2,110,116,250,1, - 92,99,1,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,115,0,0,0,115,26,0,0,0,124,0,93,18,125, - 1,116,0,124,1,131,1,100,0,107,2,86,0,1,0,113, - 2,100,1,83,0,41,2,114,31,0,0,0,78,41,1,114, - 33,0,0,0,41,2,114,24,0,0,0,114,81,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 224,0,0,0,114,5,0,0,115,2,0,0,0,4,0,122, - 25,95,115,101,116,117,112,46,60,108,111,99,97,108,115,62, - 46,60,103,101,110,101,120,112,114,62,114,62,0,0,0,122, - 30,105,109,112,111,114,116,108,105,98,32,114,101,113,117,105, - 114,101,115,32,112,111,115,105,120,32,111,114,32,110,116,114, - 3,0,0,0,114,27,0,0,0,114,23,0,0,0,114,32, - 0,0,0,90,7,95,116,104,114,101,97,100,78,90,8,95, - 119,101,97,107,114,101,102,90,6,119,105,110,114,101,103,114, - 167,0,0,0,114,7,0,0,0,122,4,46,112,121,119,122, - 6,95,100,46,112,121,100,84,41,4,114,52,0,0,0,114, - 63,0,0,0,114,25,1,0,0,114,140,0,0,0,41,19, - 114,118,0,0,0,114,8,0,0,0,114,143,0,0,0,114, - 236,0,0,0,114,109,0,0,0,90,18,95,98,117,105,108, - 116,105,110,95,102,114,111,109,95,110,97,109,101,114,113,0, - 0,0,218,3,97,108,108,218,14,65,115,115,101,114,116,105, - 111,110,69,114,114,111,114,114,103,0,0,0,114,28,0,0, - 0,114,13,0,0,0,114,226,0,0,0,114,147,0,0,0, - 114,24,1,0,0,114,88,0,0,0,114,161,0,0,0,114, - 166,0,0,0,114,170,0,0,0,41,12,218,17,95,98,111, - 111,116,115,116,114,97,112,95,109,111,100,117,108,101,90,11, - 115,101,108,102,95,109,111,100,117,108,101,90,12,98,117,105, - 108,116,105,110,95,110,97,109,101,90,14,98,117,105,108,116, - 105,110,95,109,111,100,117,108,101,90,10,111,115,95,100,101, - 116,97,105,108,115,90,10,98,117,105,108,116,105,110,95,111, - 115,114,23,0,0,0,114,27,0,0,0,90,9,111,115,95, - 109,111,100,117,108,101,90,13,116,104,114,101,97,100,95,109, - 111,100,117,108,101,90,14,119,101,97,107,114,101,102,95,109, - 111,100,117,108,101,90,13,119,105,110,114,101,103,95,109,111, - 100,117,108,101,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,218,6,95,115,101,116,117,112,89,5,0,0,115, - 82,0,0,0,0,8,4,1,6,1,6,3,10,1,10,1, - 10,1,12,2,10,1,16,3,22,1,14,2,22,1,8,1, - 10,1,10,1,4,2,2,1,10,1,6,1,14,1,12,2, - 8,1,12,1,12,1,18,3,2,1,14,1,16,2,10,1, - 12,3,10,1,12,3,10,1,10,1,12,3,14,1,14,1, - 10,1,10,1,10,1,114,32,1,0,0,99,1,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, - 115,72,0,0,0,116,0,124,0,131,1,1,0,116,1,131, - 0,125,1,116,2,106,3,106,4,116,5,106,6,124,1,142, - 0,103,1,131,1,1,0,116,7,106,8,100,1,107,2,114, - 56,116,2,106,9,106,10,116,11,131,1,1,0,116,2,106, - 9,106,10,116,12,131,1,1,0,100,2,83,0,41,3,122, - 41,73,110,115,116,97,108,108,32,116,104,101,32,112,97,116, - 104,45,98,97,115,101,100,32,105,109,112,111,114,116,32,99, - 111,109,112,111,110,101,110,116,115,46,114,27,1,0,0,78, - 41,13,114,32,1,0,0,114,159,0,0,0,114,8,0,0, - 0,114,253,0,0,0,114,147,0,0,0,114,5,1,0,0, - 114,18,1,0,0,114,3,0,0,0,114,109,0,0,0,218, - 9,109,101,116,97,95,112,97,116,104,114,161,0,0,0,114, - 166,0,0,0,114,248,0,0,0,41,2,114,31,1,0,0, - 90,17,115,117,112,112,111,114,116,101,100,95,108,111,97,100, - 101,114,115,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,8,95,105,110,115,116,97,108,108,157,5,0,0, - 115,12,0,0,0,0,2,8,1,6,1,20,1,10,1,12, - 1,114,34,1,0,0,41,1,114,0,0,0,0,41,2,114, - 1,0,0,0,114,2,0,0,0,41,1,114,49,0,0,0, - 41,1,78,41,3,78,78,78,41,3,78,78,78,41,2,114, - 62,0,0,0,114,62,0,0,0,41,1,78,41,1,78,41, - 58,114,111,0,0,0,114,12,0,0,0,90,37,95,67,65, - 83,69,95,73,78,83,69,78,83,73,84,73,86,69,95,80, - 76,65,84,70,79,82,77,83,95,66,89,84,69,83,95,75, - 69,89,114,11,0,0,0,114,13,0,0,0,114,19,0,0, - 0,114,21,0,0,0,114,30,0,0,0,114,40,0,0,0, - 114,41,0,0,0,114,45,0,0,0,114,46,0,0,0,114, - 48,0,0,0,114,58,0,0,0,218,4,116,121,112,101,218, - 8,95,95,99,111,100,101,95,95,114,142,0,0,0,114,17, - 0,0,0,114,132,0,0,0,114,16,0,0,0,114,20,0, - 0,0,90,17,95,82,65,87,95,77,65,71,73,67,95,78, - 85,77,66,69,82,114,77,0,0,0,114,76,0,0,0,114, - 88,0,0,0,114,78,0,0,0,90,23,68,69,66,85,71, - 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, - 69,83,90,27,79,80,84,73,77,73,90,69,68,95,66,89, - 84,69,67,79,68,69,95,83,85,70,70,73,88,69,83,114, - 83,0,0,0,114,89,0,0,0,114,95,0,0,0,114,99, - 0,0,0,114,101,0,0,0,114,120,0,0,0,114,127,0, - 0,0,114,139,0,0,0,114,145,0,0,0,114,148,0,0, - 0,114,153,0,0,0,218,6,111,98,106,101,99,116,114,160, - 0,0,0,114,165,0,0,0,114,166,0,0,0,114,181,0, - 0,0,114,191,0,0,0,114,207,0,0,0,114,215,0,0, - 0,114,220,0,0,0,114,226,0,0,0,114,221,0,0,0, - 114,227,0,0,0,114,246,0,0,0,114,248,0,0,0,114, - 5,1,0,0,114,23,1,0,0,114,159,0,0,0,114,32, - 1,0,0,114,34,1,0,0,114,4,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,6,0,0,0,218,8,60,109, - 111,100,117,108,101,62,8,0,0,0,115,108,0,0,0,4, - 16,4,1,4,1,2,1,6,3,8,17,8,5,8,5,8, - 6,8,12,8,10,8,9,8,5,8,7,10,22,10,122,16, - 1,12,2,4,1,4,2,6,2,6,2,8,2,16,45,8, - 34,8,19,8,12,8,12,8,28,8,17,10,55,10,12,10, - 10,8,14,6,3,4,1,14,67,14,64,14,29,16,110,14, - 41,18,45,18,16,4,3,18,53,14,60,14,42,14,127,0, - 5,14,127,0,22,10,23,8,11,8,68, + 101,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, + 0,0,7,0,0,0,115,18,0,0,0,135,0,135,1,102, + 2,100,1,100,2,132,8,125,2,124,2,83,0,41,3,97, + 20,1,0,0,65,32,99,108,97,115,115,32,109,101,116,104, + 111,100,32,119,104,105,99,104,32,114,101,116,117,114,110,115, + 32,97,32,99,108,111,115,117,114,101,32,116,111,32,117,115, + 101,32,111,110,32,115,121,115,46,112,97,116,104,95,104,111, + 111,107,10,32,32,32,32,32,32,32,32,119,104,105,99,104, + 32,119,105,108,108,32,114,101,116,117,114,110,32,97,110,32, + 105,110,115,116,97,110,99,101,32,117,115,105,110,103,32,116, + 104,101,32,115,112,101,99,105,102,105,101,100,32,108,111,97, + 100,101,114,115,32,97,110,100,32,116,104,101,32,112,97,116, + 104,10,32,32,32,32,32,32,32,32,99,97,108,108,101,100, + 32,111,110,32,116,104,101,32,99,108,111,115,117,114,101,46, + 10,10,32,32,32,32,32,32,32,32,73,102,32,116,104,101, + 32,112,97,116,104,32,99,97,108,108,101,100,32,111,110,32, + 116,104,101,32,99,108,111,115,117,114,101,32,105,115,32,110, + 111,116,32,97,32,100,105,114,101,99,116,111,114,121,44,32, + 73,109,112,111,114,116,69,114,114,111,114,32,105,115,10,32, + 32,32,32,32,32,32,32,114,97,105,115,101,100,46,10,10, + 32,32,32,32,32,32,32,32,99,1,0,0,0,0,0,0, + 0,1,0,0,0,4,0,0,0,19,0,0,0,115,34,0, + 0,0,116,0,124,0,131,1,115,20,116,1,100,1,124,0, + 100,2,141,2,130,1,136,0,124,0,102,1,136,1,158,2, + 142,0,83,0,41,3,122,45,80,97,116,104,32,104,111,111, + 107,32,102,111,114,32,105,109,112,111,114,116,108,105,98,46, + 109,97,99,104,105,110,101,114,121,46,70,105,108,101,70,105, + 110,100,101,114,46,122,30,111,110,108,121,32,100,105,114,101, + 99,116,111,114,105,101,115,32,97,114,101,32,115,117,112,112, + 111,114,116,101,100,41,1,114,37,0,0,0,41,2,114,48, + 0,0,0,114,103,0,0,0,41,1,114,37,0,0,0,41, + 2,114,168,0,0,0,114,11,1,0,0,114,4,0,0,0, + 114,6,0,0,0,218,24,112,97,116,104,95,104,111,111,107, + 95,102,111,114,95,70,105,108,101,70,105,110,100,101,114,42, + 5,0,0,115,6,0,0,0,0,2,8,1,12,1,122,54, + 70,105,108,101,70,105,110,100,101,114,46,112,97,116,104,95, + 104,111,111,107,46,60,108,111,99,97,108,115,62,46,112,97, + 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, + 70,105,110,100,101,114,114,4,0,0,0,41,3,114,168,0, + 0,0,114,11,1,0,0,114,17,1,0,0,114,4,0,0, + 0,41,2,114,168,0,0,0,114,11,1,0,0,114,6,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,32,5,0, + 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, + 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, + 99,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0, + 0,67,0,0,0,115,12,0,0,0,100,1,106,0,124,0, + 106,1,131,1,83,0,41,2,78,122,16,70,105,108,101,70, + 105,110,100,101,114,40,123,33,114,125,41,41,2,114,50,0, + 0,0,114,37,0,0,0,41,1,114,104,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,243,0, + 0,0,50,5,0,0,115,2,0,0,0,0,1,122,19,70, + 105,108,101,70,105,110,100,101,114,46,95,95,114,101,112,114, + 95,95,41,1,78,41,15,114,109,0,0,0,114,108,0,0, + 0,114,110,0,0,0,114,111,0,0,0,114,182,0,0,0, + 114,249,0,0,0,114,127,0,0,0,114,179,0,0,0,114, + 121,0,0,0,114,4,1,0,0,114,178,0,0,0,114,12, + 1,0,0,114,180,0,0,0,114,18,1,0,0,114,243,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,5,1,0,0,163,4,0,0,115, + 20,0,0,0,8,7,4,2,8,14,8,4,4,2,8,12, + 8,5,10,48,8,31,12,18,114,5,1,0,0,99,4,0, + 0,0,0,0,0,0,6,0,0,0,11,0,0,0,67,0, + 0,0,115,146,0,0,0,124,0,106,0,100,1,131,1,125, + 4,124,0,106,0,100,2,131,1,125,5,124,4,115,66,124, + 5,114,36,124,5,106,1,125,4,110,30,124,2,124,3,107, + 2,114,56,116,2,124,1,124,2,131,2,125,4,110,10,116, + 3,124,1,124,2,131,2,125,4,124,5,115,84,116,4,124, + 1,124,2,124,4,100,3,141,3,125,5,121,36,124,5,124, + 0,100,2,60,0,124,4,124,0,100,1,60,0,124,2,124, + 0,100,4,60,0,124,3,124,0,100,5,60,0,87,0,110, + 20,4,0,116,5,107,10,114,140,1,0,1,0,1,0,89, + 0,110,2,88,0,100,0,83,0,41,6,78,218,10,95,95, + 108,111,97,100,101,114,95,95,218,8,95,95,115,112,101,99, + 95,95,41,1,114,124,0,0,0,90,8,95,95,102,105,108, + 101,95,95,90,10,95,95,99,97,99,104,101,100,95,95,41, + 6,218,3,103,101,116,114,124,0,0,0,114,220,0,0,0, + 114,215,0,0,0,114,165,0,0,0,218,9,69,120,99,101, + 112,116,105,111,110,41,6,90,2,110,115,114,102,0,0,0, + 90,8,112,97,116,104,110,97,109,101,90,9,99,112,97,116, + 104,110,97,109,101,114,124,0,0,0,114,162,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,14, + 95,102,105,120,95,117,112,95,109,111,100,117,108,101,56,5, + 0,0,115,34,0,0,0,0,2,10,1,10,1,4,1,4, + 1,8,1,8,1,12,2,10,1,4,1,14,1,2,1,8, + 1,8,1,8,1,12,1,14,2,114,23,1,0,0,99,0, + 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, + 0,0,0,115,38,0,0,0,116,0,116,1,106,2,131,0, + 102,2,125,0,116,3,116,4,102,2,125,1,116,5,116,6, + 102,2,125,2,124,0,124,1,124,2,103,3,83,0,41,1, + 122,95,82,101,116,117,114,110,115,32,97,32,108,105,115,116, + 32,111,102,32,102,105,108,101,45,98,97,115,101,100,32,109, + 111,100,117,108,101,32,108,111,97,100,101,114,115,46,10,10, + 32,32,32,32,69,97,99,104,32,105,116,101,109,32,105,115, + 32,97,32,116,117,112,108,101,32,40,108,111,97,100,101,114, + 44,32,115,117,102,102,105,120,101,115,41,46,10,32,32,32, + 32,41,7,114,221,0,0,0,114,143,0,0,0,218,18,101, + 120,116,101,110,115,105,111,110,95,115,117,102,102,105,120,101, + 115,114,215,0,0,0,114,88,0,0,0,114,220,0,0,0, + 114,78,0,0,0,41,3,90,10,101,120,116,101,110,115,105, + 111,110,115,90,6,115,111,117,114,99,101,90,8,98,121,116, + 101,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,114,159,0,0,0,79,5,0,0,115,8,0, + 0,0,0,5,12,1,8,1,8,1,114,159,0,0,0,99, + 1,0,0,0,0,0,0,0,12,0,0,0,12,0,0,0, + 67,0,0,0,115,188,1,0,0,124,0,97,0,116,0,106, + 1,97,1,116,0,106,2,97,2,116,1,106,3,116,4,25, + 0,125,1,120,56,100,26,68,0,93,48,125,2,124,2,116, + 1,106,3,107,7,114,58,116,0,106,5,124,2,131,1,125, + 3,110,10,116,1,106,3,124,2,25,0,125,3,116,6,124, + 1,124,2,124,3,131,3,1,0,113,32,87,0,100,5,100, + 6,103,1,102,2,100,7,100,8,100,6,103,2,102,2,102, + 2,125,4,120,118,124,4,68,0,93,102,92,2,125,5,125, + 6,116,7,100,9,100,10,132,0,124,6,68,0,131,1,131, + 1,115,142,116,8,130,1,124,6,100,11,25,0,125,7,124, + 5,116,1,106,3,107,6,114,174,116,1,106,3,124,5,25, + 0,125,8,80,0,113,112,121,16,116,0,106,5,124,5,131, + 1,125,8,80,0,87,0,113,112,4,0,116,9,107,10,114, + 212,1,0,1,0,1,0,119,112,89,0,113,112,88,0,113, + 112,87,0,116,9,100,12,131,1,130,1,116,6,124,1,100, + 13,124,8,131,3,1,0,116,6,124,1,100,14,124,7,131, + 3,1,0,116,6,124,1,100,15,100,16,106,10,124,6,131, + 1,131,3,1,0,121,14,116,0,106,5,100,17,131,1,125, + 9,87,0,110,26,4,0,116,9,107,10,144,1,114,52,1, + 0,1,0,1,0,100,18,125,9,89,0,110,2,88,0,116, + 6,124,1,100,17,124,9,131,3,1,0,116,0,106,5,100, + 19,131,1,125,10,116,6,124,1,100,19,124,10,131,3,1, + 0,124,5,100,7,107,2,144,1,114,120,116,0,106,5,100, + 20,131,1,125,11,116,6,124,1,100,21,124,11,131,3,1, + 0,116,6,124,1,100,22,116,11,131,0,131,3,1,0,116, + 12,106,13,116,2,106,14,131,0,131,1,1,0,124,5,100, + 7,107,2,144,1,114,184,116,15,106,16,100,23,131,1,1, + 0,100,24,116,12,107,6,144,1,114,184,100,25,116,17,95, + 18,100,18,83,0,41,27,122,205,83,101,116,117,112,32,116, + 104,101,32,112,97,116,104,45,98,97,115,101,100,32,105,109, + 112,111,114,116,101,114,115,32,102,111,114,32,105,109,112,111, + 114,116,108,105,98,32,98,121,32,105,109,112,111,114,116,105, + 110,103,32,110,101,101,100,101,100,10,32,32,32,32,98,117, + 105,108,116,45,105,110,32,109,111,100,117,108,101,115,32,97, + 110,100,32,105,110,106,101,99,116,105,110,103,32,116,104,101, + 109,32,105,110,116,111,32,116,104,101,32,103,108,111,98,97, + 108,32,110,97,109,101,115,112,97,99,101,46,10,10,32,32, + 32,32,79,116,104,101,114,32,99,111,109,112,111,110,101,110, + 116,115,32,97,114,101,32,101,120,116,114,97,99,116,101,100, + 32,102,114,111,109,32,116,104,101,32,99,111,114,101,32,98, + 111,111,116,115,116,114,97,112,32,109,111,100,117,108,101,46, + 10,10,32,32,32,32,114,52,0,0,0,114,63,0,0,0, + 218,8,98,117,105,108,116,105,110,115,114,140,0,0,0,90, + 5,112,111,115,105,120,250,1,47,218,2,110,116,250,1,92, + 99,1,0,0,0,0,0,0,0,2,0,0,0,3,0,0, + 0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1, + 116,0,124,1,131,1,100,0,107,2,86,0,1,0,113,2, + 100,1,83,0,41,2,114,31,0,0,0,78,41,1,114,33, + 0,0,0,41,2,114,24,0,0,0,114,81,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,224, + 0,0,0,115,5,0,0,115,2,0,0,0,4,0,122,25, + 95,115,101,116,117,112,46,60,108,111,99,97,108,115,62,46, + 60,103,101,110,101,120,112,114,62,114,62,0,0,0,122,30, + 105,109,112,111,114,116,108,105,98,32,114,101,113,117,105,114, + 101,115,32,112,111,115,105,120,32,111,114,32,110,116,114,3, + 0,0,0,114,27,0,0,0,114,23,0,0,0,114,32,0, + 0,0,90,7,95,116,104,114,101,97,100,78,90,8,95,119, + 101,97,107,114,101,102,90,6,119,105,110,114,101,103,114,167, + 0,0,0,114,7,0,0,0,122,4,46,112,121,119,122,6, + 95,100,46,112,121,100,84,41,4,114,52,0,0,0,114,63, + 0,0,0,114,25,1,0,0,114,140,0,0,0,41,19,114, + 118,0,0,0,114,8,0,0,0,114,143,0,0,0,114,236, + 0,0,0,114,109,0,0,0,90,18,95,98,117,105,108,116, + 105,110,95,102,114,111,109,95,110,97,109,101,114,113,0,0, + 0,218,3,97,108,108,218,14,65,115,115,101,114,116,105,111, + 110,69,114,114,111,114,114,103,0,0,0,114,28,0,0,0, + 114,13,0,0,0,114,226,0,0,0,114,147,0,0,0,114, + 24,1,0,0,114,88,0,0,0,114,161,0,0,0,114,166, + 0,0,0,114,170,0,0,0,41,12,218,17,95,98,111,111, + 116,115,116,114,97,112,95,109,111,100,117,108,101,90,11,115, + 101,108,102,95,109,111,100,117,108,101,90,12,98,117,105,108, + 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, + 110,95,109,111,100,117,108,101,90,10,111,115,95,100,101,116, + 97,105,108,115,90,10,98,117,105,108,116,105,110,95,111,115, + 114,23,0,0,0,114,27,0,0,0,90,9,111,115,95,109, + 111,100,117,108,101,90,13,116,104,114,101,97,100,95,109,111, + 100,117,108,101,90,14,119,101,97,107,114,101,102,95,109,111, + 100,117,108,101,90,13,119,105,110,114,101,103,95,109,111,100, + 117,108,101,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,218,6,95,115,101,116,117,112,90,5,0,0,115,82, + 0,0,0,0,8,4,1,6,1,6,3,10,1,10,1,10, + 1,12,2,10,1,16,3,22,1,14,2,22,1,8,1,10, + 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, + 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, + 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, + 1,10,1,10,1,114,32,1,0,0,99,1,0,0,0,0, + 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, + 72,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, + 125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0, + 103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56, + 116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9, + 106,10,116,12,131,1,1,0,100,2,83,0,41,3,122,41, + 73,110,115,116,97,108,108,32,116,104,101,32,112,97,116,104, + 45,98,97,115,101,100,32,105,109,112,111,114,116,32,99,111, + 109,112,111,110,101,110,116,115,46,114,27,1,0,0,78,41, + 13,114,32,1,0,0,114,159,0,0,0,114,8,0,0,0, + 114,253,0,0,0,114,147,0,0,0,114,5,1,0,0,114, + 18,1,0,0,114,3,0,0,0,114,109,0,0,0,218,9, + 109,101,116,97,95,112,97,116,104,114,161,0,0,0,114,166, + 0,0,0,114,248,0,0,0,41,2,114,31,1,0,0,90, + 17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101, + 114,115,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,8,95,105,110,115,116,97,108,108,158,5,0,0,115, + 12,0,0,0,0,2,8,1,6,1,20,1,10,1,12,1, + 114,34,1,0,0,41,1,114,0,0,0,0,41,2,114,1, + 0,0,0,114,2,0,0,0,41,1,114,49,0,0,0,41, + 1,78,41,3,78,78,78,41,3,78,78,78,41,2,114,62, + 0,0,0,114,62,0,0,0,41,1,78,41,1,78,41,58, + 114,111,0,0,0,114,12,0,0,0,90,37,95,67,65,83, + 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, + 65,84,70,79,82,77,83,95,66,89,84,69,83,95,75,69, + 89,114,11,0,0,0,114,13,0,0,0,114,19,0,0,0, + 114,21,0,0,0,114,30,0,0,0,114,40,0,0,0,114, + 41,0,0,0,114,45,0,0,0,114,46,0,0,0,114,48, + 0,0,0,114,58,0,0,0,218,4,116,121,112,101,218,8, + 95,95,99,111,100,101,95,95,114,142,0,0,0,114,17,0, + 0,0,114,132,0,0,0,114,16,0,0,0,114,20,0,0, + 0,90,17,95,82,65,87,95,77,65,71,73,67,95,78,85, + 77,66,69,82,114,77,0,0,0,114,76,0,0,0,114,88, + 0,0,0,114,78,0,0,0,90,23,68,69,66,85,71,95, + 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, + 83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84, + 69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,83, + 0,0,0,114,89,0,0,0,114,95,0,0,0,114,99,0, + 0,0,114,101,0,0,0,114,120,0,0,0,114,127,0,0, + 0,114,139,0,0,0,114,145,0,0,0,114,148,0,0,0, + 114,153,0,0,0,218,6,111,98,106,101,99,116,114,160,0, + 0,0,114,165,0,0,0,114,166,0,0,0,114,181,0,0, + 0,114,191,0,0,0,114,207,0,0,0,114,215,0,0,0, + 114,220,0,0,0,114,226,0,0,0,114,221,0,0,0,114, + 227,0,0,0,114,246,0,0,0,114,248,0,0,0,114,5, + 1,0,0,114,23,1,0,0,114,159,0,0,0,114,32,1, + 0,0,114,34,1,0,0,114,4,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,218,8,60,109,111, + 100,117,108,101,62,8,0,0,0,115,108,0,0,0,4,16, + 4,1,4,1,2,1,6,3,8,17,8,5,8,5,8,6, + 8,12,8,10,8,9,8,5,8,7,10,22,10,123,16,1, + 12,2,4,1,4,2,6,2,6,2,8,2,16,45,8,34, + 8,19,8,12,8,12,8,28,8,17,10,55,10,12,10,10, + 8,14,6,3,4,1,14,67,14,64,14,29,16,110,14,41, + 18,45,18,16,4,3,18,53,14,60,14,42,14,127,0,5, + 14,127,0,22,10,23,8,11,8,68, }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 01:59:34 2016 From: python-checkins at python.org (nick.coghlan) Date: Mon, 05 Dec 2016 06:59:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_=2323722_from_3=2E6?= Message-ID: <20161205065934.28774.97152.D39B7A38@psf.io> https://hg.python.org/cpython/rev/9e5bc3d38de8 changeset: 105460:9e5bc3d38de8 parent: 105458:d35fc6e58a70 parent: 105459:e33245800f1a user: Nick Coghlan date: Mon Dec 05 16:59:22 2016 +1000 summary: Merge #23722 from 3.6 files: Doc/reference/datamodel.rst | 43 +- Doc/whatsnew/3.6.rst | 10 + Lib/importlib/_bootstrap_external.py | 3 +- Lib/test/test_super.py | 125 +- Misc/NEWS | 13 + Objects/typeobject.c | 11 +- Python/bltinmodule.c | 40 +- Python/compile.c | 8 +- Python/importlib_external.h | 2358 +++++++------- 9 files changed, 1398 insertions(+), 1213 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1700,6 +1700,10 @@ Metaclasses ^^^^^^^^^^^ +.. index:: + single: metaclass + builtin: type + By default, classes are constructed using :func:`type`. The class body is executed in a new namespace and the class name is bound locally to the result of ``type(name, bases, namespace)``. @@ -1730,6 +1734,8 @@ Determining the appropriate metaclass ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: metaclass hint The appropriate metaclass for a class definition is determined as follows: @@ -1751,6 +1757,9 @@ Preparing the class namespace ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: __prepare__ (metaclass method) + Once the appropriate metaclass has been identified, then the class namespace is prepared. If the metaclass has a ``__prepare__`` attribute, it is called as ``namespace = metaclass.__prepare__(name, bases, **kwds)`` (where the @@ -1768,6 +1777,9 @@ Executing the class body ^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: class; body + The class body is executed (approximately) as ``exec(body, globals(), namespace)``. The key difference from a normal call to :func:`exec` is that lexical scoping allows the class body (including @@ -1777,12 +1789,19 @@ However, even when the class definition occurs inside the function, methods defined inside the class still cannot see names defined at the class scope. Class variables must be accessed through the first parameter of instance or -class methods, and cannot be accessed at all from static methods. - +class methods, or through the implicit lexically scoped ``__class__`` reference +described in the next section. + +.. _class-object-creation: Creating the class object ^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: + single: __class__ (method cell) + single: __classcell__ (class namespace entry) + + Once the class namespace has been populated by executing the class body, the class object is created by calling ``metaclass(name, bases, namespace, **kwds)`` (the additional keywords @@ -1796,6 +1815,26 @@ lexical scoping, while the class or instance that was used to make the current call is identified based on the first argument passed to the method. +.. impl-detail:: + + In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass + as a ``__classcell__`` entry in the class namespace. If present, this must + be propagated up to the ``type.__new__`` call in order for the class to be + initialised correctly. + Failing to do so will result in a :exc:`DeprecationWarning` in Python 3.6, + and a :exc:`RuntimeWarning` in the future. + +When using the default metaclass :class:`type`, or any metaclass that ultimately +calls ``type.__new__``, the following additional customisation steps are +invoked after creating the class object: + +* first, ``type.__new__`` collects all of the descriptors in the class + namespace that define a :meth:`~object.__set_name__` method; +* second, all of these ``__set_name__`` methods are called with the class + being defined and the assigned name of that particular descriptor; and +* finally, the :meth:`~object.__init_subclass__` hook is called on the + immediate parent of the new class in its method resolution order. + After the class object is created, it is passed to the class decorators included in the class definition (if any) and the resulting object is bound in the local namespace as the defined class. diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -351,6 +351,11 @@ class Plugin2(PluginBase): pass +In order to allow zero-argument :func:`super` calls to work correctly from +:meth:`~object.__init_subclass__` implementations, custom metaclasses must +ensure that the new ``__classcell__`` namespace entry is propagated to +``type.__new__`` (as described in :ref:`class-object-creation`). + .. seealso:: :pep:`487` -- Simpler customization of class creation @@ -2235,6 +2240,11 @@ on a ZipFile created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` was raised in those scenarios. +* when custom metaclasses are combined with zero-argument :func:`super` or + direct references from methods to the implicit ``__class__`` closure + variable, the implicit ``__classcell__`` namespace entry must now be passed + up to ``type.__new__`` for initialisation. Failing to do so will result in + a :exc:`DeprecationWarning` in 3.6 and a :exc:`RuntimeWarning` in the future. Changes in the C API -------------------- diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -239,6 +239,7 @@ # Python 3.6b1 3376 (simplify CALL_FUNCTIONs & BUILD_MAP_UNPACK_WITH_CALL) # Python 3.6b1 3377 (set __class__ cell from type.__new__ #23722) # Python 3.6b2 3378 (add BUILD_TUPLE_UNPACK_WITH_CALL #28257) +# Python 3.6rc1 3379 (more thorough __class__ validation #23722) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -247,7 +248,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3378).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3379).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -1,7 +1,9 @@ -"""Unit tests for new super() implementation.""" +"""Unit tests for zero-argument super() & related machinery.""" import sys import unittest +import warnings +from test.support import check_warnings class A: @@ -144,6 +146,8 @@ self.assertIs(X.f(), X) def test___class___new(self): + # See issue #23722 + # Ensure zero-arg super() works as soon as type.__new__() is completed test_class = None class Meta(type): @@ -161,6 +165,7 @@ self.assertIs(test_class, A) def test___class___delayed(self): + # See issue #23722 test_namespace = None class Meta(type): @@ -169,10 +174,14 @@ test_namespace = namespace return None - class A(metaclass=Meta): - @staticmethod - def f(): - return __class__ + # This case shouldn't trigger the __classcell__ deprecation warning + with check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + class A(metaclass=Meta): + @staticmethod + def f(): + return __class__ + self.assertEqual(w.warnings, []) self.assertIs(A, None) @@ -180,6 +189,7 @@ self.assertIs(B.f(), B) def test___class___mro(self): + # See issue #23722 test_class = None class Meta(type): @@ -195,34 +205,105 @@ self.assertIs(test_class, A) - def test___classcell___deleted(self): + def test___classcell___expected_behaviour(self): + # See issue #23722 class Meta(type): def __new__(cls, name, bases, namespace): - del namespace['__classcell__'] + nonlocal namespace_snapshot + namespace_snapshot = namespace.copy() return super().__new__(cls, name, bases, namespace) - class A(metaclass=Meta): - @staticmethod - def f(): - __class__ + # __classcell__ is injected into the class namespace by the compiler + # when at least one method needs it, and should be omitted otherwise + namespace_snapshot = None + class WithoutClassRef(metaclass=Meta): + pass + self.assertNotIn("__classcell__", namespace_snapshot) - with self.assertRaises(NameError): - A.f() + # With zero-arg super() or an explicit __class__ reference, + # __classcell__ is the exact cell reference to be populated by + # type.__new__ + namespace_snapshot = None + class WithClassRef(metaclass=Meta): + def f(self): + return __class__ - def test___classcell___reset(self): + class_cell = namespace_snapshot["__classcell__"] + method_closure = WithClassRef.f.__closure__ + self.assertEqual(len(method_closure), 1) + self.assertIs(class_cell, method_closure[0]) + # Ensure the cell reference *doesn't* get turned into an attribute + with self.assertRaises(AttributeError): + WithClassRef.__classcell__ + + def test___classcell___missing(self): + # See issue #23722 + # Some metaclasses may not pass the original namespace to type.__new__ + # We test that case here by forcibly deleting __classcell__ class Meta(type): def __new__(cls, name, bases, namespace): - namespace['__classcell__'] = 0 + namespace.pop('__classcell__', None) return super().__new__(cls, name, bases, namespace) - class A(metaclass=Meta): - @staticmethod - def f(): - __class__ + # The default case should continue to work without any warnings + with check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + class WithoutClassRef(metaclass=Meta): + pass + self.assertEqual(w.warnings, []) - with self.assertRaises(NameError): - A.f() - self.assertEqual(A.__classcell__, 0) + # With zero-arg super() or an explicit __class__ reference, we expect + # __build_class__ to emit a DeprecationWarning complaining that + # __class__ was not set, and asking if __classcell__ was propagated + # to type.__new__. + # In Python 3.7, that warning will become a RuntimeError. + expected_warning = ( + '__class__ not set.*__classcell__ propagated', + DeprecationWarning + ) + with check_warnings(expected_warning): + warnings.simplefilter("always", DeprecationWarning) + class WithClassRef(metaclass=Meta): + def f(self): + return __class__ + # Check __class__ still gets set despite the warning + self.assertIs(WithClassRef().f(), WithClassRef) + + # Check the warning is turned into an error as expected + with warnings.catch_warnings(): + warnings.simplefilter("error", DeprecationWarning) + with self.assertRaises(DeprecationWarning): + class WithClassRef(metaclass=Meta): + def f(self): + return __class__ + + def test___classcell___overwrite(self): + # See issue #23722 + # Overwriting __classcell__ with nonsense is explicitly prohibited + class Meta(type): + def __new__(cls, name, bases, namespace, cell): + namespace['__classcell__'] = cell + return super().__new__(cls, name, bases, namespace) + + for bad_cell in (None, 0, "", object()): + with self.subTest(bad_cell=bad_cell): + with self.assertRaises(TypeError): + class A(metaclass=Meta, cell=bad_cell): + pass + + def test___classcell___wrong_cell(self): + # See issue #23722 + # Pointing the cell reference at the wrong class is also prohibited + class Meta(type): + def __new__(cls, name, bases, namespace): + cls = super().__new__(cls, name, bases, namespace) + B = type("B", (), namespace) + return cls + + with self.assertRaises(TypeError): + class A(metaclass=Meta): + def f(self): + return __class__ def test_obscure_super_errors(self): def f(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ Core and Builtins ----------------- +- Issue #23722: Rather than silently producing a class that doesn't support + zero-argument ``super()`` in methods, failing to pass the new + ``__classcell__`` namespace entry up to ``type.__new__`` now results in a + ``DeprecationWarning`` and a class that supports zero-argument ``super()``. + - Issue #28797: Modifying the class __dict__ inside the __set_name__ method of a descriptor that is used inside that class no longer prevents calling the __set_name__ method of other descriptors. @@ -30,6 +35,14 @@ non-encodable characters (non-ASCII for the ASCII codec, characters out of the U+0000-U+00FF range for Latin1). +Documentation +------------- + +- Issue #23722: The data model reference and the porting section in the + 3.6 What's New guide now cover the additional ``__classcell__`` handling + needed for custom metaclasses to fully support PEP 487 and zero-argument + ``super()``. + - Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of dict literal with constant keys up to 30%. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2687,9 +2687,16 @@ else type->tp_free = PyObject_Del; - /* store type in class' cell */ + /* store type in class' cell if one is supplied */ cell = _PyDict_GetItemId(dict, &PyId___classcell__); - if (cell != NULL && PyCell_Check(cell)) { + if (cell != NULL) { + /* At least one method requires a reference to its defining class */ + if (!PyCell_Check(cell)) { + PyErr_Format(PyExc_TypeError, + "__classcell__ must be a nonlocal cell, not %.200R", + Py_TYPE(cell)); + goto error; + } PyCell_Set(cell, (PyObject *) type); _PyDict_DelItemId(dict, &PyId___classcell__); PyErr_Clear(); diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -54,8 +54,8 @@ static PyObject * builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds) { - PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns, *none; - PyObject *cls = NULL; + PyObject *func, *name, *bases, *mkw, *meta, *winner, *prep, *ns; + PyObject *cls = NULL, *cell = NULL; Py_ssize_t nargs; int isclass = 0; /* initialize to prevent gcc warning */ @@ -167,14 +167,44 @@ Py_DECREF(bases); return NULL; } - none = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns, + cell = PyEval_EvalCodeEx(PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), ns, NULL, 0, NULL, 0, NULL, 0, NULL, PyFunction_GET_CLOSURE(func)); - if (none != NULL) { + if (cell != NULL) { PyObject *margs[3] = {name, bases, ns}; cls = _PyObject_FastCallDict(meta, margs, 3, mkw); - Py_DECREF(none); + if (cls != NULL && PyType_Check(cls) && PyCell_Check(cell)) { + PyObject *cell_cls = PyCell_GET(cell); + if (cell_cls != cls) { + /* TODO: In 3.7, DeprecationWarning will become RuntimeError. + * At that point, cell_error won't be needed. + */ + int cell_error; + if (cell_cls == NULL) { + const char *msg = + "__class__ not set defining %.200R as %.200R. " + "Was __classcell__ propagated to type.__new__?"; + cell_error = PyErr_WarnFormat( + PyExc_DeprecationWarning, 1, msg, name, cls); + } else { + const char *msg = + "__class__ set to %.200R defining %.200R as %.200R"; + PyErr_Format(PyExc_TypeError, msg, cell_cls, name, cls); + cell_error = 1; + } + if (cell_error) { + Py_DECREF(cls); + cls = NULL; + goto error; + } else { + /* Fill in the cell, since type.__new__ didn't do it */ + PyCell_Set(cell, cls); + } + } + } } +error: + Py_XDECREF(cell); Py_DECREF(ns); Py_DECREF(meta); Py_XDECREF(mkw); diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1967,8 +1967,9 @@ compiler_exit_scope(c); return 0; } + /* Return __classcell__ if it is referenced, otherwise return None */ if (c->u->u_ste->ste_needs_class_closure) { - /* store __classcell__ into class namespace */ + /* Store __classcell__ into class namespace & return it */ str = PyUnicode_InternFromString("__class__"); if (str == NULL) { compiler_exit_scope(c); @@ -1983,6 +1984,7 @@ assert(i == 0); ADDOP_I(c, LOAD_CLOSURE, i); + ADDOP(c, DUP_TOP); str = PyUnicode_InternFromString("__classcell__"); if (!str || !compiler_nameop(c, str, Store)) { Py_XDECREF(str); @@ -1992,9 +1994,11 @@ Py_DECREF(str); } else { - /* This happens when nobody references the cell. */ + /* No methods referenced __class__, so just return None */ assert(PyDict_Size(c->u->u_cellvars) == 0); + ADDOP_O(c, LOAD_CONST, Py_None, consts); } + ADDOP_IN_SCOPE(c, RETURN_VALUE); /* create the code object */ co = assemble(c, 1); } diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -242,7 +242,7 @@ 101,95,97,116,111,109,105,99,106,0,0,0,115,26,0,0, 0,0,5,16,1,6,1,26,1,2,3,14,1,20,1,16, 1,14,1,2,1,14,1,14,1,6,1,114,58,0,0,0, - 105,50,13,0,0,233,2,0,0,0,114,15,0,0,0,115, + 105,51,13,0,0,233,2,0,0,0,114,15,0,0,0,115, 2,0,0,0,13,10,90,11,95,95,112,121,99,97,99,104, 101,95,95,122,4,111,112,116,45,122,3,46,112,121,122,4, 46,112,121,99,78,41,1,218,12,111,112,116,105,109,105,122, @@ -346,7 +346,7 @@ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,6,0,0, 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,6,1,0,0,115,48,0,0,0,0,18,8, + 117,114,99,101,7,1,0,0,115,48,0,0,0,0,18,8, 1,6,1,6,1,8,1,4,1,8,1,12,1,10,1,12, 1,16,1,8,1,8,1,8,1,24,1,8,1,12,1,6, 2,8,1,8,1,8,1,8,1,14,1,14,1,114,83,0, @@ -420,7 +420,7 @@ 112,116,95,108,101,118,101,108,90,13,98,97,115,101,95,102, 105,108,101,110,97,109,101,114,4,0,0,0,114,4,0,0, 0,114,6,0,0,0,218,17,115,111,117,114,99,101,95,102, - 114,111,109,95,99,97,99,104,101,51,1,0,0,115,46,0, + 114,111,109,95,99,97,99,104,101,52,1,0,0,115,46,0, 0,0,0,9,12,1,8,1,10,1,12,1,12,1,8,1, 6,1,10,1,10,1,8,1,6,1,10,1,8,1,16,1, 10,1,6,1,8,1,16,1,8,1,6,1,8,1,14,1, @@ -456,7 +456,7 @@ 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116, 104,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108, - 101,85,1,0,0,115,20,0,0,0,0,7,12,1,4,1, + 101,86,1,0,0,115,20,0,0,0,0,7,12,1,4,1, 16,1,26,1,4,1,2,1,12,1,18,1,18,1,114,95, 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, 11,0,0,0,67,0,0,0,115,72,0,0,0,124,0,106, @@ -469,7 +469,7 @@ 114,83,0,0,0,114,70,0,0,0,114,78,0,0,0,41, 1,218,8,102,105,108,101,110,97,109,101,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,11,95,103,101,116, - 95,99,97,99,104,101,100,104,1,0,0,115,16,0,0,0, + 95,99,97,99,104,101,100,105,1,0,0,115,16,0,0,0, 0,1,14,1,2,1,8,1,14,1,8,1,14,1,4,2, 114,99,0,0,0,99,1,0,0,0,0,0,0,0,2,0, 0,0,11,0,0,0,67,0,0,0,115,52,0,0,0,121, @@ -483,7 +483,7 @@ 128,0,0,0,41,3,114,41,0,0,0,114,43,0,0,0, 114,42,0,0,0,41,2,114,37,0,0,0,114,44,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,95,99,97,108,99,95,109,111,100,101,116,1,0,0, + 218,10,95,99,97,108,99,95,109,111,100,101,117,1,0,0, 115,12,0,0,0,0,2,2,1,14,1,14,1,10,3,8, 1,114,101,0,0,0,99,1,0,0,0,0,0,0,0,3, 0,0,0,11,0,0,0,3,0,0,0,115,68,0,0,0, @@ -521,7 +521,7 @@ 114,103,115,90,6,107,119,97,114,103,115,41,1,218,6,109, 101,116,104,111,100,114,4,0,0,0,114,6,0,0,0,218, 19,95,99,104,101,99,107,95,110,97,109,101,95,119,114,97, - 112,112,101,114,136,1,0,0,115,12,0,0,0,0,1,8, + 112,112,101,114,137,1,0,0,115,12,0,0,0,0,1,8, 1,8,1,10,1,4,1,18,1,122,40,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, @@ -540,7 +540,7 @@ 100,105,99,116,95,95,218,6,117,112,100,97,116,101,41,3, 90,3,110,101,119,90,3,111,108,100,114,55,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,5, - 95,119,114,97,112,147,1,0,0,115,8,0,0,0,0,1, + 95,119,114,97,112,148,1,0,0,115,8,0,0,0,0,1, 10,1,10,1,22,1,122,26,95,99,104,101,99,107,95,110, 97,109,101,46,60,108,111,99,97,108,115,62,46,95,119,114, 97,112,41,1,78,41,3,218,10,95,98,111,111,116,115,116, @@ -548,7 +548,7 @@ 114,111,114,41,3,114,106,0,0,0,114,107,0,0,0,114, 117,0,0,0,114,4,0,0,0,41,1,114,106,0,0,0, 114,6,0,0,0,218,11,95,99,104,101,99,107,95,110,97, - 109,101,128,1,0,0,115,14,0,0,0,0,8,14,7,2, + 109,101,129,1,0,0,115,14,0,0,0,0,8,14,7,2, 1,10,1,14,2,14,5,10,1,114,120,0,0,0,99,2, 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, 0,0,0,115,60,0,0,0,124,0,106,0,124,1,131,1, @@ -576,7 +576,7 @@ 101,114,218,8,112,111,114,116,105,111,110,115,218,3,109,115, 103,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, 218,17,95,102,105,110,100,95,109,111,100,117,108,101,95,115, - 104,105,109,156,1,0,0,115,10,0,0,0,0,10,14,1, + 104,105,109,157,1,0,0,115,10,0,0,0,0,10,14,1, 16,1,4,1,22,1,114,127,0,0,0,99,4,0,0,0, 0,0,0,0,11,0,0,0,22,0,0,0,67,0,0,0, 115,136,1,0,0,105,0,125,4,124,2,100,1,107,9,114, @@ -656,7 +656,7 @@ 115,111,117,114,99,101,95,115,105,122,101,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,25,95,118,97,108, 105,100,97,116,101,95,98,121,116,101,99,111,100,101,95,104, - 101,97,100,101,114,173,1,0,0,115,76,0,0,0,0,11, + 101,97,100,101,114,174,1,0,0,115,76,0,0,0,0,11, 4,1,8,1,10,3,4,1,8,1,8,1,12,1,12,1, 12,1,8,1,12,1,12,1,14,1,12,1,10,1,12,1, 10,1,12,1,10,1,12,1,8,1,10,1,2,1,16,1, @@ -685,7 +685,7 @@ 0,0,0,114,102,0,0,0,114,93,0,0,0,114,94,0, 0,0,218,4,99,111,100,101,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,17,95,99,111,109,112,105,108, - 101,95,98,121,116,101,99,111,100,101,228,1,0,0,115,16, + 101,95,98,121,116,101,99,111,100,101,229,1,0,0,115,16, 0,0,0,0,2,10,1,10,1,12,1,8,1,12,1,4, 2,10,1,114,145,0,0,0,114,62,0,0,0,99,3,0, 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, @@ -704,7 +704,7 @@ 114,144,0,0,0,114,130,0,0,0,114,138,0,0,0,114, 56,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,98,121, - 116,101,99,111,100,101,240,1,0,0,115,10,0,0,0,0, + 116,101,99,111,100,101,241,1,0,0,115,10,0,0,0,0, 3,8,1,14,1,14,1,16,1,114,148,0,0,0,99,1, 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, 0,0,0,115,62,0,0,0,100,1,100,2,108,0,125,1, @@ -731,7 +731,7 @@ 101,110,99,111,100,105,110,103,90,15,110,101,119,108,105,110, 101,95,100,101,99,111,100,101,114,114,4,0,0,0,114,4, 0,0,0,114,6,0,0,0,218,13,100,101,99,111,100,101, - 95,115,111,117,114,99,101,250,1,0,0,115,10,0,0,0, + 95,115,111,117,114,99,101,251,1,0,0,115,10,0,0,0, 0,5,8,1,12,1,10,1,12,1,114,153,0,0,0,41, 2,114,124,0,0,0,218,26,115,117,98,109,111,100,117,108, 101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,111, @@ -793,7 +793,7 @@ 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,23,115,112,101,99,95,102,114, 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 11,2,0,0,115,62,0,0,0,0,12,8,4,4,1,10, + 12,2,0,0,115,62,0,0,0,0,12,8,4,4,1,10, 2,2,1,14,1,14,1,8,2,10,8,16,1,6,3,8, 1,16,1,14,1,10,1,6,1,6,2,4,3,8,2,10, 1,2,1,14,1,14,1,6,2,4,1,8,2,6,1,12, @@ -829,7 +829,7 @@ 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, 2,218,3,99,108,115,114,5,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,91,2,0,0,115,8, + 110,95,114,101,103,105,115,116,114,121,92,2,0,0,115,8, 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, @@ -855,7 +855,7 @@ 121,114,5,0,0,0,90,4,104,107,101,121,218,8,102,105, 108,101,112,97,116,104,114,4,0,0,0,114,4,0,0,0, 114,6,0,0,0,218,16,95,115,101,97,114,99,104,95,114, - 101,103,105,115,116,114,121,98,2,0,0,115,22,0,0,0, + 101,103,105,115,116,114,121,99,2,0,0,115,22,0,0,0, 0,2,6,1,8,2,6,1,6,1,22,1,2,1,12,1, 26,1,14,1,6,1,122,38,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,115, @@ -877,7 +877,7 @@ 0,0,0,218,6,116,97,114,103,101,116,114,174,0,0,0, 114,124,0,0,0,114,164,0,0,0,114,162,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,9, - 102,105,110,100,95,115,112,101,99,113,2,0,0,115,26,0, + 102,105,110,100,95,115,112,101,99,114,2,0,0,115,26,0, 0,0,0,2,10,1,8,1,4,1,2,1,12,1,14,1, 6,1,16,1,14,1,6,1,8,1,8,1,122,31,87,105, 110,100,111,119,115,82,101,103,105,115,116,114,121,70,105,110, @@ -896,7 +896,7 @@ 0,114,124,0,0,0,41,4,114,168,0,0,0,114,123,0, 0,0,114,37,0,0,0,114,162,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,6,0,0,0,218,11,102,105,110, - 100,95,109,111,100,117,108,101,129,2,0,0,115,8,0,0, + 100,95,109,111,100,117,108,101,130,2,0,0,115,8,0,0, 0,0,7,12,1,8,1,6,2,122,33,87,105,110,100,111, 119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,114, 46,102,105,110,100,95,109,111,100,117,108,101,41,2,78,78, @@ -906,7 +906,7 @@ 101,116,104,111,100,114,169,0,0,0,114,175,0,0,0,114, 178,0,0,0,114,179,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,166,0, - 0,0,79,2,0,0,115,20,0,0,0,8,2,4,3,4, + 0,0,80,2,0,0,115,20,0,0,0,8,2,4,3,4, 3,4,2,4,2,12,7,12,15,2,1,12,15,2,1,114, 166,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,64,0,0,0,115,48,0,0,0,101,0, @@ -941,7 +941,7 @@ 98,0,0,0,90,13,102,105,108,101,110,97,109,101,95,98, 97,115,101,90,9,116,97,105,108,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,157,0, - 0,0,148,2,0,0,115,8,0,0,0,0,3,18,1,16, + 0,0,149,2,0,0,115,8,0,0,0,0,3,18,1,16, 1,14,1,122,24,95,76,111,97,100,101,114,66,97,115,105, 99,115,46,105,115,95,112,97,99,107,97,103,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, @@ -951,7 +951,7 @@ 99,114,101,97,116,105,111,110,46,78,114,4,0,0,0,41, 2,114,104,0,0,0,114,162,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,13,99,114,101,97, - 116,101,95,109,111,100,117,108,101,156,2,0,0,115,0,0, + 116,101,95,109,111,100,117,108,101,157,2,0,0,115,0,0, 0,0,122,27,95,76,111,97,100,101,114,66,97,115,105,99, 115,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0, @@ -971,7 +971,7 @@ 114,115,0,0,0,41,3,114,104,0,0,0,218,6,109,111, 100,117,108,101,114,144,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,6,0,0,0,218,11,101,120,101,99,95,109, - 111,100,117,108,101,159,2,0,0,115,10,0,0,0,0,2, + 111,100,117,108,101,160,2,0,0,115,10,0,0,0,0,2, 12,1,8,1,6,1,10,1,122,25,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,101,120,101,99,95,109,111,100, 117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -982,14 +982,14 @@ 95,108,111,97,100,95,109,111,100,117,108,101,95,115,104,105, 109,41,2,114,104,0,0,0,114,123,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,218,11,108,111, - 97,100,95,109,111,100,117,108,101,167,2,0,0,115,2,0, + 97,100,95,109,111,100,117,108,101,168,2,0,0,115,2,0, 0,0,0,2,122,25,95,76,111,97,100,101,114,66,97,115, 105,99,115,46,108,111,97,100,95,109,111,100,117,108,101,78, 41,8,114,109,0,0,0,114,108,0,0,0,114,110,0,0, 0,114,111,0,0,0,114,157,0,0,0,114,183,0,0,0, 114,188,0,0,0,114,190,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,181, - 0,0,0,143,2,0,0,115,10,0,0,0,8,3,4,2, + 0,0,0,144,2,0,0,115,10,0,0,0,8,3,4,2, 8,8,8,3,8,8,114,181,0,0,0,99,0,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,64,0,0,0, 115,74,0,0,0,101,0,90,1,100,0,90,2,100,1,100, @@ -1014,7 +1014,7 @@ 32,32,32,32,32,32,32,78,41,1,218,7,73,79,69,114, 114,111,114,41,2,114,104,0,0,0,114,37,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,109,116,105,109,101,174,2,0,0,115,2, + 112,97,116,104,95,109,116,105,109,101,175,2,0,0,115,2, 0,0,0,0,6,122,23,83,111,117,114,99,101,76,111,97, 100,101,114,46,112,97,116,104,95,109,116,105,109,101,99,2, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1049,7 +1049,7 @@ 32,32,32,32,32,32,32,114,130,0,0,0,41,1,114,193, 0,0,0,41,2,114,104,0,0,0,114,37,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,115,116,97,116,115,182,2,0,0,115,2, + 112,97,116,104,95,115,116,97,116,115,183,2,0,0,115,2, 0,0,0,0,11,122,23,83,111,117,114,99,101,76,111,97, 100,101,114,46,112,97,116,104,95,115,116,97,116,115,99,4, 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, @@ -1073,7 +1073,7 @@ 94,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104, 114,56,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 6,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116, - 101,99,111,100,101,195,2,0,0,115,2,0,0,0,0,8, + 101,99,111,100,101,196,2,0,0,115,2,0,0,0,0,8, 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95, 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3, 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67, @@ -1090,7 +1090,7 @@ 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,104, 0,0,0,114,37,0,0,0,114,56,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,195,0,0, - 0,205,2,0,0,115,0,0,0,0,122,21,83,111,117,114, + 0,206,2,0,0,115,0,0,0,0,122,21,83,111,117,114, 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116, 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0, 0,0,67,0,0,0,115,82,0,0,0,124,0,106,0,124, @@ -1110,7 +1110,7 @@ 0,114,153,0,0,0,41,5,114,104,0,0,0,114,123,0, 0,0,114,37,0,0,0,114,151,0,0,0,218,3,101,120, 99,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,103,101,116,95,115,111,117,114,99,101,212,2,0,0, + 218,10,103,101,116,95,115,111,117,114,99,101,213,2,0,0, 115,14,0,0,0,0,2,10,1,2,1,14,1,16,1,4, 1,28,1,122,23,83,111,117,114,99,101,76,111,97,100,101, 114,46,103,101,116,95,115,111,117,114,99,101,114,31,0,0, @@ -1132,7 +1132,7 @@ 112,105,108,101,41,4,114,104,0,0,0,114,56,0,0,0, 114,37,0,0,0,114,200,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,6,0,0,0,218,14,115,111,117,114,99, - 101,95,116,111,95,99,111,100,101,222,2,0,0,115,4,0, + 101,95,116,111,95,99,111,100,101,223,2,0,0,115,4,0, 0,0,0,5,12,1,122,27,83,111,117,114,99,101,76,111, 97,100,101,114,46,115,111,117,114,99,101,95,116,111,95,99, 111,100,101,99,2,0,0,0,0,0,0,0,10,0,0,0, @@ -1189,7 +1189,7 @@ 10,98,121,116,101,115,95,100,97,116,97,114,151,0,0,0, 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,184,0,0, - 0,230,2,0,0,115,78,0,0,0,0,7,10,1,4,1, + 0,231,2,0,0,115,78,0,0,0,0,7,10,1,4,1, 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, 12,1,2,1,14,1,14,1,6,2,2,1,4,1,4,1, 12,1,18,1,6,2,8,1,6,1,6,1,2,1,8,1, @@ -1201,7 +1201,7 @@ 114,196,0,0,0,114,195,0,0,0,114,199,0,0,0,114, 203,0,0,0,114,184,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,191,0, - 0,0,172,2,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,173,2,0,0,115,14,0,0,0,8,2,8,8,8, 13,8,10,8,7,8,10,14,8,114,191,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2, @@ -1209,7 +1209,7 @@ 132,0,90,5,100,6,100,7,132,0,90,6,101,7,135,0, 102,1,100,8,100,9,132,8,131,1,90,8,101,7,100,10, 100,11,132,0,131,1,90,9,100,12,100,13,132,0,90,10, - 135,0,90,11,100,14,83,0,41,15,218,10,70,105,108,101, + 135,0,4,0,90,11,83,0,41,14,218,10,70,105,108,101, 76,111,97,100,101,114,122,103,66,97,115,101,32,102,105,108, 101,32,108,111,97,100,101,114,32,99,108,97,115,115,32,119, 104,105,99,104,32,105,109,112,108,101,109,101,110,116,115,32, @@ -1227,7 +1227,7 @@ 32,102,105,110,100,101,114,46,78,41,2,114,102,0,0,0, 114,37,0,0,0,41,3,114,104,0,0,0,114,123,0,0, 0,114,37,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,182,0,0,0,31,3,0,0,115,4, + 114,6,0,0,0,114,182,0,0,0,32,3,0,0,115,4, 0,0,0,0,3,6,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,95,95,105,110,105,116,95,95,99,2,0,0, 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, @@ -1236,7 +1236,7 @@ 78,41,2,218,9,95,95,99,108,97,115,115,95,95,114,115, 0,0,0,41,2,114,104,0,0,0,218,5,111,116,104,101, 114,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,6,95,95,101,113,95,95,37,3,0,0,115,4,0,0, + 218,6,95,95,101,113,95,95,38,3,0,0,115,4,0,0, 0,0,1,12,1,122,17,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, 0,1,0,0,0,3,0,0,0,67,0,0,0,115,20,0, @@ -1244,7 +1244,7 @@ 131,1,65,0,83,0,41,1,78,41,3,218,4,104,97,115, 104,114,102,0,0,0,114,37,0,0,0,41,1,114,104,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,8,95,95,104,97,115,104,95,95,41,3,0,0,115, + 0,218,8,95,95,104,97,115,104,95,95,42,3,0,0,115, 2,0,0,0,0,1,122,19,70,105,108,101,76,111,97,100, 101,114,46,95,95,104,97,115,104,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0, @@ -1259,7 +1259,7 @@ 5,115,117,112,101,114,114,207,0,0,0,114,190,0,0,0, 41,2,114,104,0,0,0,114,123,0,0,0,41,1,114,208, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,190,0, - 0,0,44,3,0,0,115,2,0,0,0,0,10,122,22,70, + 0,0,45,3,0,0,115,2,0,0,0,0,10,122,22,70, 105,108,101,76,111,97,100,101,114,46,108,111,97,100,95,109, 111,100,117,108,101,99,2,0,0,0,0,0,0,0,2,0, 0,0,1,0,0,0,67,0,0,0,115,6,0,0,0,124, @@ -1269,7 +1269,7 @@ 111,117,110,100,32,98,121,32,116,104,101,32,102,105,110,100, 101,114,46,41,1,114,37,0,0,0,41,2,114,104,0,0, 0,114,123,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,155,0,0,0,56,3,0,0,115,2, + 114,6,0,0,0,114,155,0,0,0,57,3,0,0,115,2, 0,0,0,0,3,122,23,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,102,105,108,101,110,97,109,101,99,2, 0,0,0,0,0,0,0,3,0,0,0,9,0,0,0,67, @@ -1281,1156 +1281,1156 @@ 101,115,46,218,1,114,78,41,3,114,52,0,0,0,114,53, 0,0,0,90,4,114,101,97,100,41,3,114,104,0,0,0, 114,37,0,0,0,114,57,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,197,0,0,0,61,3, + 4,0,0,0,114,6,0,0,0,114,197,0,0,0,62,3, 0,0,115,4,0,0,0,0,2,14,1,122,19,70,105,108, 101,76,111,97,100,101,114,46,103,101,116,95,100,97,116,97, - 78,41,12,114,109,0,0,0,114,108,0,0,0,114,110,0, - 0,0,114,111,0,0,0,114,182,0,0,0,114,210,0,0, - 0,114,212,0,0,0,114,120,0,0,0,114,190,0,0,0, - 114,155,0,0,0,114,197,0,0,0,90,13,95,95,99,108, - 97,115,115,99,101,108,108,95,95,114,4,0,0,0,114,4, - 0,0,0,41,1,114,208,0,0,0,114,6,0,0,0,114, - 207,0,0,0,26,3,0,0,115,14,0,0,0,8,3,4, - 2,8,6,8,4,8,3,16,12,12,5,114,207,0,0,0, - 99,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, - 0,64,0,0,0,115,46,0,0,0,101,0,90,1,100,0, - 90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,4, - 100,5,132,0,90,5,100,6,100,7,156,1,100,8,100,9, - 132,2,90,6,100,10,83,0,41,11,218,16,83,111,117,114, - 99,101,70,105,108,101,76,111,97,100,101,114,122,62,67,111, - 110,99,114,101,116,101,32,105,109,112,108,101,109,101,110,116, - 97,116,105,111,110,32,111,102,32,83,111,117,114,99,101,76, - 111,97,100,101,114,32,117,115,105,110,103,32,116,104,101,32, - 102,105,108,101,32,115,121,115,116,101,109,46,99,2,0,0, - 0,0,0,0,0,3,0,0,0,3,0,0,0,67,0,0, - 0,115,22,0,0,0,116,0,124,1,131,1,125,2,124,2, - 106,1,124,2,106,2,100,1,156,2,83,0,41,2,122,33, - 82,101,116,117,114,110,32,116,104,101,32,109,101,116,97,100, - 97,116,97,32,102,111,114,32,116,104,101,32,112,97,116,104, - 46,41,2,114,130,0,0,0,114,131,0,0,0,41,3,114, - 41,0,0,0,218,8,115,116,95,109,116,105,109,101,90,7, - 115,116,95,115,105,122,101,41,3,114,104,0,0,0,114,37, - 0,0,0,114,205,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,194,0,0,0,71,3,0,0, - 115,4,0,0,0,0,2,8,1,122,27,83,111,117,114,99, - 101,70,105,108,101,76,111,97,100,101,114,46,112,97,116,104, - 95,115,116,97,116,115,99,4,0,0,0,0,0,0,0,5, - 0,0,0,5,0,0,0,67,0,0,0,115,24,0,0,0, - 116,0,124,1,131,1,125,4,124,0,106,1,124,2,124,3, - 124,4,100,1,141,3,83,0,41,2,78,41,1,218,5,95, - 109,111,100,101,41,2,114,101,0,0,0,114,195,0,0,0, - 41,5,114,104,0,0,0,114,94,0,0,0,114,93,0,0, - 0,114,56,0,0,0,114,44,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,196,0,0,0,76, - 3,0,0,115,4,0,0,0,0,2,8,1,122,32,83,111, - 117,114,99,101,70,105,108,101,76,111,97,100,101,114,46,95, - 99,97,99,104,101,95,98,121,116,101,99,111,100,101,105,182, - 1,0,0,41,1,114,217,0,0,0,99,3,0,0,0,1, - 0,0,0,9,0,0,0,17,0,0,0,67,0,0,0,115, - 250,0,0,0,116,0,124,1,131,1,92,2,125,4,125,5, - 103,0,125,6,120,40,124,4,114,56,116,1,124,4,131,1, - 12,0,114,56,116,0,124,4,131,1,92,2,125,4,125,7, - 124,6,106,2,124,7,131,1,1,0,113,18,87,0,120,108, - 116,3,124,6,131,1,68,0,93,96,125,7,116,4,124,4, - 124,7,131,2,125,4,121,14,116,5,106,6,124,4,131,1, - 1,0,87,0,113,68,4,0,116,7,107,10,114,118,1,0, - 1,0,1,0,119,68,89,0,113,68,4,0,116,8,107,10, - 114,162,1,0,125,8,1,0,122,18,116,9,106,10,100,1, - 124,4,124,8,131,3,1,0,100,2,83,0,100,2,125,8, - 126,8,88,0,113,68,88,0,113,68,87,0,121,28,116,11, - 124,1,124,2,124,3,131,3,1,0,116,9,106,10,100,3, - 124,1,131,2,1,0,87,0,110,48,4,0,116,8,107,10, - 114,244,1,0,125,8,1,0,122,20,116,9,106,10,100,1, - 124,1,124,8,131,3,1,0,87,0,89,0,100,2,100,2, - 125,8,126,8,88,0,110,2,88,0,100,2,83,0,41,4, - 122,27,87,114,105,116,101,32,98,121,116,101,115,32,100,97, - 116,97,32,116,111,32,97,32,102,105,108,101,46,122,27,99, - 111,117,108,100,32,110,111,116,32,99,114,101,97,116,101,32, - 123,33,114,125,58,32,123,33,114,125,78,122,12,99,114,101, - 97,116,101,100,32,123,33,114,125,41,12,114,40,0,0,0, - 114,48,0,0,0,114,161,0,0,0,114,35,0,0,0,114, - 30,0,0,0,114,3,0,0,0,90,5,109,107,100,105,114, - 218,15,70,105,108,101,69,120,105,115,116,115,69,114,114,111, - 114,114,42,0,0,0,114,118,0,0,0,114,133,0,0,0, - 114,58,0,0,0,41,9,114,104,0,0,0,114,37,0,0, - 0,114,56,0,0,0,114,217,0,0,0,218,6,112,97,114, - 101,110,116,114,98,0,0,0,114,29,0,0,0,114,25,0, - 0,0,114,198,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,195,0,0,0,81,3,0,0,115, - 42,0,0,0,0,2,12,1,4,2,16,1,12,1,14,2, - 14,1,10,1,2,1,14,1,14,2,6,1,16,3,6,1, - 8,1,20,1,2,1,12,1,16,1,16,2,8,1,122,25, - 83,111,117,114,99,101,70,105,108,101,76,111,97,100,101,114, - 46,115,101,116,95,100,97,116,97,78,41,7,114,109,0,0, - 0,114,108,0,0,0,114,110,0,0,0,114,111,0,0,0, - 114,194,0,0,0,114,196,0,0,0,114,195,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,215,0,0,0,67,3,0,0,115,8,0,0, - 0,8,2,4,2,8,5,8,5,114,215,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,64, - 0,0,0,115,32,0,0,0,101,0,90,1,100,0,90,2, - 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, - 132,0,90,5,100,6,83,0,41,7,218,20,83,111,117,114, - 99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,114, - 122,45,76,111,97,100,101,114,32,119,104,105,99,104,32,104, - 97,110,100,108,101,115,32,115,111,117,114,99,101,108,101,115, - 115,32,102,105,108,101,32,105,109,112,111,114,116,115,46,99, - 2,0,0,0,0,0,0,0,5,0,0,0,5,0,0,0, - 67,0,0,0,115,48,0,0,0,124,0,106,0,124,1,131, - 1,125,2,124,0,106,1,124,2,131,1,125,3,116,2,124, - 3,124,1,124,2,100,1,141,3,125,4,116,3,124,4,124, - 1,124,2,100,2,141,3,83,0,41,3,78,41,2,114,102, - 0,0,0,114,37,0,0,0,41,2,114,102,0,0,0,114, - 93,0,0,0,41,4,114,155,0,0,0,114,197,0,0,0, - 114,139,0,0,0,114,145,0,0,0,41,5,114,104,0,0, - 0,114,123,0,0,0,114,37,0,0,0,114,56,0,0,0, - 114,206,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,184,0,0,0,116,3,0,0,115,8,0, - 0,0,0,1,10,1,10,1,14,1,122,29,83,111,117,114, - 99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,114, - 46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,39,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,116,104,101,114,101,32, - 105,115,32,110,111,32,115,111,117,114,99,101,32,99,111,100, - 101,46,78,114,4,0,0,0,41,2,114,104,0,0,0,114, - 123,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,199,0,0,0,122,3,0,0,115,2,0,0, - 0,0,2,122,31,83,111,117,114,99,101,108,101,115,115,70, - 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, - 117,114,99,101,78,41,6,114,109,0,0,0,114,108,0,0, - 0,114,110,0,0,0,114,111,0,0,0,114,184,0,0,0, - 114,199,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,220,0,0,0,112,3, - 0,0,115,6,0,0,0,8,2,4,2,8,6,114,220,0, - 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, - 0,0,0,64,0,0,0,115,92,0,0,0,101,0,90,1, - 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, - 100,4,100,5,132,0,90,5,100,6,100,7,132,0,90,6, - 100,8,100,9,132,0,90,7,100,10,100,11,132,0,90,8, - 100,12,100,13,132,0,90,9,100,14,100,15,132,0,90,10, - 100,16,100,17,132,0,90,11,101,12,100,18,100,19,132,0, - 131,1,90,13,100,20,83,0,41,21,218,19,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,122, - 93,76,111,97,100,101,114,32,102,111,114,32,101,120,116,101, - 110,115,105,111,110,32,109,111,100,117,108,101,115,46,10,10, - 32,32,32,32,84,104,101,32,99,111,110,115,116,114,117,99, - 116,111,114,32,105,115,32,100,101,115,105,103,110,101,100,32, - 116,111,32,119,111,114,107,32,119,105,116,104,32,70,105,108, - 101,70,105,110,100,101,114,46,10,10,32,32,32,32,99,3, - 0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,67, - 0,0,0,115,16,0,0,0,124,1,124,0,95,0,124,2, - 124,0,95,1,100,0,83,0,41,1,78,41,2,114,102,0, - 0,0,114,37,0,0,0,41,3,114,104,0,0,0,114,102, - 0,0,0,114,37,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,182,0,0,0,139,3,0,0, - 115,4,0,0,0,0,1,6,1,122,28,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, + 41,12,114,109,0,0,0,114,108,0,0,0,114,110,0,0, + 0,114,111,0,0,0,114,182,0,0,0,114,210,0,0,0, + 114,212,0,0,0,114,120,0,0,0,114,190,0,0,0,114, + 155,0,0,0,114,197,0,0,0,90,13,95,95,99,108,97, + 115,115,99,101,108,108,95,95,114,4,0,0,0,114,4,0, + 0,0,41,1,114,208,0,0,0,114,6,0,0,0,114,207, + 0,0,0,27,3,0,0,115,14,0,0,0,8,3,4,2, + 8,6,8,4,8,3,16,12,12,5,114,207,0,0,0,99, + 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, + 64,0,0,0,115,46,0,0,0,101,0,90,1,100,0,90, + 2,100,1,90,3,100,2,100,3,132,0,90,4,100,4,100, + 5,132,0,90,5,100,6,100,7,156,1,100,8,100,9,132, + 2,90,6,100,10,83,0,41,11,218,16,83,111,117,114,99, + 101,70,105,108,101,76,111,97,100,101,114,122,62,67,111,110, + 99,114,101,116,101,32,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,32,111,102,32,83,111,117,114,99,101,76,111, + 97,100,101,114,32,117,115,105,110,103,32,116,104,101,32,102, + 105,108,101,32,115,121,115,116,101,109,46,99,2,0,0,0, + 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, + 115,22,0,0,0,116,0,124,1,131,1,125,2,124,2,106, + 1,124,2,106,2,100,1,156,2,83,0,41,2,122,33,82, + 101,116,117,114,110,32,116,104,101,32,109,101,116,97,100,97, + 116,97,32,102,111,114,32,116,104,101,32,112,97,116,104,46, + 41,2,114,130,0,0,0,114,131,0,0,0,41,3,114,41, + 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, + 116,95,115,105,122,101,41,3,114,104,0,0,0,114,37,0, + 0,0,114,205,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,194,0,0,0,72,3,0,0,115, + 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, + 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, + 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, + 0,0,5,0,0,0,67,0,0,0,115,24,0,0,0,116, + 0,124,1,131,1,125,4,124,0,106,1,124,2,124,3,124, + 4,100,1,141,3,83,0,41,2,78,41,1,218,5,95,109, + 111,100,101,41,2,114,101,0,0,0,114,195,0,0,0,41, + 5,114,104,0,0,0,114,94,0,0,0,114,93,0,0,0, + 114,56,0,0,0,114,44,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,196,0,0,0,77,3, + 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, + 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, + 97,99,104,101,95,98,121,116,101,99,111,100,101,105,182,1, + 0,0,41,1,114,217,0,0,0,99,3,0,0,0,1,0, + 0,0,9,0,0,0,17,0,0,0,67,0,0,0,115,250, + 0,0,0,116,0,124,1,131,1,92,2,125,4,125,5,103, + 0,125,6,120,40,124,4,114,56,116,1,124,4,131,1,12, + 0,114,56,116,0,124,4,131,1,92,2,125,4,125,7,124, + 6,106,2,124,7,131,1,1,0,113,18,87,0,120,108,116, + 3,124,6,131,1,68,0,93,96,125,7,116,4,124,4,124, + 7,131,2,125,4,121,14,116,5,106,6,124,4,131,1,1, + 0,87,0,113,68,4,0,116,7,107,10,114,118,1,0,1, + 0,1,0,119,68,89,0,113,68,4,0,116,8,107,10,114, + 162,1,0,125,8,1,0,122,18,116,9,106,10,100,1,124, + 4,124,8,131,3,1,0,100,2,83,0,100,2,125,8,126, + 8,88,0,113,68,88,0,113,68,87,0,121,28,116,11,124, + 1,124,2,124,3,131,3,1,0,116,9,106,10,100,3,124, + 1,131,2,1,0,87,0,110,48,4,0,116,8,107,10,114, + 244,1,0,125,8,1,0,122,20,116,9,106,10,100,1,124, + 1,124,8,131,3,1,0,87,0,89,0,100,2,100,2,125, + 8,126,8,88,0,110,2,88,0,100,2,83,0,41,4,122, + 27,87,114,105,116,101,32,98,121,116,101,115,32,100,97,116, + 97,32,116,111,32,97,32,102,105,108,101,46,122,27,99,111, + 117,108,100,32,110,111,116,32,99,114,101,97,116,101,32,123, + 33,114,125,58,32,123,33,114,125,78,122,12,99,114,101,97, + 116,101,100,32,123,33,114,125,41,12,114,40,0,0,0,114, + 48,0,0,0,114,161,0,0,0,114,35,0,0,0,114,30, + 0,0,0,114,3,0,0,0,90,5,109,107,100,105,114,218, + 15,70,105,108,101,69,120,105,115,116,115,69,114,114,111,114, + 114,42,0,0,0,114,118,0,0,0,114,133,0,0,0,114, + 58,0,0,0,41,9,114,104,0,0,0,114,37,0,0,0, + 114,56,0,0,0,114,217,0,0,0,218,6,112,97,114,101, + 110,116,114,98,0,0,0,114,29,0,0,0,114,25,0,0, + 0,114,198,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,195,0,0,0,82,3,0,0,115,42, + 0,0,0,0,2,12,1,4,2,16,1,12,1,14,2,14, + 1,10,1,2,1,14,1,14,2,6,1,16,3,6,1,8, + 1,20,1,2,1,12,1,16,1,16,2,8,1,122,25,83, + 111,117,114,99,101,70,105,108,101,76,111,97,100,101,114,46, + 115,101,116,95,100,97,116,97,78,41,7,114,109,0,0,0, + 114,108,0,0,0,114,110,0,0,0,114,111,0,0,0,114, + 194,0,0,0,114,196,0,0,0,114,195,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,215,0,0,0,68,3,0,0,115,8,0,0,0, + 8,2,4,2,8,5,8,5,114,215,0,0,0,99,0,0, + 0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,0, + 0,0,115,32,0,0,0,101,0,90,1,100,0,90,2,100, + 1,90,3,100,2,100,3,132,0,90,4,100,4,100,5,132, + 0,90,5,100,6,83,0,41,7,218,20,83,111,117,114,99, + 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,122, + 45,76,111,97,100,101,114,32,119,104,105,99,104,32,104,97, + 110,100,108,101,115,32,115,111,117,114,99,101,108,101,115,115, + 32,102,105,108,101,32,105,109,112,111,114,116,115,46,99,2, + 0,0,0,0,0,0,0,5,0,0,0,5,0,0,0,67, + 0,0,0,115,48,0,0,0,124,0,106,0,124,1,131,1, + 125,2,124,0,106,1,124,2,131,1,125,3,116,2,124,3, + 124,1,124,2,100,1,141,3,125,4,116,3,124,4,124,1, + 124,2,100,2,141,3,83,0,41,3,78,41,2,114,102,0, + 0,0,114,37,0,0,0,41,2,114,102,0,0,0,114,93, + 0,0,0,41,4,114,155,0,0,0,114,197,0,0,0,114, + 139,0,0,0,114,145,0,0,0,41,5,114,104,0,0,0, + 114,123,0,0,0,114,37,0,0,0,114,56,0,0,0,114, + 206,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,184,0,0,0,117,3,0,0,115,8,0,0, + 0,0,1,10,1,10,1,14,1,122,29,83,111,117,114,99, + 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, + 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,83,0,41,2,122,39,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,116,104,101,114,101,32,105, + 115,32,110,111,32,115,111,117,114,99,101,32,99,111,100,101, + 46,78,114,4,0,0,0,41,2,114,104,0,0,0,114,123, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,199,0,0,0,123,3,0,0,115,2,0,0,0, + 0,2,122,31,83,111,117,114,99,101,108,101,115,115,70,105, + 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, + 114,99,101,78,41,6,114,109,0,0,0,114,108,0,0,0, + 114,110,0,0,0,114,111,0,0,0,114,184,0,0,0,114, + 199,0,0,0,114,4,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,6,0,0,0,114,220,0,0,0,113,3,0, + 0,115,6,0,0,0,8,2,4,2,8,6,114,220,0,0, + 0,99,0,0,0,0,0,0,0,0,0,0,0,0,3,0, + 0,0,64,0,0,0,115,92,0,0,0,101,0,90,1,100, + 0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100, + 4,100,5,132,0,90,5,100,6,100,7,132,0,90,6,100, + 8,100,9,132,0,90,7,100,10,100,11,132,0,90,8,100, + 12,100,13,132,0,90,9,100,14,100,15,132,0,90,10,100, + 16,100,17,132,0,90,11,101,12,100,18,100,19,132,0,131, + 1,90,13,100,20,83,0,41,21,218,19,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,122,93, + 76,111,97,100,101,114,32,102,111,114,32,101,120,116,101,110, + 115,105,111,110,32,109,111,100,117,108,101,115,46,10,10,32, + 32,32,32,84,104,101,32,99,111,110,115,116,114,117,99,116, + 111,114,32,105,115,32,100,101,115,105,103,110,101,100,32,116, + 111,32,119,111,114,107,32,119,105,116,104,32,70,105,108,101, + 70,105,110,100,101,114,46,10,10,32,32,32,32,99,3,0, + 0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,0, + 0,0,115,16,0,0,0,124,1,124,0,95,0,124,2,124, + 0,95,1,100,0,83,0,41,1,78,41,2,114,102,0,0, + 0,114,37,0,0,0,41,3,114,104,0,0,0,114,102,0, + 0,0,114,37,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,182,0,0,0,140,3,0,0,115, + 4,0,0,0,0,1,6,1,122,28,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, + 105,110,105,116,95,95,99,2,0,0,0,0,0,0,0,2, + 0,0,0,2,0,0,0,67,0,0,0,115,24,0,0,0, + 124,0,106,0,124,1,106,0,107,2,111,22,124,0,106,1, + 124,1,106,1,107,2,83,0,41,1,78,41,2,114,208,0, + 0,0,114,115,0,0,0,41,2,114,104,0,0,0,114,209, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,114,210,0,0,0,144,3,0,0,115,4,0,0,0, + 0,1,12,1,122,26,69,120,116,101,110,115,105,111,110,70, + 105,108,101,76,111,97,100,101,114,46,95,95,101,113,95,95, + 99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0, + 0,67,0,0,0,115,20,0,0,0,116,0,124,0,106,1, + 131,1,116,0,124,0,106,2,131,1,65,0,83,0,41,1, + 78,41,3,114,211,0,0,0,114,102,0,0,0,114,37,0, + 0,0,41,1,114,104,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,6,0,0,0,114,212,0,0,0,148,3,0, + 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, + 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,3, + 0,0,0,4,0,0,0,67,0,0,0,115,36,0,0,0, + 116,0,106,1,116,2,106,3,124,1,131,2,125,2,116,0, + 106,4,100,1,124,1,106,5,124,0,106,6,131,3,1,0, + 124,2,83,0,41,2,122,38,67,114,101,97,116,101,32,97, + 110,32,117,110,105,116,105,97,108,105,122,101,100,32,101,120, + 116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,38, + 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, + 32,123,33,114,125,32,108,111,97,100,101,100,32,102,114,111, + 109,32,123,33,114,125,41,7,114,118,0,0,0,114,185,0, + 0,0,114,143,0,0,0,90,14,99,114,101,97,116,101,95, + 100,121,110,97,109,105,99,114,133,0,0,0,114,102,0,0, + 0,114,37,0,0,0,41,3,114,104,0,0,0,114,162,0, + 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,183,0,0,0,151,3,0,0,115, + 10,0,0,0,0,2,4,1,10,1,6,1,12,1,122,33, + 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97, + 100,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108, + 101,99,2,0,0,0,0,0,0,0,2,0,0,0,4,0, + 0,0,67,0,0,0,115,36,0,0,0,116,0,106,1,116, + 2,106,3,124,1,131,2,1,0,116,0,106,4,100,1,124, + 0,106,5,124,0,106,6,131,3,1,0,100,2,83,0,41, + 3,122,30,73,110,105,116,105,97,108,105,122,101,32,97,110, + 32,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, + 101,122,40,101,120,116,101,110,115,105,111,110,32,109,111,100, + 117,108,101,32,123,33,114,125,32,101,120,101,99,117,116,101, + 100,32,102,114,111,109,32,123,33,114,125,78,41,7,114,118, + 0,0,0,114,185,0,0,0,114,143,0,0,0,90,12,101, + 120,101,99,95,100,121,110,97,109,105,99,114,133,0,0,0, + 114,102,0,0,0,114,37,0,0,0,41,2,114,104,0,0, + 0,114,187,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,188,0,0,0,159,3,0,0,115,6, + 0,0,0,0,2,14,1,6,1,122,31,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,101, + 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0, + 0,0,0,2,0,0,0,4,0,0,0,3,0,0,0,115, + 36,0,0,0,116,0,124,0,106,1,131,1,100,1,25,0, + 137,0,116,2,135,0,102,1,100,2,100,3,132,8,116,3, + 68,0,131,1,131,1,83,0,41,4,122,49,82,101,116,117, + 114,110,32,84,114,117,101,32,105,102,32,116,104,101,32,101, + 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,32, + 105,115,32,97,32,112,97,99,107,97,103,101,46,114,31,0, + 0,0,99,1,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,51,0,0,0,115,26,0,0,0,124,0,93,18, + 125,1,136,0,100,0,124,1,23,0,107,2,86,0,1,0, + 113,2,100,1,83,0,41,2,114,182,0,0,0,78,114,4, + 0,0,0,41,2,114,24,0,0,0,218,6,115,117,102,102, + 105,120,41,1,218,9,102,105,108,101,95,110,97,109,101,114, + 4,0,0,0,114,6,0,0,0,250,9,60,103,101,110,101, + 120,112,114,62,168,3,0,0,115,2,0,0,0,4,1,122, + 49,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, + 97,100,101,114,46,105,115,95,112,97,99,107,97,103,101,46, + 60,108,111,99,97,108,115,62,46,60,103,101,110,101,120,112, + 114,62,41,4,114,40,0,0,0,114,37,0,0,0,218,3, + 97,110,121,218,18,69,88,84,69,78,83,73,79,78,95,83, + 85,70,70,73,88,69,83,41,2,114,104,0,0,0,114,123, + 0,0,0,114,4,0,0,0,41,1,114,223,0,0,0,114, + 6,0,0,0,114,157,0,0,0,165,3,0,0,115,6,0, + 0,0,0,2,14,1,12,1,122,30,69,120,116,101,110,115, + 105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,115, + 95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,83,0,41,2,122,63,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,97,110,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,32,99,97,110, + 110,111,116,32,99,114,101,97,116,101,32,97,32,99,111,100, + 101,32,111,98,106,101,99,116,46,78,114,4,0,0,0,41, + 2,114,104,0,0,0,114,123,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,6,0,0,0,114,184,0,0,0,171, + 3,0,0,115,2,0,0,0,0,2,122,28,69,120,116,101, + 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, + 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, + 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, + 0,0,100,1,83,0,41,2,122,53,82,101,116,117,114,110, + 32,78,111,110,101,32,97,115,32,101,120,116,101,110,115,105, + 111,110,32,109,111,100,117,108,101,115,32,104,97,118,101,32, + 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, + 114,4,0,0,0,41,2,114,104,0,0,0,114,123,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,199,0,0,0,175,3,0,0,115,2,0,0,0,0,2, + 122,30,69,120,116,101,110,115,105,111,110,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, + 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, + 0,67,0,0,0,115,6,0,0,0,124,0,106,0,83,0, + 41,1,122,58,82,101,116,117,114,110,32,116,104,101,32,112, + 97,116,104,32,116,111,32,116,104,101,32,115,111,117,114,99, + 101,32,102,105,108,101,32,97,115,32,102,111,117,110,100,32, + 98,121,32,116,104,101,32,102,105,110,100,101,114,46,41,1, + 114,37,0,0,0,41,2,114,104,0,0,0,114,123,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,155,0,0,0,179,3,0,0,115,2,0,0,0,0,3, + 122,32,69,120,116,101,110,115,105,111,110,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,102,105,108,101,110,97, + 109,101,78,41,14,114,109,0,0,0,114,108,0,0,0,114, + 110,0,0,0,114,111,0,0,0,114,182,0,0,0,114,210, + 0,0,0,114,212,0,0,0,114,183,0,0,0,114,188,0, + 0,0,114,157,0,0,0,114,184,0,0,0,114,199,0,0, + 0,114,120,0,0,0,114,155,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 221,0,0,0,132,3,0,0,115,20,0,0,0,8,6,4, + 2,8,4,8,4,8,3,8,8,8,6,8,6,8,4,8, + 4,114,221,0,0,0,99,0,0,0,0,0,0,0,0,0, + 0,0,0,2,0,0,0,64,0,0,0,115,96,0,0,0, + 101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3, + 132,0,90,4,100,4,100,5,132,0,90,5,100,6,100,7, + 132,0,90,6,100,8,100,9,132,0,90,7,100,10,100,11, + 132,0,90,8,100,12,100,13,132,0,90,9,100,14,100,15, + 132,0,90,10,100,16,100,17,132,0,90,11,100,18,100,19, + 132,0,90,12,100,20,100,21,132,0,90,13,100,22,83,0, + 41,23,218,14,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,97,38,1,0,0,82,101,112,114,101,115,101,110,116, + 115,32,97,32,110,97,109,101,115,112,97,99,101,32,112,97, + 99,107,97,103,101,39,115,32,112,97,116,104,46,32,32,73, + 116,32,117,115,101,115,32,116,104,101,32,109,111,100,117,108, + 101,32,110,97,109,101,10,32,32,32,32,116,111,32,102,105, + 110,100,32,105,116,115,32,112,97,114,101,110,116,32,109,111, + 100,117,108,101,44,32,97,110,100,32,102,114,111,109,32,116, + 104,101,114,101,32,105,116,32,108,111,111,107,115,32,117,112, + 32,116,104,101,32,112,97,114,101,110,116,39,115,10,32,32, + 32,32,95,95,112,97,116,104,95,95,46,32,32,87,104,101, + 110,32,116,104,105,115,32,99,104,97,110,103,101,115,44,32, + 116,104,101,32,109,111,100,117,108,101,39,115,32,111,119,110, + 32,112,97,116,104,32,105,115,32,114,101,99,111,109,112,117, + 116,101,100,44,10,32,32,32,32,117,115,105,110,103,32,112, + 97,116,104,95,102,105,110,100,101,114,46,32,32,70,111,114, + 32,116,111,112,45,108,101,118,101,108,32,109,111,100,117,108, + 101,115,44,32,116,104,101,32,112,97,114,101,110,116,32,109, + 111,100,117,108,101,39,115,32,112,97,116,104,10,32,32,32, + 32,105,115,32,115,121,115,46,112,97,116,104,46,99,4,0, + 0,0,0,0,0,0,4,0,0,0,2,0,0,0,67,0, + 0,0,115,36,0,0,0,124,1,124,0,95,0,124,2,124, + 0,95,1,116,2,124,0,106,3,131,0,131,1,124,0,95, + 4,124,3,124,0,95,5,100,0,83,0,41,1,78,41,6, + 218,5,95,110,97,109,101,218,5,95,112,97,116,104,114,97, + 0,0,0,218,16,95,103,101,116,95,112,97,114,101,110,116, + 95,112,97,116,104,218,17,95,108,97,115,116,95,112,97,114, + 101,110,116,95,112,97,116,104,218,12,95,112,97,116,104,95, + 102,105,110,100,101,114,41,4,114,104,0,0,0,114,102,0, + 0,0,114,37,0,0,0,218,11,112,97,116,104,95,102,105, + 110,100,101,114,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,114,182,0,0,0,192,3,0,0,115,8,0,0, + 0,0,1,6,1,6,1,14,1,122,23,95,78,97,109,101, + 115,112,97,99,101,80,97,116,104,46,95,95,105,110,105,116, + 95,95,99,1,0,0,0,0,0,0,0,4,0,0,0,3, + 0,0,0,67,0,0,0,115,38,0,0,0,124,0,106,0, + 106,1,100,1,131,1,92,3,125,1,125,2,125,3,124,2, + 100,2,107,2,114,30,100,6,83,0,124,1,100,5,102,2, + 83,0,41,7,122,62,82,101,116,117,114,110,115,32,97,32, + 116,117,112,108,101,32,111,102,32,40,112,97,114,101,110,116, + 45,109,111,100,117,108,101,45,110,97,109,101,44,32,112,97, + 114,101,110,116,45,112,97,116,104,45,97,116,116,114,45,110, + 97,109,101,41,114,61,0,0,0,114,32,0,0,0,114,8, + 0,0,0,114,37,0,0,0,90,8,95,95,112,97,116,104, + 95,95,41,2,114,8,0,0,0,114,37,0,0,0,41,2, + 114,228,0,0,0,114,34,0,0,0,41,4,114,104,0,0, + 0,114,219,0,0,0,218,3,100,111,116,90,2,109,101,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,23, + 95,102,105,110,100,95,112,97,114,101,110,116,95,112,97,116, + 104,95,110,97,109,101,115,198,3,0,0,115,8,0,0,0, + 0,2,18,1,8,2,4,3,122,38,95,78,97,109,101,115, + 112,97,99,101,80,97,116,104,46,95,102,105,110,100,95,112, + 97,114,101,110,116,95,112,97,116,104,95,110,97,109,101,115, + 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, + 0,67,0,0,0,115,28,0,0,0,124,0,106,0,131,0, + 92,2,125,1,125,2,116,1,116,2,106,3,124,1,25,0, + 124,2,131,2,83,0,41,1,78,41,4,114,235,0,0,0, + 114,114,0,0,0,114,8,0,0,0,218,7,109,111,100,117, + 108,101,115,41,3,114,104,0,0,0,90,18,112,97,114,101, + 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14, + 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,230,0, + 0,0,208,3,0,0,115,4,0,0,0,0,1,12,1,122, + 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, + 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104, + 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, + 0,67,0,0,0,115,80,0,0,0,116,0,124,0,106,1, + 131,0,131,1,125,1,124,1,124,0,106,2,107,3,114,74, + 124,0,106,3,124,0,106,4,124,1,131,2,125,2,124,2, + 100,0,107,9,114,68,124,2,106,5,100,0,107,8,114,68, + 124,2,106,6,114,68,124,2,106,6,124,0,95,7,124,1, + 124,0,95,2,124,0,106,7,83,0,41,1,78,41,8,114, + 97,0,0,0,114,230,0,0,0,114,231,0,0,0,114,232, + 0,0,0,114,228,0,0,0,114,124,0,0,0,114,154,0, + 0,0,114,229,0,0,0,41,3,114,104,0,0,0,90,11, + 112,97,114,101,110,116,95,112,97,116,104,114,162,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, + 12,95,114,101,99,97,108,99,117,108,97,116,101,212,3,0, + 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, + 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, + 97,116,101,99,1,0,0,0,0,0,0,0,1,0,0,0, + 2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,124, + 0,106,1,131,0,131,1,83,0,41,1,78,41,2,218,4, + 105,116,101,114,114,237,0,0,0,41,1,114,104,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, + 8,95,95,105,116,101,114,95,95,225,3,0,0,115,2,0, + 0,0,0,1,122,23,95,78,97,109,101,115,112,97,99,101, + 80,97,116,104,46,95,95,105,116,101,114,95,95,99,3,0, + 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, + 0,0,115,14,0,0,0,124,2,124,0,106,0,124,1,60, + 0,100,0,83,0,41,1,78,41,1,114,229,0,0,0,41, + 3,114,104,0,0,0,218,5,105,110,100,101,120,114,37,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,11,95,95,115,101,116,105,116,101,109,95,95,228,3, + 0,0,115,2,0,0,0,0,1,122,26,95,78,97,109,101, + 115,112,97,99,101,80,97,116,104,46,95,95,115,101,116,105, + 116,101,109,95,95,99,1,0,0,0,0,0,0,0,1,0, + 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116, + 0,124,0,106,1,131,0,131,1,83,0,41,1,78,41,2, + 114,33,0,0,0,114,237,0,0,0,41,1,114,104,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 218,7,95,95,108,101,110,95,95,231,3,0,0,115,2,0, + 0,0,0,1,122,22,95,78,97,109,101,115,112,97,99,101, + 80,97,116,104,46,95,95,108,101,110,95,95,99,1,0,0, + 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, + 0,115,12,0,0,0,100,1,106,0,124,0,106,1,131,1, + 83,0,41,2,78,122,20,95,78,97,109,101,115,112,97,99, + 101,80,97,116,104,40,123,33,114,125,41,41,2,114,50,0, + 0,0,114,229,0,0,0,41,1,114,104,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,95, + 95,114,101,112,114,95,95,234,3,0,0,115,2,0,0,0, + 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,114,101,112,114,95,95,99,2,0,0,0, + 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, + 115,12,0,0,0,124,1,124,0,106,0,131,0,107,6,83, + 0,41,1,78,41,1,114,237,0,0,0,41,2,114,104,0, + 0,0,218,4,105,116,101,109,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,218,12,95,95,99,111,110,116,97, + 105,110,115,95,95,237,3,0,0,115,2,0,0,0,0,1, + 122,27,95,78,97,109,101,115,112,97,99,101,80,97,116,104, + 46,95,95,99,111,110,116,97,105,110,115,95,95,99,2,0, + 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, + 0,0,115,16,0,0,0,124,0,106,0,106,1,124,1,131, + 1,1,0,100,0,83,0,41,1,78,41,2,114,229,0,0, + 0,114,161,0,0,0,41,2,114,104,0,0,0,114,244,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,114,161,0,0,0,240,3,0,0,115,2,0,0,0,0, + 1,122,21,95,78,97,109,101,115,112,97,99,101,80,97,116, + 104,46,97,112,112,101,110,100,78,41,14,114,109,0,0,0, + 114,108,0,0,0,114,110,0,0,0,114,111,0,0,0,114, + 182,0,0,0,114,235,0,0,0,114,230,0,0,0,114,237, + 0,0,0,114,239,0,0,0,114,241,0,0,0,114,242,0, + 0,0,114,243,0,0,0,114,245,0,0,0,114,161,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,227,0,0,0,185,3,0,0,115,22, + 0,0,0,8,5,4,2,8,6,8,10,8,4,8,13,8, + 3,8,3,8,3,8,3,8,3,114,227,0,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, + 0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2, + 100,1,100,2,132,0,90,3,101,4,100,3,100,4,132,0, + 131,1,90,5,100,5,100,6,132,0,90,6,100,7,100,8, + 132,0,90,7,100,9,100,10,132,0,90,8,100,11,100,12, + 132,0,90,9,100,13,100,14,132,0,90,10,100,15,100,16, + 132,0,90,11,100,17,83,0,41,18,218,16,95,78,97,109, + 101,115,112,97,99,101,76,111,97,100,101,114,99,4,0,0, + 0,0,0,0,0,4,0,0,0,4,0,0,0,67,0,0, + 0,115,18,0,0,0,116,0,124,1,124,2,124,3,131,3, + 124,0,95,1,100,0,83,0,41,1,78,41,2,114,227,0, + 0,0,114,229,0,0,0,41,4,114,104,0,0,0,114,102, + 0,0,0,114,37,0,0,0,114,233,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,182,0,0, + 0,246,3,0,0,115,2,0,0,0,0,1,122,25,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,95, 95,105,110,105,116,95,95,99,2,0,0,0,0,0,0,0, - 2,0,0,0,2,0,0,0,67,0,0,0,115,24,0,0, - 0,124,0,106,0,124,1,106,0,107,2,111,22,124,0,106, - 1,124,1,106,1,107,2,83,0,41,1,78,41,2,114,208, - 0,0,0,114,115,0,0,0,41,2,114,104,0,0,0,114, - 209,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,210,0,0,0,143,3,0,0,115,4,0,0, - 0,0,1,12,1,122,26,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,46,95,95,101,113,95, - 95,99,1,0,0,0,0,0,0,0,1,0,0,0,3,0, - 0,0,67,0,0,0,115,20,0,0,0,116,0,124,0,106, - 1,131,1,116,0,124,0,106,2,131,1,65,0,83,0,41, - 1,78,41,3,114,211,0,0,0,114,102,0,0,0,114,37, - 0,0,0,41,1,114,104,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,212,0,0,0,147,3, - 0,0,115,2,0,0,0,0,1,122,28,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, - 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, - 3,0,0,0,4,0,0,0,67,0,0,0,115,36,0,0, - 0,116,0,106,1,116,2,106,3,124,1,131,2,125,2,116, - 0,106,4,100,1,124,1,106,5,124,0,106,6,131,3,1, - 0,124,2,83,0,41,2,122,38,67,114,101,97,116,101,32, - 97,110,32,117,110,105,116,105,97,108,105,122,101,100,32,101, - 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,122, - 38,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, - 101,32,123,33,114,125,32,108,111,97,100,101,100,32,102,114, - 111,109,32,123,33,114,125,41,7,114,118,0,0,0,114,185, - 0,0,0,114,143,0,0,0,90,14,99,114,101,97,116,101, - 95,100,121,110,97,109,105,99,114,133,0,0,0,114,102,0, - 0,0,114,37,0,0,0,41,3,114,104,0,0,0,114,162, - 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,183,0,0,0,150,3,0,0, - 115,10,0,0,0,0,2,4,1,10,1,6,1,12,1,122, - 33,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, - 97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,117, - 108,101,99,2,0,0,0,0,0,0,0,2,0,0,0,4, - 0,0,0,67,0,0,0,115,36,0,0,0,116,0,106,1, - 116,2,106,3,124,1,131,2,1,0,116,0,106,4,100,1, - 124,0,106,5,124,0,106,6,131,3,1,0,100,2,83,0, - 41,3,122,30,73,110,105,116,105,97,108,105,122,101,32,97, - 110,32,101,120,116,101,110,115,105,111,110,32,109,111,100,117, - 108,101,122,40,101,120,116,101,110,115,105,111,110,32,109,111, - 100,117,108,101,32,123,33,114,125,32,101,120,101,99,117,116, - 101,100,32,102,114,111,109,32,123,33,114,125,78,41,7,114, - 118,0,0,0,114,185,0,0,0,114,143,0,0,0,90,12, - 101,120,101,99,95,100,121,110,97,109,105,99,114,133,0,0, - 0,114,102,0,0,0,114,37,0,0,0,41,2,114,104,0, + 2,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, + 0,100,1,106,0,124,1,106,1,131,1,83,0,41,2,122, + 115,82,101,116,117,114,110,32,114,101,112,114,32,102,111,114, + 32,116,104,101,32,109,111,100,117,108,101,46,10,10,32,32, + 32,32,32,32,32,32,84,104,101,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,84,104,101,32,105,109,112,111,114,116,32,109,97,99,104, + 105,110,101,114,121,32,100,111,101,115,32,116,104,101,32,106, + 111,98,32,105,116,115,101,108,102,46,10,10,32,32,32,32, + 32,32,32,32,122,25,60,109,111,100,117,108,101,32,123,33, + 114,125,32,40,110,97,109,101,115,112,97,99,101,41,62,41, + 2,114,50,0,0,0,114,109,0,0,0,41,2,114,168,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,188,0,0,0,158,3,0,0,115, - 6,0,0,0,0,2,14,1,6,1,122,31,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, - 101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,0, - 0,0,0,0,2,0,0,0,4,0,0,0,3,0,0,0, - 115,36,0,0,0,116,0,124,0,106,1,131,1,100,1,25, - 0,137,0,116,2,135,0,102,1,100,2,100,3,132,8,116, - 3,68,0,131,1,131,1,83,0,41,4,122,49,82,101,116, - 117,114,110,32,84,114,117,101,32,105,102,32,116,104,101,32, - 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, - 32,105,115,32,97,32,112,97,99,107,97,103,101,46,114,31, - 0,0,0,99,1,0,0,0,0,0,0,0,2,0,0,0, - 4,0,0,0,51,0,0,0,115,26,0,0,0,124,0,93, - 18,125,1,136,0,100,0,124,1,23,0,107,2,86,0,1, - 0,113,2,100,1,83,0,41,2,114,182,0,0,0,78,114, - 4,0,0,0,41,2,114,24,0,0,0,218,6,115,117,102, - 102,105,120,41,1,218,9,102,105,108,101,95,110,97,109,101, - 114,4,0,0,0,114,6,0,0,0,250,9,60,103,101,110, - 101,120,112,114,62,167,3,0,0,115,2,0,0,0,4,1, - 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, - 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, - 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, - 112,114,62,41,4,114,40,0,0,0,114,37,0,0,0,218, - 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, - 83,85,70,70,73,88,69,83,41,2,114,104,0,0,0,114, - 123,0,0,0,114,4,0,0,0,41,1,114,223,0,0,0, - 114,6,0,0,0,114,157,0,0,0,164,3,0,0,115,6, - 0,0,0,0,2,14,1,12,1,122,30,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,105, - 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,63,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,97,110,32,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,32,99,97, - 110,110,111,116,32,99,114,101,97,116,101,32,97,32,99,111, - 100,101,32,111,98,106,101,99,116,46,78,114,4,0,0,0, - 41,2,114,104,0,0,0,114,123,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,114,184,0,0,0, - 170,3,0,0,115,2,0,0,0,0,2,122,28,69,120,116, - 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, - 46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,122,53,82,101,116,117,114, - 110,32,78,111,110,101,32,97,115,32,101,120,116,101,110,115, - 105,111,110,32,109,111,100,117,108,101,115,32,104,97,118,101, - 32,110,111,32,115,111,117,114,99,101,32,99,111,100,101,46, - 78,114,4,0,0,0,41,2,114,104,0,0,0,114,123,0, + 0,114,6,0,0,0,218,11,109,111,100,117,108,101,95,114, + 101,112,114,249,3,0,0,115,2,0,0,0,0,7,122,28, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,109,111,100,117,108,101,95,114,101,112,114,99,2,0,0, + 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, + 0,115,4,0,0,0,100,1,83,0,41,2,78,84,114,4, + 0,0,0,41,2,114,104,0,0,0,114,123,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,157, + 0,0,0,2,4,0,0,115,2,0,0,0,0,1,122,27, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, + 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, + 115,4,0,0,0,100,1,83,0,41,2,78,114,32,0,0, + 0,114,4,0,0,0,41,2,114,104,0,0,0,114,123,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,199,0,0,0,174,3,0,0,115,2,0,0,0,0, - 2,122,30,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99, - 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, - 0,0,67,0,0,0,115,6,0,0,0,124,0,106,0,83, - 0,41,1,122,58,82,101,116,117,114,110,32,116,104,101,32, - 112,97,116,104,32,116,111,32,116,104,101,32,115,111,117,114, - 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, - 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, - 1,114,37,0,0,0,41,2,114,104,0,0,0,114,123,0, + 0,114,199,0,0,0,5,4,0,0,115,2,0,0,0,0, + 1,122,27,95,78,97,109,101,115,112,97,99,101,76,111,97, + 100,101,114,46,103,101,116,95,115,111,117,114,99,101,99,2, + 0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,67, + 0,0,0,115,16,0,0,0,116,0,100,1,100,2,100,3, + 100,4,100,5,141,4,83,0,41,6,78,114,32,0,0,0, + 122,8,60,115,116,114,105,110,103,62,114,186,0,0,0,84, + 41,1,114,201,0,0,0,41,1,114,202,0,0,0,41,2, + 114,104,0,0,0,114,123,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,184,0,0,0,8,4, + 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101, + 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, + 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, + 0,1,0,0,0,67,0,0,0,115,4,0,0,0,100,1, + 83,0,41,2,122,42,85,115,101,32,100,101,102,97,117,108, + 116,32,115,101,109,97,110,116,105,99,115,32,102,111,114,32, + 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46, + 78,114,4,0,0,0,41,2,114,104,0,0,0,114,162,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,155,0,0,0,178,3,0,0,115,2,0,0,0,0, - 3,122,32,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,103,101,116,95,102,105,108,101,110, - 97,109,101,78,41,14,114,109,0,0,0,114,108,0,0,0, - 114,110,0,0,0,114,111,0,0,0,114,182,0,0,0,114, - 210,0,0,0,114,212,0,0,0,114,183,0,0,0,114,188, - 0,0,0,114,157,0,0,0,114,184,0,0,0,114,199,0, - 0,0,114,120,0,0,0,114,155,0,0,0,114,4,0,0, + 0,114,183,0,0,0,11,4,0,0,115,0,0,0,0,122, + 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, + 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, + 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, + 67,0,0,0,115,4,0,0,0,100,0,83,0,41,1,78, + 114,4,0,0,0,41,2,114,104,0,0,0,114,187,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,221,0,0,0,131,3,0,0,115,20,0,0,0,8,6, - 4,2,8,4,8,4,8,3,8,8,8,6,8,6,8,4, - 8,4,114,221,0,0,0,99,0,0,0,0,0,0,0,0, - 0,0,0,0,2,0,0,0,64,0,0,0,115,96,0,0, - 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100, - 3,132,0,90,4,100,4,100,5,132,0,90,5,100,6,100, - 7,132,0,90,6,100,8,100,9,132,0,90,7,100,10,100, - 11,132,0,90,8,100,12,100,13,132,0,90,9,100,14,100, - 15,132,0,90,10,100,16,100,17,132,0,90,11,100,18,100, - 19,132,0,90,12,100,20,100,21,132,0,90,13,100,22,83, - 0,41,23,218,14,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,97,38,1,0,0,82,101,112,114,101,115,101,110, - 116,115,32,97,32,110,97,109,101,115,112,97,99,101,32,112, - 97,99,107,97,103,101,39,115,32,112,97,116,104,46,32,32, - 73,116,32,117,115,101,115,32,116,104,101,32,109,111,100,117, - 108,101,32,110,97,109,101,10,32,32,32,32,116,111,32,102, - 105,110,100,32,105,116,115,32,112,97,114,101,110,116,32,109, - 111,100,117,108,101,44,32,97,110,100,32,102,114,111,109,32, - 116,104,101,114,101,32,105,116,32,108,111,111,107,115,32,117, - 112,32,116,104,101,32,112,97,114,101,110,116,39,115,10,32, - 32,32,32,95,95,112,97,116,104,95,95,46,32,32,87,104, - 101,110,32,116,104,105,115,32,99,104,97,110,103,101,115,44, - 32,116,104,101,32,109,111,100,117,108,101,39,115,32,111,119, - 110,32,112,97,116,104,32,105,115,32,114,101,99,111,109,112, - 117,116,101,100,44,10,32,32,32,32,117,115,105,110,103,32, - 112,97,116,104,95,102,105,110,100,101,114,46,32,32,70,111, - 114,32,116,111,112,45,108,101,118,101,108,32,109,111,100,117, - 108,101,115,44,32,116,104,101,32,112,97,114,101,110,116,32, - 109,111,100,117,108,101,39,115,32,112,97,116,104,10,32,32, - 32,32,105,115,32,115,121,115,46,112,97,116,104,46,99,4, - 0,0,0,0,0,0,0,4,0,0,0,2,0,0,0,67, - 0,0,0,115,36,0,0,0,124,1,124,0,95,0,124,2, - 124,0,95,1,116,2,124,0,106,3,131,0,131,1,124,0, - 95,4,124,3,124,0,95,5,100,0,83,0,41,1,78,41, - 6,218,5,95,110,97,109,101,218,5,95,112,97,116,104,114, - 97,0,0,0,218,16,95,103,101,116,95,112,97,114,101,110, - 116,95,112,97,116,104,218,17,95,108,97,115,116,95,112,97, - 114,101,110,116,95,112,97,116,104,218,12,95,112,97,116,104, - 95,102,105,110,100,101,114,41,4,114,104,0,0,0,114,102, - 0,0,0,114,37,0,0,0,218,11,112,97,116,104,95,102, - 105,110,100,101,114,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,182,0,0,0,191,3,0,0,115,8,0, - 0,0,0,1,6,1,6,1,14,1,122,23,95,78,97,109, - 101,115,112,97,99,101,80,97,116,104,46,95,95,105,110,105, - 116,95,95,99,1,0,0,0,0,0,0,0,4,0,0,0, - 3,0,0,0,67,0,0,0,115,38,0,0,0,124,0,106, - 0,106,1,100,1,131,1,92,3,125,1,125,2,125,3,124, - 2,100,2,107,2,114,30,100,6,83,0,124,1,100,5,102, - 2,83,0,41,7,122,62,82,101,116,117,114,110,115,32,97, - 32,116,117,112,108,101,32,111,102,32,40,112,97,114,101,110, - 116,45,109,111,100,117,108,101,45,110,97,109,101,44,32,112, - 97,114,101,110,116,45,112,97,116,104,45,97,116,116,114,45, - 110,97,109,101,41,114,61,0,0,0,114,32,0,0,0,114, - 8,0,0,0,114,37,0,0,0,90,8,95,95,112,97,116, - 104,95,95,41,2,114,8,0,0,0,114,37,0,0,0,41, - 2,114,228,0,0,0,114,34,0,0,0,41,4,114,104,0, - 0,0,114,219,0,0,0,218,3,100,111,116,90,2,109,101, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 23,95,102,105,110,100,95,112,97,114,101,110,116,95,112,97, - 116,104,95,110,97,109,101,115,197,3,0,0,115,8,0,0, - 0,0,2,18,1,8,2,4,3,122,38,95,78,97,109,101, - 115,112,97,99,101,80,97,116,104,46,95,102,105,110,100,95, - 112,97,114,101,110,116,95,112,97,116,104,95,110,97,109,101, - 115,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,67,0,0,0,115,28,0,0,0,124,0,106,0,131, - 0,92,2,125,1,125,2,116,1,116,2,106,3,124,1,25, - 0,124,2,131,2,83,0,41,1,78,41,4,114,235,0,0, - 0,114,114,0,0,0,114,8,0,0,0,218,7,109,111,100, - 117,108,101,115,41,3,114,104,0,0,0,90,18,112,97,114, - 101,110,116,95,109,111,100,117,108,101,95,110,97,109,101,90, - 14,112,97,116,104,95,97,116,116,114,95,110,97,109,101,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,230, - 0,0,0,207,3,0,0,115,4,0,0,0,0,1,12,1, - 122,31,95,78,97,109,101,115,112,97,99,101,80,97,116,104, - 46,95,103,101,116,95,112,97,114,101,110,116,95,112,97,116, - 104,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, - 0,0,67,0,0,0,115,80,0,0,0,116,0,124,0,106, - 1,131,0,131,1,125,1,124,1,124,0,106,2,107,3,114, - 74,124,0,106,3,124,0,106,4,124,1,131,2,125,2,124, - 2,100,0,107,9,114,68,124,2,106,5,100,0,107,8,114, - 68,124,2,106,6,114,68,124,2,106,6,124,0,95,7,124, - 1,124,0,95,2,124,0,106,7,83,0,41,1,78,41,8, - 114,97,0,0,0,114,230,0,0,0,114,231,0,0,0,114, - 232,0,0,0,114,228,0,0,0,114,124,0,0,0,114,154, - 0,0,0,114,229,0,0,0,41,3,114,104,0,0,0,90, - 11,112,97,114,101,110,116,95,112,97,116,104,114,162,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,12,95,114,101,99,97,108,99,117,108,97,116,101,211,3, - 0,0,115,16,0,0,0,0,2,12,1,10,1,14,3,18, - 1,6,1,8,1,6,1,122,27,95,78,97,109,101,115,112, - 97,99,101,80,97,116,104,46,95,114,101,99,97,108,99,117, - 108,97,116,101,99,1,0,0,0,0,0,0,0,1,0,0, - 0,2,0,0,0,67,0,0,0,115,12,0,0,0,116,0, - 124,0,106,1,131,0,131,1,83,0,41,1,78,41,2,218, - 4,105,116,101,114,114,237,0,0,0,41,1,114,104,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,8,95,95,105,116,101,114,95,95,224,3,0,0,115,2, - 0,0,0,0,1,122,23,95,78,97,109,101,115,112,97,99, - 101,80,97,116,104,46,95,95,105,116,101,114,95,95,99,3, - 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, - 0,0,0,115,14,0,0,0,124,2,124,0,106,0,124,1, - 60,0,100,0,83,0,41,1,78,41,1,114,229,0,0,0, - 41,3,114,104,0,0,0,218,5,105,110,100,101,120,114,37, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,11,95,95,115,101,116,105,116,101,109,95,95,227, - 3,0,0,115,2,0,0,0,0,1,122,26,95,78,97,109, - 101,115,112,97,99,101,80,97,116,104,46,95,95,115,101,116, - 105,116,101,109,95,95,99,1,0,0,0,0,0,0,0,1, - 0,0,0,2,0,0,0,67,0,0,0,115,12,0,0,0, - 116,0,124,0,106,1,131,0,131,1,83,0,41,1,78,41, - 2,114,33,0,0,0,114,237,0,0,0,41,1,114,104,0, + 114,188,0,0,0,14,4,0,0,115,2,0,0,0,0,1, + 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, + 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2, + 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, + 0,0,0,115,26,0,0,0,116,0,106,1,100,1,124,0, + 106,2,131,2,1,0,116,0,106,3,124,0,124,1,131,2, + 83,0,41,2,122,98,76,111,97,100,32,97,32,110,97,109, + 101,115,112,97,99,101,32,109,111,100,117,108,101,46,10,10, + 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116, + 104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101, + 100,46,32,32,85,115,101,32,101,120,101,99,95,109,111,100, + 117,108,101,40,41,32,105,110,115,116,101,97,100,46,10,10, + 32,32,32,32,32,32,32,32,122,38,110,97,109,101,115,112, + 97,99,101,32,109,111,100,117,108,101,32,108,111,97,100,101, + 100,32,119,105,116,104,32,112,97,116,104,32,123,33,114,125, + 41,4,114,118,0,0,0,114,133,0,0,0,114,229,0,0, + 0,114,189,0,0,0,41,2,114,104,0,0,0,114,123,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,7,95,95,108,101,110,95,95,230,3,0,0,115,2, - 0,0,0,0,1,122,22,95,78,97,109,101,115,112,97,99, - 101,80,97,116,104,46,95,95,108,101,110,95,95,99,1,0, + 0,114,190,0,0,0,17,4,0,0,115,6,0,0,0,0, + 7,6,1,8,1,122,28,95,78,97,109,101,115,112,97,99, + 101,76,111,97,100,101,114,46,108,111,97,100,95,109,111,100, + 117,108,101,78,41,12,114,109,0,0,0,114,108,0,0,0, + 114,110,0,0,0,114,182,0,0,0,114,180,0,0,0,114, + 247,0,0,0,114,157,0,0,0,114,199,0,0,0,114,184, + 0,0,0,114,183,0,0,0,114,188,0,0,0,114,190,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,246,0,0,0,245,3,0,0,115, + 16,0,0,0,8,1,8,3,12,9,8,3,8,3,8,3, + 8,3,8,3,114,246,0,0,0,99,0,0,0,0,0,0, + 0,0,0,0,0,0,4,0,0,0,64,0,0,0,115,106, + 0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,101, + 4,100,2,100,3,132,0,131,1,90,5,101,4,100,4,100, + 5,132,0,131,1,90,6,101,4,100,6,100,7,132,0,131, + 1,90,7,101,4,100,8,100,9,132,0,131,1,90,8,101, + 4,100,17,100,11,100,12,132,1,131,1,90,9,101,4,100, + 18,100,13,100,14,132,1,131,1,90,10,101,4,100,19,100, + 15,100,16,132,1,131,1,90,11,100,10,83,0,41,20,218, + 10,80,97,116,104,70,105,110,100,101,114,122,62,77,101,116, + 97,32,112,97,116,104,32,102,105,110,100,101,114,32,102,111, + 114,32,115,121,115,46,112,97,116,104,32,97,110,100,32,112, + 97,99,107,97,103,101,32,95,95,112,97,116,104,95,95,32, + 97,116,116,114,105,98,117,116,101,115,46,99,1,0,0,0, + 0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,0, + 115,42,0,0,0,120,36,116,0,106,1,106,2,131,0,68, + 0,93,22,125,1,116,3,124,1,100,1,131,2,114,12,124, + 1,106,4,131,0,1,0,113,12,87,0,100,2,83,0,41, + 3,122,125,67,97,108,108,32,116,104,101,32,105,110,118,97, + 108,105,100,97,116,101,95,99,97,99,104,101,115,40,41,32, + 109,101,116,104,111,100,32,111,110,32,97,108,108,32,112,97, + 116,104,32,101,110,116,114,121,32,102,105,110,100,101,114,115, + 10,32,32,32,32,32,32,32,32,115,116,111,114,101,100,32, + 105,110,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,115,32,40,119,104,101, + 114,101,32,105,109,112,108,101,109,101,110,116,101,100,41,46, + 218,17,105,110,118,97,108,105,100,97,116,101,95,99,97,99, + 104,101,115,78,41,5,114,8,0,0,0,218,19,112,97,116, + 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, + 218,6,118,97,108,117,101,115,114,112,0,0,0,114,249,0, + 0,0,41,2,114,168,0,0,0,218,6,102,105,110,100,101, + 114,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, + 114,249,0,0,0,35,4,0,0,115,6,0,0,0,0,4, + 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, + 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, + 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, + 0,0,0,67,0,0,0,115,86,0,0,0,116,0,106,1, + 100,1,107,9,114,30,116,0,106,1,12,0,114,30,116,2, + 106,3,100,2,116,4,131,2,1,0,120,50,116,0,106,1, + 68,0,93,36,125,2,121,8,124,2,124,1,131,1,83,0, + 4,0,116,5,107,10,114,72,1,0,1,0,1,0,119,38, + 89,0,113,38,88,0,113,38,87,0,100,1,83,0,100,1, + 83,0,41,3,122,46,83,101,97,114,99,104,32,115,121,115, + 46,112,97,116,104,95,104,111,111,107,115,32,102,111,114,32, + 97,32,102,105,110,100,101,114,32,102,111,114,32,39,112,97, + 116,104,39,46,78,122,23,115,121,115,46,112,97,116,104,95, + 104,111,111,107,115,32,105,115,32,101,109,112,116,121,41,6, + 114,8,0,0,0,218,10,112,97,116,104,95,104,111,111,107, + 115,114,63,0,0,0,114,64,0,0,0,114,122,0,0,0, + 114,103,0,0,0,41,3,114,168,0,0,0,114,37,0,0, + 0,90,4,104,111,111,107,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,218,11,95,112,97,116,104,95,104,111, + 111,107,115,43,4,0,0,115,16,0,0,0,0,3,18,1, + 12,1,12,1,2,1,8,1,14,1,12,2,122,22,80,97, + 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,104, + 111,111,107,115,99,2,0,0,0,0,0,0,0,3,0,0, + 0,19,0,0,0,67,0,0,0,115,102,0,0,0,124,1, + 100,1,107,2,114,42,121,12,116,0,106,1,131,0,125,1, + 87,0,110,20,4,0,116,2,107,10,114,40,1,0,1,0, + 1,0,100,2,83,0,88,0,121,14,116,3,106,4,124,1, + 25,0,125,2,87,0,110,40,4,0,116,5,107,10,114,96, + 1,0,1,0,1,0,124,0,106,6,124,1,131,1,125,2, + 124,2,116,3,106,4,124,1,60,0,89,0,110,2,88,0, + 124,2,83,0,41,3,122,210,71,101,116,32,116,104,101,32, + 102,105,110,100,101,114,32,102,111,114,32,116,104,101,32,112, + 97,116,104,32,101,110,116,114,121,32,102,114,111,109,32,115, + 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, + 95,99,97,99,104,101,46,10,10,32,32,32,32,32,32,32, + 32,73,102,32,116,104,101,32,112,97,116,104,32,101,110,116, + 114,121,32,105,115,32,110,111,116,32,105,110,32,116,104,101, + 32,99,97,99,104,101,44,32,102,105,110,100,32,116,104,101, + 32,97,112,112,114,111,112,114,105,97,116,101,32,102,105,110, + 100,101,114,10,32,32,32,32,32,32,32,32,97,110,100,32, + 99,97,99,104,101,32,105,116,46,32,73,102,32,110,111,32, + 102,105,110,100,101,114,32,105,115,32,97,118,97,105,108,97, + 98,108,101,44,32,115,116,111,114,101,32,78,111,110,101,46, + 10,10,32,32,32,32,32,32,32,32,114,32,0,0,0,78, + 41,7,114,3,0,0,0,114,47,0,0,0,218,17,70,105, + 108,101,78,111,116,70,111,117,110,100,69,114,114,111,114,114, + 8,0,0,0,114,250,0,0,0,114,135,0,0,0,114,254, + 0,0,0,41,3,114,168,0,0,0,114,37,0,0,0,114, + 252,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, + 0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,56,4,0,0,115,22,0, + 0,0,0,8,8,1,2,1,12,1,14,3,6,1,2,1, + 14,1,14,1,10,1,16,1,122,31,80,97,116,104,70,105, + 110,100,101,114,46,95,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,99,3,0,0,0,0,0, + 0,0,6,0,0,0,3,0,0,0,67,0,0,0,115,82, + 0,0,0,116,0,124,2,100,1,131,2,114,26,124,2,106, + 1,124,1,131,1,92,2,125,3,125,4,110,14,124,2,106, + 2,124,1,131,1,125,3,103,0,125,4,124,3,100,0,107, + 9,114,60,116,3,106,4,124,1,124,3,131,2,83,0,116, + 3,106,5,124,1,100,0,131,2,125,5,124,4,124,5,95, + 6,124,5,83,0,41,2,78,114,121,0,0,0,41,7,114, + 112,0,0,0,114,121,0,0,0,114,179,0,0,0,114,118, + 0,0,0,114,176,0,0,0,114,158,0,0,0,114,154,0, + 0,0,41,6,114,168,0,0,0,114,123,0,0,0,114,252, + 0,0,0,114,124,0,0,0,114,125,0,0,0,114,162,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,16,95,108,101,103,97,99,121,95,103,101,116,95,115, + 112,101,99,78,4,0,0,115,18,0,0,0,0,4,10,1, + 16,2,10,1,4,1,8,1,12,1,12,1,6,1,122,27, + 80,97,116,104,70,105,110,100,101,114,46,95,108,101,103,97, + 99,121,95,103,101,116,95,115,112,101,99,78,99,4,0,0, + 0,0,0,0,0,9,0,0,0,5,0,0,0,67,0,0, + 0,115,170,0,0,0,103,0,125,4,120,160,124,2,68,0, + 93,130,125,5,116,0,124,5,116,1,116,2,102,2,131,2, + 115,30,113,10,124,0,106,3,124,5,131,1,125,6,124,6, + 100,1,107,9,114,10,116,4,124,6,100,2,131,2,114,72, + 124,6,106,5,124,1,124,3,131,2,125,7,110,12,124,0, + 106,6,124,1,124,6,131,2,125,7,124,7,100,1,107,8, + 114,94,113,10,124,7,106,7,100,1,107,9,114,108,124,7, + 83,0,124,7,106,8,125,8,124,8,100,1,107,8,114,130, + 116,9,100,3,131,1,130,1,124,4,106,10,124,8,131,1, + 1,0,113,10,87,0,116,11,106,12,124,1,100,1,131,2, + 125,7,124,4,124,7,95,8,124,7,83,0,100,1,83,0, + 41,4,122,63,70,105,110,100,32,116,104,101,32,108,111,97, + 100,101,114,32,111,114,32,110,97,109,101,115,112,97,99,101, + 95,112,97,116,104,32,102,111,114,32,116,104,105,115,32,109, + 111,100,117,108,101,47,112,97,99,107,97,103,101,32,110,97, + 109,101,46,78,114,178,0,0,0,122,19,115,112,101,99,32, + 109,105,115,115,105,110,103,32,108,111,97,100,101,114,41,13, + 114,141,0,0,0,114,73,0,0,0,218,5,98,121,116,101, + 115,114,0,1,0,0,114,112,0,0,0,114,178,0,0,0, + 114,1,1,0,0,114,124,0,0,0,114,154,0,0,0,114, + 103,0,0,0,114,147,0,0,0,114,118,0,0,0,114,158, + 0,0,0,41,9,114,168,0,0,0,114,123,0,0,0,114, + 37,0,0,0,114,177,0,0,0,218,14,110,97,109,101,115, + 112,97,99,101,95,112,97,116,104,90,5,101,110,116,114,121, + 114,252,0,0,0,114,162,0,0,0,114,125,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,9, + 95,103,101,116,95,115,112,101,99,93,4,0,0,115,40,0, + 0,0,0,5,4,1,10,1,14,1,2,1,10,1,8,1, + 10,1,14,2,12,1,8,1,2,1,10,1,4,1,6,1, + 8,1,8,5,14,2,12,1,6,1,122,20,80,97,116,104, + 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, + 99,4,0,0,0,0,0,0,0,6,0,0,0,4,0,0, + 0,67,0,0,0,115,100,0,0,0,124,2,100,1,107,8, + 114,14,116,0,106,1,125,2,124,0,106,2,124,1,124,2, + 124,3,131,3,125,4,124,4,100,1,107,8,114,40,100,1, + 83,0,124,4,106,3,100,1,107,8,114,92,124,4,106,4, + 125,5,124,5,114,86,100,2,124,4,95,5,116,6,124,1, + 124,5,124,0,106,2,131,3,124,4,95,4,124,4,83,0, + 100,1,83,0,110,4,124,4,83,0,100,1,83,0,41,3, + 122,141,84,114,121,32,116,111,32,102,105,110,100,32,97,32, + 115,112,101,99,32,102,111,114,32,39,102,117,108,108,110,97, + 109,101,39,32,111,110,32,115,121,115,46,112,97,116,104,32, + 111,114,32,39,112,97,116,104,39,46,10,10,32,32,32,32, + 32,32,32,32,84,104,101,32,115,101,97,114,99,104,32,105, + 115,32,98,97,115,101,100,32,111,110,32,115,121,115,46,112, + 97,116,104,95,104,111,111,107,115,32,97,110,100,32,115,121, + 115,46,112,97,116,104,95,105,109,112,111,114,116,101,114,95, + 99,97,99,104,101,46,10,32,32,32,32,32,32,32,32,78, + 90,9,110,97,109,101,115,112,97,99,101,41,7,114,8,0, + 0,0,114,37,0,0,0,114,4,1,0,0,114,124,0,0, + 0,114,154,0,0,0,114,156,0,0,0,114,227,0,0,0, + 41,6,114,168,0,0,0,114,123,0,0,0,114,37,0,0, + 0,114,177,0,0,0,114,162,0,0,0,114,3,1,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 178,0,0,0,125,4,0,0,115,26,0,0,0,0,6,8, + 1,6,1,14,1,8,1,4,1,10,1,6,1,4,3,6, + 1,16,1,4,2,6,2,122,20,80,97,116,104,70,105,110, + 100,101,114,46,102,105,110,100,95,115,112,101,99,99,3,0, + 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, + 0,0,115,30,0,0,0,124,0,106,0,124,1,124,2,131, + 2,125,3,124,3,100,1,107,8,114,24,100,1,83,0,124, + 3,106,1,83,0,41,2,122,170,102,105,110,100,32,116,104, + 101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,46, + 112,97,116,104,32,111,114,32,39,112,97,116,104,39,32,98, + 97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,104, + 95,104,111,111,107,115,32,97,110,100,10,32,32,32,32,32, + 32,32,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,46,10,10,32,32,32, + 32,32,32,32,32,84,104,105,115,32,109,101,116,104,111,100, + 32,105,115,32,100,101,112,114,101,99,97,116,101,100,46,32, + 32,85,115,101,32,102,105,110,100,95,115,112,101,99,40,41, + 32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,32, + 32,32,32,78,41,2,114,178,0,0,0,114,124,0,0,0, + 41,4,114,168,0,0,0,114,123,0,0,0,114,37,0,0, + 0,114,162,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,6,0,0,0,114,179,0,0,0,149,4,0,0,115,8, + 0,0,0,0,8,12,1,8,1,4,1,122,22,80,97,116, + 104,70,105,110,100,101,114,46,102,105,110,100,95,109,111,100, + 117,108,101,41,1,78,41,2,78,78,41,1,78,41,12,114, + 109,0,0,0,114,108,0,0,0,114,110,0,0,0,114,111, + 0,0,0,114,180,0,0,0,114,249,0,0,0,114,254,0, + 0,0,114,0,1,0,0,114,1,1,0,0,114,4,1,0, + 0,114,178,0,0,0,114,179,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 248,0,0,0,31,4,0,0,115,22,0,0,0,8,2,4, + 2,12,8,12,13,12,22,12,15,2,1,12,31,2,1,12, + 23,2,1,114,248,0,0,0,99,0,0,0,0,0,0,0, + 0,0,0,0,0,3,0,0,0,64,0,0,0,115,90,0, + 0,0,101,0,90,1,100,0,90,2,100,1,90,3,100,2, + 100,3,132,0,90,4,100,4,100,5,132,0,90,5,101,6, + 90,7,100,6,100,7,132,0,90,8,100,8,100,9,132,0, + 90,9,100,19,100,11,100,12,132,1,90,10,100,13,100,14, + 132,0,90,11,101,12,100,15,100,16,132,0,131,1,90,13, + 100,17,100,18,132,0,90,14,100,10,83,0,41,20,218,10, + 70,105,108,101,70,105,110,100,101,114,122,172,70,105,108,101, + 45,98,97,115,101,100,32,102,105,110,100,101,114,46,10,10, + 32,32,32,32,73,110,116,101,114,97,99,116,105,111,110,115, + 32,119,105,116,104,32,116,104,101,32,102,105,108,101,32,115, + 121,115,116,101,109,32,97,114,101,32,99,97,99,104,101,100, + 32,102,111,114,32,112,101,114,102,111,114,109,97,110,99,101, + 44,32,98,101,105,110,103,10,32,32,32,32,114,101,102,114, + 101,115,104,101,100,32,119,104,101,110,32,116,104,101,32,100, + 105,114,101,99,116,111,114,121,32,116,104,101,32,102,105,110, + 100,101,114,32,105,115,32,104,97,110,100,108,105,110,103,32, + 104,97,115,32,98,101,101,110,32,109,111,100,105,102,105,101, + 100,46,10,10,32,32,32,32,99,2,0,0,0,0,0,0, + 0,5,0,0,0,5,0,0,0,7,0,0,0,115,88,0, + 0,0,103,0,125,3,120,40,124,2,68,0,93,32,92,2, + 137,0,125,4,124,3,106,0,135,0,102,1,100,1,100,2, + 132,8,124,4,68,0,131,1,131,1,1,0,113,10,87,0, + 124,3,124,0,95,1,124,1,112,58,100,3,124,0,95,2, + 100,6,124,0,95,3,116,4,131,0,124,0,95,5,116,4, + 131,0,124,0,95,6,100,5,83,0,41,7,122,154,73,110, + 105,116,105,97,108,105,122,101,32,119,105,116,104,32,116,104, + 101,32,112,97,116,104,32,116,111,32,115,101,97,114,99,104, + 32,111,110,32,97,110,100,32,97,32,118,97,114,105,97,98, + 108,101,32,110,117,109,98,101,114,32,111,102,10,32,32,32, + 32,32,32,32,32,50,45,116,117,112,108,101,115,32,99,111, + 110,116,97,105,110,105,110,103,32,116,104,101,32,108,111,97, + 100,101,114,32,97,110,100,32,116,104,101,32,102,105,108,101, + 32,115,117,102,102,105,120,101,115,32,116,104,101,32,108,111, + 97,100,101,114,10,32,32,32,32,32,32,32,32,114,101,99, + 111,103,110,105,122,101,115,46,99,1,0,0,0,0,0,0, + 0,2,0,0,0,3,0,0,0,51,0,0,0,115,22,0, + 0,0,124,0,93,14,125,1,124,1,136,0,102,2,86,0, + 1,0,113,2,100,0,83,0,41,1,78,114,4,0,0,0, + 41,2,114,24,0,0,0,114,222,0,0,0,41,1,114,124, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,224,0, + 0,0,178,4,0,0,115,2,0,0,0,4,0,122,38,70, + 105,108,101,70,105,110,100,101,114,46,95,95,105,110,105,116, + 95,95,46,60,108,111,99,97,108,115,62,46,60,103,101,110, + 101,120,112,114,62,114,61,0,0,0,114,31,0,0,0,78, + 114,91,0,0,0,41,7,114,147,0,0,0,218,8,95,108, + 111,97,100,101,114,115,114,37,0,0,0,218,11,95,112,97, + 116,104,95,109,116,105,109,101,218,3,115,101,116,218,11,95, + 112,97,116,104,95,99,97,99,104,101,218,19,95,114,101,108, + 97,120,101,100,95,112,97,116,104,95,99,97,99,104,101,41, + 5,114,104,0,0,0,114,37,0,0,0,218,14,108,111,97, + 100,101,114,95,100,101,116,97,105,108,115,90,7,108,111,97, + 100,101,114,115,114,164,0,0,0,114,4,0,0,0,41,1, + 114,124,0,0,0,114,6,0,0,0,114,182,0,0,0,172, + 4,0,0,115,16,0,0,0,0,4,4,1,14,1,28,1, + 6,2,10,1,6,1,8,1,122,19,70,105,108,101,70,105, + 110,100,101,114,46,95,95,105,110,105,116,95,95,99,1,0, 0,0,0,0,0,0,1,0,0,0,2,0,0,0,67,0, - 0,0,115,12,0,0,0,100,1,106,0,124,0,106,1,131, - 1,83,0,41,2,78,122,20,95,78,97,109,101,115,112,97, - 99,101,80,97,116,104,40,123,33,114,125,41,41,2,114,50, - 0,0,0,114,229,0,0,0,41,1,114,104,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,8, - 95,95,114,101,112,114,95,95,233,3,0,0,115,2,0,0, - 0,0,1,122,23,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,46,95,95,114,101,112,114,95,95,99,2,0,0, - 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, - 0,115,12,0,0,0,124,1,124,0,106,0,131,0,107,6, - 83,0,41,1,78,41,1,114,237,0,0,0,41,2,114,104, - 0,0,0,218,4,105,116,101,109,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,218,12,95,95,99,111,110,116, - 97,105,110,115,95,95,236,3,0,0,115,2,0,0,0,0, - 1,122,27,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,95,99,111,110,116,97,105,110,115,95,95,99,2, - 0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,67, - 0,0,0,115,16,0,0,0,124,0,106,0,106,1,124,1, - 131,1,1,0,100,0,83,0,41,1,78,41,2,114,229,0, - 0,0,114,161,0,0,0,41,2,114,104,0,0,0,114,244, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,161,0,0,0,239,3,0,0,115,2,0,0,0, - 0,1,122,21,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,46,97,112,112,101,110,100,78,41,14,114,109,0,0, - 0,114,108,0,0,0,114,110,0,0,0,114,111,0,0,0, - 114,182,0,0,0,114,235,0,0,0,114,230,0,0,0,114, - 237,0,0,0,114,239,0,0,0,114,241,0,0,0,114,242, - 0,0,0,114,243,0,0,0,114,245,0,0,0,114,161,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,227,0,0,0,184,3,0,0,115, - 22,0,0,0,8,5,4,2,8,6,8,10,8,4,8,13, - 8,3,8,3,8,3,8,3,8,3,114,227,0,0,0,99, - 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, - 64,0,0,0,115,80,0,0,0,101,0,90,1,100,0,90, - 2,100,1,100,2,132,0,90,3,101,4,100,3,100,4,132, - 0,131,1,90,5,100,5,100,6,132,0,90,6,100,7,100, - 8,132,0,90,7,100,9,100,10,132,0,90,8,100,11,100, - 12,132,0,90,9,100,13,100,14,132,0,90,10,100,15,100, - 16,132,0,90,11,100,17,83,0,41,18,218,16,95,78,97, - 109,101,115,112,97,99,101,76,111,97,100,101,114,99,4,0, - 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, - 0,0,115,18,0,0,0,116,0,124,1,124,2,124,3,131, - 3,124,0,95,1,100,0,83,0,41,1,78,41,2,114,227, - 0,0,0,114,229,0,0,0,41,4,114,104,0,0,0,114, - 102,0,0,0,114,37,0,0,0,114,233,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,182,0, - 0,0,245,3,0,0,115,2,0,0,0,0,1,122,25,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, - 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,12,0, - 0,0,100,1,106,0,124,1,106,1,131,1,83,0,41,2, - 122,115,82,101,116,117,114,110,32,114,101,112,114,32,102,111, - 114,32,116,104,101,32,109,111,100,117,108,101,46,10,10,32, - 32,32,32,32,32,32,32,84,104,101,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,84,104,101,32,105,109,112,111,114,116,32,109,97,99, - 104,105,110,101,114,121,32,100,111,101,115,32,116,104,101,32, - 106,111,98,32,105,116,115,101,108,102,46,10,10,32,32,32, - 32,32,32,32,32,122,25,60,109,111,100,117,108,101,32,123, - 33,114,125,32,40,110,97,109,101,115,112,97,99,101,41,62, - 41,2,114,50,0,0,0,114,109,0,0,0,41,2,114,168, - 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,11,109,111,100,117,108,101,95, - 114,101,112,114,248,3,0,0,115,2,0,0,0,0,7,122, - 28,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, - 114,46,109,111,100,117,108,101,95,114,101,112,114,99,2,0, - 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, - 0,0,115,4,0,0,0,100,1,83,0,41,2,78,84,114, - 4,0,0,0,41,2,114,104,0,0,0,114,123,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 157,0,0,0,1,4,0,0,115,2,0,0,0,0,1,122, - 27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, - 114,46,105,115,95,112,97,99,107,97,103,101,99,2,0,0, - 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, - 0,115,4,0,0,0,100,1,83,0,41,2,78,114,32,0, - 0,0,114,4,0,0,0,41,2,114,104,0,0,0,114,123, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,199,0,0,0,4,4,0,0,115,2,0,0,0, - 0,1,122,27,95,78,97,109,101,115,112,97,99,101,76,111, - 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,6,0,0,0, - 67,0,0,0,115,16,0,0,0,116,0,100,1,100,2,100, - 3,100,4,100,5,141,4,83,0,41,6,78,114,32,0,0, - 0,122,8,60,115,116,114,105,110,103,62,114,186,0,0,0, - 84,41,1,114,201,0,0,0,41,1,114,202,0,0,0,41, - 2,114,104,0,0,0,114,123,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,184,0,0,0,7, - 4,0,0,115,2,0,0,0,0,1,122,25,95,78,97,109, - 101,115,112,97,99,101,76,111,97,100,101,114,46,103,101,116, - 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, - 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, - 1,83,0,41,2,122,42,85,115,101,32,100,101,102,97,117, - 108,116,32,115,101,109,97,110,116,105,99,115,32,102,111,114, - 32,109,111,100,117,108,101,32,99,114,101,97,116,105,111,110, - 46,78,114,4,0,0,0,41,2,114,104,0,0,0,114,162, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,183,0,0,0,10,4,0,0,115,0,0,0,0, - 122,30,95,78,97,109,101,115,112,97,99,101,76,111,97,100, - 101,114,46,99,114,101,97,116,101,95,109,111,100,117,108,101, - 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, - 0,67,0,0,0,115,4,0,0,0,100,0,83,0,41,1, - 78,114,4,0,0,0,41,2,114,104,0,0,0,114,187,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,188,0,0,0,13,4,0,0,115,2,0,0,0,0, - 1,122,28,95,78,97,109,101,115,112,97,99,101,76,111,97, - 100,101,114,46,101,120,101,99,95,109,111,100,117,108,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, - 67,0,0,0,115,26,0,0,0,116,0,106,1,100,1,124, - 0,106,2,131,2,1,0,116,0,106,3,124,0,124,1,131, - 2,83,0,41,2,122,98,76,111,97,100,32,97,32,110,97, - 109,101,115,112,97,99,101,32,109,111,100,117,108,101,46,10, + 0,0,115,10,0,0,0,100,3,124,0,95,0,100,2,83, + 0,41,4,122,31,73,110,118,97,108,105,100,97,116,101,32, + 116,104,101,32,100,105,114,101,99,116,111,114,121,32,109,116, + 105,109,101,46,114,31,0,0,0,78,114,91,0,0,0,41, + 1,114,7,1,0,0,41,1,114,104,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,6,0,0,0,114,249,0,0, + 0,186,4,0,0,115,2,0,0,0,0,2,122,28,70,105, + 108,101,70,105,110,100,101,114,46,105,110,118,97,108,105,100, + 97,116,101,95,99,97,99,104,101,115,99,2,0,0,0,0, + 0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115, + 42,0,0,0,124,0,106,0,124,1,131,1,125,2,124,2, + 100,1,107,8,114,26,100,1,103,0,102,2,83,0,124,2, + 106,1,124,2,106,2,112,38,103,0,102,2,83,0,41,2, + 122,197,84,114,121,32,116,111,32,102,105,110,100,32,97,32, + 108,111,97,100,101,114,32,102,111,114,32,116,104,101,32,115, + 112,101,99,105,102,105,101,100,32,109,111,100,117,108,101,44, + 32,111,114,32,116,104,101,32,110,97,109,101,115,112,97,99, + 101,10,32,32,32,32,32,32,32,32,112,97,99,107,97,103, + 101,32,112,111,114,116,105,111,110,115,46,32,82,101,116,117, + 114,110,115,32,40,108,111,97,100,101,114,44,32,108,105,115, + 116,45,111,102,45,112,111,114,116,105,111,110,115,41,46,10, 10,32,32,32,32,32,32,32,32,84,104,105,115,32,109,101, 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,85,115,101,32,101,120,101,99,95,109,111, - 100,117,108,101,40,41,32,105,110,115,116,101,97,100,46,10, - 10,32,32,32,32,32,32,32,32,122,38,110,97,109,101,115, - 112,97,99,101,32,109,111,100,117,108,101,32,108,111,97,100, - 101,100,32,119,105,116,104,32,112,97,116,104,32,123,33,114, - 125,41,4,114,118,0,0,0,114,133,0,0,0,114,229,0, - 0,0,114,189,0,0,0,41,2,114,104,0,0,0,114,123, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,190,0,0,0,16,4,0,0,115,6,0,0,0, - 0,7,6,1,8,1,122,28,95,78,97,109,101,115,112,97, - 99,101,76,111,97,100,101,114,46,108,111,97,100,95,109,111, - 100,117,108,101,78,41,12,114,109,0,0,0,114,108,0,0, - 0,114,110,0,0,0,114,182,0,0,0,114,180,0,0,0, - 114,247,0,0,0,114,157,0,0,0,114,199,0,0,0,114, - 184,0,0,0,114,183,0,0,0,114,188,0,0,0,114,190, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,246,0,0,0,244,3,0,0, - 115,16,0,0,0,8,1,8,3,12,9,8,3,8,3,8, - 3,8,3,8,3,114,246,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,4,0,0,0,64,0,0,0,115, - 106,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, - 101,4,100,2,100,3,132,0,131,1,90,5,101,4,100,4, - 100,5,132,0,131,1,90,6,101,4,100,6,100,7,132,0, - 131,1,90,7,101,4,100,8,100,9,132,0,131,1,90,8, - 101,4,100,17,100,11,100,12,132,1,131,1,90,9,101,4, - 100,18,100,13,100,14,132,1,131,1,90,10,101,4,100,19, - 100,15,100,16,132,1,131,1,90,11,100,10,83,0,41,20, - 218,10,80,97,116,104,70,105,110,100,101,114,122,62,77,101, - 116,97,32,112,97,116,104,32,102,105,110,100,101,114,32,102, - 111,114,32,115,121,115,46,112,97,116,104,32,97,110,100,32, - 112,97,99,107,97,103,101,32,95,95,112,97,116,104,95,95, - 32,97,116,116,114,105,98,117,116,101,115,46,99,1,0,0, - 0,0,0,0,0,2,0,0,0,4,0,0,0,67,0,0, - 0,115,42,0,0,0,120,36,116,0,106,1,106,2,131,0, - 68,0,93,22,125,1,116,3,124,1,100,1,131,2,114,12, - 124,1,106,4,131,0,1,0,113,12,87,0,100,2,83,0, - 41,3,122,125,67,97,108,108,32,116,104,101,32,105,110,118, - 97,108,105,100,97,116,101,95,99,97,99,104,101,115,40,41, - 32,109,101,116,104,111,100,32,111,110,32,97,108,108,32,112, - 97,116,104,32,101,110,116,114,121,32,102,105,110,100,101,114, - 115,10,32,32,32,32,32,32,32,32,115,116,111,114,101,100, - 32,105,110,32,115,121,115,46,112,97,116,104,95,105,109,112, - 111,114,116,101,114,95,99,97,99,104,101,115,32,40,119,104, - 101,114,101,32,105,109,112,108,101,109,101,110,116,101,100,41, - 46,218,17,105,110,118,97,108,105,100,97,116,101,95,99,97, - 99,104,101,115,78,41,5,114,8,0,0,0,218,19,112,97, - 116,104,95,105,109,112,111,114,116,101,114,95,99,97,99,104, - 101,218,6,118,97,108,117,101,115,114,112,0,0,0,114,249, - 0,0,0,41,2,114,168,0,0,0,218,6,102,105,110,100, - 101,114,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,249,0,0,0,34,4,0,0,115,6,0,0,0,0, - 4,16,1,10,1,122,28,80,97,116,104,70,105,110,100,101, - 114,46,105,110,118,97,108,105,100,97,116,101,95,99,97,99, - 104,101,115,99,2,0,0,0,0,0,0,0,3,0,0,0, - 12,0,0,0,67,0,0,0,115,86,0,0,0,116,0,106, - 1,100,1,107,9,114,30,116,0,106,1,12,0,114,30,116, - 2,106,3,100,2,116,4,131,2,1,0,120,50,116,0,106, - 1,68,0,93,36,125,2,121,8,124,2,124,1,131,1,83, - 0,4,0,116,5,107,10,114,72,1,0,1,0,1,0,119, - 38,89,0,113,38,88,0,113,38,87,0,100,1,83,0,100, - 1,83,0,41,3,122,46,83,101,97,114,99,104,32,115,121, - 115,46,112,97,116,104,95,104,111,111,107,115,32,102,111,114, - 32,97,32,102,105,110,100,101,114,32,102,111,114,32,39,112, - 97,116,104,39,46,78,122,23,115,121,115,46,112,97,116,104, - 95,104,111,111,107,115,32,105,115,32,101,109,112,116,121,41, - 6,114,8,0,0,0,218,10,112,97,116,104,95,104,111,111, - 107,115,114,63,0,0,0,114,64,0,0,0,114,122,0,0, - 0,114,103,0,0,0,41,3,114,168,0,0,0,114,37,0, - 0,0,90,4,104,111,111,107,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,218,11,95,112,97,116,104,95,104, - 111,111,107,115,42,4,0,0,115,16,0,0,0,0,3,18, - 1,12,1,12,1,2,1,8,1,14,1,12,2,122,22,80, - 97,116,104,70,105,110,100,101,114,46,95,112,97,116,104,95, - 104,111,111,107,115,99,2,0,0,0,0,0,0,0,3,0, - 0,0,19,0,0,0,67,0,0,0,115,102,0,0,0,124, - 1,100,1,107,2,114,42,121,12,116,0,106,1,131,0,125, - 1,87,0,110,20,4,0,116,2,107,10,114,40,1,0,1, - 0,1,0,100,2,83,0,88,0,121,14,116,3,106,4,124, - 1,25,0,125,2,87,0,110,40,4,0,116,5,107,10,114, - 96,1,0,1,0,1,0,124,0,106,6,124,1,131,1,125, - 2,124,2,116,3,106,4,124,1,60,0,89,0,110,2,88, - 0,124,2,83,0,41,3,122,210,71,101,116,32,116,104,101, - 32,102,105,110,100,101,114,32,102,111,114,32,116,104,101,32, - 112,97,116,104,32,101,110,116,114,121,32,102,114,111,109,32, - 115,121,115,46,112,97,116,104,95,105,109,112,111,114,116,101, - 114,95,99,97,99,104,101,46,10,10,32,32,32,32,32,32, - 32,32,73,102,32,116,104,101,32,112,97,116,104,32,101,110, - 116,114,121,32,105,115,32,110,111,116,32,105,110,32,116,104, - 101,32,99,97,99,104,101,44,32,102,105,110,100,32,116,104, - 101,32,97,112,112,114,111,112,114,105,97,116,101,32,102,105, - 110,100,101,114,10,32,32,32,32,32,32,32,32,97,110,100, - 32,99,97,99,104,101,32,105,116,46,32,73,102,32,110,111, - 32,102,105,110,100,101,114,32,105,115,32,97,118,97,105,108, - 97,98,108,101,44,32,115,116,111,114,101,32,78,111,110,101, - 46,10,10,32,32,32,32,32,32,32,32,114,32,0,0,0, - 78,41,7,114,3,0,0,0,114,47,0,0,0,218,17,70, - 105,108,101,78,111,116,70,111,117,110,100,69,114,114,111,114, - 114,8,0,0,0,114,250,0,0,0,114,135,0,0,0,114, - 254,0,0,0,41,3,114,168,0,0,0,114,37,0,0,0, - 114,252,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,218,20,95,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,55,4,0,0,115,22, - 0,0,0,0,8,8,1,2,1,12,1,14,3,6,1,2, - 1,14,1,14,1,10,1,16,1,122,31,80,97,116,104,70, - 105,110,100,101,114,46,95,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,99,3,0,0,0,0, - 0,0,0,6,0,0,0,3,0,0,0,67,0,0,0,115, - 82,0,0,0,116,0,124,2,100,1,131,2,114,26,124,2, - 106,1,124,1,131,1,92,2,125,3,125,4,110,14,124,2, - 106,2,124,1,131,1,125,3,103,0,125,4,124,3,100,0, - 107,9,114,60,116,3,106,4,124,1,124,3,131,2,83,0, - 116,3,106,5,124,1,100,0,131,2,125,5,124,4,124,5, - 95,6,124,5,83,0,41,2,78,114,121,0,0,0,41,7, - 114,112,0,0,0,114,121,0,0,0,114,179,0,0,0,114, - 118,0,0,0,114,176,0,0,0,114,158,0,0,0,114,154, - 0,0,0,41,6,114,168,0,0,0,114,123,0,0,0,114, - 252,0,0,0,114,124,0,0,0,114,125,0,0,0,114,162, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,16,95,108,101,103,97,99,121,95,103,101,116,95, - 115,112,101,99,77,4,0,0,115,18,0,0,0,0,4,10, - 1,16,2,10,1,4,1,8,1,12,1,12,1,6,1,122, - 27,80,97,116,104,70,105,110,100,101,114,46,95,108,101,103, - 97,99,121,95,103,101,116,95,115,112,101,99,78,99,4,0, - 0,0,0,0,0,0,9,0,0,0,5,0,0,0,67,0, - 0,0,115,170,0,0,0,103,0,125,4,120,160,124,2,68, - 0,93,130,125,5,116,0,124,5,116,1,116,2,102,2,131, - 2,115,30,113,10,124,0,106,3,124,5,131,1,125,6,124, - 6,100,1,107,9,114,10,116,4,124,6,100,2,131,2,114, - 72,124,6,106,5,124,1,124,3,131,2,125,7,110,12,124, - 0,106,6,124,1,124,6,131,2,125,7,124,7,100,1,107, - 8,114,94,113,10,124,7,106,7,100,1,107,9,114,108,124, - 7,83,0,124,7,106,8,125,8,124,8,100,1,107,8,114, - 130,116,9,100,3,131,1,130,1,124,4,106,10,124,8,131, - 1,1,0,113,10,87,0,116,11,106,12,124,1,100,1,131, - 2,125,7,124,4,124,7,95,8,124,7,83,0,100,1,83, - 0,41,4,122,63,70,105,110,100,32,116,104,101,32,108,111, - 97,100,101,114,32,111,114,32,110,97,109,101,115,112,97,99, - 101,95,112,97,116,104,32,102,111,114,32,116,104,105,115,32, - 109,111,100,117,108,101,47,112,97,99,107,97,103,101,32,110, - 97,109,101,46,78,114,178,0,0,0,122,19,115,112,101,99, - 32,109,105,115,115,105,110,103,32,108,111,97,100,101,114,41, - 13,114,141,0,0,0,114,73,0,0,0,218,5,98,121,116, - 101,115,114,0,1,0,0,114,112,0,0,0,114,178,0,0, - 0,114,1,1,0,0,114,124,0,0,0,114,154,0,0,0, - 114,103,0,0,0,114,147,0,0,0,114,118,0,0,0,114, - 158,0,0,0,41,9,114,168,0,0,0,114,123,0,0,0, - 114,37,0,0,0,114,177,0,0,0,218,14,110,97,109,101, - 115,112,97,99,101,95,112,97,116,104,90,5,101,110,116,114, - 121,114,252,0,0,0,114,162,0,0,0,114,125,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 9,95,103,101,116,95,115,112,101,99,92,4,0,0,115,40, - 0,0,0,0,5,4,1,10,1,14,1,2,1,10,1,8, - 1,10,1,14,2,12,1,8,1,2,1,10,1,4,1,6, - 1,8,1,8,5,14,2,12,1,6,1,122,20,80,97,116, - 104,70,105,110,100,101,114,46,95,103,101,116,95,115,112,101, - 99,99,4,0,0,0,0,0,0,0,6,0,0,0,4,0, - 0,0,67,0,0,0,115,100,0,0,0,124,2,100,1,107, - 8,114,14,116,0,106,1,125,2,124,0,106,2,124,1,124, - 2,124,3,131,3,125,4,124,4,100,1,107,8,114,40,100, - 1,83,0,124,4,106,3,100,1,107,8,114,92,124,4,106, - 4,125,5,124,5,114,86,100,2,124,4,95,5,116,6,124, - 1,124,5,124,0,106,2,131,3,124,4,95,4,124,4,83, - 0,100,1,83,0,110,4,124,4,83,0,100,1,83,0,41, - 3,122,141,84,114,121,32,116,111,32,102,105,110,100,32,97, - 32,115,112,101,99,32,102,111,114,32,39,102,117,108,108,110, - 97,109,101,39,32,111,110,32,115,121,115,46,112,97,116,104, - 32,111,114,32,39,112,97,116,104,39,46,10,10,32,32,32, - 32,32,32,32,32,84,104,101,32,115,101,97,114,99,104,32, - 105,115,32,98,97,115,101,100,32,111,110,32,115,121,115,46, - 112,97,116,104,95,104,111,111,107,115,32,97,110,100,32,115, - 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, - 95,99,97,99,104,101,46,10,32,32,32,32,32,32,32,32, - 78,90,9,110,97,109,101,115,112,97,99,101,41,7,114,8, - 0,0,0,114,37,0,0,0,114,4,1,0,0,114,124,0, - 0,0,114,154,0,0,0,114,156,0,0,0,114,227,0,0, - 0,41,6,114,168,0,0,0,114,123,0,0,0,114,37,0, - 0,0,114,177,0,0,0,114,162,0,0,0,114,3,1,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,178,0,0,0,124,4,0,0,115,26,0,0,0,0,6, - 8,1,6,1,14,1,8,1,4,1,10,1,6,1,4,3, - 6,1,16,1,4,2,6,2,122,20,80,97,116,104,70,105, - 110,100,101,114,46,102,105,110,100,95,115,112,101,99,99,3, - 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, - 0,0,0,115,30,0,0,0,124,0,106,0,124,1,124,2, - 131,2,125,3,124,3,100,1,107,8,114,24,100,1,83,0, - 124,3,106,1,83,0,41,2,122,170,102,105,110,100,32,116, - 104,101,32,109,111,100,117,108,101,32,111,110,32,115,121,115, - 46,112,97,116,104,32,111,114,32,39,112,97,116,104,39,32, - 98,97,115,101,100,32,111,110,32,115,121,115,46,112,97,116, - 104,95,104,111,111,107,115,32,97,110,100,10,32,32,32,32, - 32,32,32,32,115,121,115,46,112,97,116,104,95,105,109,112, - 111,114,116,101,114,95,99,97,99,104,101,46,10,10,32,32, - 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,85,115,101,32,102,105,110,100,95,115,112,101,99,40, - 41,32,105,110,115,116,101,97,100,46,10,10,32,32,32,32, - 32,32,32,32,78,41,2,114,178,0,0,0,114,124,0,0, - 0,41,4,114,168,0,0,0,114,123,0,0,0,114,37,0, - 0,0,114,162,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,179,0,0,0,148,4,0,0,115, - 8,0,0,0,0,8,12,1,8,1,4,1,122,22,80,97, - 116,104,70,105,110,100,101,114,46,102,105,110,100,95,109,111, - 100,117,108,101,41,1,78,41,2,78,78,41,1,78,41,12, - 114,109,0,0,0,114,108,0,0,0,114,110,0,0,0,114, - 111,0,0,0,114,180,0,0,0,114,249,0,0,0,114,254, - 0,0,0,114,0,1,0,0,114,1,1,0,0,114,4,1, - 0,0,114,178,0,0,0,114,179,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,248,0,0,0,30,4,0,0,115,22,0,0,0,8,2, - 4,2,12,8,12,13,12,22,12,15,2,1,12,31,2,1, - 12,23,2,1,114,248,0,0,0,99,0,0,0,0,0,0, - 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,90, - 0,0,0,101,0,90,1,100,0,90,2,100,1,90,3,100, - 2,100,3,132,0,90,4,100,4,100,5,132,0,90,5,101, - 6,90,7,100,6,100,7,132,0,90,8,100,8,100,9,132, - 0,90,9,100,19,100,11,100,12,132,1,90,10,100,13,100, - 14,132,0,90,11,101,12,100,15,100,16,132,0,131,1,90, - 13,100,17,100,18,132,0,90,14,100,10,83,0,41,20,218, - 10,70,105,108,101,70,105,110,100,101,114,122,172,70,105,108, - 101,45,98,97,115,101,100,32,102,105,110,100,101,114,46,10, - 10,32,32,32,32,73,110,116,101,114,97,99,116,105,111,110, - 115,32,119,105,116,104,32,116,104,101,32,102,105,108,101,32, - 115,121,115,116,101,109,32,97,114,101,32,99,97,99,104,101, - 100,32,102,111,114,32,112,101,114,102,111,114,109,97,110,99, - 101,44,32,98,101,105,110,103,10,32,32,32,32,114,101,102, - 114,101,115,104,101,100,32,119,104,101,110,32,116,104,101,32, - 100,105,114,101,99,116,111,114,121,32,116,104,101,32,102,105, - 110,100,101,114,32,105,115,32,104,97,110,100,108,105,110,103, - 32,104,97,115,32,98,101,101,110,32,109,111,100,105,102,105, - 101,100,46,10,10,32,32,32,32,99,2,0,0,0,0,0, - 0,0,5,0,0,0,5,0,0,0,7,0,0,0,115,88, - 0,0,0,103,0,125,3,120,40,124,2,68,0,93,32,92, - 2,137,0,125,4,124,3,106,0,135,0,102,1,100,1,100, - 2,132,8,124,4,68,0,131,1,131,1,1,0,113,10,87, - 0,124,3,124,0,95,1,124,1,112,58,100,3,124,0,95, - 2,100,6,124,0,95,3,116,4,131,0,124,0,95,5,116, - 4,131,0,124,0,95,6,100,5,83,0,41,7,122,154,73, - 110,105,116,105,97,108,105,122,101,32,119,105,116,104,32,116, - 104,101,32,112,97,116,104,32,116,111,32,115,101,97,114,99, - 104,32,111,110,32,97,110,100,32,97,32,118,97,114,105,97, - 98,108,101,32,110,117,109,98,101,114,32,111,102,10,32,32, - 32,32,32,32,32,32,50,45,116,117,112,108,101,115,32,99, - 111,110,116,97,105,110,105,110,103,32,116,104,101,32,108,111, - 97,100,101,114,32,97,110,100,32,116,104,101,32,102,105,108, - 101,32,115,117,102,102,105,120,101,115,32,116,104,101,32,108, - 111,97,100,101,114,10,32,32,32,32,32,32,32,32,114,101, - 99,111,103,110,105,122,101,115,46,99,1,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,51,0,0,0,115,22, - 0,0,0,124,0,93,14,125,1,124,1,136,0,102,2,86, - 0,1,0,113,2,100,0,83,0,41,1,78,114,4,0,0, - 0,41,2,114,24,0,0,0,114,222,0,0,0,41,1,114, - 124,0,0,0,114,4,0,0,0,114,6,0,0,0,114,224, - 0,0,0,177,4,0,0,115,2,0,0,0,4,0,122,38, - 70,105,108,101,70,105,110,100,101,114,46,95,95,105,110,105, - 116,95,95,46,60,108,111,99,97,108,115,62,46,60,103,101, - 110,101,120,112,114,62,114,61,0,0,0,114,31,0,0,0, - 78,114,91,0,0,0,41,7,114,147,0,0,0,218,8,95, - 108,111,97,100,101,114,115,114,37,0,0,0,218,11,95,112, - 97,116,104,95,109,116,105,109,101,218,3,115,101,116,218,11, - 95,112,97,116,104,95,99,97,99,104,101,218,19,95,114,101, - 108,97,120,101,100,95,112,97,116,104,95,99,97,99,104,101, - 41,5,114,104,0,0,0,114,37,0,0,0,218,14,108,111, - 97,100,101,114,95,100,101,116,97,105,108,115,90,7,108,111, - 97,100,101,114,115,114,164,0,0,0,114,4,0,0,0,41, - 1,114,124,0,0,0,114,6,0,0,0,114,182,0,0,0, - 171,4,0,0,115,16,0,0,0,0,4,4,1,14,1,28, - 1,6,2,10,1,6,1,8,1,122,19,70,105,108,101,70, - 105,110,100,101,114,46,95,95,105,110,105,116,95,95,99,1, - 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67, - 0,0,0,115,10,0,0,0,100,3,124,0,95,0,100,2, - 83,0,41,4,122,31,73,110,118,97,108,105,100,97,116,101, - 32,116,104,101,32,100,105,114,101,99,116,111,114,121,32,109, - 116,105,109,101,46,114,31,0,0,0,78,114,91,0,0,0, - 41,1,114,7,1,0,0,41,1,114,104,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,6,0,0,0,114,249,0, - 0,0,185,4,0,0,115,2,0,0,0,0,2,122,28,70, - 105,108,101,70,105,110,100,101,114,46,105,110,118,97,108,105, - 100,97,116,101,95,99,97,99,104,101,115,99,2,0,0,0, - 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0, - 115,42,0,0,0,124,0,106,0,124,1,131,1,125,2,124, - 2,100,1,107,8,114,26,100,1,103,0,102,2,83,0,124, - 2,106,1,124,2,106,2,112,38,103,0,102,2,83,0,41, - 2,122,197,84,114,121,32,116,111,32,102,105,110,100,32,97, - 32,108,111,97,100,101,114,32,102,111,114,32,116,104,101,32, - 115,112,101,99,105,102,105,101,100,32,109,111,100,117,108,101, - 44,32,111,114,32,116,104,101,32,110,97,109,101,115,112,97, - 99,101,10,32,32,32,32,32,32,32,32,112,97,99,107,97, - 103,101,32,112,111,114,116,105,111,110,115,46,32,82,101,116, - 117,114,110,115,32,40,108,111,97,100,101,114,44,32,108,105, - 115,116,45,111,102,45,112,111,114,116,105,111,110,115,41,46, - 10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109, - 101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97, - 116,101,100,46,32,32,85,115,101,32,102,105,110,100,95,115, - 112,101,99,40,41,32,105,110,115,116,101,97,100,46,10,10, - 32,32,32,32,32,32,32,32,78,41,3,114,178,0,0,0, - 114,124,0,0,0,114,154,0,0,0,41,3,114,104,0,0, - 0,114,123,0,0,0,114,162,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,121,0,0,0,191, - 4,0,0,115,8,0,0,0,0,7,10,1,8,1,8,1, - 122,22,70,105,108,101,70,105,110,100,101,114,46,102,105,110, - 100,95,108,111,97,100,101,114,99,6,0,0,0,0,0,0, - 0,7,0,0,0,6,0,0,0,67,0,0,0,115,26,0, - 0,0,124,1,124,2,124,3,131,2,125,6,116,0,124,2, - 124,3,124,6,124,4,100,1,141,4,83,0,41,2,78,41, - 2,114,124,0,0,0,114,154,0,0,0,41,1,114,165,0, - 0,0,41,7,114,104,0,0,0,114,163,0,0,0,114,123, - 0,0,0,114,37,0,0,0,90,4,115,109,115,108,114,177, - 0,0,0,114,124,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,4,1,0,0,203,4,0,0, - 115,6,0,0,0,0,1,10,1,8,1,122,20,70,105,108, - 101,70,105,110,100,101,114,46,95,103,101,116,95,115,112,101, - 99,78,99,3,0,0,0,0,0,0,0,14,0,0,0,15, - 0,0,0,67,0,0,0,115,98,1,0,0,100,1,125,3, - 124,1,106,0,100,2,131,1,100,3,25,0,125,4,121,24, - 116,1,124,0,106,2,112,34,116,3,106,4,131,0,131,1, - 106,5,125,5,87,0,110,24,4,0,116,6,107,10,114,66, - 1,0,1,0,1,0,100,10,125,5,89,0,110,2,88,0, - 124,5,124,0,106,7,107,3,114,92,124,0,106,8,131,0, - 1,0,124,5,124,0,95,7,116,9,131,0,114,114,124,0, - 106,10,125,6,124,4,106,11,131,0,125,7,110,10,124,0, - 106,12,125,6,124,4,125,7,124,7,124,6,107,6,114,218, - 116,13,124,0,106,2,124,4,131,2,125,8,120,72,124,0, - 106,14,68,0,93,54,92,2,125,9,125,10,100,5,124,9, - 23,0,125,11,116,13,124,8,124,11,131,2,125,12,116,15, - 124,12,131,1,114,152,124,0,106,16,124,10,124,1,124,12, - 124,8,103,1,124,2,131,5,83,0,113,152,87,0,116,17, - 124,8,131,1,125,3,120,88,124,0,106,14,68,0,93,78, - 92,2,125,9,125,10,116,13,124,0,106,2,124,4,124,9, - 23,0,131,2,125,12,116,18,106,19,100,6,124,12,100,3, - 100,7,141,3,1,0,124,7,124,9,23,0,124,6,107,6, - 114,226,116,15,124,12,131,1,114,226,124,0,106,16,124,10, - 124,1,124,12,100,8,124,2,131,5,83,0,113,226,87,0, - 124,3,144,1,114,94,116,18,106,19,100,9,124,8,131,2, - 1,0,116,18,106,20,124,1,100,8,131,2,125,13,124,8, - 103,1,124,13,95,21,124,13,83,0,100,8,83,0,41,11, - 122,111,84,114,121,32,116,111,32,102,105,110,100,32,97,32, - 115,112,101,99,32,102,111,114,32,116,104,101,32,115,112,101, - 99,105,102,105,101,100,32,109,111,100,117,108,101,46,10,10, - 32,32,32,32,32,32,32,32,82,101,116,117,114,110,115,32, - 116,104,101,32,109,97,116,99,104,105,110,103,32,115,112,101, - 99,44,32,111,114,32,78,111,110,101,32,105,102,32,110,111, - 116,32,102,111,117,110,100,46,10,32,32,32,32,32,32,32, - 32,70,114,61,0,0,0,114,59,0,0,0,114,31,0,0, - 0,114,182,0,0,0,122,9,116,114,121,105,110,103,32,123, - 125,41,1,90,9,118,101,114,98,111,115,105,116,121,78,122, - 25,112,111,115,115,105,98,108,101,32,110,97,109,101,115,112, - 97,99,101,32,102,111,114,32,123,125,114,91,0,0,0,41, - 22,114,34,0,0,0,114,41,0,0,0,114,37,0,0,0, - 114,3,0,0,0,114,47,0,0,0,114,216,0,0,0,114, - 42,0,0,0,114,7,1,0,0,218,11,95,102,105,108,108, - 95,99,97,99,104,101,114,7,0,0,0,114,10,1,0,0, - 114,92,0,0,0,114,9,1,0,0,114,30,0,0,0,114, - 6,1,0,0,114,46,0,0,0,114,4,1,0,0,114,48, - 0,0,0,114,118,0,0,0,114,133,0,0,0,114,158,0, - 0,0,114,154,0,0,0,41,14,114,104,0,0,0,114,123, - 0,0,0,114,177,0,0,0,90,12,105,115,95,110,97,109, - 101,115,112,97,99,101,90,11,116,97,105,108,95,109,111,100, - 117,108,101,114,130,0,0,0,90,5,99,97,99,104,101,90, - 12,99,97,99,104,101,95,109,111,100,117,108,101,90,9,98, - 97,115,101,95,112,97,116,104,114,222,0,0,0,114,163,0, - 0,0,90,13,105,110,105,116,95,102,105,108,101,110,97,109, - 101,90,9,102,117,108,108,95,112,97,116,104,114,162,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,178,0,0,0,208,4,0,0,115,70,0,0,0,0,5, - 4,1,14,1,2,1,24,1,14,1,10,1,10,1,8,1, - 6,2,6,1,6,1,10,2,6,1,4,2,8,1,12,1, - 16,1,8,1,10,1,8,1,24,4,8,2,16,1,16,1, - 16,1,12,1,8,1,10,1,12,1,6,1,12,1,12,1, - 8,1,4,1,122,20,70,105,108,101,70,105,110,100,101,114, - 46,102,105,110,100,95,115,112,101,99,99,1,0,0,0,0, - 0,0,0,9,0,0,0,13,0,0,0,67,0,0,0,115, - 194,0,0,0,124,0,106,0,125,1,121,22,116,1,106,2, - 124,1,112,22,116,1,106,3,131,0,131,1,125,2,87,0, - 110,30,4,0,116,4,116,5,116,6,102,3,107,10,114,58, - 1,0,1,0,1,0,103,0,125,2,89,0,110,2,88,0, - 116,7,106,8,106,9,100,1,131,1,115,84,116,10,124,2, - 131,1,124,0,95,11,110,78,116,10,131,0,125,3,120,64, - 124,2,68,0,93,56,125,4,124,4,106,12,100,2,131,1, - 92,3,125,5,125,6,125,7,124,6,114,138,100,3,106,13, - 124,5,124,7,106,14,131,0,131,2,125,8,110,4,124,5, - 125,8,124,3,106,15,124,8,131,1,1,0,113,96,87,0, - 124,3,124,0,95,11,116,7,106,8,106,9,116,16,131,1, - 114,190,100,4,100,5,132,0,124,2,68,0,131,1,124,0, - 95,17,100,6,83,0,41,7,122,68,70,105,108,108,32,116, - 104,101,32,99,97,99,104,101,32,111,102,32,112,111,116,101, - 110,116,105,97,108,32,109,111,100,117,108,101,115,32,97,110, - 100,32,112,97,99,107,97,103,101,115,32,102,111,114,32,116, - 104,105,115,32,100,105,114,101,99,116,111,114,121,46,114,0, - 0,0,0,114,61,0,0,0,122,5,123,125,46,123,125,99, - 1,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, - 83,0,0,0,115,20,0,0,0,104,0,124,0,93,12,125, - 1,124,1,106,0,131,0,146,2,113,4,83,0,114,4,0, - 0,0,41,1,114,92,0,0,0,41,2,114,24,0,0,0, - 90,2,102,110,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,250,9,60,115,101,116,99,111,109,112,62,29,5, - 0,0,115,2,0,0,0,6,0,122,41,70,105,108,101,70, + 101,100,46,32,32,85,115,101,32,102,105,110,100,95,115,112, + 101,99,40,41,32,105,110,115,116,101,97,100,46,10,10,32, + 32,32,32,32,32,32,32,78,41,3,114,178,0,0,0,114, + 124,0,0,0,114,154,0,0,0,41,3,114,104,0,0,0, + 114,123,0,0,0,114,162,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,121,0,0,0,192,4, + 0,0,115,8,0,0,0,0,7,10,1,8,1,8,1,122, + 22,70,105,108,101,70,105,110,100,101,114,46,102,105,110,100, + 95,108,111,97,100,101,114,99,6,0,0,0,0,0,0,0, + 7,0,0,0,6,0,0,0,67,0,0,0,115,26,0,0, + 0,124,1,124,2,124,3,131,2,125,6,116,0,124,2,124, + 3,124,6,124,4,100,1,141,4,83,0,41,2,78,41,2, + 114,124,0,0,0,114,154,0,0,0,41,1,114,165,0,0, + 0,41,7,114,104,0,0,0,114,163,0,0,0,114,123,0, + 0,0,114,37,0,0,0,90,4,115,109,115,108,114,177,0, + 0,0,114,124,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,4,1,0,0,204,4,0,0,115, + 6,0,0,0,0,1,10,1,8,1,122,20,70,105,108,101, + 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, + 78,99,3,0,0,0,0,0,0,0,14,0,0,0,15,0, + 0,0,67,0,0,0,115,98,1,0,0,100,1,125,3,124, + 1,106,0,100,2,131,1,100,3,25,0,125,4,121,24,116, + 1,124,0,106,2,112,34,116,3,106,4,131,0,131,1,106, + 5,125,5,87,0,110,24,4,0,116,6,107,10,114,66,1, + 0,1,0,1,0,100,10,125,5,89,0,110,2,88,0,124, + 5,124,0,106,7,107,3,114,92,124,0,106,8,131,0,1, + 0,124,5,124,0,95,7,116,9,131,0,114,114,124,0,106, + 10,125,6,124,4,106,11,131,0,125,7,110,10,124,0,106, + 12,125,6,124,4,125,7,124,7,124,6,107,6,114,218,116, + 13,124,0,106,2,124,4,131,2,125,8,120,72,124,0,106, + 14,68,0,93,54,92,2,125,9,125,10,100,5,124,9,23, + 0,125,11,116,13,124,8,124,11,131,2,125,12,116,15,124, + 12,131,1,114,152,124,0,106,16,124,10,124,1,124,12,124, + 8,103,1,124,2,131,5,83,0,113,152,87,0,116,17,124, + 8,131,1,125,3,120,88,124,0,106,14,68,0,93,78,92, + 2,125,9,125,10,116,13,124,0,106,2,124,4,124,9,23, + 0,131,2,125,12,116,18,106,19,100,6,124,12,100,3,100, + 7,141,3,1,0,124,7,124,9,23,0,124,6,107,6,114, + 226,116,15,124,12,131,1,114,226,124,0,106,16,124,10,124, + 1,124,12,100,8,124,2,131,5,83,0,113,226,87,0,124, + 3,144,1,114,94,116,18,106,19,100,9,124,8,131,2,1, + 0,116,18,106,20,124,1,100,8,131,2,125,13,124,8,103, + 1,124,13,95,21,124,13,83,0,100,8,83,0,41,11,122, + 111,84,114,121,32,116,111,32,102,105,110,100,32,97,32,115, + 112,101,99,32,102,111,114,32,116,104,101,32,115,112,101,99, + 105,102,105,101,100,32,109,111,100,117,108,101,46,10,10,32, + 32,32,32,32,32,32,32,82,101,116,117,114,110,115,32,116, + 104,101,32,109,97,116,99,104,105,110,103,32,115,112,101,99, + 44,32,111,114,32,78,111,110,101,32,105,102,32,110,111,116, + 32,102,111,117,110,100,46,10,32,32,32,32,32,32,32,32, + 70,114,61,0,0,0,114,59,0,0,0,114,31,0,0,0, + 114,182,0,0,0,122,9,116,114,121,105,110,103,32,123,125, + 41,1,90,9,118,101,114,98,111,115,105,116,121,78,122,25, + 112,111,115,115,105,98,108,101,32,110,97,109,101,115,112,97, + 99,101,32,102,111,114,32,123,125,114,91,0,0,0,41,22, + 114,34,0,0,0,114,41,0,0,0,114,37,0,0,0,114, + 3,0,0,0,114,47,0,0,0,114,216,0,0,0,114,42, + 0,0,0,114,7,1,0,0,218,11,95,102,105,108,108,95, + 99,97,99,104,101,114,7,0,0,0,114,10,1,0,0,114, + 92,0,0,0,114,9,1,0,0,114,30,0,0,0,114,6, + 1,0,0,114,46,0,0,0,114,4,1,0,0,114,48,0, + 0,0,114,118,0,0,0,114,133,0,0,0,114,158,0,0, + 0,114,154,0,0,0,41,14,114,104,0,0,0,114,123,0, + 0,0,114,177,0,0,0,90,12,105,115,95,110,97,109,101, + 115,112,97,99,101,90,11,116,97,105,108,95,109,111,100,117, + 108,101,114,130,0,0,0,90,5,99,97,99,104,101,90,12, + 99,97,99,104,101,95,109,111,100,117,108,101,90,9,98,97, + 115,101,95,112,97,116,104,114,222,0,0,0,114,163,0,0, + 0,90,13,105,110,105,116,95,102,105,108,101,110,97,109,101, + 90,9,102,117,108,108,95,112,97,116,104,114,162,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, + 178,0,0,0,209,4,0,0,115,70,0,0,0,0,5,4, + 1,14,1,2,1,24,1,14,1,10,1,10,1,8,1,6, + 2,6,1,6,1,10,2,6,1,4,2,8,1,12,1,16, + 1,8,1,10,1,8,1,24,4,8,2,16,1,16,1,16, + 1,12,1,8,1,10,1,12,1,6,1,12,1,12,1,8, + 1,4,1,122,20,70,105,108,101,70,105,110,100,101,114,46, + 102,105,110,100,95,115,112,101,99,99,1,0,0,0,0,0, + 0,0,9,0,0,0,13,0,0,0,67,0,0,0,115,194, + 0,0,0,124,0,106,0,125,1,121,22,116,1,106,2,124, + 1,112,22,116,1,106,3,131,0,131,1,125,2,87,0,110, + 30,4,0,116,4,116,5,116,6,102,3,107,10,114,58,1, + 0,1,0,1,0,103,0,125,2,89,0,110,2,88,0,116, + 7,106,8,106,9,100,1,131,1,115,84,116,10,124,2,131, + 1,124,0,95,11,110,78,116,10,131,0,125,3,120,64,124, + 2,68,0,93,56,125,4,124,4,106,12,100,2,131,1,92, + 3,125,5,125,6,125,7,124,6,114,138,100,3,106,13,124, + 5,124,7,106,14,131,0,131,2,125,8,110,4,124,5,125, + 8,124,3,106,15,124,8,131,1,1,0,113,96,87,0,124, + 3,124,0,95,11,116,7,106,8,106,9,116,16,131,1,114, + 190,100,4,100,5,132,0,124,2,68,0,131,1,124,0,95, + 17,100,6,83,0,41,7,122,68,70,105,108,108,32,116,104, + 101,32,99,97,99,104,101,32,111,102,32,112,111,116,101,110, + 116,105,97,108,32,109,111,100,117,108,101,115,32,97,110,100, + 32,112,97,99,107,97,103,101,115,32,102,111,114,32,116,104, + 105,115,32,100,105,114,101,99,116,111,114,121,46,114,0,0, + 0,0,114,61,0,0,0,122,5,123,125,46,123,125,99,1, + 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,83, + 0,0,0,115,20,0,0,0,104,0,124,0,93,12,125,1, + 124,1,106,0,131,0,146,2,113,4,83,0,114,4,0,0, + 0,41,1,114,92,0,0,0,41,2,114,24,0,0,0,90, + 2,102,110,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,250,9,60,115,101,116,99,111,109,112,62,30,5,0, + 0,115,2,0,0,0,6,0,122,41,70,105,108,101,70,105, + 110,100,101,114,46,95,102,105,108,108,95,99,97,99,104,101, + 46,60,108,111,99,97,108,115,62,46,60,115,101,116,99,111, + 109,112,62,78,41,18,114,37,0,0,0,114,3,0,0,0, + 90,7,108,105,115,116,100,105,114,114,47,0,0,0,114,255, + 0,0,0,218,15,80,101,114,109,105,115,115,105,111,110,69, + 114,114,111,114,218,18,78,111,116,65,68,105,114,101,99,116, + 111,114,121,69,114,114,111,114,114,8,0,0,0,114,9,0, + 0,0,114,10,0,0,0,114,8,1,0,0,114,9,1,0, + 0,114,87,0,0,0,114,50,0,0,0,114,92,0,0,0, + 218,3,97,100,100,114,11,0,0,0,114,10,1,0,0,41, + 9,114,104,0,0,0,114,37,0,0,0,90,8,99,111,110, + 116,101,110,116,115,90,21,108,111,119,101,114,95,115,117,102, + 102,105,120,95,99,111,110,116,101,110,116,115,114,244,0,0, + 0,114,102,0,0,0,114,234,0,0,0,114,222,0,0,0, + 90,8,110,101,119,95,110,97,109,101,114,4,0,0,0,114, + 4,0,0,0,114,6,0,0,0,114,12,1,0,0,1,5, + 0,0,115,34,0,0,0,0,2,6,1,2,1,22,1,20, + 3,10,3,12,1,12,7,6,1,10,1,16,1,4,1,18, + 2,4,1,14,1,6,1,12,1,122,22,70,105,108,101,70, 105,110,100,101,114,46,95,102,105,108,108,95,99,97,99,104, - 101,46,60,108,111,99,97,108,115,62,46,60,115,101,116,99, - 111,109,112,62,78,41,18,114,37,0,0,0,114,3,0,0, - 0,90,7,108,105,115,116,100,105,114,114,47,0,0,0,114, - 255,0,0,0,218,15,80,101,114,109,105,115,115,105,111,110, - 69,114,114,111,114,218,18,78,111,116,65,68,105,114,101,99, - 116,111,114,121,69,114,114,111,114,114,8,0,0,0,114,9, - 0,0,0,114,10,0,0,0,114,8,1,0,0,114,9,1, - 0,0,114,87,0,0,0,114,50,0,0,0,114,92,0,0, - 0,218,3,97,100,100,114,11,0,0,0,114,10,1,0,0, - 41,9,114,104,0,0,0,114,37,0,0,0,90,8,99,111, - 110,116,101,110,116,115,90,21,108,111,119,101,114,95,115,117, - 102,102,105,120,95,99,111,110,116,101,110,116,115,114,244,0, - 0,0,114,102,0,0,0,114,234,0,0,0,114,222,0,0, - 0,90,8,110,101,119,95,110,97,109,101,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,12,1,0,0,0, - 5,0,0,115,34,0,0,0,0,2,6,1,2,1,22,1, - 20,3,10,3,12,1,12,7,6,1,10,1,16,1,4,1, - 18,2,4,1,14,1,6,1,12,1,122,22,70,105,108,101, - 70,105,110,100,101,114,46,95,102,105,108,108,95,99,97,99, - 104,101,99,1,0,0,0,0,0,0,0,3,0,0,0,3, - 0,0,0,7,0,0,0,115,18,0,0,0,135,0,135,1, - 102,2,100,1,100,2,132,8,125,2,124,2,83,0,41,3, - 97,20,1,0,0,65,32,99,108,97,115,115,32,109,101,116, - 104,111,100,32,119,104,105,99,104,32,114,101,116,117,114,110, - 115,32,97,32,99,108,111,115,117,114,101,32,116,111,32,117, - 115,101,32,111,110,32,115,121,115,46,112,97,116,104,95,104, - 111,111,107,10,32,32,32,32,32,32,32,32,119,104,105,99, - 104,32,119,105,108,108,32,114,101,116,117,114,110,32,97,110, - 32,105,110,115,116,97,110,99,101,32,117,115,105,110,103,32, - 116,104,101,32,115,112,101,99,105,102,105,101,100,32,108,111, - 97,100,101,114,115,32,97,110,100,32,116,104,101,32,112,97, - 116,104,10,32,32,32,32,32,32,32,32,99,97,108,108,101, - 100,32,111,110,32,116,104,101,32,99,108,111,115,117,114,101, - 46,10,10,32,32,32,32,32,32,32,32,73,102,32,116,104, - 101,32,112,97,116,104,32,99,97,108,108,101,100,32,111,110, - 32,116,104,101,32,99,108,111,115,117,114,101,32,105,115,32, - 110,111,116,32,97,32,100,105,114,101,99,116,111,114,121,44, - 32,73,109,112,111,114,116,69,114,114,111,114,32,105,115,10, - 32,32,32,32,32,32,32,32,114,97,105,115,101,100,46,10, - 10,32,32,32,32,32,32,32,32,99,1,0,0,0,0,0, - 0,0,1,0,0,0,4,0,0,0,19,0,0,0,115,34, - 0,0,0,116,0,124,0,131,1,115,20,116,1,100,1,124, - 0,100,2,141,2,130,1,136,0,124,0,102,1,136,1,158, - 2,142,0,83,0,41,3,122,45,80,97,116,104,32,104,111, - 111,107,32,102,111,114,32,105,109,112,111,114,116,108,105,98, - 46,109,97,99,104,105,110,101,114,121,46,70,105,108,101,70, - 105,110,100,101,114,46,122,30,111,110,108,121,32,100,105,114, - 101,99,116,111,114,105,101,115,32,97,114,101,32,115,117,112, - 112,111,114,116,101,100,41,1,114,37,0,0,0,41,2,114, - 48,0,0,0,114,103,0,0,0,41,1,114,37,0,0,0, - 41,2,114,168,0,0,0,114,11,1,0,0,114,4,0,0, - 0,114,6,0,0,0,218,24,112,97,116,104,95,104,111,111, - 107,95,102,111,114,95,70,105,108,101,70,105,110,100,101,114, - 41,5,0,0,115,6,0,0,0,0,2,8,1,12,1,122, - 54,70,105,108,101,70,105,110,100,101,114,46,112,97,116,104, - 95,104,111,111,107,46,60,108,111,99,97,108,115,62,46,112, - 97,116,104,95,104,111,111,107,95,102,111,114,95,70,105,108, - 101,70,105,110,100,101,114,114,4,0,0,0,41,3,114,168, - 0,0,0,114,11,1,0,0,114,17,1,0,0,114,4,0, - 0,0,41,2,114,168,0,0,0,114,11,1,0,0,114,6, - 0,0,0,218,9,112,97,116,104,95,104,111,111,107,31,5, - 0,0,115,4,0,0,0,0,10,14,6,122,20,70,105,108, - 101,70,105,110,100,101,114,46,112,97,116,104,95,104,111,111, - 107,99,1,0,0,0,0,0,0,0,1,0,0,0,2,0, - 0,0,67,0,0,0,115,12,0,0,0,100,1,106,0,124, - 0,106,1,131,1,83,0,41,2,78,122,16,70,105,108,101, - 70,105,110,100,101,114,40,123,33,114,125,41,41,2,114,50, - 0,0,0,114,37,0,0,0,41,1,114,104,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,243, - 0,0,0,49,5,0,0,115,2,0,0,0,0,1,122,19, - 70,105,108,101,70,105,110,100,101,114,46,95,95,114,101,112, - 114,95,95,41,1,78,41,15,114,109,0,0,0,114,108,0, - 0,0,114,110,0,0,0,114,111,0,0,0,114,182,0,0, - 0,114,249,0,0,0,114,127,0,0,0,114,179,0,0,0, - 114,121,0,0,0,114,4,1,0,0,114,178,0,0,0,114, - 12,1,0,0,114,180,0,0,0,114,18,1,0,0,114,243, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,6,0,0,0,114,5,1,0,0,162,4,0,0, - 115,20,0,0,0,8,7,4,2,8,14,8,4,4,2,8, - 12,8,5,10,48,8,31,12,18,114,5,1,0,0,99,4, - 0,0,0,0,0,0,0,6,0,0,0,11,0,0,0,67, - 0,0,0,115,146,0,0,0,124,0,106,0,100,1,131,1, - 125,4,124,0,106,0,100,2,131,1,125,5,124,4,115,66, - 124,5,114,36,124,5,106,1,125,4,110,30,124,2,124,3, - 107,2,114,56,116,2,124,1,124,2,131,2,125,4,110,10, - 116,3,124,1,124,2,131,2,125,4,124,5,115,84,116,4, - 124,1,124,2,124,4,100,3,141,3,125,5,121,36,124,5, - 124,0,100,2,60,0,124,4,124,0,100,1,60,0,124,2, - 124,0,100,4,60,0,124,3,124,0,100,5,60,0,87,0, - 110,20,4,0,116,5,107,10,114,140,1,0,1,0,1,0, - 89,0,110,2,88,0,100,0,83,0,41,6,78,218,10,95, - 95,108,111,97,100,101,114,95,95,218,8,95,95,115,112,101, - 99,95,95,41,1,114,124,0,0,0,90,8,95,95,102,105, - 108,101,95,95,90,10,95,95,99,97,99,104,101,100,95,95, - 41,6,218,3,103,101,116,114,124,0,0,0,114,220,0,0, - 0,114,215,0,0,0,114,165,0,0,0,218,9,69,120,99, - 101,112,116,105,111,110,41,6,90,2,110,115,114,102,0,0, - 0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,97, - 116,104,110,97,109,101,114,124,0,0,0,114,162,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,55, - 5,0,0,115,34,0,0,0,0,2,10,1,10,1,4,1, - 4,1,8,1,8,1,12,2,10,1,4,1,14,1,2,1, - 8,1,8,1,8,1,12,1,14,2,114,23,1,0,0,99, - 0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, - 67,0,0,0,115,38,0,0,0,116,0,116,1,106,2,131, - 0,102,2,125,0,116,3,116,4,102,2,125,1,116,5,116, - 6,102,2,125,2,124,0,124,1,124,2,103,3,83,0,41, - 1,122,95,82,101,116,117,114,110,115,32,97,32,108,105,115, - 116,32,111,102,32,102,105,108,101,45,98,97,115,101,100,32, - 109,111,100,117,108,101,32,108,111,97,100,101,114,115,46,10, - 10,32,32,32,32,69,97,99,104,32,105,116,101,109,32,105, - 115,32,97,32,116,117,112,108,101,32,40,108,111,97,100,101, - 114,44,32,115,117,102,102,105,120,101,115,41,46,10,32,32, - 32,32,41,7,114,221,0,0,0,114,143,0,0,0,218,18, - 101,120,116,101,110,115,105,111,110,95,115,117,102,102,105,120, - 101,115,114,215,0,0,0,114,88,0,0,0,114,220,0,0, - 0,114,78,0,0,0,41,3,90,10,101,120,116,101,110,115, - 105,111,110,115,90,6,115,111,117,114,99,101,90,8,98,121, - 116,101,99,111,100,101,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,159,0,0,0,78,5,0,0,115,8, - 0,0,0,0,5,12,1,8,1,8,1,114,159,0,0,0, - 99,1,0,0,0,0,0,0,0,12,0,0,0,12,0,0, - 0,67,0,0,0,115,188,1,0,0,124,0,97,0,116,0, - 106,1,97,1,116,0,106,2,97,2,116,1,106,3,116,4, - 25,0,125,1,120,56,100,26,68,0,93,48,125,2,124,2, - 116,1,106,3,107,7,114,58,116,0,106,5,124,2,131,1, - 125,3,110,10,116,1,106,3,124,2,25,0,125,3,116,6, - 124,1,124,2,124,3,131,3,1,0,113,32,87,0,100,5, - 100,6,103,1,102,2,100,7,100,8,100,6,103,2,102,2, - 102,2,125,4,120,118,124,4,68,0,93,102,92,2,125,5, - 125,6,116,7,100,9,100,10,132,0,124,6,68,0,131,1, - 131,1,115,142,116,8,130,1,124,6,100,11,25,0,125,7, - 124,5,116,1,106,3,107,6,114,174,116,1,106,3,124,5, - 25,0,125,8,80,0,113,112,121,16,116,0,106,5,124,5, - 131,1,125,8,80,0,87,0,113,112,4,0,116,9,107,10, - 114,212,1,0,1,0,1,0,119,112,89,0,113,112,88,0, - 113,112,87,0,116,9,100,12,131,1,130,1,116,6,124,1, - 100,13,124,8,131,3,1,0,116,6,124,1,100,14,124,7, - 131,3,1,0,116,6,124,1,100,15,100,16,106,10,124,6, - 131,1,131,3,1,0,121,14,116,0,106,5,100,17,131,1, - 125,9,87,0,110,26,4,0,116,9,107,10,144,1,114,52, - 1,0,1,0,1,0,100,18,125,9,89,0,110,2,88,0, - 116,6,124,1,100,17,124,9,131,3,1,0,116,0,106,5, - 100,19,131,1,125,10,116,6,124,1,100,19,124,10,131,3, - 1,0,124,5,100,7,107,2,144,1,114,120,116,0,106,5, - 100,20,131,1,125,11,116,6,124,1,100,21,124,11,131,3, - 1,0,116,6,124,1,100,22,116,11,131,0,131,3,1,0, - 116,12,106,13,116,2,106,14,131,0,131,1,1,0,124,5, - 100,7,107,2,144,1,114,184,116,15,106,16,100,23,131,1, - 1,0,100,24,116,12,107,6,144,1,114,184,100,25,116,17, - 95,18,100,18,83,0,41,27,122,205,83,101,116,117,112,32, - 116,104,101,32,112,97,116,104,45,98,97,115,101,100,32,105, - 109,112,111,114,116,101,114,115,32,102,111,114,32,105,109,112, - 111,114,116,108,105,98,32,98,121,32,105,109,112,111,114,116, - 105,110,103,32,110,101,101,100,101,100,10,32,32,32,32,98, - 117,105,108,116,45,105,110,32,109,111,100,117,108,101,115,32, - 97,110,100,32,105,110,106,101,99,116,105,110,103,32,116,104, - 101,109,32,105,110,116,111,32,116,104,101,32,103,108,111,98, - 97,108,32,110,97,109,101,115,112,97,99,101,46,10,10,32, - 32,32,32,79,116,104,101,114,32,99,111,109,112,111,110,101, - 110,116,115,32,97,114,101,32,101,120,116,114,97,99,116,101, - 100,32,102,114,111,109,32,116,104,101,32,99,111,114,101,32, - 98,111,111,116,115,116,114,97,112,32,109,111,100,117,108,101, - 46,10,10,32,32,32,32,114,52,0,0,0,114,63,0,0, - 0,218,8,98,117,105,108,116,105,110,115,114,140,0,0,0, - 90,5,112,111,115,105,120,250,1,47,218,2,110,116,250,1, - 92,99,1,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,115,0,0,0,115,26,0,0,0,124,0,93,18,125, - 1,116,0,124,1,131,1,100,0,107,2,86,0,1,0,113, - 2,100,1,83,0,41,2,114,31,0,0,0,78,41,1,114, - 33,0,0,0,41,2,114,24,0,0,0,114,81,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 224,0,0,0,114,5,0,0,115,2,0,0,0,4,0,122, - 25,95,115,101,116,117,112,46,60,108,111,99,97,108,115,62, - 46,60,103,101,110,101,120,112,114,62,114,62,0,0,0,122, - 30,105,109,112,111,114,116,108,105,98,32,114,101,113,117,105, - 114,101,115,32,112,111,115,105,120,32,111,114,32,110,116,114, - 3,0,0,0,114,27,0,0,0,114,23,0,0,0,114,32, - 0,0,0,90,7,95,116,104,114,101,97,100,78,90,8,95, - 119,101,97,107,114,101,102,90,6,119,105,110,114,101,103,114, - 167,0,0,0,114,7,0,0,0,122,4,46,112,121,119,122, - 6,95,100,46,112,121,100,84,41,4,114,52,0,0,0,114, - 63,0,0,0,114,25,1,0,0,114,140,0,0,0,41,19, - 114,118,0,0,0,114,8,0,0,0,114,143,0,0,0,114, - 236,0,0,0,114,109,0,0,0,90,18,95,98,117,105,108, - 116,105,110,95,102,114,111,109,95,110,97,109,101,114,113,0, - 0,0,218,3,97,108,108,218,14,65,115,115,101,114,116,105, - 111,110,69,114,114,111,114,114,103,0,0,0,114,28,0,0, - 0,114,13,0,0,0,114,226,0,0,0,114,147,0,0,0, - 114,24,1,0,0,114,88,0,0,0,114,161,0,0,0,114, - 166,0,0,0,114,170,0,0,0,41,12,218,17,95,98,111, - 111,116,115,116,114,97,112,95,109,111,100,117,108,101,90,11, - 115,101,108,102,95,109,111,100,117,108,101,90,12,98,117,105, - 108,116,105,110,95,110,97,109,101,90,14,98,117,105,108,116, - 105,110,95,109,111,100,117,108,101,90,10,111,115,95,100,101, - 116,97,105,108,115,90,10,98,117,105,108,116,105,110,95,111, - 115,114,23,0,0,0,114,27,0,0,0,90,9,111,115,95, - 109,111,100,117,108,101,90,13,116,104,114,101,97,100,95,109, - 111,100,117,108,101,90,14,119,101,97,107,114,101,102,95,109, - 111,100,117,108,101,90,13,119,105,110,114,101,103,95,109,111, - 100,117,108,101,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,218,6,95,115,101,116,117,112,89,5,0,0,115, - 82,0,0,0,0,8,4,1,6,1,6,3,10,1,10,1, - 10,1,12,2,10,1,16,3,22,1,14,2,22,1,8,1, - 10,1,10,1,4,2,2,1,10,1,6,1,14,1,12,2, - 8,1,12,1,12,1,18,3,2,1,14,1,16,2,10,1, - 12,3,10,1,12,3,10,1,10,1,12,3,14,1,14,1, - 10,1,10,1,10,1,114,32,1,0,0,99,1,0,0,0, - 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, - 115,72,0,0,0,116,0,124,0,131,1,1,0,116,1,131, - 0,125,1,116,2,106,3,106,4,116,5,106,6,124,1,142, - 0,103,1,131,1,1,0,116,7,106,8,100,1,107,2,114, - 56,116,2,106,9,106,10,116,11,131,1,1,0,116,2,106, - 9,106,10,116,12,131,1,1,0,100,2,83,0,41,3,122, - 41,73,110,115,116,97,108,108,32,116,104,101,32,112,97,116, - 104,45,98,97,115,101,100,32,105,109,112,111,114,116,32,99, - 111,109,112,111,110,101,110,116,115,46,114,27,1,0,0,78, - 41,13,114,32,1,0,0,114,159,0,0,0,114,8,0,0, - 0,114,253,0,0,0,114,147,0,0,0,114,5,1,0,0, - 114,18,1,0,0,114,3,0,0,0,114,109,0,0,0,218, - 9,109,101,116,97,95,112,97,116,104,114,161,0,0,0,114, - 166,0,0,0,114,248,0,0,0,41,2,114,31,1,0,0, - 90,17,115,117,112,112,111,114,116,101,100,95,108,111,97,100, - 101,114,115,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,8,95,105,110,115,116,97,108,108,157,5,0,0, - 115,12,0,0,0,0,2,8,1,6,1,20,1,10,1,12, - 1,114,34,1,0,0,41,1,114,0,0,0,0,41,2,114, - 1,0,0,0,114,2,0,0,0,41,1,114,49,0,0,0, - 41,1,78,41,3,78,78,78,41,3,78,78,78,41,2,114, - 62,0,0,0,114,62,0,0,0,41,1,78,41,1,78,41, - 58,114,111,0,0,0,114,12,0,0,0,90,37,95,67,65, - 83,69,95,73,78,83,69,78,83,73,84,73,86,69,95,80, - 76,65,84,70,79,82,77,83,95,66,89,84,69,83,95,75, - 69,89,114,11,0,0,0,114,13,0,0,0,114,19,0,0, - 0,114,21,0,0,0,114,30,0,0,0,114,40,0,0,0, - 114,41,0,0,0,114,45,0,0,0,114,46,0,0,0,114, - 48,0,0,0,114,58,0,0,0,218,4,116,121,112,101,218, - 8,95,95,99,111,100,101,95,95,114,142,0,0,0,114,17, - 0,0,0,114,132,0,0,0,114,16,0,0,0,114,20,0, - 0,0,90,17,95,82,65,87,95,77,65,71,73,67,95,78, - 85,77,66,69,82,114,77,0,0,0,114,76,0,0,0,114, - 88,0,0,0,114,78,0,0,0,90,23,68,69,66,85,71, - 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, - 69,83,90,27,79,80,84,73,77,73,90,69,68,95,66,89, - 84,69,67,79,68,69,95,83,85,70,70,73,88,69,83,114, - 83,0,0,0,114,89,0,0,0,114,95,0,0,0,114,99, - 0,0,0,114,101,0,0,0,114,120,0,0,0,114,127,0, - 0,0,114,139,0,0,0,114,145,0,0,0,114,148,0,0, - 0,114,153,0,0,0,218,6,111,98,106,101,99,116,114,160, - 0,0,0,114,165,0,0,0,114,166,0,0,0,114,181,0, - 0,0,114,191,0,0,0,114,207,0,0,0,114,215,0,0, - 0,114,220,0,0,0,114,226,0,0,0,114,221,0,0,0, - 114,227,0,0,0,114,246,0,0,0,114,248,0,0,0,114, - 5,1,0,0,114,23,1,0,0,114,159,0,0,0,114,32, - 1,0,0,114,34,1,0,0,114,4,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,6,0,0,0,218,8,60,109, - 111,100,117,108,101,62,8,0,0,0,115,108,0,0,0,4, - 16,4,1,4,1,2,1,6,3,8,17,8,5,8,5,8, - 6,8,12,8,10,8,9,8,5,8,7,10,22,10,122,16, - 1,12,2,4,1,4,2,6,2,6,2,8,2,16,45,8, - 34,8,19,8,12,8,12,8,28,8,17,10,55,10,12,10, - 10,8,14,6,3,4,1,14,67,14,64,14,29,16,110,14, - 41,18,45,18,16,4,3,18,53,14,60,14,42,14,127,0, - 5,14,127,0,22,10,23,8,11,8,68, + 101,99,1,0,0,0,0,0,0,0,3,0,0,0,3,0, + 0,0,7,0,0,0,115,18,0,0,0,135,0,135,1,102, + 2,100,1,100,2,132,8,125,2,124,2,83,0,41,3,97, + 20,1,0,0,65,32,99,108,97,115,115,32,109,101,116,104, + 111,100,32,119,104,105,99,104,32,114,101,116,117,114,110,115, + 32,97,32,99,108,111,115,117,114,101,32,116,111,32,117,115, + 101,32,111,110,32,115,121,115,46,112,97,116,104,95,104,111, + 111,107,10,32,32,32,32,32,32,32,32,119,104,105,99,104, + 32,119,105,108,108,32,114,101,116,117,114,110,32,97,110,32, + 105,110,115,116,97,110,99,101,32,117,115,105,110,103,32,116, + 104,101,32,115,112,101,99,105,102,105,101,100,32,108,111,97, + 100,101,114,115,32,97,110,100,32,116,104,101,32,112,97,116, + 104,10,32,32,32,32,32,32,32,32,99,97,108,108,101,100, + 32,111,110,32,116,104,101,32,99,108,111,115,117,114,101,46, + 10,10,32,32,32,32,32,32,32,32,73,102,32,116,104,101, + 32,112,97,116,104,32,99,97,108,108,101,100,32,111,110,32, + 116,104,101,32,99,108,111,115,117,114,101,32,105,115,32,110, + 111,116,32,97,32,100,105,114,101,99,116,111,114,121,44,32, + 73,109,112,111,114,116,69,114,114,111,114,32,105,115,10,32, + 32,32,32,32,32,32,32,114,97,105,115,101,100,46,10,10, + 32,32,32,32,32,32,32,32,99,1,0,0,0,0,0,0, + 0,1,0,0,0,4,0,0,0,19,0,0,0,115,34,0, + 0,0,116,0,124,0,131,1,115,20,116,1,100,1,124,0, + 100,2,141,2,130,1,136,0,124,0,102,1,136,1,158,2, + 142,0,83,0,41,3,122,45,80,97,116,104,32,104,111,111, + 107,32,102,111,114,32,105,109,112,111,114,116,108,105,98,46, + 109,97,99,104,105,110,101,114,121,46,70,105,108,101,70,105, + 110,100,101,114,46,122,30,111,110,108,121,32,100,105,114,101, + 99,116,111,114,105,101,115,32,97,114,101,32,115,117,112,112, + 111,114,116,101,100,41,1,114,37,0,0,0,41,2,114,48, + 0,0,0,114,103,0,0,0,41,1,114,37,0,0,0,41, + 2,114,168,0,0,0,114,11,1,0,0,114,4,0,0,0, + 114,6,0,0,0,218,24,112,97,116,104,95,104,111,111,107, + 95,102,111,114,95,70,105,108,101,70,105,110,100,101,114,42, + 5,0,0,115,6,0,0,0,0,2,8,1,12,1,122,54, + 70,105,108,101,70,105,110,100,101,114,46,112,97,116,104,95, + 104,111,111,107,46,60,108,111,99,97,108,115,62,46,112,97, + 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, + 70,105,110,100,101,114,114,4,0,0,0,41,3,114,168,0, + 0,0,114,11,1,0,0,114,17,1,0,0,114,4,0,0, + 0,41,2,114,168,0,0,0,114,11,1,0,0,114,6,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,32,5,0, + 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, + 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, + 99,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0, + 0,67,0,0,0,115,12,0,0,0,100,1,106,0,124,0, + 106,1,131,1,83,0,41,2,78,122,16,70,105,108,101,70, + 105,110,100,101,114,40,123,33,114,125,41,41,2,114,50,0, + 0,0,114,37,0,0,0,41,1,114,104,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,114,243,0, + 0,0,50,5,0,0,115,2,0,0,0,0,1,122,19,70, + 105,108,101,70,105,110,100,101,114,46,95,95,114,101,112,114, + 95,95,41,1,78,41,15,114,109,0,0,0,114,108,0,0, + 0,114,110,0,0,0,114,111,0,0,0,114,182,0,0,0, + 114,249,0,0,0,114,127,0,0,0,114,179,0,0,0,114, + 121,0,0,0,114,4,1,0,0,114,178,0,0,0,114,12, + 1,0,0,114,180,0,0,0,114,18,1,0,0,114,243,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,6,0,0,0,114,5,1,0,0,163,4,0,0,115, + 20,0,0,0,8,7,4,2,8,14,8,4,4,2,8,12, + 8,5,10,48,8,31,12,18,114,5,1,0,0,99,4,0, + 0,0,0,0,0,0,6,0,0,0,11,0,0,0,67,0, + 0,0,115,146,0,0,0,124,0,106,0,100,1,131,1,125, + 4,124,0,106,0,100,2,131,1,125,5,124,4,115,66,124, + 5,114,36,124,5,106,1,125,4,110,30,124,2,124,3,107, + 2,114,56,116,2,124,1,124,2,131,2,125,4,110,10,116, + 3,124,1,124,2,131,2,125,4,124,5,115,84,116,4,124, + 1,124,2,124,4,100,3,141,3,125,5,121,36,124,5,124, + 0,100,2,60,0,124,4,124,0,100,1,60,0,124,2,124, + 0,100,4,60,0,124,3,124,0,100,5,60,0,87,0,110, + 20,4,0,116,5,107,10,114,140,1,0,1,0,1,0,89, + 0,110,2,88,0,100,0,83,0,41,6,78,218,10,95,95, + 108,111,97,100,101,114,95,95,218,8,95,95,115,112,101,99, + 95,95,41,1,114,124,0,0,0,90,8,95,95,102,105,108, + 101,95,95,90,10,95,95,99,97,99,104,101,100,95,95,41, + 6,218,3,103,101,116,114,124,0,0,0,114,220,0,0,0, + 114,215,0,0,0,114,165,0,0,0,218,9,69,120,99,101, + 112,116,105,111,110,41,6,90,2,110,115,114,102,0,0,0, + 90,8,112,97,116,104,110,97,109,101,90,9,99,112,97,116, + 104,110,97,109,101,114,124,0,0,0,114,162,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,14, + 95,102,105,120,95,117,112,95,109,111,100,117,108,101,56,5, + 0,0,115,34,0,0,0,0,2,10,1,10,1,4,1,4, + 1,8,1,8,1,12,2,10,1,4,1,14,1,2,1,8, + 1,8,1,8,1,12,1,14,2,114,23,1,0,0,99,0, + 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, + 0,0,0,115,38,0,0,0,116,0,116,1,106,2,131,0, + 102,2,125,0,116,3,116,4,102,2,125,1,116,5,116,6, + 102,2,125,2,124,0,124,1,124,2,103,3,83,0,41,1, + 122,95,82,101,116,117,114,110,115,32,97,32,108,105,115,116, + 32,111,102,32,102,105,108,101,45,98,97,115,101,100,32,109, + 111,100,117,108,101,32,108,111,97,100,101,114,115,46,10,10, + 32,32,32,32,69,97,99,104,32,105,116,101,109,32,105,115, + 32,97,32,116,117,112,108,101,32,40,108,111,97,100,101,114, + 44,32,115,117,102,102,105,120,101,115,41,46,10,32,32,32, + 32,41,7,114,221,0,0,0,114,143,0,0,0,218,18,101, + 120,116,101,110,115,105,111,110,95,115,117,102,102,105,120,101, + 115,114,215,0,0,0,114,88,0,0,0,114,220,0,0,0, + 114,78,0,0,0,41,3,90,10,101,120,116,101,110,115,105, + 111,110,115,90,6,115,111,117,114,99,101,90,8,98,121,116, + 101,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114, + 6,0,0,0,114,159,0,0,0,79,5,0,0,115,8,0, + 0,0,0,5,12,1,8,1,8,1,114,159,0,0,0,99, + 1,0,0,0,0,0,0,0,12,0,0,0,12,0,0,0, + 67,0,0,0,115,188,1,0,0,124,0,97,0,116,0,106, + 1,97,1,116,0,106,2,97,2,116,1,106,3,116,4,25, + 0,125,1,120,56,100,26,68,0,93,48,125,2,124,2,116, + 1,106,3,107,7,114,58,116,0,106,5,124,2,131,1,125, + 3,110,10,116,1,106,3,124,2,25,0,125,3,116,6,124, + 1,124,2,124,3,131,3,1,0,113,32,87,0,100,5,100, + 6,103,1,102,2,100,7,100,8,100,6,103,2,102,2,102, + 2,125,4,120,118,124,4,68,0,93,102,92,2,125,5,125, + 6,116,7,100,9,100,10,132,0,124,6,68,0,131,1,131, + 1,115,142,116,8,130,1,124,6,100,11,25,0,125,7,124, + 5,116,1,106,3,107,6,114,174,116,1,106,3,124,5,25, + 0,125,8,80,0,113,112,121,16,116,0,106,5,124,5,131, + 1,125,8,80,0,87,0,113,112,4,0,116,9,107,10,114, + 212,1,0,1,0,1,0,119,112,89,0,113,112,88,0,113, + 112,87,0,116,9,100,12,131,1,130,1,116,6,124,1,100, + 13,124,8,131,3,1,0,116,6,124,1,100,14,124,7,131, + 3,1,0,116,6,124,1,100,15,100,16,106,10,124,6,131, + 1,131,3,1,0,121,14,116,0,106,5,100,17,131,1,125, + 9,87,0,110,26,4,0,116,9,107,10,144,1,114,52,1, + 0,1,0,1,0,100,18,125,9,89,0,110,2,88,0,116, + 6,124,1,100,17,124,9,131,3,1,0,116,0,106,5,100, + 19,131,1,125,10,116,6,124,1,100,19,124,10,131,3,1, + 0,124,5,100,7,107,2,144,1,114,120,116,0,106,5,100, + 20,131,1,125,11,116,6,124,1,100,21,124,11,131,3,1, + 0,116,6,124,1,100,22,116,11,131,0,131,3,1,0,116, + 12,106,13,116,2,106,14,131,0,131,1,1,0,124,5,100, + 7,107,2,144,1,114,184,116,15,106,16,100,23,131,1,1, + 0,100,24,116,12,107,6,144,1,114,184,100,25,116,17,95, + 18,100,18,83,0,41,27,122,205,83,101,116,117,112,32,116, + 104,101,32,112,97,116,104,45,98,97,115,101,100,32,105,109, + 112,111,114,116,101,114,115,32,102,111,114,32,105,109,112,111, + 114,116,108,105,98,32,98,121,32,105,109,112,111,114,116,105, + 110,103,32,110,101,101,100,101,100,10,32,32,32,32,98,117, + 105,108,116,45,105,110,32,109,111,100,117,108,101,115,32,97, + 110,100,32,105,110,106,101,99,116,105,110,103,32,116,104,101, + 109,32,105,110,116,111,32,116,104,101,32,103,108,111,98,97, + 108,32,110,97,109,101,115,112,97,99,101,46,10,10,32,32, + 32,32,79,116,104,101,114,32,99,111,109,112,111,110,101,110, + 116,115,32,97,114,101,32,101,120,116,114,97,99,116,101,100, + 32,102,114,111,109,32,116,104,101,32,99,111,114,101,32,98, + 111,111,116,115,116,114,97,112,32,109,111,100,117,108,101,46, + 10,10,32,32,32,32,114,52,0,0,0,114,63,0,0,0, + 218,8,98,117,105,108,116,105,110,115,114,140,0,0,0,90, + 5,112,111,115,105,120,250,1,47,218,2,110,116,250,1,92, + 99,1,0,0,0,0,0,0,0,2,0,0,0,3,0,0, + 0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1, + 116,0,124,1,131,1,100,0,107,2,86,0,1,0,113,2, + 100,1,83,0,41,2,114,31,0,0,0,78,41,1,114,33, + 0,0,0,41,2,114,24,0,0,0,114,81,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,224, + 0,0,0,115,5,0,0,115,2,0,0,0,4,0,122,25, + 95,115,101,116,117,112,46,60,108,111,99,97,108,115,62,46, + 60,103,101,110,101,120,112,114,62,114,62,0,0,0,122,30, + 105,109,112,111,114,116,108,105,98,32,114,101,113,117,105,114, + 101,115,32,112,111,115,105,120,32,111,114,32,110,116,114,3, + 0,0,0,114,27,0,0,0,114,23,0,0,0,114,32,0, + 0,0,90,7,95,116,104,114,101,97,100,78,90,8,95,119, + 101,97,107,114,101,102,90,6,119,105,110,114,101,103,114,167, + 0,0,0,114,7,0,0,0,122,4,46,112,121,119,122,6, + 95,100,46,112,121,100,84,41,4,114,52,0,0,0,114,63, + 0,0,0,114,25,1,0,0,114,140,0,0,0,41,19,114, + 118,0,0,0,114,8,0,0,0,114,143,0,0,0,114,236, + 0,0,0,114,109,0,0,0,90,18,95,98,117,105,108,116, + 105,110,95,102,114,111,109,95,110,97,109,101,114,113,0,0, + 0,218,3,97,108,108,218,14,65,115,115,101,114,116,105,111, + 110,69,114,114,111,114,114,103,0,0,0,114,28,0,0,0, + 114,13,0,0,0,114,226,0,0,0,114,147,0,0,0,114, + 24,1,0,0,114,88,0,0,0,114,161,0,0,0,114,166, + 0,0,0,114,170,0,0,0,41,12,218,17,95,98,111,111, + 116,115,116,114,97,112,95,109,111,100,117,108,101,90,11,115, + 101,108,102,95,109,111,100,117,108,101,90,12,98,117,105,108, + 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, + 110,95,109,111,100,117,108,101,90,10,111,115,95,100,101,116, + 97,105,108,115,90,10,98,117,105,108,116,105,110,95,111,115, + 114,23,0,0,0,114,27,0,0,0,90,9,111,115,95,109, + 111,100,117,108,101,90,13,116,104,114,101,97,100,95,109,111, + 100,117,108,101,90,14,119,101,97,107,114,101,102,95,109,111, + 100,117,108,101,90,13,119,105,110,114,101,103,95,109,111,100, + 117,108,101,114,4,0,0,0,114,4,0,0,0,114,6,0, + 0,0,218,6,95,115,101,116,117,112,90,5,0,0,115,82, + 0,0,0,0,8,4,1,6,1,6,3,10,1,10,1,10, + 1,12,2,10,1,16,3,22,1,14,2,22,1,8,1,10, + 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, + 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, + 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, + 1,10,1,10,1,114,32,1,0,0,99,1,0,0,0,0, + 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, + 72,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, + 125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0, + 103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56, + 116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9, + 106,10,116,12,131,1,1,0,100,2,83,0,41,3,122,41, + 73,110,115,116,97,108,108,32,116,104,101,32,112,97,116,104, + 45,98,97,115,101,100,32,105,109,112,111,114,116,32,99,111, + 109,112,111,110,101,110,116,115,46,114,27,1,0,0,78,41, + 13,114,32,1,0,0,114,159,0,0,0,114,8,0,0,0, + 114,253,0,0,0,114,147,0,0,0,114,5,1,0,0,114, + 18,1,0,0,114,3,0,0,0,114,109,0,0,0,218,9, + 109,101,116,97,95,112,97,116,104,114,161,0,0,0,114,166, + 0,0,0,114,248,0,0,0,41,2,114,31,1,0,0,90, + 17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101, + 114,115,114,4,0,0,0,114,4,0,0,0,114,6,0,0, + 0,218,8,95,105,110,115,116,97,108,108,158,5,0,0,115, + 12,0,0,0,0,2,8,1,6,1,20,1,10,1,12,1, + 114,34,1,0,0,41,1,114,0,0,0,0,41,2,114,1, + 0,0,0,114,2,0,0,0,41,1,114,49,0,0,0,41, + 1,78,41,3,78,78,78,41,3,78,78,78,41,2,114,62, + 0,0,0,114,62,0,0,0,41,1,78,41,1,78,41,58, + 114,111,0,0,0,114,12,0,0,0,90,37,95,67,65,83, + 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, + 65,84,70,79,82,77,83,95,66,89,84,69,83,95,75,69, + 89,114,11,0,0,0,114,13,0,0,0,114,19,0,0,0, + 114,21,0,0,0,114,30,0,0,0,114,40,0,0,0,114, + 41,0,0,0,114,45,0,0,0,114,46,0,0,0,114,48, + 0,0,0,114,58,0,0,0,218,4,116,121,112,101,218,8, + 95,95,99,111,100,101,95,95,114,142,0,0,0,114,17,0, + 0,0,114,132,0,0,0,114,16,0,0,0,114,20,0,0, + 0,90,17,95,82,65,87,95,77,65,71,73,67,95,78,85, + 77,66,69,82,114,77,0,0,0,114,76,0,0,0,114,88, + 0,0,0,114,78,0,0,0,90,23,68,69,66,85,71,95, + 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, + 83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84, + 69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,83, + 0,0,0,114,89,0,0,0,114,95,0,0,0,114,99,0, + 0,0,114,101,0,0,0,114,120,0,0,0,114,127,0,0, + 0,114,139,0,0,0,114,145,0,0,0,114,148,0,0,0, + 114,153,0,0,0,218,6,111,98,106,101,99,116,114,160,0, + 0,0,114,165,0,0,0,114,166,0,0,0,114,181,0,0, + 0,114,191,0,0,0,114,207,0,0,0,114,215,0,0,0, + 114,220,0,0,0,114,226,0,0,0,114,221,0,0,0,114, + 227,0,0,0,114,246,0,0,0,114,248,0,0,0,114,5, + 1,0,0,114,23,1,0,0,114,159,0,0,0,114,32,1, + 0,0,114,34,1,0,0,114,4,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,6,0,0,0,218,8,60,109,111, + 100,117,108,101,62,8,0,0,0,115,108,0,0,0,4,16, + 4,1,4,1,2,1,6,3,8,17,8,5,8,5,8,6, + 8,12,8,10,8,9,8,5,8,7,10,22,10,123,16,1, + 12,2,4,1,4,2,6,2,6,2,8,2,16,45,8,34, + 8,19,8,12,8,12,8,28,8,17,10,55,10,12,10,10, + 8,14,6,3,4,1,14,67,14,64,14,29,16,110,14,41, + 18,45,18,16,4,3,18,53,14,60,14,42,14,127,0,5, + 14,127,0,22,10,23,8,11,8,68, }; -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Dec 5 04:04:20 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 05 Dec 2016 09:04:20 +0000 Subject: [Python-checkins] Daily reference leaks (d35fc6e58a70): sum=71 Message-ID: <20161205090420.14352.81829.C4F422F4@psf.io> results for d35fc6e58a70 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, 0, 44] references, sum=44 test_multiprocessing_fork leaked [0, 0, 21] memory blocks, sum=21 test_multiprocessing_fork leaked [0, 0, 2] file descriptors, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflognwPKl4', '--timeout', '7200'] From lp_benchmark_robot at intel.com Mon Dec 5 10:29:20 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 5 Dec 2016 15:29:20 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-12-05 Message-ID: Results for project Python default, build date 2016-12-05 03:02:30 +0000 commit: d35fc6e58a70 previous commit: 9ded2433dc2c revision date: 2016-12-04 21:59: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.22% -1.36% 3.87% 15.61% :-) pybench 0.14% 0.84% 6.40% 3.26% :-( regex_v8 3.83% 1.00% -2.08% 3.32% :-| nbody 0.21% 0.41% 1.86% 4.93% :-| json_dump_v2 0.30% 0.91% -1.88% 8.14% :-| normal_startup 0.28% -0.36% 0.62% 7.94% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-12-05/ 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 Dec 5 10:28:32 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 5 Dec 2016 15:28:32 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python 2.7 2016-12-05 Message-ID: Results for project Python 2.7, build date 2016-12-05 07:41:32 +0000 commit: baf972859ec5 previous commit: 59bd48afa1bc revision date: 2016-12-04 13:42:13 +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.49% 5.54% 7.83% :-) pybench 0.14% 0.44% 6.12% 4.45% :-| regex_v8 0.55% 0.32% -1.93% 10.54% :-) nbody 0.55% 1.69% 9.45% 1.59% :-) json_dump_v2 0.29% -1.57% 2.02% 9.31% :-| normal_startup 0.77% 0.41% 0.17% 2.46% :-) ssbench 0.21% 0.24% 2.30% 2.36% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-2-7-2016-12-05/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Mon Dec 5 11:13:08 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 05 Dec 2016 16:13:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328858=3A_Remove_?= =?utf-8?q?=5FPyObject=5FCallArg1=28=29_macro?= Message-ID: <20161205161308.21396.69193.81BB709D@psf.io> https://hg.python.org/cpython/rev/4171cc26272c changeset: 105461:4171cc26272c user: Victor Stinner date: Mon Dec 05 17:04:32 2016 +0100 summary: Issue #28858: Remove _PyObject_CallArg1() macro Replace _PyObject_CallArg1(func, arg) with PyObject_CallFunctionObjArgs(func, arg, NULL) Using the _PyObject_CallArg1() macro increases the usage of the C stack, which was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this issue. files: Include/abstract.h | 5 +---- Modules/_asynciomodule.c | 6 +++--- Modules/_collectionsmodule.c | 3 ++- Modules/_elementtree.c | 11 ++++++----- Modules/_pickle.c | 2 +- Modules/_sre.c | 2 +- Modules/pyexpat.c | 2 +- Objects/abstract.c | 2 +- Objects/fileobject.c | 2 +- Objects/genobject.c | 2 +- Objects/typeobject.c | 6 +++--- Python/_warnings.c | 2 +- Python/codecs.c | 2 +- Python/errors.c | 2 +- Python/sysmodule.c | 2 +- 15 files changed, 25 insertions(+), 26 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -338,10 +338,7 @@ _PyObject_FastCallDict((func), (args), (nargs), NULL) #define _PyObject_CallNoArg(func) \ - _PyObject_FastCall((func), NULL, 0) - -#define _PyObject_CallArg1(func, arg) \ - _PyObject_FastCall((func), (PyObject **)&(arg), 1) + _PyObject_FastCallDict((func), NULL, 0, NULL) PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args, diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -257,7 +257,7 @@ return -1; } - exc = _PyObject_CallArg1(asyncio_InvalidStateError, msg); + exc = PyObject_CallFunctionObjArgs(asyncio_InvalidStateError, msg, NULL); Py_DECREF(msg); if (exc == NULL) { return -1; @@ -835,7 +835,7 @@ func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler); if (func != NULL) { - res = _PyObject_CallArg1(func, context); + res = PyObject_CallFunctionObjArgs(func, context, NULL); if (res == NULL) { PyErr_WriteUnraisable(func); } @@ -1731,7 +1731,7 @@ func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler); if (func != NULL) { - res = _PyObject_CallArg1(func, context); + res = PyObject_CallFunctionObjArgs(func, context, NULL); if (res == NULL) { PyErr_WriteUnraisable(func); } diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -538,7 +538,8 @@ return NULL; } if (old_deque->maxlen < 0) - return _PyObject_CallArg1((PyObject *)(Py_TYPE(deque)), deque); + return PyObject_CallFunctionObjArgs((PyObject *)(Py_TYPE(deque)), + deque, NULL); else return PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi", deque, old_deque->maxlen, NULL); diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2831,7 +2831,7 @@ if (errmsg == NULL) return; - error = _PyObject_CallArg1(st->parseerror_obj, errmsg); + error = PyObject_CallFunctionObjArgs(st->parseerror_obj, errmsg, NULL); Py_DECREF(errmsg); if (!error) return; @@ -2894,7 +2894,7 @@ (TreeBuilderObject*) self->target, value ); else if (self->handle_data) - res = _PyObject_CallArg1(self->handle_data, value); + res = PyObject_CallFunctionObjArgs(self->handle_data, value, NULL); else res = NULL; Py_XDECREF(res); @@ -3004,7 +3004,7 @@ /* shortcut */ res = treebuilder_handle_data((TreeBuilderObject*) self->target, data); else if (self->handle_data) - res = _PyObject_CallArg1(self->handle_data, data); + res = PyObject_CallFunctionObjArgs(self->handle_data, data, NULL); else res = NULL; @@ -3031,7 +3031,7 @@ else if (self->handle_end) { tag = makeuniversal(self, tag_in); if (tag) { - res = _PyObject_CallArg1(self->handle_end, tag); + res = PyObject_CallFunctionObjArgs(self->handle_end, tag, NULL); Py_DECREF(tag); } } @@ -3090,7 +3090,8 @@ if (self->handle_comment) { comment = PyUnicode_DecodeUTF8(comment_in, strlen(comment_in), "strict"); if (comment) { - res = _PyObject_CallArg1(self->handle_comment, comment); + res = PyObject_CallFunctionObjArgs(self->handle_comment, + comment, NULL); Py_XDECREF(res); Py_DECREF(comment); } diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -346,7 +346,7 @@ { PyObject *result; - result = _PyObject_CallArg1(func, obj); + result = PyObject_CallFunctionObjArgs(func, obj, NULL); Py_DECREF(obj); return result; } diff --git a/Modules/_sre.c b/Modules/_sre.c --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1157,7 +1157,7 @@ match = pattern_new_match(self, &state, 1); if (!match) goto error; - item = _PyObject_CallArg1(filter, match); + item = PyObject_CallFunctionObjArgs(filter, match, NULL); Py_DECREF(match); if (!item) goto error; diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -119,7 +119,7 @@ XML_ErrorString(code), lineno, column); if (buffer == NULL) return NULL; - err = _PyObject_CallArg1(ErrorObject, buffer); + err = PyObject_CallFunctionObjArgs(ErrorObject, buffer, NULL); Py_DECREF(buffer); if ( err != NULL && set_error_attr(err, "code", code) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2496,7 +2496,7 @@ assert(args != NULL); if (!PyTuple_Check(args)) { - result = _PyObject_CallArg1(callable, args); + result = PyObject_CallFunctionObjArgs(callable, args, NULL); } else { result = PyObject_Call(callable, args, NULL); diff --git a/Objects/fileobject.c b/Objects/fileobject.c --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -146,7 +146,7 @@ Py_DECREF(writer); return -1; } - result = _PyObject_CallArg1(writer, value); + result = PyObject_CallFunctionObjArgs(writer, value, NULL); Py_DECREF(value); Py_DECREF(writer); if (result == NULL) diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -1341,7 +1341,7 @@ PyObject *res; Py_INCREF(firstiter); - res = _PyObject_CallArg1(firstiter, o); + res = PyObject_CallFunctionObjArgs(firstiter, o, NULL); Py_DECREF(firstiter); if (res == NULL) { return 1; diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5873,7 +5873,7 @@ goto error; } - retval = _PyObject_CallArg1(func, ival); + retval = PyObject_CallFunctionObjArgs(func, ival, NULL); Py_DECREF(func); Py_DECREF(ival); return retval; @@ -5914,7 +5914,7 @@ return -1; } if (func != NULL) { - res = _PyObject_CallArg1(func, value); + res = PyObject_CallFunctionObjArgs(func, value, NULL); Py_DECREF(func); if (res != NULL) { result = PyObject_IsTrue(res); @@ -6284,7 +6284,7 @@ PyErr_Clear(); Py_RETURN_NOTIMPLEMENTED; } - res = _PyObject_CallArg1(func, other); + res = PyObject_CallFunctionObjArgs(func, other, NULL); Py_DECREF(func); return res; } diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -476,7 +476,7 @@ } else { text = message; - message = _PyObject_CallArg1(category, message); + message = PyObject_CallFunctionObjArgs(category, message, NULL); if (message == NULL) goto cleanup; } diff --git a/Python/codecs.c b/Python/codecs.c --- a/Python/codecs.c +++ b/Python/codecs.c @@ -322,7 +322,7 @@ if (errors != NULL) streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors); else - streamcodec = _PyObject_CallArg1(codeccls, stream); + streamcodec = PyObject_CallFunctionObjArgs(codeccls, stream, NULL); Py_DECREF(codecs); return streamcodec; } diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -62,7 +62,7 @@ return PyObject_Call(exception, value, NULL); } else { - return _PyObject_CallArg1(exception, value); + return PyObject_CallFunctionObjArgs(exception, value, NULL); } } diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -2325,7 +2325,7 @@ if (writer == NULL) goto error; - result = _PyObject_CallArg1(writer, unicode); + result = PyObject_CallFunctionObjArgs(writer, unicode, NULL); if (result == NULL) { goto error; } else { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 11:57:53 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 05 Dec 2016 16:57:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328152=3A_Fix_-Wun?= =?utf-8?q?reachable-code_warnings_on_Clang?= Message-ID: <20161205165753.14423.31849.2610A976@psf.io> https://hg.python.org/cpython/rev/b3f1210d098d changeset: 105462:b3f1210d098d user: Victor Stinner date: Mon Dec 05 17:56:36 2016 +0100 summary: Issue #28152: Fix -Wunreachable-code warnings on Clang Don't declare dead code when the code is declared with Clang. files: Modules/faulthandler.c | 9 +++++++++ Modules/posixmodule.c | 5 +++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -980,12 +980,21 @@ static void faulthandler_fatal_error_thread(void *plock) { +#ifndef __clang__ PyThread_type_lock *lock = (PyThread_type_lock *)plock; +#endif Py_FatalError("in new thread"); +#ifndef __clang__ + /* Issue #28152: Py_FatalError() is declared with + __attribute__((__noreturn__)). GCC emits a warning without + "PyThread_release_lock()" (compiler bug?), but Clang is smarter and + emits a warning on the return. */ + /* notify the caller that we are done */ PyThread_release_lock(lock); +#endif } static PyObject * diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -10337,8 +10337,13 @@ { abort(); /*NOTREACHED*/ +#ifndef __clang__ + /* Issue #28152: abort() is declared with __attribute__((__noreturn__)). + GCC emits a warning without "return NULL;" (compiler bug?), but Clang + is smarter and emits a warning on the return. */ Py_FatalError("abort() called from Python code didn't abort!"); return NULL; +#endif } #ifdef MS_WINDOWS -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 11:57:54 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 05 Dec 2016 16:57:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328152=3A_Fix_-Wun?= =?utf-8?q?reachable-code_warning_on_clang?= Message-ID: <20161205165753.93294.80131.3D60E0B4@psf.io> https://hg.python.org/cpython/rev/390fbb9c5e59 changeset: 105463:390fbb9c5e59 user: Victor Stinner date: Mon Dec 05 17:55:36 2016 +0100 summary: Issue #28152: Fix -Wunreachable-code warning on clang Replace C if() with precompiler #if to fix a warning on dead code when using clang. files: Modules/zipimport.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/zipimport.c b/Modules/zipimport.c --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -998,13 +998,13 @@ goto file_error; } name[name_size] = '\0'; /* Add terminating null byte */ - if (SEP != '/') { - for (i = 0; i < name_size; i++) { - if (name[i] == '/') { - name[i] = SEP; - } +#if SEP != '/' + for (i = 0; i < name_size; i++) { + if (name[i] == '/') { + name[i] = SEP; } } +#endif /* Skip the rest of the header. * On Windows, calling fseek to skip over the fields we don't use is * slower than reading the data because fseek flushes stdio's -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 12:03:13 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 05 Dec 2016 17:03:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328152=3A_Fix_-Wun?= =?utf-8?q?reachable-code_warning_on_clang?= Message-ID: <20161205170310.21305.30975.ECC147F1@psf.io> https://hg.python.org/cpython/rev/7c7055305f69 changeset: 105464:7c7055305f69 user: Victor Stinner date: Mon Dec 05 18:00:42 2016 +0100 summary: Issue #28152: Fix -Wunreachable-code warning on clang Replace 0 with (0) to ignore a compiler warning about dead code on "((int)(SEM_VALUE_MAX) < 0)": SEM_VALUE_MAX is not negative on Linux. files: Modules/_multiprocessing/multiprocessing.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/_multiprocessing/multiprocessing.c b/Modules/_multiprocessing/multiprocessing.c --- a/Modules/_multiprocessing/multiprocessing.c +++ b/Modules/_multiprocessing/multiprocessing.c @@ -171,8 +171,11 @@ { PyObject *py_sem_value_max; /* Some systems define SEM_VALUE_MAX as an unsigned value that - * causes it to be negative when used as an int (NetBSD). */ - if ((int)(SEM_VALUE_MAX) < 0) + * causes it to be negative when used as an int (NetBSD). + * + * Issue #28152: Use (0) instead of 0 to fix a warning on dead code + * when using clang -Wunreachable-code. */ + if ((int)(SEM_VALUE_MAX) < (0)) py_sem_value_max = PyLong_FromLong(INT_MAX); else py_sem_value_max = PyLong_FromLong(SEM_VALUE_MAX); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 12:25:27 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 05 Dec 2016 17:25:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_directly_=5FPyObject?= =?utf-8?q?=5FGenericSetAttrWithDict=28=29?= Message-ID: <20161205172526.93840.12097.1EAABFE2@psf.io> https://hg.python.org/cpython/rev/90d318d40a83 changeset: 105465:90d318d40a83 user: Victor Stinner date: Mon Dec 05 18:23:27 2016 +0100 summary: Use directly _PyObject_GenericSetAttrWithDict() Modify type_setattro() to call directly _PyObject_GenericSetAttrWithDict() instead of PyObject_GenericSetAttr(). PyObject_GenericSetAttr() is a thin wrapper to _PyObject_GenericSetAttrWithDict(). files: Objects/typeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -3082,7 +3082,7 @@ type->tp_name); return -1; } - if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) + if (_PyObject_GenericSetAttrWithDict((PyObject *)type, name, value, NULL) < 0) return -1; return update_slot(type, name); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 17:20:50 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 05 Dec 2016 22:20:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4ODA4?= =?utf-8?q?=3A_PyUnicode=5FCompareWithASCIIString=28=29_now_never_raises_e?= =?utf-8?q?xceptions=2E?= Message-ID: <20161205222049.92897.77488.EF411577@psf.io> https://hg.python.org/cpython/rev/b431d39da67f changeset: 105466:b431d39da67f branch: 3.5 parent: 105452:dee2a4ca62f7 user: Serhiy Storchaka date: Tue Dec 06 00:13:34 2016 +0200 summary: Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. files: Doc/c-api/unicode.rst | 3 +-- Include/unicodeobject.h | 2 +- Misc/NEWS | 2 ++ Objects/unicodeobject.c | 18 ++++++++++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1652,8 +1652,7 @@ ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. - This function returns ``-1`` upon failure, so one should call - :c:func:`PyErr_Occurred` to check for errors. + This function does not raise exceptions. .. c:function:: PyObject* PyUnicode_RichCompare(PyObject *left, PyObject *right, int op) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2023,7 +2023,7 @@ equal, and greater than, respectively. It is best to pass only ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. - Raise an exception and return -1 on error. */ + This function does not raise exceptions. */ PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( PyObject *left, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -506,6 +506,8 @@ C API ----- +- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. + - Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of integers. Now only strings and bytes-like objects are accepted. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10793,10 +10793,24 @@ Py_ssize_t i; int kind; Py_UCS4 chr; + const unsigned char *ustr = (const unsigned char *)str; assert(_PyUnicode_CHECK(uni)); - if (PyUnicode_READY(uni) == -1) - return -1; + if (!PyUnicode_IS_READY(uni)) { + const wchar_t *ws = _PyUnicode_WSTR(uni); + /* Compare Unicode string and source character set string */ + for (i = 0; (chr = ws[i]) && ustr[i]; i++) { + if (chr != ustr[i]) + return (chr < ustr[i]) ? -1 : 1; + } + /* This check keeps Python strings that end in '\0' from comparing equal + to C strings identical up to that point. */ + if (_PyUnicode_WSTR_LENGTH(uni) != i || chr) + return 1; /* uni is longer */ + if (ustr[i]) + return -1; /* str is longer */ + return 0; + } kind = PyUnicode_KIND(uni); if (kind == PyUnicode_1BYTE_KIND) { const void *data = PyUnicode_1BYTE_DATA(uni); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 17:20:50 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 05 Dec 2016 22:20:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328808=3A_PyUnicode=5FCompareWithASCIIString=28?= =?utf-8?q?=29_now_never_raises_exceptions=2E?= Message-ID: <20161205222050.29039.46588.4B2C7AF2@psf.io> https://hg.python.org/cpython/rev/db56e39ea067 changeset: 105468:db56e39ea067 parent: 105465:90d318d40a83 parent: 105467:5bdc8e1a50c8 user: Serhiy Storchaka date: Tue Dec 06 00:20:26 2016 +0200 summary: Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. files: Doc/c-api/unicode.rst | 3 +-- Include/unicodeobject.h | 2 +- Misc/NEWS | 2 ++ Objects/unicodeobject.c | 18 ++++++++++++++++-- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1657,8 +1657,7 @@ ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. - This function returns ``-1`` upon failure, so one should call - :c:func:`PyErr_Occurred` to check for errors. + This function does not raise exceptions. .. c:function:: PyObject* PyUnicode_RichCompare(PyObject *left, PyObject *right, int op) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2055,7 +2055,7 @@ equal, and greater than, respectively. It is best to pass only ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. - Raise an exception and return -1 on error. */ + This function does not raise exceptions. */ PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( PyObject *left, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -480,6 +480,8 @@ C API ----- +- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. + - Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef, PyStructSequence_Field, PyStructSequence_Desc, and wrapperbase are now of type ``const char *`` rather of ``char *``. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10977,10 +10977,24 @@ Py_ssize_t i; int kind; Py_UCS4 chr; + const unsigned char *ustr = (const unsigned char *)str; assert(_PyUnicode_CHECK(uni)); - if (PyUnicode_READY(uni) == -1) - return -1; + if (!PyUnicode_IS_READY(uni)) { + const wchar_t *ws = _PyUnicode_WSTR(uni); + /* Compare Unicode string and source character set string */ + for (i = 0; (chr = ws[i]) && ustr[i]; i++) { + if (chr != ustr[i]) + return (chr < ustr[i]) ? -1 : 1; + } + /* This check keeps Python strings that end in '\0' from comparing equal + to C strings identical up to that point. */ + if (_PyUnicode_WSTR_LENGTH(uni) != i || chr) + return 1; /* uni is longer */ + if (ustr[i]) + return -1; /* str is longer */ + return 0; + } kind = PyUnicode_KIND(uni); if (kind == PyUnicode_1BYTE_KIND) { const void *data = PyUnicode_1BYTE_DATA(uni); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 17:20:50 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 05 Dec 2016 22:20:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328808=3A_PyUnicode=5FCompareWithASCIIString=28=29_now?= =?utf-8?q?_never_raises_exceptions=2E?= Message-ID: <20161205222050.93462.28793.10E016C6@psf.io> https://hg.python.org/cpython/rev/5bdc8e1a50c8 changeset: 105467:5bdc8e1a50c8 branch: 3.6 parent: 105459:e33245800f1a parent: 105466:b431d39da67f user: Serhiy Storchaka date: Tue Dec 06 00:17:45 2016 +0200 summary: Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. files: Doc/c-api/unicode.rst | 3 +-- Include/unicodeobject.h | 2 +- Misc/NEWS | 5 +++++ Objects/unicodeobject.c | 18 ++++++++++++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1657,8 +1657,7 @@ ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. - This function returns ``-1`` upon failure, so one should call - :c:func:`PyErr_Occurred` to check for errors. + This function does not raise exceptions. .. c:function:: PyObject* PyUnicode_RichCompare(PyObject *left, PyObject *right, int op) diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2051,7 +2051,7 @@ equal, and greater than, respectively. It is best to pass only ASCII-encoded strings, but the function interprets the input string as ISO-8859-1 if it contains non-ASCII characters. - Raise an exception and return -1 on error. */ + This function does not raise exceptions. */ PyAPI_FUNC(int) PyUnicode_CompareWithASCIIString( PyObject *left, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -36,6 +36,11 @@ - Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. +C API +----- + +- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. + Documentation ------------- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11011,10 +11011,24 @@ Py_ssize_t i; int kind; Py_UCS4 chr; + const unsigned char *ustr = (const unsigned char *)str; assert(_PyUnicode_CHECK(uni)); - if (PyUnicode_READY(uni) == -1) - return -1; + if (!PyUnicode_IS_READY(uni)) { + const wchar_t *ws = _PyUnicode_WSTR(uni); + /* Compare Unicode string and source character set string */ + for (i = 0; (chr = ws[i]) && ustr[i]; i++) { + if (chr != ustr[i]) + return (chr < ustr[i]) ? -1 : 1; + } + /* This check keeps Python strings that end in '\0' from comparing equal + to C strings identical up to that point. */ + if (_PyUnicode_WSTR_LENGTH(uni) != i || chr) + return 1; /* uni is longer */ + if (ustr[i]) + return -1; /* str is longer */ + return 0; + } kind = PyUnicode_KIND(uni); if (kind == PyUnicode_1BYTE_KIND) { const void *data = PyUnicode_1BYTE_DATA(uni); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 5 17:24:29 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 05 Dec 2016 22:24:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fixed_merge_error_in_Misc/?= =?utf-8?q?NEWS_for_issue_=2323722=2E?= Message-ID: <20161205222429.93799.88829.3A930F99@psf.io> https://hg.python.org/cpython/rev/fa4d8276d0fb changeset: 105469:fa4d8276d0fb user: Serhiy Storchaka date: Tue Dec 06 00:24:19 2016 +0200 summary: Fixed merge error in Misc/NEWS for issue #23722. files: Misc/NEWS | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -35,14 +35,6 @@ non-encodable characters (non-ASCII for the ASCII codec, characters out of the U+0000-U+00FF range for Latin1). -Documentation -------------- - -- Issue #23722: The data model reference and the porting section in the - 3.6 What's New guide now cover the additional ``__classcell__`` handling - needed for custom metaclasses to fully support PEP 487 and zero-argument - ``super()``. - - Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of dict literal with constant keys up to 30%. @@ -499,6 +491,11 @@ Documentation ------------- +- Issue #23722: The data model reference and the porting section in the + 3.6 What's New guide now cover the additional ``__classcell__`` handling + needed for custom metaclasses to fully support PEP 487 and zero-argument + ``super()``. + - Issue #28513: Documented command-line interface of zipfile. Build -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 01:30:32 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 06 Dec 2016 06:30:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_remove_unused_?= =?utf-8?q?logger_from_BaseFix?= Message-ID: <20161206063031.28672.56736.69206C92@psf.io> https://hg.python.org/cpython/rev/fdf2e778b88b changeset: 105470:fdf2e778b88b branch: 2.7 parent: 105453:baf972859ec5 user: Benjamin Peterson date: Mon Dec 05 22:30:26 2016 -0800 summary: remove unused logger from BaseFix files: Lib/lib2to3/fixer_base.py | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Lib/lib2to3/fixer_base.py b/Lib/lib2to3/fixer_base.py --- a/Lib/lib2to3/fixer_base.py +++ b/Lib/lib2to3/fixer_base.py @@ -4,7 +4,6 @@ """Base class for fixers (optional, but recommended).""" # Python imports -import logging import itertools # Local imports @@ -75,7 +74,6 @@ The main refactoring tool should call this. """ self.filename = filename - self.logger = logging.getLogger(filename) def match(self, node): """Returns match for a given parse tree node. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 01:31:27 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 06 Dec 2016 06:31:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_merge_3=2E5?= Message-ID: <20161206063127.28483.71259.1AB39B4A@psf.io> https://hg.python.org/cpython/rev/ab66423c3581 changeset: 105472:ab66423c3581 branch: 3.6 parent: 105467:5bdc8e1a50c8 parent: 105471:e3e7e9248f98 user: Benjamin Peterson date: Mon Dec 05 22:31:12 2016 -0800 summary: merge 3.5 files: Lib/lib2to3/fixer_base.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/lib2to3/fixer_base.py b/Lib/lib2to3/fixer_base.py --- a/Lib/lib2to3/fixer_base.py +++ b/Lib/lib2to3/fixer_base.py @@ -4,7 +4,6 @@ """Base class for fixers (optional, but recommended).""" # Python imports -import logging import itertools # Local imports -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 01:31:27 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 06 Dec 2016 06:31:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_rm_unused_impo?= =?utf-8?q?rt?= Message-ID: <20161206063127.93632.9248.A3D09CD6@psf.io> https://hg.python.org/cpython/rev/e3e7e9248f98 changeset: 105471:e3e7e9248f98 branch: 3.5 parent: 105466:b431d39da67f user: Benjamin Peterson date: Mon Dec 05 22:30:55 2016 -0800 summary: rm unused import files: Lib/lib2to3/fixer_base.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/lib2to3/fixer_base.py b/Lib/lib2to3/fixer_base.py --- a/Lib/lib2to3/fixer_base.py +++ b/Lib/lib2to3/fixer_base.py @@ -4,7 +4,6 @@ """Base class for fixers (optional, but recommended).""" # Python imports -import logging import itertools # Local imports -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 01:31:27 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 06 Dec 2016 06:31:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy42?= Message-ID: <20161206063127.29039.41411.0D1DF8A6@psf.io> https://hg.python.org/cpython/rev/e526780303bc changeset: 105473:e526780303bc parent: 105469:fa4d8276d0fb parent: 105472:ab66423c3581 user: Benjamin Peterson date: Mon Dec 05 22:31:20 2016 -0800 summary: merge 3.6 files: Lib/lib2to3/fixer_base.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/lib2to3/fixer_base.py b/Lib/lib2to3/fixer_base.py --- a/Lib/lib2to3/fixer_base.py +++ b/Lib/lib2to3/fixer_base.py @@ -4,7 +4,6 @@ """Base class for fixers (optional, but recommended).""" # Python imports -import logging import itertools # Local imports -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Dec 6 04:06:43 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 06 Dec 2016 09:06:43 +0000 Subject: [Python-checkins] Daily reference leaks (fa4d8276d0fb): sum=4 Message-ID: <20161206090643.14377.72237.15919F6E@psf.io> results for fa4d8276d0fb 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/reflogEyI50d', '--timeout', '7200'] From python-checkins at python.org Tue Dec 6 05:00:37 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 10:00:37 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogY2F0Y2hfd2Fybmlu?= =?utf-8?q?gs=28=29_calls_showwarning=28=29_if_overriden?= Message-ID: <20161206100037.93799.21433.D004EA21@psf.io> https://hg.python.org/cpython/rev/726308cfe3b5 changeset: 105474:726308cfe3b5 branch: 3.6 parent: 105472:ab66423c3581 user: Victor Stinner date: Tue Dec 06 10:53:52 2016 +0100 summary: catch_warnings() calls showwarning() if overriden Issue #28089: Fix a regression introduced in warnings.catch_warnings(): call warnings.showwarning() if it was overriden inside the context manager. files: Lib/test/test_warnings/__init__.py | 45 ++++++++++++++++++ Lib/warnings.py | 14 ++++- Misc/NEWS | 3 + 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -944,6 +944,51 @@ self.assertTrue(wmod.filters is not orig_filters) self.assertTrue(wmod.filters is orig_filters) + def test_record_override_showwarning_before(self): + # Issue #28089: If warnings.showwarning() was overriden, make sure + # that catch_warnings(record=True) overrides it again. + text = "This is a warning" + wmod = self.module + my_log = [] + + def my_logger(message, category, filename, lineno, file=None, line=None): + nonlocal my_log + my_log.append(message) + + # Override warnings.showwarning() before calling catch_warnings() + with support.swap_attr(wmod, 'showwarning', my_logger): + with wmod.catch_warnings(module=wmod, record=True) as log: + self.assertIsNot(wmod.showwarning, my_logger) + + wmod.simplefilter("always") + wmod.warn(text) + + self.assertIs(wmod.showwarning, my_logger) + + self.assertEqual(len(log), 1, log) + self.assertEqual(log[0].message.args[0], text) + self.assertEqual(my_log, []) + + def test_record_override_showwarning_inside(self): + # Issue #28089: It is possible to override warnings.showwarning() + # in the catch_warnings(record=True) context manager. + text = "This is a warning" + wmod = self.module + my_log = [] + + def my_logger(message, category, filename, lineno, file=None, line=None): + nonlocal my_log + my_log.append(message) + + with wmod.catch_warnings(module=wmod, record=True) as log: + wmod.simplefilter("always") + wmod.showwarning = my_logger + wmod.warn(text) + + self.assertEqual(len(my_log), 1, my_log) + self.assertEqual(my_log[0].args[0], text) + self.assertEqual(log, []) + def test_check_warnings(self): # Explicit tests for the test.support convenience wrapper wmod = self.module diff --git a/Lib/warnings.py b/Lib/warnings.py --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -447,11 +447,20 @@ self._module._filters_mutated() self._showwarning = self._module.showwarning self._showwarnmsg = self._module._showwarnmsg + self._showwarnmsg_impl = self._module._showwarnmsg_impl if self._record: log = [] - def showarnmsg(msg): + + def showarnmsg_logger(msg): + nonlocal log log.append(msg) - self._module._showwarnmsg = showarnmsg + + self._module._showwarnmsg_impl = showarnmsg_logger + + # Reset showwarning() to the default implementation to make sure + # that _showwarnmsg() calls _showwarnmsg_impl() + self._module.showwarning = self._module._showwarning + return log else: return None @@ -463,6 +472,7 @@ self._module._filters_mutated() self._module.showwarning = self._showwarning self._module._showwarnmsg = self._showwarnmsg + self._module._showwarnmsg_impl = self._showwarnmsg_impl # filters contains a sequence of filter 5-tuples diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,9 @@ Library ------- +- Issue #28089: Fix a regression introduced in warnings.catch_warnings(): + call warnings.showwarning() if it was overriden inside the context manager. + - Issue #27172: To assist with upgrades from 2.7, the previously documented deprecation of ``inspect.getfullargspec()`` has been reversed. This decision may be revisited again after the Python 2.7 branch is no longer officially -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 05:00:37 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 10:00:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161206100037.14504.77690.230E9557@psf.io> https://hg.python.org/cpython/rev/2bd1717b6e00 changeset: 105475:2bd1717b6e00 parent: 105473:e526780303bc parent: 105474:726308cfe3b5 user: Victor Stinner date: Tue Dec 06 10:59:54 2016 +0100 summary: Merge 3.6 files: Lib/test/test_warnings/__init__.py | 45 ++++++++++++++++++ Lib/warnings.py | 14 ++++- Misc/NEWS | 3 + 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -944,6 +944,51 @@ self.assertTrue(wmod.filters is not orig_filters) self.assertTrue(wmod.filters is orig_filters) + def test_record_override_showwarning_before(self): + # Issue #28089: If warnings.showwarning() was overriden, make sure + # that catch_warnings(record=True) overrides it again. + text = "This is a warning" + wmod = self.module + my_log = [] + + def my_logger(message, category, filename, lineno, file=None, line=None): + nonlocal my_log + my_log.append(message) + + # Override warnings.showwarning() before calling catch_warnings() + with support.swap_attr(wmod, 'showwarning', my_logger): + with wmod.catch_warnings(module=wmod, record=True) as log: + self.assertIsNot(wmod.showwarning, my_logger) + + wmod.simplefilter("always") + wmod.warn(text) + + self.assertIs(wmod.showwarning, my_logger) + + self.assertEqual(len(log), 1, log) + self.assertEqual(log[0].message.args[0], text) + self.assertEqual(my_log, []) + + def test_record_override_showwarning_inside(self): + # Issue #28089: It is possible to override warnings.showwarning() + # in the catch_warnings(record=True) context manager. + text = "This is a warning" + wmod = self.module + my_log = [] + + def my_logger(message, category, filename, lineno, file=None, line=None): + nonlocal my_log + my_log.append(message) + + with wmod.catch_warnings(module=wmod, record=True) as log: + wmod.simplefilter("always") + wmod.showwarning = my_logger + wmod.warn(text) + + self.assertEqual(len(my_log), 1, my_log) + self.assertEqual(my_log[0].args[0], text) + self.assertEqual(log, []) + def test_check_warnings(self): # Explicit tests for the test.support convenience wrapper wmod = self.module diff --git a/Lib/warnings.py b/Lib/warnings.py --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -447,11 +447,20 @@ self._module._filters_mutated() self._showwarning = self._module.showwarning self._showwarnmsg = self._module._showwarnmsg + self._showwarnmsg_impl = self._module._showwarnmsg_impl if self._record: log = [] - def showarnmsg(msg): + + def showarnmsg_logger(msg): + nonlocal log log.append(msg) - self._module._showwarnmsg = showarnmsg + + self._module._showwarnmsg_impl = showarnmsg_logger + + # Reset showwarning() to the default implementation to make sure + # that _showwarnmsg() calls _showwarnmsg_impl() + self._module.showwarning = self._module._showwarning + return log else: return None @@ -463,6 +472,7 @@ self._module._filters_mutated() self._module.showwarning = self._showwarning self._module._showwarnmsg = self._showwarnmsg + self._module._showwarnmsg_impl = self._showwarnmsg_impl # filters contains a sequence of filter 5-tuples diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -165,6 +165,9 @@ Library ------- +- Issue #28089: Fix a regression introduced in warnings.catch_warnings(): + call warnings.showwarning() if it was overriden inside the context manager. + - Issue #27172: To assist with upgrades from 2.7, the previously documented deprecation of ``inspect.getfullargspec()`` has been reversed. This decision may be revisited again after the Python 2.7 branch is no longer officially -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 05:03:13 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 10:03:13 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogd2FybmluZ3M6IEZp?= =?utf-8?q?x_the_issue_number?= Message-ID: <20161206100311.21414.73502.CBD61BBA@psf.io> https://hg.python.org/cpython/rev/150d36dbe3ba changeset: 105476:150d36dbe3ba branch: 3.6 parent: 105474:726308cfe3b5 user: Victor Stinner date: Tue Dec 06 11:02:12 2016 +0100 summary: warnings: Fix the issue number The fix for catch_warnings() is the issue #28835 (not the issue #28089). files: Lib/test/test_warnings/__init__.py | 4 ++-- Misc/NEWS | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -945,7 +945,7 @@ self.assertTrue(wmod.filters is orig_filters) def test_record_override_showwarning_before(self): - # Issue #28089: If warnings.showwarning() was overriden, make sure + # Issue #28835: If warnings.showwarning() was overriden, make sure # that catch_warnings(record=True) overrides it again. text = "This is a warning" wmod = self.module @@ -970,7 +970,7 @@ self.assertEqual(my_log, []) def test_record_override_showwarning_inside(self): - # Issue #28089: It is possible to override warnings.showwarning() + # Issue #28835: It is possible to override warnings.showwarning() # in the catch_warnings(record=True) context manager. text = "This is a warning" wmod = self.module diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,7 +26,7 @@ Library ------- -- Issue #28089: Fix a regression introduced in warnings.catch_warnings(): +- Issue #28835: Fix a regression introduced in warnings.catch_warnings(): call warnings.showwarning() if it was overriden inside the context manager. - Issue #27172: To assist with upgrades from 2.7, the previously documented -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 05:03:13 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 10:03:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161206100313.22177.52752.51B18AA3@psf.io> https://hg.python.org/cpython/rev/9db231dd0b73 changeset: 105477:9db231dd0b73 parent: 105475:2bd1717b6e00 parent: 105476:150d36dbe3ba user: Victor Stinner date: Tue Dec 06 11:02:54 2016 +0100 summary: Merge 3.6 files: Lib/test/test_warnings/__init__.py | 4 ++-- Misc/NEWS | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -945,7 +945,7 @@ self.assertTrue(wmod.filters is orig_filters) def test_record_override_showwarning_before(self): - # Issue #28089: If warnings.showwarning() was overriden, make sure + # Issue #28835: If warnings.showwarning() was overriden, make sure # that catch_warnings(record=True) overrides it again. text = "This is a warning" wmod = self.module @@ -970,7 +970,7 @@ self.assertEqual(my_log, []) def test_record_override_showwarning_inside(self): - # Issue #28089: It is possible to override warnings.showwarning() + # Issue #28835: It is possible to override warnings.showwarning() # in the catch_warnings(record=True) context manager. text = "This is a warning" wmod = self.module diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -165,7 +165,7 @@ Library ------- -- Issue #28089: Fix a regression introduced in warnings.catch_warnings(): +- Issue #28835: Fix a regression introduced in warnings.catch_warnings(): call warnings.showwarning() if it was overriden inside the context manager. - Issue #27172: To assist with upgrades from 2.7, the previously documented -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 06:46:30 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 06 Dec 2016 11:46:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fixed_misplace?= =?utf-8?q?d_comment=2E?= Message-ID: <20161206114630.28019.38523.B51D6CBA@psf.io> https://hg.python.org/cpython/rev/104fdc42bcd1 changeset: 105478:104fdc42bcd1 branch: 3.5 parent: 105471:e3e7e9248f98 user: Serhiy Storchaka date: Tue Dec 06 13:43:46 2016 +0200 summary: Fixed misplaced comment. files: Include/abstract.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -266,18 +266,18 @@ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw); + /* + Call a callable Python object, callable_object, with + arguments and keywords arguments. The 'args' argument can not be + NULL, but the 'kw' argument can be NULL. + */ + #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where); #endif - /* - Call a callable Python object, callable_object, with - arguments and keywords arguments. The 'args' argument can not be - NULL, but the 'kw' argument can be NULL. - */ - PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, PyObject *args); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 06:46:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 06 Dec 2016 11:46:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Fixed_misplaced_comment=2E?= Message-ID: <20161206114630.93520.84047.9BB79280@psf.io> https://hg.python.org/cpython/rev/bf664ae916b1 changeset: 105480:bf664ae916b1 parent: 105477:9db231dd0b73 parent: 105479:a4d4dd411431 user: Serhiy Storchaka date: Tue Dec 06 13:46:17 2016 +0200 summary: Fixed misplaced comment. files: Include/abstract.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -268,6 +268,12 @@ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kwargs); + /* + Call a callable Python object, callable_object, with + arguments and keywords arguments. The 'args' argument can not be + NULL. + */ + #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyStack_AsTuple( PyObject **stack, @@ -349,12 +355,6 @@ const char *where); #endif /* Py_LIMITED_API */ - /* - Call a callable Python object, callable_object, with - arguments and keywords arguments. The 'args' argument can not be - NULL. - */ - PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, PyObject *args); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 06:46:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 06 Dec 2016 11:46:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Fixed_misplaced_comment=2E?= Message-ID: <20161206114630.93093.33518.493EAE6B@psf.io> https://hg.python.org/cpython/rev/a4d4dd411431 changeset: 105479:a4d4dd411431 branch: 3.6 parent: 105476:150d36dbe3ba parent: 105478:104fdc42bcd1 user: Serhiy Storchaka date: Tue Dec 06 13:45:44 2016 +0200 summary: Fixed misplaced comment. files: Include/abstract.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -268,6 +268,12 @@ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kwargs); + /* + Call a callable Python object, callable_object, with + arguments and keywords arguments. The 'args' argument can not be + NULL. + */ + #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyStack_AsTuple( PyObject **stack, @@ -352,12 +358,6 @@ const char *where); #endif /* Py_LIMITED_API */ - /* - Call a callable Python object, callable_object, with - arguments and keywords arguments. The 'args' argument can not be - NULL. - */ - PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, PyObject *args); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 10:31:52 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 15:31:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Uniformize_argument_names_?= =?utf-8?q?of_=22call=22_functions?= Message-ID: <20161206153151.21246.80486.28345429@psf.io> https://hg.python.org/cpython/rev/e6ad41a3f3bd changeset: 105481:e6ad41a3f3bd user: Victor Stinner date: Tue Dec 06 16:27:24 2016 +0100 summary: Uniformize argument names of "call" functions Issue #28838: Rename parameters of the "calls" functions of the Python C API. * Rename 'callable_object' and 'func' to 'callable': any Python callable object is accepted, not only Python functions * Rename 'method' and 'nameid' to 'name' (method name) * Rename 'o' to 'obj' * Move, fix and update documentation of PyObject_CallXXX() functions in abstract.h * Update also the documentaton of the C API (update parameter names) files: Doc/c-api/object.rst | 73 +++++++++----- Include/abstract.h | 132 +++++++++++++------------- Include/ceval.h | 12 +- Objects/abstract.c | 150 ++++++++++++++++-------------- Objects/typeobject.c | 10 +- Python/ceval.c | 7 +- Python/modsupport.c | 8 +- 7 files changed, 212 insertions(+), 180 deletions(-) diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst --- a/Doc/c-api/object.rst +++ b/Doc/c-api/object.rst @@ -244,63 +244,82 @@ and ``0`` otherwise. This function always succeeds. -.. c:function:: PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw) +.. c:function:: PyObject* PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) - Call a callable Python object *callable_object*, with arguments given by the - tuple *args*, and named arguments given by the dictionary *kw*. If no named - arguments are needed, *kw* may be *NULL*. *args* must not be *NULL*, use an - empty tuple if no arguments are needed. Returns the result of the call on - success, or *NULL* on failure. This is the equivalent of the Python expression - ``callable_object(*args, **kw)``. + Call a callable Python object *callable*, with arguments given by the + tuple *args*, and named arguments given by the dictionary *kwargs*. + *args* must not be *NULL*, use an empty tuple if no arguments are needed. + If no named arguments are needed, *kwargs* can be *NULL*. -.. c:function:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args) + Returns the result of the call on success, or *NULL* on failure. - Call a callable Python object *callable_object*, with arguments given by the - tuple *args*. If no arguments are needed, then *args* may be *NULL*. Returns - the result of the call on success, or *NULL* on failure. This is the equivalent - of the Python expression ``callable_object(*args)``. + This is the equivalent of the Python expression: + ``callable(*args, **kwargs)``. + + +.. c:function:: PyObject* PyObject_CallObject(PyObject *callable, PyObject *args) + + Call a callable Python object *callable*, with arguments given by the + tuple *args*. If no arguments are needed, then *args* can be *NULL*. + + Returns the result of the call on success, or *NULL* on failure. + + This is the equivalent of the Python expression: ``callable(*args)``. .. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...) Call a callable Python object *callable*, with a variable number of C arguments. The C arguments are described using a :c:func:`Py_BuildValue` style format - string. The format may be *NULL*, indicating that no arguments are provided. - Returns the result of the call on success, or *NULL* on failure. This is the - equivalent of the Python expression ``callable(*args)``. Note that if you only - pass :c:type:`PyObject \*` args, :c:func:`PyObject_CallFunctionObjArgs` is a - faster alternative. + string. The format can be *NULL*, indicating that no arguments are provided. + + Returns the result of the call on success, or *NULL* on failure. + + This is the equivalent of the Python expression: ``callable(*args)``. + + Note that if you only pass :c:type:`PyObject \*` args, + :c:func:`PyObject_CallFunctionObjArgs` is a faster alternative. .. versionchanged:: 3.4 The type of *format* was changed from ``char *``. -.. c:function:: PyObject* PyObject_CallMethod(PyObject *o, const char *method, const char *format, ...) +.. c:function:: PyObject* PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) - Call the method named *method* of object *o* with a variable number of C + Call the method named *name* of object *obj* with a variable number of C arguments. The C arguments are described by a :c:func:`Py_BuildValue` format - string that should produce a tuple. The format may be *NULL*, indicating that - no arguments are provided. Returns the result of the call on success, or *NULL* - on failure. This is the equivalent of the Python expression ``o.method(args)``. + string that should produce a tuple. + + The format can be *NULL*, indicating that no arguments are provided. + + Returns the result of the call on success, or *NULL* on failure. + + This is the equivalent of the Python expression: + ``obj.name(arg1, arg2, ...)``. + Note that if you only pass :c:type:`PyObject \*` args, :c:func:`PyObject_CallMethodObjArgs` is a faster alternative. .. versionchanged:: 3.4 - The types of *method* and *format* were changed from ``char *``. + The types of *name* and *format* were changed from ``char *``. .. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL) Call a callable Python object *callable*, with a variable number of :c:type:`PyObject\*` arguments. The arguments are provided as a variable number - of parameters followed by *NULL*. Returns the result of the call on success, or - *NULL* on failure. + of parameters followed by *NULL*. + Returns the result of the call on success, or *NULL* on failure. -.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL) + This is the equivalent of the Python expression: + ``callable(arg1, arg2, ...)``. - Calls a method of the object *o*, where the name of the method is given as a + +.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *obj, PyObject *name, ..., NULL) + + Calls a method of the Python object *obj*, where the name of the method is given as a Python string object in *name*. It is called with a variable number of :c:type:`PyObject\*` arguments. The arguments are provided as a variable number of parameters followed by *NULL*. Returns the result of the call on success, or diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -265,15 +265,17 @@ This function always succeeds. */ - PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, + /* Call a callable Python object 'callable' with arguments given by the + tuple 'args' and keywords arguments given by the dictionary 'kwargs'. + + 'args' must not be *NULL*, use an empty tuple if no arguments are + needed. If no named arguments are needed, 'kwargs' can be NULL. + + This is the equivalent of the Python expression: + callable(*args, **kwargs). */ + PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs); - /* - Call a callable Python object, callable_object, with - arguments and keywords arguments. The 'args' argument can not be - NULL. - */ - #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyStack_AsTuple( PyObject **stack, @@ -306,7 +308,7 @@ PyObject **kwnames, PyObject *func); - /* Call the callable object func with the "fast call" calling convention: + /* Call the callable object 'callable' with the "fast call" calling convention: args is a C array for positional arguments (nargs is the number of positional arguments), kwargs is a dictionary for keyword arguments. @@ -315,11 +317,11 @@ Return the result on success. Raise an exception on return NULL on error. */ - PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *func, + PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); - /* Call the callable object func with the "fast call" calling convention: + /* Call the callable object 'callable' with the "fast call" calling convention: args is a C array for positional arguments followed by values of keyword arguments. Keys of keyword arguments are stored as a tuple of strings in kwnames. nargs is the number of positional parameters at @@ -335,7 +337,7 @@ Return the result on success. Raise an exception and return NULL on error. */ PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords - (PyObject *func, + (PyObject *callable, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); @@ -346,55 +348,54 @@ #define _PyObject_CallNoArg(func) \ _PyObject_FastCallDict((func), NULL, 0, NULL) - PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *func, + PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *callable, PyObject *obj, PyObject *args, PyObject *kwargs); - PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *func, + PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where); #endif /* Py_LIMITED_API */ - PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, + /* Call a callable Python object 'callable', with arguments given by the + tuple 'args'. If no arguments are needed, then 'args' can be *NULL*. + + Returns the result of the call on success, or *NULL* on failure. + + This is the equivalent of the Python expression: + callable(*args) */ + PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable, PyObject *args); - /* - Call a callable Python object, callable_object, with - arguments given by the tuple, args. If no arguments are - needed, then args may be NULL. Returns the result of the - call on success, or NULL on failure. This is the equivalent - of the Python expression: o(*args). - */ + /* Call a callable Python object, callable, with a variable number of C + arguments. The C arguments are described using a mkvalue-style format + string. - PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object, + The format may be NULL, indicating that no arguments are provided. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + callable(arg1, arg2, ...) */ + PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable, const char *format, ...); - /* - Call a callable Python object, callable_object, with a - variable number of C arguments. The C arguments are described - using a mkvalue-style format string. The format may be NULL, - indicating that no arguments are provided. Returns the - result of the call on success, or NULL on failure. This is - the equivalent of the Python expression: o(*args). - */ + /* Call the method named 'name' of object 'obj' with a variable number of + C arguments. The C arguments are described by a mkvalue format string. + The format can be NULL, indicating that no arguments are provided. - PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, - const char *method, + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + obj.name(arg1, arg2, ...) */ + PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj, + const char *name, const char *format, ...); - /* - Call the method named m of object o with a variable number of - C arguments. The C arguments are described by a mkvalue - format string. The format may be NULL, indicating that no - arguments are provided. Returns the result of the call on - success, or NULL on failure. This is the equivalent of the - Python expression: o.method(args). - */ - #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *o, - _Py_Identifier *method, + PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, + _Py_Identifier *name, const char *format, ...); /* @@ -406,44 +407,45 @@ PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...); - PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o, + PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj, const char *name, const char *format, ...); #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *o, - _Py_Identifier *name, - const char *format, - ...); + PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, + _Py_Identifier *name, + const char *format, + ...); #endif /* !Py_LIMITED_API */ + /* Call a callable Python object 'callable' with a variable number of C + arguments. The C arguments are provided as PyObject* values, terminated + by a NULL. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + callable(arg1, arg2, ...) */ PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, ...); /* - Call a callable Python object, callable_object, with a - variable number of C arguments. The C arguments are provided - as PyObject * values, terminated by a NULL. Returns the - result of the call on success, or NULL on failure. This is - the equivalent of the Python expression: o(*args). + Call the method named 'name' of object 'obj' with a variable number of + C arguments. The C arguments are provided as PyObject * + values, terminated by NULL. Returns the result of the call + on success, or NULL on failure. This is the equivalent of + the Python expression: obj.name(args). */ - - PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, - PyObject *method, ...); + PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *obj, + PyObject *name, + ...); #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *o, - struct _Py_Identifier *method, + PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *obj, + struct _Py_Identifier *name, ...); #endif /* !Py_LIMITED_API */ - /* - Call the method named m of object o with a variable number of - C arguments. The C arguments are provided as PyObject * - values, terminated by NULL. Returns the result of the call - on success, or NULL on failure. This is the equivalent of - the Python expression: o.method(args). - */ /* Implemented elsewhere: diff --git a/Include/ceval.h b/Include/ceval.h --- a/Include/ceval.h +++ b/Include/ceval.h @@ -8,16 +8,18 @@ /* Interface to random parts in ceval.c */ PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( - PyObject *func, PyObject *args, PyObject *kwargs); + PyObject *callable, + PyObject *args, + PyObject *kwargs); /* Inline this */ -#define PyEval_CallObject(func,arg) \ - PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) +#define PyEval_CallObject(callable, arg) \ + PyEval_CallObjectWithKeywords(callable, arg, (PyObject *)NULL) -PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, +PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *callable, const char *format, ...); PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, - const char *methodname, + const char *name, const char *format, ...); #ifndef Py_LIMITED_API diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2173,24 +2173,24 @@ /* XXX PyCallable_Check() is in object.c */ PyObject * -PyObject_CallObject(PyObject *o, PyObject *a) +PyObject_CallObject(PyObject *callable, PyObject *args) { - return PyEval_CallObjectWithKeywords(o, a, NULL); + return PyEval_CallObjectWithKeywords(callable, args, NULL); } PyObject* -_Py_CheckFunctionResult(PyObject *func, PyObject *result, const char *where) +_Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where) { int err_occurred = (PyErr_Occurred() != NULL); - assert((func != NULL) ^ (where != NULL)); + assert((callable != NULL) ^ (where != NULL)); if (result == NULL) { if (!err_occurred) { - if (func) + if (callable) PyErr_Format(PyExc_SystemError, "%R returned NULL without setting an error", - func); + callable); else PyErr_Format(PyExc_SystemError, "%s returned NULL without setting an error", @@ -2206,10 +2206,10 @@ if (err_occurred) { Py_DECREF(result); - if (func) { + if (callable) { _PyErr_FormatFromCause(PyExc_SystemError, "%R returned a result with an error set", - func); + callable); } else { _PyErr_FormatFromCause(PyExc_SystemError, @@ -2227,7 +2227,7 @@ } PyObject * -PyObject_Call(PyObject *func, PyObject *args, PyObject *kwargs) +PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) { ternaryfunc call; PyObject *result; @@ -2239,21 +2239,21 @@ assert(PyTuple_Check(args)); assert(kwargs == NULL || PyDict_Check(kwargs)); - call = func->ob_type->tp_call; + call = callable->ob_type->tp_call; if (call == NULL) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - func->ob_type->tp_name); + callable->ob_type->tp_name); return NULL; } if (Py_EnterRecursiveCall(" while calling a Python object")) return NULL; - result = (*call)(func, args, kwargs); + result = (*call)(callable, args, kwargs); Py_LeaveRecursiveCall(); - return _Py_CheckFunctionResult(func, result, NULL); + return _Py_CheckFunctionResult(callable, result, NULL); } PyObject* @@ -2277,7 +2277,7 @@ } PyObject * -_PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, +_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { ternaryfunc call; @@ -2288,7 +2288,7 @@ caller loses its exception */ assert(!PyErr_Occurred()); - assert(func != NULL); + assert(callable != NULL); assert(nargs >= 0); assert(nargs == 0 || args != NULL); assert(kwargs == NULL || PyDict_Check(kwargs)); @@ -2297,20 +2297,20 @@ return NULL; } - if (PyFunction_Check(func)) { - result = _PyFunction_FastCallDict(func, args, nargs, kwargs); + if (PyFunction_Check(callable)) { + result = _PyFunction_FastCallDict(callable, args, nargs, kwargs); } - else if (PyCFunction_Check(func)) { - result = _PyCFunction_FastCallDict(func, args, nargs, kwargs); + else if (PyCFunction_Check(callable)) { + result = _PyCFunction_FastCallDict(callable, args, nargs, kwargs); } else { PyObject *tuple; /* Slow-path: build a temporary tuple */ - call = func->ob_type->tp_call; + call = callable->ob_type->tp_call; if (call == NULL) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - func->ob_type->tp_name); + callable->ob_type->tp_name); goto exit; } @@ -2319,10 +2319,10 @@ goto exit; } - result = (*call)(func, tuple, kwargs); + result = (*call)(callable, tuple, kwargs); Py_DECREF(tuple); - result = _Py_CheckFunctionResult(func, result, NULL); + result = _Py_CheckFunctionResult(callable, result, NULL); } exit: @@ -2331,9 +2331,10 @@ return result; } -/* Positional arguments are obj followed args. */ +/* Positional arguments are obj followed args: + call callable(obj, *args, **kwargs) */ PyObject * -_PyObject_Call_Prepend(PyObject *func, +_PyObject_Call_Prepend(PyObject *callable, PyObject *obj, PyObject *args, PyObject *kwargs) { PyObject *small_stack[8]; @@ -2361,7 +2362,7 @@ &PyTuple_GET_ITEM(args, 0), argcount * sizeof(PyObject *)); - result = _PyObject_FastCallDict(func, + result = _PyObject_FastCallDict(callable, stack, argcount + 1, kwargs); if (stack != small_stack) { @@ -2452,7 +2453,7 @@ } PyObject * -_PyObject_FastCallKeywords(PyObject *func, PyObject **stack, Py_ssize_t nargs, +_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs, PyObject *kwnames) { PyObject *kwdict, *result; @@ -2465,12 +2466,12 @@ be unique: these are implemented in Python/ceval.c and _PyArg_ParseStack(). */ - if (PyFunction_Check(func)) { - return _PyFunction_FastCallKeywords(func, stack, nargs, kwnames); + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames); } - if (PyCFunction_Check(func)) { - return _PyCFunction_FastCallKeywords(func, stack, nargs, kwnames); + if (PyCFunction_Check(callable)) { + return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames); } if (nkwargs > 0) { @@ -2483,7 +2484,7 @@ kwdict = NULL; } - result = _PyObject_FastCallDict(func, stack, nargs, kwdict); + result = _PyObject_FastCallDict(callable, stack, nargs, kwdict); Py_XDECREF(kwdict); return result; } @@ -2558,19 +2559,19 @@ } static PyObject* -callmethod(PyObject* func, const char *format, va_list va, int is_size_t) +callmethod(PyObject* callable, const char *format, va_list va, int is_size_t) { PyObject *args, *result; - assert(func != NULL); - - if (!PyCallable_Check(func)) { - type_error("attribute of type '%.200s' is not callable", func); + assert(callable != NULL); + + if (!PyCallable_Check(callable)) { + type_error("attribute of type '%.200s' is not callable", callable); return NULL; } if (!format || !*format) { - return _PyObject_CallNoArg(func); + return _PyObject_CallNoArg(callable); } if (is_size_t) { @@ -2583,98 +2584,104 @@ return NULL; } - result = call_function_tail(func, args); + result = call_function_tail(callable, args); Py_DECREF(args); return result; } PyObject * -PyObject_CallMethod(PyObject *o, const char *name, const char *format, ...) +PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) { va_list va; - PyObject *func = NULL; + PyObject *callable = NULL; PyObject *retval = NULL; - if (o == NULL || name == NULL) { + if (obj == NULL || name == NULL) { return null_error(); } - func = PyObject_GetAttrString(o, name); - if (func == NULL) + callable = PyObject_GetAttrString(obj, name); + if (callable == NULL) return NULL; va_start(va, format); - retval = callmethod(func, format, va, 0); + retval = callmethod(callable, format, va, 0); va_end(va); - Py_DECREF(func); + + Py_DECREF(callable); return retval; } PyObject * -_PyObject_CallMethodId(PyObject *o, _Py_Identifier *name, +_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, const char *format, ...) { va_list va; - PyObject *func = NULL; + PyObject *callable = NULL; PyObject *retval = NULL; - if (o == NULL || name == NULL) { + if (obj == NULL || name == NULL) { return null_error(); } - func = _PyObject_GetAttrId(o, name); - if (func == NULL) + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) return NULL; va_start(va, format); - retval = callmethod(func, format, va, 0); + retval = callmethod(callable, format, va, 0); va_end(va); - Py_DECREF(func); + + Py_DECREF(callable); return retval; } PyObject * -_PyObject_CallMethod_SizeT(PyObject *o, const char *name, +_PyObject_CallMethod_SizeT(PyObject *obj, const char *name, const char *format, ...) { va_list va; - PyObject *func = NULL; + PyObject *callable = NULL; PyObject *retval; - if (o == NULL || name == NULL) { + if (obj == NULL || name == NULL) { return null_error(); } - func = PyObject_GetAttrString(o, name); - if (func == NULL) + callable = PyObject_GetAttrString(obj, name); + if (callable == NULL) return NULL; + va_start(va, format); - retval = callmethod(func, format, va, 1); + retval = callmethod(callable, format, va, 1); va_end(va); - Py_DECREF(func); + + Py_DECREF(callable); return retval; } PyObject * -_PyObject_CallMethodId_SizeT(PyObject *o, _Py_Identifier *name, +_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name, const char *format, ...) { va_list va; - PyObject *func = NULL; + PyObject *callable = NULL; PyObject *retval; - if (o == NULL || name == NULL) { + if (obj == NULL || name == NULL) { return null_error(); } - func = _PyObject_GetAttrId(o, name); - if (func == NULL) { + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) { return NULL; } + va_start(va, format); - retval = callmethod(func, format, va, 1); + retval = callmethod(callable, format, va, 1); va_end(va); - Py_DECREF(func); + + Py_DECREF(callable); return retval; } @@ -2756,20 +2763,21 @@ } PyObject * -_PyObject_CallMethodIdObjArgs(PyObject *callable, - struct _Py_Identifier *name, ...) +_PyObject_CallMethodIdObjArgs(PyObject *obj, + struct _Py_Identifier *name, ...) { PyObject *small_stack[5]; PyObject **stack; + PyObject *callable; Py_ssize_t nargs; PyObject *result; va_list vargs; - if (callable == NULL || name == NULL) { + if (obj == NULL || name == NULL) { return null_error(); } - callable = _PyObject_GetAttrId(callable, name); + callable = _PyObject_GetAttrId(obj, name); if (callable == NULL) return NULL; diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1425,15 +1425,15 @@ as lookup_method to cache the interned name string object. */ static PyObject * -call_method(PyObject *o, _Py_Identifier *nameid, const char *format, ...) +call_method(PyObject *obj, _Py_Identifier *name, const char *format, ...) { va_list va; PyObject *func = NULL, *retval; - func = lookup_maybe(o, nameid); + func = lookup_maybe(obj, name); if (func == NULL) { if (!PyErr_Occurred()) - PyErr_SetObject(PyExc_AttributeError, nameid->object); + PyErr_SetObject(PyExc_AttributeError, name->object); return NULL; } @@ -1465,12 +1465,12 @@ /* Clone of call_method() that returns NotImplemented when the lookup fails. */ static PyObject * -call_maybe(PyObject *o, _Py_Identifier *nameid, const char *format, ...) +call_maybe(PyObject *obj, _Py_Identifier *name, const char *format, ...) { va_list va; PyObject *func = NULL, *retval; - func = lookup_maybe(o, nameid); + func = lookup_maybe(obj, name); if (func == NULL) { if (!PyErr_Occurred()) Py_RETURN_NOTIMPLEMENTED; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4637,7 +4637,8 @@ The arg must be a tuple or NULL. The kw must be a dict or NULL. */ PyObject * -PyEval_CallObjectWithKeywords(PyObject *func, PyObject *args, PyObject *kwargs) +PyEval_CallObjectWithKeywords(PyObject *callable, + PyObject *args, PyObject *kwargs) { #ifdef Py_DEBUG /* PyEval_CallObjectWithKeywords() must not be called with an exception @@ -4647,7 +4648,7 @@ #endif if (args == NULL) { - return _PyObject_FastCallDict(func, NULL, 0, kwargs); + return _PyObject_FastCallDict(callable, NULL, 0, kwargs); } if (!PyTuple_Check(args)) { @@ -4662,7 +4663,7 @@ return NULL; } - return PyObject_Call(func, args, kwargs); + return PyObject_Call(callable, args, kwargs); } const char * diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -487,7 +487,7 @@ PyObject * -PyEval_CallFunction(PyObject *obj, const char *format, ...) +PyEval_CallFunction(PyObject *callable, const char *format, ...) { va_list vargs; PyObject *args; @@ -501,7 +501,7 @@ if (args == NULL) return NULL; - res = PyEval_CallObject(obj, args); + res = PyEval_CallObject(callable, args); Py_DECREF(args); return res; @@ -509,14 +509,14 @@ PyObject * -PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...) +PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) { va_list vargs; PyObject *meth; PyObject *args; PyObject *res; - meth = PyObject_GetAttrString(obj, methodname); + meth = PyObject_GetAttrString(obj, name); if (meth == NULL) return NULL; -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Dec 6 10:39:24 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 6 Dec 2016 15:39:24 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python 2.7 2016-12-06 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-12-06 03:46:04 +0000 commit: baf972859ec5 previous commit: 59bd48afa1bc revision date: 2016-12-04 13:42:13 +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.49% 5.54% 7.83% :-) pybench 0.14% 0.44% 6.12% 4.45% :-| regex_v8 0.55% 0.32% -1.93% 10.54% :-) nbody 0.55% 1.69% 9.45% 1.59% :-) json_dump_v2 0.29% -1.57% 2.02% 9.31% :-| normal_startup 0.77% 0.41% 0.17% 2.46% :-) ssbench 0.21% 0.24% 2.30% 2.36% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-2-7-2016-12-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 python-checkins at python.org Tue Dec 6 12:25:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 06 Dec 2016 17:25:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_documentation_for_issue_=2327030_from_3=2E6=2E?= Message-ID: <20161206172544.28672.48223.1D7C197B@psf.io> https://hg.python.org/cpython/rev/5904d2ced3d8 changeset: 105483:5904d2ced3d8 parent: 105481:e6ad41a3f3bd parent: 105482:1b162d6e3d01 user: Serhiy Storchaka date: Tue Dec 06 19:25:19 2016 +0200 summary: Merge documentation for issue #27030 from 3.6. files: Doc/library/re.rst | 7 ++++++- Doc/whatsnew/3.6.rst | 5 +++-- Doc/whatsnew/3.7.rst | 5 +++++ Misc/NEWS | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -758,7 +758,12 @@ Unmatched groups are replaced with an empty string. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. + Unknown escapes in *pattern* consisting of ``'\'`` and an ASCII letter + now are errors. + + .. versionchanged:: 3.7 + Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter + now are errors. .. function:: subn(pattern, repl, string, count=0, flags=0) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2021,8 +2021,9 @@ ------------------------ * Unknown escapes consisting of ``'\'`` and an ASCII letter in - regular expressions will now cause an error. The :const:`re.LOCALE` - flag can now only be used with binary patterns. + regular expressions will now cause an error. In replacement templates for + :func:`re.sub` they are still allowed, but deprecated. + The :const:`re.LOCALE` flag can now only be used with binary patterns. * ``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :func:`inspect.getmodulename` should be used for obtaining the module diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -116,6 +116,11 @@ Removed ======= +API and Feature Removals +------------------------ + +* Unknown escapes consisting of ``'\'`` and an ASCII letter in replacement + templates for :func:`re.sub` will now cause an error. Porting to Python 3.7 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -165,6 +165,9 @@ Library ------- +- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in + re.sub() replacement templates regular expressions now are errors. + - Issue #28835: Fix a regression introduced in warnings.catch_warnings(): call warnings.showwarning() if it was overriden inside the context manager. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 12:25:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 06 Dec 2016 17:25:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI3MDMw?= =?utf-8?q?=3A_Unknown_escapes_in_re=2Esub=28=29_replacement_template_are_?= =?utf-8?q?allowed?= Message-ID: <20161206172544.93840.24027.1E06C582@psf.io> https://hg.python.org/cpython/rev/1b162d6e3d01 changeset: 105482:1b162d6e3d01 branch: 3.6 parent: 105479:a4d4dd411431 user: Serhiy Storchaka date: Tue Dec 06 19:15:29 2016 +0200 summary: Issue #27030: Unknown escapes in re.sub() replacement template are allowed again. But they still are deprecated and will be disabled in 3.7. files: Doc/library/re.rst | 7 ++++++- Doc/whatsnew/3.6.rst | 5 +++-- Lib/sre_parse.py | 4 +++- Lib/test/test_re.py | 2 +- Misc/NEWS | 3 +++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -758,7 +758,12 @@ Unmatched groups are replaced with an empty string. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. + Unknown escapes in *pattern* consisting of ``'\'`` and an ASCII letter + now are errors. + + .. deprecated-removed:: 3.5 3.7 + Unknown escapes in *repl* consist of ``'\'`` and ASCII letter now raise + a deprecation warning and will be forbidden in Python 3.7. .. function:: subn(pattern, repl, string, count=0, flags=0) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -2021,8 +2021,9 @@ ------------------------ * Unknown escapes consisting of ``'\'`` and an ASCII letter in - regular expressions will now cause an error. The :const:`re.LOCALE` - flag can now only be used with binary patterns. + regular expressions will now cause an error. In replacement templates for + :func:`re.sub` they are still allowed, but deprecated. + The :const:`re.LOCALE` flag can now only be used with binary patterns. * ``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :func:`inspect.getmodulename` should be used for obtaining the module diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -947,7 +947,9 @@ this = chr(ESCAPES[this][1]) except KeyError: if c in ASCIILETTERS: - raise s.error('bad escape %s' % this, len(this)) + import warnings + warnings.warn('bad escape %s' % this, + DeprecationWarning, stacklevel=4) lappend(this) else: lappend(this) diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -126,7 +126,7 @@ (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7)+chr(8))) for c in 'cdehijklmopqsuwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ': with self.subTest(c): - with self.assertRaises(re.error): + with self.assertWarns(DeprecationWarning): self.assertEqual(re.sub('a', '\\' + c, 'a'), '\\' + c) self.assertEqual(re.sub(r'^\s*', 'X', 'test'), 'Xtest') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,9 @@ Library ------- +- Issue #27030: Unknown escapes in re.sub() replacement template are allowed + again. But they still are deprecated and will be disabled in 3.7. + - Issue #28835: Fix a regression introduced in warnings.catch_warnings(): call warnings.showwarning() if it was overriden inside the context manager. -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Dec 6 12:35:44 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 6 Dec 2016 17:35:44 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-12-06 Message-ID: <3d88c54a-0c6e-4436-8d37-57fcab478d2b@irsmsx102.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python default, build date 2016-12-06 16:00:01 +0000 commit: fa4d8276d0fb previous commit: d35fc6e58a70 revision date: 2016-12-05 22:24: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.37% -0.08% 3.79% 16.10% :-) pybench 0.32% -0.38% 6.05% 5.12% :-( regex_v8 3.85% -0.01% -2.09% 2.11% :-) nbody 0.13% 0.42% 2.27% 6.02% :-( json_dump_v2 0.29% -2.10% -4.02% 10.39% :-| normal_startup 1.06% 1.21% 1.76% 6.33% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-12-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 Tue Dec 6 12:39:19 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 17:39:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328838=3A_Fix_weir?= =?utf-8?q?d_indentation_of_abstract=2Eh?= Message-ID: <20161206173747.14278.83467.85F2604E@psf.io> https://hg.python.org/cpython/rev/69c7451c3ec1 changeset: 105484:69c7451c3ec1 user: Victor Stinner date: Tue Dec 06 16:55:39 2016 +0100 summary: Issue #28838: Fix weird indentation of abstract.h Remove most indentation to move code at the left. files: Include/abstract.h | 1666 ++++++++++++++++--------------- 1 files changed, 839 insertions(+), 827 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -5,11 +5,11 @@ #endif #ifdef PY_SSIZE_T_CLEAN -#define PyObject_CallFunction _PyObject_CallFunction_SizeT -#define PyObject_CallMethod _PyObject_CallMethod_SizeT -#ifndef Py_LIMITED_API -#define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT -#endif /* !Py_LIMITED_API */ +# define PyObject_CallFunction _PyObject_CallFunction_SizeT +# define PyObject_CallMethod _PyObject_CallMethod_SizeT +# ifndef Py_LIMITED_API +# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT +# endif /* !Py_LIMITED_API */ #endif /* Abstract Object Interface (many thanks to Jim Fulton) */ @@ -28,10 +28,10 @@ the programmer must determine whether the sequence is a list or a tuple: - if(is_tupleobject(o)) - e=gettupleitem(o,i) - else if(is_listitem(o)) - e=getlistitem(o,i) + if (is_tupleobject(o)) + e = gettupleitem(o, i) + else if (is_listitem(o)) + e = getlistitem(o, i) If the programmer wants to get an item from another type of object that provides sequence behavior, there is no clear way to do it @@ -127,220 +127,223 @@ built-in types. Protocols +*/ -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ -/* Object Protocol: */ +/* === Object Protocol ================================================== */ - /* Implemented elsewhere: +/* Implemented elsewhere: - int PyObject_Print(PyObject *o, FILE *fp, int flags); +int PyObject_Print(PyObject *o, FILE *fp, int flags); - Print an object, o, on file, fp. Returns -1 on - error. The flags argument is used to enable certain printing - options. The only option currently supported is Py_Print_RAW. +Print an object, o, on file, fp. Returns -1 on +error. The flags argument is used to enable certain printing +options. The only option currently supported is Py_Print_RAW. - (What should be said about Py_Print_RAW?) +(What should be said about Py_Print_RAW?) - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - int PyObject_HasAttrString(PyObject *o, const char *attr_name); +int PyObject_HasAttrString(PyObject *o, const char *attr_name); - Returns 1 if o has the attribute attr_name, and 0 otherwise. - This is equivalent to the Python expression: - hasattr(o,attr_name). +Returns 1 if o has the attribute attr_name, and 0 otherwise. +This is equivalent to the Python expression: +hasattr(o,attr_name). - This function always succeeds. +This function always succeeds. - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); +PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); - Retrieve an attributed named attr_name form object o. - Returns the attribute value on success, or NULL on failure. - This is the equivalent of the Python expression: o.attr_name. +Retrieve an attributed named attr_name form object o. +Returns the attribute value on success, or NULL on failure. +This is the equivalent of the Python expression: o.attr_name. - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - int PyObject_HasAttr(PyObject *o, PyObject *attr_name); +int PyObject_HasAttr(PyObject *o, PyObject *attr_name); - Returns 1 if o has the attribute attr_name, and 0 otherwise. - This is equivalent to the Python expression: - hasattr(o,attr_name). +Returns 1 if o has the attribute attr_name, and 0 otherwise. +This is equivalent to the Python expression: +hasattr(o,attr_name). - This function always succeeds. +This function always succeeds. - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); +PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); - Retrieve an attributed named attr_name form object o. - Returns the attribute value on success, or NULL on failure. - This is the equivalent of the Python expression: o.attr_name. +Retrieve an attributed named attr_name form object o. +Returns the attribute value on success, or NULL on failure. +This is the equivalent of the Python expression: o.attr_name. - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); +int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); - Set the value of the attribute named attr_name, for object o, - to the value v. Raise an exception and return -1 on failure; return 0 on - success. This is the equivalent of the Python statement o.attr_name=v. +Set the value of the attribute named attr_name, for object o, +to the value v. Raise an exception and return -1 on failure; return 0 on +success. This is the equivalent of the Python statement o.attr_name=v. - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); +int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); - Set the value of the attribute named attr_name, for object o, - to the value v. Raise an exception and return -1 on failure; return 0 on - success. This is the equivalent of the Python statement o.attr_name=v. +Set the value of the attribute named attr_name, for object o, +to the value v. Raise an exception and return -1 on failure; return 0 on +success. This is the equivalent of the Python statement o.attr_name=v. - */ + */ - /* implemented as a macro: +/* implemented as a macro: - int PyObject_DelAttrString(PyObject *o, const char *attr_name); +int PyObject_DelAttrString(PyObject *o, const char *attr_name); - Delete attribute named attr_name, for object o. Returns - -1 on failure. This is the equivalent of the Python - statement: del o.attr_name. +Delete attribute named attr_name, for object o. Returns +-1 on failure. This is the equivalent of the Python +statement: del o.attr_name. - */ + */ #define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL) - /* implemented as a macro: +/* implemented as a macro: - int PyObject_DelAttr(PyObject *o, PyObject *attr_name); +int PyObject_DelAttr(PyObject *o, PyObject *attr_name); - Delete attribute named attr_name, for object o. Returns -1 - on failure. This is the equivalent of the Python - statement: del o.attr_name. +Delete attribute named attr_name, for object o. Returns -1 +on failure. This is the equivalent of the Python +statement: del o.attr_name. - */ + */ #define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) - /* Implemented elsewhere: +/* Implemented elsewhere: - PyObject *PyObject_Repr(PyObject *o); +PyObject *PyObject_Repr(PyObject *o); - Compute the string representation of object, o. Returns the - string representation on success, NULL on failure. This is - the equivalent of the Python expression: repr(o). +Compute the string representation of object, o. Returns the +string representation on success, NULL on failure. This is +the equivalent of the Python expression: repr(o). - Called by the repr() built-in function. +Called by the repr() built-in function. - */ + */ - /* Implemented elsewhere: +/* Implemented elsewhere: - PyObject *PyObject_Str(PyObject *o); +PyObject *PyObject_Str(PyObject *o); - Compute the string representation of object, o. Returns the - string representation on success, NULL on failure. This is - the equivalent of the Python expression: str(o).) +Compute the string representation of object, o. Returns the +string representation on success, NULL on failure. This is +the equivalent of the Python expression: str(o).) - Called by the str() and print() built-in functions. +Called by the str() and print() built-in functions. - */ + */ - /* Declared elsewhere + /* Declared elsewhere - PyAPI_FUNC(int) PyCallable_Check(PyObject *o); +PyAPI_FUNC(int) PyCallable_Check(PyObject *o); - Determine if the object, o, is callable. Return 1 if the - object is callable and 0 otherwise. +Determine if the object, o, is callable. Return 1 if the +object is callable and 0 otherwise. - This function always succeeds. - */ +This function always succeeds. + */ - /* Call a callable Python object 'callable' with arguments given by the - tuple 'args' and keywords arguments given by the dictionary 'kwargs'. +/* Call a callable Python object 'callable' with arguments given by the + tuple 'args' and keywords arguments given by the dictionary 'kwargs'. - 'args' must not be *NULL*, use an empty tuple if no arguments are - needed. If no named arguments are needed, 'kwargs' can be NULL. + 'args' must not be *NULL*, use an empty tuple if no arguments are + needed. If no named arguments are needed, 'kwargs' can be NULL. - This is the equivalent of the Python expression: - callable(*args, **kwargs). */ - PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable, - PyObject *args, PyObject *kwargs); + This is the equivalent of the Python expression: + callable(*args, **kwargs). */ +PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable, + PyObject *args, PyObject *kwargs); + #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject*) _PyStack_AsTuple( - PyObject **stack, - Py_ssize_t nargs); +PyAPI_FUNC(PyObject*) _PyStack_AsTuple( + PyObject **stack, + Py_ssize_t nargs); - /* Convert keyword arguments from the (stack, kwnames) format to a Python - dictionary. +/* Convert keyword arguments from the (stack, kwnames) format to a Python + dictionary. - kwnames must only contains str strings, no subclass, and all keys must - be unique. kwnames is not checked, usually these checks are done before or later - calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an - error if a key is not a string. */ - PyAPI_FUNC(PyObject *) _PyStack_AsDict( - PyObject **values, - PyObject *kwnames); + kwnames must only contains str strings, no subclass, and all keys must + be unique. kwnames is not checked, usually these checks are done before or later + calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an + error if a key is not a string. */ +PyAPI_FUNC(PyObject *) _PyStack_AsDict( + PyObject **values, + PyObject *kwnames); - /* Convert (args, nargs, kwargs) into a (stack, nargs, kwnames). +/* Convert (args, nargs, kwargs) into a (stack, nargs, kwnames). - Return a new stack which should be released by PyMem_Free(), or return - args unchanged if kwargs is NULL or an empty dictionary. + Return a new stack which should be released by PyMem_Free(), or return + args unchanged if kwargs is NULL or an empty dictionary. - The stack uses borrowed references. + The stack uses borrowed references. - The type of keyword keys is not checked, these checks should be done - later (ex: _PyArg_ParseStack). */ - PyAPI_FUNC(PyObject **) _PyStack_UnpackDict( - PyObject **args, - Py_ssize_t nargs, - PyObject *kwargs, - PyObject **kwnames, - PyObject *func); + The type of keyword keys is not checked, these checks should be done + later (ex: _PyArg_ParseStack). */ +PyAPI_FUNC(PyObject **) _PyStack_UnpackDict( + PyObject **args, + Py_ssize_t nargs, + PyObject *kwargs, + PyObject **kwnames, + PyObject *func); - /* Call the callable object 'callable' with the "fast call" calling convention: - args is a C array for positional arguments (nargs is the number of - positional arguments), kwargs is a dictionary for keyword arguments. +/* Call the callable object 'callable' with the "fast call" calling convention: + args is a C array for positional arguments (nargs is the number of + positional arguments), kwargs is a dictionary for keyword arguments. - If nargs is equal to zero, args can be NULL. kwargs can be NULL. - nargs must be greater or equal to zero. + If nargs is equal to zero, args can be NULL. kwargs can be NULL. + nargs must be greater or equal to zero. - Return the result on success. Raise an exception on return NULL on - error. */ - PyAPI_FUNC(PyObject *) _PyObject_FastCallDict(PyObject *callable, - PyObject **args, Py_ssize_t nargs, - PyObject *kwargs); + Return the result on success. Raise an exception on return NULL on + error. */ +PyAPI_FUNC(PyObject *) _PyObject_FastCallDict( + PyObject *callable, + PyObject **args, + Py_ssize_t nargs, + PyObject *kwargs); - /* Call the callable object 'callable' with the "fast call" calling convention: - args is a C array for positional arguments followed by values of - keyword arguments. Keys of keyword arguments are stored as a tuple - of strings in kwnames. nargs is the number of positional parameters at - the beginning of stack. The size of kwnames gives the number of keyword - values in the stack after positional arguments. +/* Call the callable object 'callable' with the "fast call" calling convention: + args is a C array for positional arguments followed by values of + keyword arguments. Keys of keyword arguments are stored as a tuple + of strings in kwnames. nargs is the number of positional parameters at + the beginning of stack. The size of kwnames gives the number of keyword + values in the stack after positional arguments. - kwnames must only contains str strings, no subclass, and all keys must - be unique. + kwnames must only contains str strings, no subclass, and all keys must + be unique. - If nargs is equal to zero and there is no keyword argument (kwnames is - NULL or its size is zero), args can be NULL. + If nargs is equal to zero and there is no keyword argument (kwnames is + NULL or its size is zero), args can be NULL. - Return the result on success. Raise an exception and return NULL on - error. */ - PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords - (PyObject *callable, - PyObject **args, - Py_ssize_t nargs, - PyObject *kwnames); + Return the result on success. Raise an exception and return NULL on + error. */ +PyAPI_FUNC(PyObject *) _PyObject_FastCallKeywords( + PyObject *callable, + PyObject **args, + Py_ssize_t nargs, + PyObject *kwnames); #define _PyObject_FastCall(func, args, nargs) \ _PyObject_FastCallDict((func), (args), (nargs), NULL) @@ -348,793 +351,801 @@ #define _PyObject_CallNoArg(func) \ _PyObject_FastCallDict((func), NULL, 0, NULL) - PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(PyObject *callable, - PyObject *obj, PyObject *args, - PyObject *kwargs); +PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend( + PyObject *callable, + PyObject *obj, + PyObject *args, + PyObject *kwargs); - PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, - PyObject *result, - const char *where); +PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, + PyObject *result, + const char *where); #endif /* Py_LIMITED_API */ - /* Call a callable Python object 'callable', with arguments given by the - tuple 'args'. If no arguments are needed, then 'args' can be *NULL*. - Returns the result of the call on success, or *NULL* on failure. +/* Call a callable Python object 'callable', with arguments given by the + tuple 'args'. If no arguments are needed, then 'args' can be *NULL*. - This is the equivalent of the Python expression: - callable(*args) */ - PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable, - PyObject *args); + Returns the result of the call on success, or *NULL* on failure. - /* Call a callable Python object, callable, with a variable number of C - arguments. The C arguments are described using a mkvalue-style format - string. + This is the equivalent of the Python expression: + callable(*args) */ +PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable, + PyObject *args); - The format may be NULL, indicating that no arguments are provided. +/* Call a callable Python object, callable, with a variable number of C + arguments. The C arguments are described using a mkvalue-style format + string. - Returns the result of the call on success, or NULL on failure. + The format may be NULL, indicating that no arguments are provided. - This is the equivalent of the Python expression: - callable(arg1, arg2, ...) */ - PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable, - const char *format, ...); + Returns the result of the call on success, or NULL on failure. - /* Call the method named 'name' of object 'obj' with a variable number of - C arguments. The C arguments are described by a mkvalue format string. + This is the equivalent of the Python expression: + callable(arg1, arg2, ...) */ +PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable, + const char *format, ...); - The format can be NULL, indicating that no arguments are provided. +/* Call the method named 'name' of object 'obj' with a variable number of + C arguments. The C arguments are described by a mkvalue format string. - Returns the result of the call on success, or NULL on failure. + The format can be NULL, indicating that no arguments are provided. - This is the equivalent of the Python expression: - obj.name(arg1, arg2, ...) */ - PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj, - const char *name, - const char *format, ...); + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: + obj.name(arg1, arg2, ...) */ +PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj, + const char *name, + const char *format, ...); #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, - _Py_Identifier *name, - const char *format, ...); +PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, + _Py_Identifier *name, + const char *format, ...); - /* - Like PyObject_CallMethod, but expect a _Py_Identifier* as the - method name. - */ +/* + Like PyObject_CallMethod, but expect a _Py_Identifier* as the + method name. +*/ #endif /* !Py_LIMITED_API */ - PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, - const char *format, - ...); - PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj, - const char *name, - const char *format, - ...); +PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, + const char *format, + ...); + +PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *obj, + const char *name, + const char *format, + ...); + #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, - _Py_Identifier *name, - const char *format, - ...); +PyAPI_FUNC(PyObject *) _PyObject_CallMethodId_SizeT(PyObject *obj, + _Py_Identifier *name, + const char *format, + ...); #endif /* !Py_LIMITED_API */ - /* Call a callable Python object 'callable' with a variable number of C - arguments. The C arguments are provided as PyObject* values, terminated - by a NULL. +/* Call a callable Python object 'callable' with a variable number of C + arguments. The C arguments are provided as PyObject* values, terminated + by a NULL. - Returns the result of the call on success, or NULL on failure. + Returns the result of the call on success, or NULL on failure. - This is the equivalent of the Python expression: - callable(arg1, arg2, ...) */ - PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, - ...); + This is the equivalent of the Python expression: + callable(arg1, arg2, ...) */ +PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, + ...); - /* - Call the method named 'name' of object 'obj' with a variable number of - C arguments. The C arguments are provided as PyObject * - values, terminated by NULL. Returns the result of the call - on success, or NULL on failure. This is the equivalent of - the Python expression: obj.name(args). - */ + /* +Call the method named 'name' of object 'obj' with a variable number of +C arguments. The C arguments are provided as PyObject * +values, terminated by NULL. Returns the result of the call +on success, or NULL on failure. This is the equivalent of +the Python expression: obj.name(args). + */ - PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *obj, - PyObject *name, - ...); +PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs( + PyObject *obj, + PyObject *name, + ...); + #ifndef Py_LIMITED_API - PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs(PyObject *obj, - struct _Py_Identifier *name, - ...); +PyAPI_FUNC(PyObject *) _PyObject_CallMethodIdObjArgs( + PyObject *obj, + struct _Py_Identifier *name, + ...); #endif /* !Py_LIMITED_API */ +/* Implemented elsewhere: - /* Implemented elsewhere: +long PyObject_Hash(PyObject *o); - long PyObject_Hash(PyObject *o); +Compute and return the hash, hash_value, of an object, o. On +failure, return -1. This is the equivalent of the Python +expression: hash(o). + */ - Compute and return the hash, hash_value, of an object, o. On - failure, return -1. This is the equivalent of the Python - expression: hash(o). - */ +/* Implemented elsewhere: - /* Implemented elsewhere: +int PyObject_IsTrue(PyObject *o); - int PyObject_IsTrue(PyObject *o); +Returns 1 if the object, o, is considered to be true, 0 if o is +considered to be false and -1 on failure. This is equivalent to the +Python expression: not not o + */ - Returns 1 if the object, o, is considered to be true, 0 if o is - considered to be false and -1 on failure. This is equivalent to the - Python expression: not not o - */ +/* Implemented elsewhere: - /* Implemented elsewhere: +int PyObject_Not(PyObject *o); - int PyObject_Not(PyObject *o); +Returns 0 if the object, o, is considered to be true, 1 if o is +considered to be false and -1 on failure. This is equivalent to the +Python expression: not o + */ - Returns 0 if the object, o, is considered to be true, 1 if o is - considered to be false and -1 on failure. This is equivalent to the - Python expression: not o - */ +PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); - PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); + /* +On success, returns a type object corresponding to the object +type of object o. On failure, returns NULL. This is +equivalent to the Python expression: type(o). + */ - /* - On success, returns a type object corresponding to the object - type of object o. On failure, returns NULL. This is - equivalent to the Python expression: type(o). - */ +PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); - PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); + /* +Return the size of object o. If the object, o, provides +both sequence and mapping protocols, the sequence size is +returned. On error, -1 is returned. This is the equivalent +to the Python expression: len(o). + */ - /* - Return the size of object o. If the object, o, provides - both sequence and mapping protocols, the sequence size is - returned. On error, -1 is returned. This is the equivalent - to the Python expression: len(o). - */ - - /* For DLL compatibility */ +/* For DLL compatibility */ #undef PyObject_Length - PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); +PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size #ifndef Py_LIMITED_API - PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); - PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); +PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); +PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); #endif - /* - Guess the size of object o using len(o) or o.__length_hint__(). - If neither of those return a non-negative value, then return the - default value. If one of the calls fails, this function returns -1. - */ + /* +Guess the size of object o using len(o) or o.__length_hint__(). +If neither of those return a non-negative value, then return the +default value. If one of the calls fails, this function returns -1. + */ - PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); +PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); - /* - Return element of o corresponding to the object, key, or NULL - on failure. This is the equivalent of the Python expression: - o[key]. - */ + /* +Return element of o corresponding to the object, key, or NULL +on failure. This is the equivalent of the Python expression: +o[key]. + */ - PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); +PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); - /* - Map the object key to the value v. Raise an exception and return -1 - on failure; return 0 on success. This is the equivalent of the Python - statement o[key]=v. - */ + /* +Map the object key to the value v. Raise an exception and return -1 +on failure; return 0 on success. This is the equivalent of the Python +statement o[key]=v. + */ - PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key); +PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key); - /* - Remove the mapping for object, key, from the object *o. - Returns -1 on failure. This is equivalent to - the Python statement: del o[key]. - */ + /* +Remove the mapping for object, key, from the object *o. +Returns -1 on failure. This is equivalent to +the Python statement: del o[key]. + */ - PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); +PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); - /* - Delete the mapping for key from *o. Returns -1 on failure. - This is the equivalent of the Python statement: del o[key]. - */ + /* +Delete the mapping for key from *o. Returns -1 on failure. +This is the equivalent of the Python statement: del o[key]. + */ - /* old buffer API - FIXME: usage of these should all be replaced in Python itself - but for backwards compatibility we will implement them. - Their usage without a corresponding "unlock" mechanism - may create issues (but they would already be there). */ +/* old buffer API + FIXME: usage of these should all be replaced in Python itself + but for backwards compatibility we will implement them. + Their usage without a corresponding "unlock" mechanism + may create issues (but they would already be there). */ - PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, - const char **buffer, - Py_ssize_t *buffer_len) - Py_DEPRECATED(3.0); +PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, + const char **buffer, + Py_ssize_t *buffer_len) + Py_DEPRECATED(3.0); - /* - Takes an arbitrary object which must support the (character, - single segment) buffer interface and returns a pointer to a - read-only memory location useable as character based input - for subsequent processing. + /* +Takes an arbitrary object which must support the (character, +single segment) buffer interface and returns a pointer to a +read-only memory location useable as character based input +for subsequent processing. - 0 is returned on success. buffer and buffer_len are only - set in case no error occurs. Otherwise, -1 is returned and - an exception set. - */ +0 is returned on success. buffer and buffer_len are only +set in case no error occurs. Otherwise, -1 is returned and +an exception set. + */ - PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj) - Py_DEPRECATED(3.0); +PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj) + Py_DEPRECATED(3.0); - /* - Checks whether an arbitrary object supports the (character, - single segment) buffer interface. Returns 1 on success, 0 - on failure. - */ +/* +Checks whether an arbitrary object supports the (character, +single segment) buffer interface. Returns 1 on success, 0 +on failure. +*/ - PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, - const void **buffer, - Py_ssize_t *buffer_len) - Py_DEPRECATED(3.0); +PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, + const void **buffer, + Py_ssize_t *buffer_len) + Py_DEPRECATED(3.0); - /* - Same as PyObject_AsCharBuffer() except that this API expects - (readable, single segment) buffer interface and returns a - pointer to a read-only memory location which can contain - arbitrary data. + /* +Same as PyObject_AsCharBuffer() except that this API expects +(readable, single segment) buffer interface and returns a +pointer to a read-only memory location which can contain +arbitrary data. - 0 is returned on success. buffer and buffer_len are only - set in case no error occurs. Otherwise, -1 is returned and - an exception set. - */ +0 is returned on success. buffer and buffer_len are only +set in case no error occurs. Otherwise, -1 is returned and +an exception set. + */ - PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, - void **buffer, - Py_ssize_t *buffer_len) - Py_DEPRECATED(3.0); +PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, + void **buffer, + Py_ssize_t *buffer_len) + Py_DEPRECATED(3.0); - /* - Takes an arbitrary object which must support the (writable, - single segment) buffer interface and returns a pointer to a - writable memory location in buffer of size buffer_len. + /* +Takes an arbitrary object which must support the (writable, +single segment) buffer interface and returns a pointer to a +writable memory location in buffer of size buffer_len. - 0 is returned on success. buffer and buffer_len are only - set in case no error occurs. Otherwise, -1 is returned and - an exception set. - */ +0 is returned on success. buffer and buffer_len are only +set in case no error occurs. Otherwise, -1 is returned and +an exception set. + */ - /* new buffer API */ +/* new buffer API */ #ifndef Py_LIMITED_API #define PyObject_CheckBuffer(obj) \ (((obj)->ob_type->tp_as_buffer != NULL) && \ ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) - /* Return 1 if the getbuffer function is available, otherwise - return 0 */ +/* Return 1 if the getbuffer function is available, otherwise + return 0 */ - PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, - int flags); +PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, + int flags); - /* This is a C-API version of the getbuffer function call. It checks - to make sure object has the required function pointer and issues the - call. Returns -1 and raises an error on failure and returns 0 on - success - */ +/* This is a C-API version of the getbuffer function call. It checks + to make sure object has the required function pointer and issues the + call. Returns -1 and raises an error on failure and returns 0 on + success +*/ +PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); - PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); +/* Get the memory area pointed to by the indices for the buffer given. + Note that view->ndim is the assumed size of indices +*/ - /* Get the memory area pointed to by the indices for the buffer given. - Note that view->ndim is the assumed size of indices - */ +PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); - PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); +/* Return the implied itemsize of the data-format area from a + struct-style description */ - /* Return the implied itemsize of the data-format area from a - struct-style description */ +/* Implementation in memoryobject.c */ +PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, + Py_ssize_t len, char order); - /* Implementation in memoryobject.c */ - PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, - Py_ssize_t len, char order); +PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, + Py_ssize_t len, char order); - PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, - Py_ssize_t len, char order); +/* Copy len bytes of data from the contiguous chunk of memory + pointed to by buf into the buffer exported by obj. Return + 0 on success and return -1 and raise a PyBuffer_Error on + error (i.e. the object does not have a buffer interface or + it is not working). - /* Copy len bytes of data from the contiguous chunk of memory - pointed to by buf into the buffer exported by obj. Return - 0 on success and return -1 and raise a PyBuffer_Error on - error (i.e. the object does not have a buffer interface or - it is not working). + If fort is 'F', then if the object is multi-dimensional, + then the data will be copied into the array in + Fortran-style (first dimension varies the fastest). If + fort is 'C', then the data will be copied into the array + in C-style (last dimension varies the fastest). If fort + is 'A', then it does not matter and the copy will be made + in whatever way is more efficient. - If fort is 'F', then if the object is multi-dimensional, - then the data will be copied into the array in - Fortran-style (first dimension varies the fastest). If - fort is 'C', then the data will be copied into the array - in C-style (last dimension varies the fastest). If fort - is 'A', then it does not matter and the copy will be made - in whatever way is more efficient. +*/ - */ +PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); - PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); +/* Copy the data from the src buffer to the buffer of destination + */ - /* Copy the data from the src buffer to the buffer of destination - */ +PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort); - PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort); +PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, + Py_ssize_t *shape, + Py_ssize_t *strides, + int itemsize, + char fort); - PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, - Py_ssize_t *shape, - Py_ssize_t *strides, - int itemsize, - char fort); +/* Fill the strides array with byte-strides of a contiguous + (Fortran-style if fort is 'F' or C-style otherwise) + array of the given shape with the given number of bytes + per element. +*/ - /* Fill the strides array with byte-strides of a contiguous - (Fortran-style if fort is 'F' or C-style otherwise) - array of the given shape with the given number of bytes - per element. - */ +PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, + Py_ssize_t len, int readonly, + int flags); - PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, - Py_ssize_t len, int readonly, - int flags); +/* Fills in a buffer-info structure correctly for an exporter + that can only share a contiguous chunk of memory of + "unsigned bytes" of the given length. Returns 0 on success + and -1 (with raising an error) on error. + */ - /* Fills in a buffer-info structure correctly for an exporter - that can only share a contiguous chunk of memory of - "unsigned bytes" of the given length. Returns 0 on success - and -1 (with raising an error) on error. - */ +PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); - PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); - - /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. - */ +/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. + */ #endif /* Py_LIMITED_API */ - PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, - PyObject *format_spec); - /* - Takes an arbitrary object and returns the result of - calling obj.__format__(format_spec). - */ +PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, + PyObject *format_spec); + /* +Takes an arbitrary object and returns the result of +calling obj.__format__(format_spec). + */ /* Iterators */ - PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); - /* Takes an object and returns an iterator for it. - This is typically a new iterator but if the argument - is an iterator, this returns itself. */ +PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); + /* Takes an object and returns an iterator for it. +This is typically a new iterator but if the argument +is an iterator, this returns itself. */ #define PyIter_Check(obj) \ ((obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) - PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); - /* Takes an iterator object and calls its tp_iternext slot, - returning the next value. If the iterator is exhausted, - this returns NULL without setting an exception. - NULL with an exception means an error occurred. */ +PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); + /* Takes an iterator object and calls its tp_iternext slot, +returning the next value. If the iterator is exhausted, +this returns NULL without setting an exception. +NULL with an exception means an error occurred. */ -/* Number Protocol:*/ - PyAPI_FUNC(int) PyNumber_Check(PyObject *o); +/* === Number Protocol ================================================== */ - /* - Returns 1 if the object, o, provides numeric protocols, and - false otherwise. +PyAPI_FUNC(int) PyNumber_Check(PyObject *o); - This function always succeeds. - */ + /* +Returns 1 if the object, o, provides numeric protocols, and +false otherwise. - PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); +This function always succeeds. + */ - /* - Returns the result of adding o1 and o2, or null on failure. - This is the equivalent of the Python expression: o1+o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); + /* +Returns the result of adding o1 and o2, or null on failure. +This is the equivalent of the Python expression: o1+o2. + */ - /* - Returns the result of subtracting o2 from o1, or null on - failure. This is the equivalent of the Python expression: - o1-o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); + /* +Returns the result of subtracting o2 from o1, or null on +failure. This is the equivalent of the Python expression: +o1-o2. + */ - /* - Returns the result of multiplying o1 and o2, or null on - failure. This is the equivalent of the Python expression: - o1*o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); + /* +Returns the result of multiplying o1 and o2, or null on +failure. This is the equivalent of the Python expression: +o1*o2. + */ - /* - This is the equivalent of the Python expression: o1 @ o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); + /* +This is the equivalent of the Python expression: o1 @ o2. + */ - /* - Returns the result of dividing o1 by o2 giving an integral result, - or null on failure. - This is the equivalent of the Python expression: o1//o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); + /* +Returns the result of dividing o1 by o2 giving an integral result, +or null on failure. +This is the equivalent of the Python expression: o1//o2. + */ - /* - Returns the result of dividing o1 by o2 giving a float result, - or null on failure. - This is the equivalent of the Python expression: o1/o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); + /* +Returns the result of dividing o1 by o2 giving a float result, +or null on failure. +This is the equivalent of the Python expression: o1/o2. + */ - /* - Returns the remainder of dividing o1 by o2, or null on - failure. This is the equivalent of the Python expression: - o1%o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); + /* +Returns the remainder of dividing o1 by o2, or null on +failure. This is the equivalent of the Python expression: +o1%o2. + */ - /* - See the built-in function divmod. Returns NULL on failure. - This is the equivalent of the Python expression: - divmod(o1,o2). - */ +PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, - PyObject *o3); + /* +See the built-in function divmod. Returns NULL on failure. +This is the equivalent of the Python expression: +divmod(o1,o2). + */ - /* - See the built-in function pow. Returns NULL on failure. - This is the equivalent of the Python expression: - pow(o1,o2,o3), where o3 is optional. - */ +PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, + PyObject *o3); - PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); + /* +See the built-in function pow. Returns NULL on failure. +This is the equivalent of the Python expression: +pow(o1,o2,o3), where o3 is optional. + */ - /* - Returns the negation of o on success, or null on failure. - This is the equivalent of the Python expression: -o. - */ +PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); - PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); + /* +Returns the negation of o on success, or null on failure. +This is the equivalent of the Python expression: -o. + */ - /* - Returns the (what?) of o on success, or NULL on failure. - This is the equivalent of the Python expression: +o. - */ +PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); - PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); + /* +Returns the (what?) of o on success, or NULL on failure. +This is the equivalent of the Python expression: +o. + */ - /* - Returns the absolute value of o, or null on failure. This is - the equivalent of the Python expression: abs(o). - */ +PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); - PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); + /* +Returns the absolute value of o, or null on failure. This is +the equivalent of the Python expression: abs(o). + */ - /* - Returns the bitwise negation of o on success, or NULL on - failure. This is the equivalent of the Python expression: - ~o. - */ +PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); - PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); + /* +Returns the bitwise negation of o on success, or NULL on +failure. This is the equivalent of the Python expression: +~o. + */ - /* - Returns the result of left shifting o1 by o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1 << o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); + /* +Returns the result of left shifting o1 by o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1 << o2. + */ - /* - Returns the result of right shifting o1 by o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1 >> o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); + /* +Returns the result of right shifting o1 by o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1 >> o2. + */ - /* - Returns the result of bitwise and of o1 and o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1&o2. +PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); - */ + /* +Returns the result of bitwise and of o1 and o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1&o2. - PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); + */ - /* - Returns the bitwise exclusive or of o1 by o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1^o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); - PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); + /* +Returns the bitwise exclusive or of o1 by o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1^o2. + */ - /* - Returns the result of bitwise or on o1 and o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1|o2. - */ +PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); + + /* +Returns the result of bitwise or on o1 and o2 on success, or +NULL on failure. This is the equivalent of the Python +expression: o1|o2. + */ #define PyIndex_Check(obj) \ ((obj)->ob_type->tp_as_number != NULL && \ (obj)->ob_type->tp_as_number->nb_index != NULL) - PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); +PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); - /* - Returns the object converted to a Python int - or NULL with an error raised on failure. - */ + /* +Returns the object converted to a Python int +or NULL with an error raised on failure. + */ - PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); +PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); - /* - Returns the object converted to Py_ssize_t by going through - PyNumber_Index first. If an overflow error occurs while - converting the int to Py_ssize_t, then the second argument - is the error-type to return. If it is NULL, then the overflow error - is cleared and the value is clipped. - */ + /* +Returns the object converted to Py_ssize_t by going through +PyNumber_Index first. If an overflow error occurs while +converting the int to Py_ssize_t, then the second argument +is the error-type to return. If it is NULL, then the overflow error +is cleared and the value is clipped. + */ - PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); +PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); - /* - Returns the o converted to an integer object on success, or - NULL on failure. This is the equivalent of the Python - expression: int(o). - */ + /* +Returns the o converted to an integer object on success, or +NULL on failure. This is the equivalent of the Python +expression: int(o). + */ - PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); +PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); - /* - Returns the o converted to a float object on success, or NULL - on failure. This is the equivalent of the Python expression: - float(o). - */ + /* +Returns the o converted to a float object on success, or NULL +on failure. This is the equivalent of the Python expression: +float(o). + */ + /* In-place variants of (some of) the above number protocol functions */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); - /* - Returns the result of adding o2 to o1, possibly in-place, or null - on failure. This is the equivalent of the Python expression: - o1 += o2. - */ + /* +Returns the result of adding o2 to o1, possibly in-place, or null +on failure. This is the equivalent of the Python expression: +o1 += o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); - /* - Returns the result of subtracting o2 from o1, possibly in-place or - null on failure. This is the equivalent of the Python expression: - o1 -= o2. - */ + /* +Returns the result of subtracting o2 from o1, possibly in-place or +null on failure. This is the equivalent of the Python expression: +o1 -= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); - /* - Returns the result of multiplying o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 *= o2. - */ + /* +Returns the result of multiplying o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 *= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); - /* - This is the equivalent of the Python expression: o1 @= o2. - */ + /* +This is the equivalent of the Python expression: o1 @= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, - PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, + PyObject *o2); - /* - Returns the result of dividing o1 by o2 giving an integral result, - possibly in-place, or null on failure. - This is the equivalent of the Python expression: - o1 /= o2. - */ + /* +Returns the result of dividing o1 by o2 giving an integral result, +possibly in-place, or null on failure. +This is the equivalent of the Python expression: +o1 /= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, - PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, + PyObject *o2); - /* - Returns the result of dividing o1 by o2 giving a float result, - possibly in-place, or null on failure. - This is the equivalent of the Python expression: - o1 /= o2. - */ + /* +Returns the result of dividing o1 by o2 giving a float result, +possibly in-place, or null on failure. +This is the equivalent of the Python expression: +o1 /= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); - /* - Returns the remainder of dividing o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 %= o2. - */ + /* +Returns the remainder of dividing o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 %= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, - PyObject *o3); +PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, + PyObject *o3); - /* - Returns the result of raising o1 to the power of o2, possibly - in-place, or null on failure. This is the equivalent of the Python - expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. - */ + /* +Returns the result of raising o1 to the power of o2, possibly +in-place, or null on failure. This is the equivalent of the Python +expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); - /* - Returns the result of left shifting o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 <<= o2. - */ + /* +Returns the result of left shifting o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 <<= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); - /* - Returns the result of right shifting o1 by o2, possibly in-place or - null on failure. This is the equivalent of the Python expression: - o1 >>= o2. - */ + /* +Returns the result of right shifting o1 by o2, possibly in-place or +null on failure. This is the equivalent of the Python expression: +o1 >>= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); - /* - Returns the result of bitwise and of o1 and o2, possibly in-place, - or null on failure. This is the equivalent of the Python - expression: o1 &= o2. - */ + /* +Returns the result of bitwise and of o1 and o2, possibly in-place, +or null on failure. This is the equivalent of the Python +expression: o1 &= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); - /* - Returns the bitwise exclusive or of o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 ^= o2. - */ + /* +Returns the bitwise exclusive or of o1 by o2, possibly in-place, or +null on failure. This is the equivalent of the Python expression: +o1 ^= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); - /* - Returns the result of bitwise or of o1 and o2, possibly in-place, - or null on failure. This is the equivalent of the Python - expression: o1 |= o2. - */ + /* +Returns the result of bitwise or of o1 and o2, possibly in-place, +or null on failure. This is the equivalent of the Python +expression: o1 |= o2. + */ - PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); +PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); - /* - Returns the integer n converted to a string with a base, with a base - marker of 0b, 0o or 0x prefixed if applicable. - If n is not an int object, it is converted with PyNumber_Index first. - */ + /* +Returns the integer n converted to a string with a base, with a base +marker of 0b, 0o or 0x prefixed if applicable. +If n is not an int object, it is converted with PyNumber_Index first. + */ -/* Sequence protocol:*/ +/* === Sequence protocol ================================================ */ - PyAPI_FUNC(int) PySequence_Check(PyObject *o); +PyAPI_FUNC(int) PySequence_Check(PyObject *o); - /* - Return 1 if the object provides sequence protocol, and zero - otherwise. + /* +Return 1 if the object provides sequence protocol, and zero +otherwise. - This function always succeeds. - */ +This function always succeeds. + */ - PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); +PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); - /* - Return the size of sequence object o, or -1 on failure. - */ + /* +Return the size of sequence object o, or -1 on failure. + */ - /* For DLL compatibility */ +/* For DLL compatibility */ #undef PySequence_Length PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); #define PySequence_Length PySequence_Size - PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); - /* - Return the concatenation of o1 and o2 on success, and NULL on - failure. This is the equivalent of the Python - expression: o1+o2. - */ + /* +Return the concatenation of o1 and o2 on success, and NULL on +failure. This is the equivalent of the Python +expression: o1+o2. + */ - PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); +PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); - /* - Return the result of repeating sequence object o count times, - or NULL on failure. This is the equivalent of the Python - expression: o1*count. - */ + /* +Return the result of repeating sequence object o count times, +or NULL on failure. This is the equivalent of the Python +expression: o1*count. + */ - PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); +PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); - /* - Return the ith element of o, or NULL on failure. This is the - equivalent of the Python expression: o[i]. - */ + /* +Return the ith element of o, or NULL on failure. This is the +equivalent of the Python expression: o[i]. + */ - PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); +PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); - /* - Return the slice of sequence object o between i1 and i2, or - NULL on failure. This is the equivalent of the Python - expression: o[i1:i2]. - */ + /* +Return the slice of sequence object o between i1 and i2, or +NULL on failure. This is the equivalent of the Python +expression: o[i1:i2]. + */ - PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); +PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); - /* - Assign object v to the ith element of o. Raise an exception and return - -1 on failure; return 0 on success. This is the equivalent of the - Python statement o[i]=v. - */ + /* +Assign object v to the ith element of o. Raise an exception and return +-1 on failure; return 0 on success. This is the equivalent of the +Python statement o[i]=v. + */ - PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); +PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); - /* - Delete the ith element of object v. Returns - -1 on failure. This is the equivalent of the Python - statement: del o[i]. - */ + /* +Delete the ith element of object v. Returns +-1 on failure. This is the equivalent of the Python +statement: del o[i]. + */ - PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, - PyObject *v); +PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, + PyObject *v); - /* - Assign the sequence object, v, to the slice in sequence - object, o, from i1 to i2. Returns -1 on failure. This is the - equivalent of the Python statement: o[i1:i2]=v. - */ + /* +Assign the sequence object, v, to the slice in sequence +object, o, from i1 to i2. Returns -1 on failure. This is the +equivalent of the Python statement: o[i1:i2]=v. + */ - PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); +PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); - /* - Delete the slice in sequence object, o, from i1 to i2. - Returns -1 on failure. This is the equivalent of the Python - statement: del o[i1:i2]. - */ + /* +Delete the slice in sequence object, o, from i1 to i2. +Returns -1 on failure. This is the equivalent of the Python +statement: del o[i1:i2]. + */ - PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); +PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); - /* - Returns the sequence, o, as a tuple on success, and NULL on failure. - This is equivalent to the Python expression: tuple(o) - */ + /* +Returns the sequence, o, as a tuple on success, and NULL on failure. +This is equivalent to the Python expression: tuple(o) + */ - PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); - /* - Returns the sequence, o, as a list on success, and NULL on failure. - This is equivalent to the Python expression: list(o) - */ +PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); + /* +Returns the sequence, o, as a list on success, and NULL on failure. +This is equivalent to the Python expression: list(o) + */ - PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); - /* - Return the sequence, o, as a list, unless it's already a - tuple or list. Use PySequence_Fast_GET_ITEM to access the - members of this list, and PySequence_Fast_GET_SIZE to get its length. +PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); + /* +Return the sequence, o, as a list, unless it's already a +tuple or list. Use PySequence_Fast_GET_ITEM to access the +members of this list, and PySequence_Fast_GET_SIZE to get its length. - Returns NULL on failure. If the object does not support iteration, - raises a TypeError exception with m as the message text. - */ +Returns NULL on failure. If the object does not support iteration, +raises a TypeError exception with m as the message text. + */ #define PySequence_Fast_GET_SIZE(o) \ (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) @@ -1159,189 +1170,190 @@ #define PySequence_Fast_ITEMS(sf) \ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ : ((PyTupleObject *)(sf))->ob_item) - /* Return a pointer to the underlying item array for - an object retured by PySequence_Fast */ +/* Return a pointer to the underlying item array for + an object retured by PySequence_Fast */ - PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); +PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); - /* - Return the number of occurrences on value on o, that is, - return the number of keys for which o[key]==value. On - failure, return -1. This is equivalent to the Python - expression: o.count(value). - */ + /* +Return the number of occurrences on value on o, that is, +return the number of keys for which o[key]==value. On +failure, return -1. This is equivalent to the Python +expression: o.count(value). + */ - PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); - /* - Return -1 if error; 1 if ob in seq; 0 if ob not in seq. - Use __contains__ if possible, else _PySequence_IterSearch(). - */ +PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); + /* +Return -1 if error; 1 if ob in seq; 0 if ob not in seq. +Use __contains__ if possible, else _PySequence_IterSearch(). + */ #ifndef Py_LIMITED_API #define PY_ITERSEARCH_COUNT 1 #define PY_ITERSEARCH_INDEX 2 #define PY_ITERSEARCH_CONTAINS 3 - PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, - PyObject *obj, int operation); +PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, + PyObject *obj, int operation); #endif - /* - Iterate over seq. Result depends on the operation: - PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if - error. - PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of - obj in seq; set ValueError and return -1 if none found; - also return -1 on error. - PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on - error. - */ +/* + Iterate over seq. Result depends on the operation: + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. +*/ /* For DLL-level backwards compatibility */ #undef PySequence_In - PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); +PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); /* For source-level backwards compatibility */ #define PySequence_In PySequence_Contains - /* - Determine if o contains value. If an item in o is equal to - X, return 1, otherwise return 0. On error, return -1. This - is equivalent to the Python expression: value in o. - */ + /* +Determine if o contains value. If an item in o is equal to +X, return 1, otherwise return 0. On error, return -1. This +is equivalent to the Python expression: value in o. + */ - PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); +PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); - /* - Return the first index for which o[i]=value. On error, - return -1. This is equivalent to the Python - expression: o.index(value). - */ + /* +Return the first index for which o[i]=value. On error, +return -1. This is equivalent to the Python +expression: o.index(value). + */ + /* In-place versions of some of the above Sequence functions. */ - PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); +PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); - /* - Append o2 to o1, in-place when possible. Return the resulting - object, which could be o1, or NULL on failure. This is the - equivalent of the Python expression: o1 += o2. + /* +Append o2 to o1, in-place when possible. Return the resulting +object, which could be o1, or NULL on failure. This is the +equivalent of the Python expression: o1 += o2. - */ + */ - PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); +PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); - /* - Repeat o1 by count, in-place when possible. Return the resulting - object, which could be o1, or NULL on failure. This is the - equivalent of the Python expression: o1 *= count. + /* +Repeat o1 by count, in-place when possible. Return the resulting +object, which could be o1, or NULL on failure. This is the +equivalent of the Python expression: o1 *= count. - */ + */ /* Mapping protocol:*/ - PyAPI_FUNC(int) PyMapping_Check(PyObject *o); +PyAPI_FUNC(int) PyMapping_Check(PyObject *o); - /* - Return 1 if the object provides mapping protocol, and zero - otherwise. + /* +Return 1 if the object provides mapping protocol, and zero +otherwise. - This function always succeeds. - */ +This function always succeeds. + */ - PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); +PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); - /* - Returns the number of keys in object o on success, and -1 on - failure. For objects that do not provide sequence protocol, - this is equivalent to the Python expression: len(o). - */ + /* +Returns the number of keys in object o on success, and -1 on +failure. For objects that do not provide sequence protocol, +this is equivalent to the Python expression: len(o). + */ - /* For DLL compatibility */ +/* For DLL compatibility */ #undef PyMapping_Length - PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); +PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); #define PyMapping_Length PyMapping_Size - /* implemented as a macro: +/* implemented as a macro: - int PyMapping_DelItemString(PyObject *o, const char *key); +int PyMapping_DelItemString(PyObject *o, const char *key); - Remove the mapping for object, key, from the object *o. - Returns -1 on failure. This is equivalent to - the Python statement: del o[key]. - */ +Remove the mapping for object, key, from the object *o. +Returns -1 on failure. This is equivalent to +the Python statement: del o[key]. + */ #define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) - /* implemented as a macro: +/* implemented as a macro: - int PyMapping_DelItem(PyObject *o, PyObject *key); +int PyMapping_DelItem(PyObject *o, PyObject *key); - Remove the mapping for object, key, from the object *o. - Returns -1 on failure. This is equivalent to - the Python statement: del o[key]. - */ +Remove the mapping for object, key, from the object *o. +Returns -1 on failure. This is equivalent to +the Python statement: del o[key]. + */ #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) - PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key); +PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key); - /* - On success, return 1 if the mapping object has the key, key, - and 0 otherwise. This is equivalent to the Python expression: - key in o. + /* +On success, return 1 if the mapping object has the key, key, +and 0 otherwise. This is equivalent to the Python expression: +key in o. - This function always succeeds. - */ +This function always succeeds. + */ - PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); +PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); - /* - Return 1 if the mapping object has the key, key, - and 0 otherwise. This is equivalent to the Python expression: - key in o. + /* +Return 1 if the mapping object has the key, key, +and 0 otherwise. This is equivalent to the Python expression: +key in o. - This function always succeeds. +This function always succeeds. - */ + */ - PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o); +PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o); - /* - On success, return a list or tuple of the keys in object o. - On failure, return NULL. - */ + /* +On success, return a list or tuple of the keys in object o. +On failure, return NULL. + */ - PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o); +PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o); - /* - On success, return a list or tuple of the values in object o. - On failure, return NULL. - */ + /* +On success, return a list or tuple of the values in object o. +On failure, return NULL. + */ - PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o); +PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o); - /* - On success, return a list or tuple of the items in object o, - where each item is a tuple containing a key-value pair. - On failure, return NULL. + /* +On success, return a list or tuple of the items in object o, +where each item is a tuple containing a key-value pair. +On failure, return NULL. - */ + */ - PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, - const char *key); +PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, + const char *key); - /* - Return element of o corresponding to the object, key, or NULL - on failure. This is the equivalent of the Python expression: - o[key]. - */ + /* +Return element of o corresponding to the object, key, or NULL +on failure. This is the equivalent of the Python expression: +o[key]. + */ - PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key, - PyObject *value); +PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key, + PyObject *value); - /* - Map the object, key, to the value, v. Returns - -1 on failure. This is the equivalent of the Python - statement: o[key]=v. - */ + /* +Map the object, key, to the value, v. Returns +-1 on failure. This is the equivalent of the Python +statement: o[key]=v. + */ PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 12:48:12 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 17:48:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallNoAr?= =?utf-8?b?Zygp?= Message-ID: <20161206174811.21479.82182.A51A66C6@psf.io> https://hg.python.org/cpython/rev/57379d7f8e46 changeset: 105486:57379d7f8e46 user: Victor Stinner date: Tue Dec 06 18:46:19 2016 +0100 summary: Use _PyObject_CallNoArg() Replace: PyObject_CallFunctionObjArgs(callable, NULL) with: _PyObject_CallNoArg(callable) files: Modules/_asynciomodule.c | 2 +- Modules/_ctypes/_ctypes.c | 2 +- Modules/_ctypes/callbacks.c | 2 +- Modules/_ssl.c | 2 +- Modules/mathmodule.c | 6 +++--- Modules/posixmodule.c | 4 ++-- Objects/abstract.c | 2 +- Objects/bytesobject.c | 4 ++-- Objects/complexobject.c | 2 +- Objects/enumobject.c | 2 +- Objects/object.c | 4 ++-- Objects/odictobject.c | 2 +- Python/bltinmodule.c | 2 +- Python/ceval.c | 4 ++-- Python/sysmodule.c | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1948,7 +1948,7 @@ if (!exc) { /* exc was not a CancelledError */ - exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL); + exc = _PyObject_CallNoArg(asyncio_CancelledError); if (!exc) { goto fail; } diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -5258,7 +5258,7 @@ CDataObject *result; if (0 == cast_check_pointertype(ctype)) return NULL; - result = (CDataObject *)PyObject_CallFunctionObjArgs(ctype, NULL); + result = (CDataObject *)_PyObject_CallNoArg(ctype); if (result == NULL) return NULL; diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -181,7 +181,7 @@ */ } else if (dict) { /* Hm, shouldn't we use PyCData_AtAddress() or something like that instead? */ - CDataObject *obj = (CDataObject *)PyObject_CallFunctionObjArgs(cnv, NULL); + CDataObject *obj = (CDataObject *)_PyObject_CallNoArg(cnv); if (!obj) { PrintError("create argument %d:\n", i); Py_DECREF(cnv); diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -3197,7 +3197,7 @@ PySSL_END_ALLOW_THREADS_S(pw_info->thread_state); if (pw_info->callable) { - fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL); + fn_ret = _PyObject_CallNoArg(pw_info->callable); if (!fn_ret) { /* TODO: It would be nice to move _ctypes_add_traceback() into the core python API, so we could use it to add a frame here */ diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -951,7 +951,7 @@ return NULL; return math_1_to_int(number, ceil, 0); } - result = PyObject_CallFunctionObjArgs(method, NULL); + result = _PyObject_CallNoArg(method); Py_DECREF(method); return result; } @@ -991,7 +991,7 @@ return NULL; return math_1_to_int(number, floor, 0); } - result = PyObject_CallFunctionObjArgs(method, NULL); + result = _PyObject_CallNoArg(method); Py_DECREF(method); return result; } @@ -1542,7 +1542,7 @@ Py_TYPE(number)->tp_name); return NULL; } - result = PyObject_CallFunctionObjArgs(trunc, NULL); + result = _PyObject_CallNoArg(trunc); Py_DECREF(trunc); return result; } diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -902,7 +902,7 @@ goto error_exit; } - o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL); + o = to_cleanup = _PyObject_CallNoArg(func); Py_DECREF(func); if (NULL == o) { goto error_exit; @@ -12046,7 +12046,7 @@ Py_TYPE(path)->tp_name); } - path_repr = PyObject_CallFunctionObjArgs(func, NULL); + path_repr = _PyObject_CallNoArg(func); Py_DECREF(func); if (NULL == path_repr) { return NULL; diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -103,7 +103,7 @@ } return defaultvalue; } - result = PyObject_CallFunctionObjArgs(hint, NULL); + result = _PyObject_CallNoArg(hint); Py_DECREF(hint); if (result == NULL) { if (PyErr_ExceptionMatches(PyExc_TypeError)) { diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -549,7 +549,7 @@ /* does it support __bytes__? */ func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { - result = PyObject_CallFunctionObjArgs(func, NULL); + result = _PyObject_CallNoArg(func); Py_DECREF(func); if (result == NULL) return NULL; @@ -2569,7 +2569,7 @@ PyObject_Bytes doesn't do. */ func = _PyObject_LookupSpecial(x, &PyId___bytes__); if (func != NULL) { - new = PyObject_CallFunctionObjArgs(func, NULL); + new = _PyObject_CallNoArg(func); Py_DECREF(func); if (new == NULL) return NULL; diff --git a/Objects/complexobject.c b/Objects/complexobject.c --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -273,7 +273,7 @@ f = _PyObject_LookupSpecial(op, &PyId___complex__); if (f) { - PyObject *res = PyObject_CallFunctionObjArgs(f, NULL); + PyObject *res = _PyObject_CallNoArg(f); Py_DECREF(f); if (res != NULL && !PyComplex_Check(res)) { PyErr_SetString(PyExc_TypeError, diff --git a/Objects/enumobject.c b/Objects/enumobject.c --- a/Objects/enumobject.c +++ b/Objects/enumobject.c @@ -258,7 +258,7 @@ return NULL; } if (reversed_meth != NULL) { - PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL); + PyObject *res = _PyObject_CallNoArg(reversed_meth); Py_DECREF(reversed_meth); return res; } diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -596,7 +596,7 @@ func = _PyObject_LookupSpecial(v, &PyId___bytes__); if (func != NULL) { - result = PyObject_CallFunctionObjArgs(func, NULL); + result = _PyObject_CallNoArg(func); Py_DECREF(func); if (result == NULL) return NULL; @@ -1314,7 +1314,7 @@ return NULL; } /* use __dir__ */ - result = PyObject_CallFunctionObjArgs(dirfunc, NULL); + result = _PyObject_CallNoArg(dirfunc); Py_DECREF(dirfunc); if (result == NULL) return NULL; diff --git a/Objects/odictobject.c b/Objects/odictobject.c --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1256,7 +1256,7 @@ if (PyODict_CheckExact(od)) od_copy = PyODict_New(); else - od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL); + od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od)); if (od_copy == NULL) return NULL; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2074,7 +2074,7 @@ } if (ndigits == NULL || ndigits == Py_None) - result = PyObject_CallFunctionObjArgs(round, NULL); + result = _PyObject_CallNoArg(round); else result = PyObject_CallFunctionObjArgs(round, ndigits, NULL); Py_DECREF(round); diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3062,7 +3062,7 @@ Py_DECREF(mgr); if (enter == NULL) goto error; - res = PyObject_CallFunctionObjArgs(enter, NULL); + res = _PyObject_CallNoArg(enter); Py_DECREF(enter); if (res == NULL) goto error; @@ -3096,7 +3096,7 @@ } SET_TOP(exit); Py_DECREF(mgr); - res = PyObject_CallFunctionObjArgs(enter, NULL); + res = _PyObject_CallNoArg(enter); Py_DECREF(enter); if (res == NULL) goto error; diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1098,7 +1098,7 @@ Py_TYPE(o)->tp_name); } else { - res = PyObject_CallFunctionObjArgs(method, NULL); + res = _PyObject_CallNoArg(method); Py_DECREF(method); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 12:48:12 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 17:48:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallNoAr?= =?utf-8?b?Zygp?= Message-ID: <20161206174811.21345.90761.2804A5C6@psf.io> https://hg.python.org/cpython/rev/54a89144ee1d changeset: 105485:54a89144ee1d user: Victor Stinner date: Tue Dec 06 18:45:50 2016 +0100 summary: Use _PyObject_CallNoArg() Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable) files: Modules/_asynciomodule.c | 12 ++++++------ Modules/_ctypes/_ctypes.c | 8 ++++---- Modules/_ctypes/stgdict.c | 2 +- Modules/_decimal/_decimal.c | 16 ++++++++-------- Modules/_functoolsmodule.c | 2 +- Modules/_testcapimodule.c | 2 +- Modules/main.c | 2 +- Objects/dictobject.c | 2 +- Objects/typeobject.c | 10 +++++----- Parser/tokenizer.c | 6 +++--- Python/ceval.c | 4 ++-- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -141,7 +141,7 @@ _Py_IDENTIFIER(get_debug); if (loop == NULL || loop == Py_None) { - loop = PyObject_CallObject(asyncio_get_event_loop, NULL); + loop = _PyObject_CallNoArg(asyncio_get_event_loop); if (loop == NULL) { return -1; } @@ -158,7 +158,7 @@ } if (PyObject_IsTrue(res)) { Py_CLEAR(res); - fut->fut_source_tb = PyObject_CallObject(traceback_extract_stack, NULL); + fut->fut_source_tb = _PyObject_CallNoArg(traceback_extract_stack); if (fut->fut_source_tb == NULL) { return -1; } @@ -204,7 +204,7 @@ } if (PyExceptionClass_Check(exc)) { - exc_val = PyObject_CallObject(exc, NULL); + exc_val = _PyObject_CallNoArg(exc); if (exc_val == NULL) { return NULL; } @@ -1429,7 +1429,7 @@ PyObject *res; if (loop == NULL) { - loop = PyObject_CallObject(asyncio_get_event_loop, NULL); + loop = _PyObject_CallNoArg(asyncio_get_event_loop); if (loop == NULL) { return NULL; } @@ -1514,7 +1514,7 @@ PyObject *res; if (loop == NULL) { - loop = PyObject_CallObject(asyncio_get_event_loop, NULL); + loop = _PyObject_CallNoArg(asyncio_get_event_loop); if (loop == NULL) { return NULL; } @@ -2387,7 +2387,7 @@ WITH_MOD("weakref") GET_MOD_ATTR(cls, "WeakSet") - all_tasks = PyObject_CallObject(cls, NULL); + all_tasks = _PyObject_CallNoArg(cls); Py_CLEAR(cls); if (all_tasks == NULL) { goto fail; diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -211,7 +211,7 @@ PyObject *proxy; int result; - obj = PyObject_CallObject((PyObject *)&DictRemover_Type, NULL); + obj = _PyObject_CallNoArg((PyObject *)&DictRemover_Type); if (obj == NULL) return -1; @@ -373,7 +373,7 @@ if (PyDict_GetItemString(result->tp_dict, "_abstract_")) return (PyObject *)result; - dict = (StgDictObject *)PyObject_CallObject((PyObject *)&PyCStgDict_Type, NULL); + dict = (StgDictObject *)_PyObject_CallNoArg((PyObject *)&PyCStgDict_Type); if (!dict) { Py_DECREF(result); return NULL; @@ -3654,10 +3654,10 @@ goto error; } if (PyCArrayTypeObject_Check(ob)) - ob = PyObject_CallObject(ob, NULL); + ob = _PyObject_CallNoArg(ob); else /* Create an instance of the pointed-to type */ - ob = PyObject_CallObject(dict->proto, NULL); + ob = _PyObject_CallNoArg(dict->proto); /* XXX Is the following correct any longer? We must not pass a byref() to the array then but diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c --- a/Modules/_ctypes/stgdict.c +++ b/Modules/_ctypes/stgdict.c @@ -228,7 +228,7 @@ } continue; } - new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&PyCField_Type, NULL); + new_descr = (CFieldObject *)_PyObject_CallNoArg((PyObject *)&PyCField_Type); if (new_descr == NULL) { Py_DECREF(fdescr); Py_DECREF(fieldlist); diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -1194,13 +1194,13 @@ return NULL; } - self->traps = PyObject_CallObject((PyObject *)PyDecSignalDict_Type, NULL); + self->traps = _PyObject_CallNoArg((PyObject *)PyDecSignalDict_Type); if (self->traps == NULL) { self->flags = NULL; Py_DECREF(self); return NULL; } - self->flags = PyObject_CallObject((PyObject *)PyDecSignalDict_Type, NULL); + self->flags = _PyObject_CallNoArg((PyObject *)PyDecSignalDict_Type); if (self->flags == NULL) { Py_DECREF(self); return NULL; @@ -1395,7 +1395,7 @@ goto error; } - context = PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL); + context = _PyObject_CallNoArg((PyObject *)&PyDecContext_Type); if (context == NULL) { return NULL; } @@ -1417,7 +1417,7 @@ { PyObject *copy; - copy = PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL); + copy = _PyObject_CallNoArg((PyObject *)&PyDecContext_Type); if (copy == NULL) { return NULL; } @@ -5835,7 +5835,7 @@ /* Init default context template first */ ASSIGN_PTR(default_context_template, - PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL)); + _PyObject_CallNoArg((PyObject *)&PyDecContext_Type)); Py_INCREF(default_context_template); CHECK_INT(PyModule_AddObject(m, "DefaultContext", default_context_template)); @@ -5843,7 +5843,7 @@ #ifdef WITHOUT_THREADS /* Init module context */ ASSIGN_PTR(module_context, - PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL)); + _PyObject_CallNoArg((PyObject *)&PyDecContext_Type)); Py_INCREF(Py_False); CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_False)); #else @@ -5854,7 +5854,7 @@ /* Init basic context template */ ASSIGN_PTR(basic_context_template, - PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL)); + _PyObject_CallNoArg((PyObject *)&PyDecContext_Type)); init_basic_context(basic_context_template); Py_INCREF(basic_context_template); CHECK_INT(PyModule_AddObject(m, "BasicContext", @@ -5862,7 +5862,7 @@ /* Init extended context template */ ASSIGN_PTR(extended_context_template, - PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL)); + _PyObject_CallNoArg((PyObject *)&PyDecContext_Type)); init_extended_context(extended_context_template); Py_INCREF(extended_context_template); CHECK_INT(PyModule_AddObject(m, "ExtendedContext", diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -1246,7 +1246,7 @@ if (m == NULL) return NULL; - kwd_mark = PyObject_CallObject((PyObject *)&PyBaseObject_Type, NULL); + kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type); if (!kwd_mark) { Py_DECREF(m); return NULL; diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2277,7 +2277,7 @@ { /* we assume the argument is callable object to which we own a reference */ PyObject *callable = (PyObject *)arg; - PyObject *r = PyObject_CallObject(callable, NULL); + PyObject *r = _PyObject_CallNoArg(callable); Py_DECREF(callable); Py_XDECREF(r); return r != NULL ? 0 : -1; diff --git a/Modules/main.c b/Modules/main.c --- a/Modules/main.c +++ b/Modules/main.c @@ -157,7 +157,7 @@ if (hook == NULL) PyErr_Clear(); else { - result = PyObject_CallObject(hook, NULL); + result = _PyObject_CallNoArg(hook); Py_DECREF(hook); if (result == NULL) goto error; diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1843,7 +1843,7 @@ PyObject *d; int status; - d = PyObject_CallObject(cls, NULL); + d = _PyObject_CallNoArg(cls); if (d == NULL) return NULL; diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1856,7 +1856,7 @@ PyObject *mro_meth = lookup_method((PyObject *)type, &PyId_mro); if (mro_meth == NULL) return NULL; - mro_result = PyObject_CallObject(mro_meth, NULL); + mro_result = _PyObject_CallNoArg(mro_meth); Py_DECREF(mro_meth); } else { @@ -4032,7 +4032,7 @@ Py_DECREF(slotnames); } else { /* getstate != NULL */ - state = PyObject_CallObject(getstate, NULL); + state = _PyObject_CallNoArg(getstate); Py_DECREF(getstate); if (state == NULL) return NULL; @@ -4057,7 +4057,7 @@ __getnewargs_ex__ on the object. */ getnewargs_ex = _PyObject_LookupSpecial(obj, &PyId___getnewargs_ex__); if (getnewargs_ex != NULL) { - PyObject *newargs = PyObject_CallObject(getnewargs_ex, NULL); + PyObject *newargs = _PyObject_CallNoArg(getnewargs_ex); Py_DECREF(getnewargs_ex); if (newargs == NULL) { return -1; @@ -4110,7 +4110,7 @@ __getnewargs__ instead. */ getnewargs = _PyObject_LookupSpecial(obj, &PyId___getnewargs__); if (getnewargs != NULL) { - *args = PyObject_CallObject(getnewargs, NULL); + *args = _PyObject_CallNoArg(getnewargs); Py_DECREF(getnewargs); if (*args == NULL) { return -1; @@ -4362,7 +4362,7 @@ override = (clsreduce != objreduce); Py_DECREF(clsreduce); if (override) { - res = PyObject_CallObject(reduce, NULL); + res = _PyObject_CallNoArg(reduce); Py_DECREF(reduce); return res; } diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -440,7 +440,7 @@ } else { - bufobj = PyObject_CallObject(tok->decoding_readline, NULL); + bufobj = _PyObject_CallNoArg(tok->decoding_readline); if (bufobj == NULL) goto error; } @@ -533,7 +533,7 @@ Py_XSETREF(tok->decoding_readline, readline); if (pos > 0) { - PyObject *bufobj = PyObject_CallObject(readline, NULL); + PyObject *bufobj = _PyObject_CallNoArg(readline); if (bufobj == NULL) return 0; Py_DECREF(bufobj); @@ -650,7 +650,7 @@ } else { PyObject* buf = tok->decoding_buffer; if (buf == NULL) { - buf = PyObject_CallObject(tok->decoding_readline, NULL); + buf = _PyObject_CallNoArg(tok->decoding_readline); if (buf == NULL) { error_ret(tok); return 1; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4198,7 +4198,7 @@ if (PyExceptionClass_Check(exc)) { type = exc; - value = PyObject_CallObject(exc, NULL); + value = _PyObject_CallNoArg(exc); if (value == NULL) goto raise_error; if (!PyExceptionInstance_Check(value)) { @@ -4229,7 +4229,7 @@ if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); + fixed_cause = _PyObject_CallNoArg(cause); if (fixed_cause == NULL) goto raise_error; Py_DECREF(cause); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 12:49:24 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 17:49:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_typo_in_a_comment_of_a?= =?utf-8?q?bstract=2Ec?= Message-ID: <20161206174919.30812.27006.C8FE0577@psf.io> https://hg.python.org/cpython/rev/330b608edd3c changeset: 105487:330b608edd3c user: Victor Stinner date: Tue Dec 06 18:49:15 2016 +0100 summary: Fix typo in a comment of abstract.c files: Objects/abstract.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2463,7 +2463,7 @@ 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: these are implemented in Python/ceval.c and + be unique: these checks are implemented in Python/ceval.c and _PyArg_ParseStack(). */ if (PyFunction_Check(callable)) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 17:02:24 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 06 Dec 2016 22:02:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Update_the_Mac?= =?utf-8?q?_installer_README_file_for_3=2E6=2E0=2E?= Message-ID: <20161206220223.117179.74286.46C5D1BB@psf.io> https://hg.python.org/cpython/rev/c0f59410ccfc changeset: 105488:c0f59410ccfc branch: 3.6 parent: 105482:1b162d6e3d01 user: Ned Deily date: Tue Dec 06 17:00:44 2016 -0500 summary: Update the Mac installer README file for 3.6.0. files: Mac/BuildScript/resources/ReadMe.rtf | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf --- a/Mac/BuildScript/resources/ReadMe.rtf +++ b/Mac/BuildScript/resources/ReadMe.rtf @@ -1,7 +1,7 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf390 +{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf750 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;} {\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;\csgray\c100000;} +{\*\expandedcolortbl;;} \margl1440\margr1440\vieww13380\viewh14600\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 @@ -37,13 +37,13 @@ \i security \i0 command line utility are no longer used as defaults by the Python \f1 ssl -\f0 module. For 3.6.0b1, a sample command script is included in +\f0 module. For 3.6.0, a sample command script is included in \f1 /Applications/Python 3.6 \f0 to install a curated bundle of default root certificates from the third-party \f1 certifi \f0 package ({\field{\*\fldinst{HYPERLINK "https://pypi.python.org/pypi/certifi"}}{\fldrslt https://pypi.python.org/pypi/certifi}}). If you choose to use \f1 certifi -\f0 , you should consider subscribing to the{\field{\*\fldinst{HYPERLINK "https://certifi.io/en/latest/"}}{\fldrslt project's email update service}} to be notified when the certificate bundle is updated. More options will be provided prior to the final release of 3.6.0.\ +\f0 , you should consider subscribing to the{\field{\*\fldinst{HYPERLINK "https://certifi.io/en/latest/"}}{\fldrslt project's email update service}} to be notified when the certificate bundle is updated.\ \ The bundled \f1 pip @@ -58,7 +58,7 @@ \i Tcl/Tk \i0 frameworks. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of \i Tcl/Tk -\i0 for this version of Python and of Mac OS X. For the initial preview releases of Python 3.6, the installer is still linked with Tcl/Tk 8.5; this will likely change prior to the final release of 3.6.0.\ +\i0 for this version of Python and of Mac OS X. For the initial release of Python 3.6, the installer is still linked with Tcl/Tk 8.5.\ \b \ul \ Other changes\ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 17:02:24 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 06 Dec 2016 22:02: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: <20161206220223.28103.33759.C3F71E52@psf.io> https://hg.python.org/cpython/rev/92432636b2f9 changeset: 105489:92432636b2f9 parent: 105487:330b608edd3c parent: 105488:c0f59410ccfc user: Ned Deily date: Tue Dec 06 17:02:03 2016 -0500 summary: Merge from 3.6 files: Mac/BuildScript/resources/ReadMe.rtf | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf --- a/Mac/BuildScript/resources/ReadMe.rtf +++ b/Mac/BuildScript/resources/ReadMe.rtf @@ -1,7 +1,7 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf390 +{\rtf1\ansi\ansicpg1252\cocoartf1504\cocoasubrtf750 {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;} {\colortbl;\red255\green255\blue255;} -{\*\expandedcolortbl;\csgray\c100000;} +{\*\expandedcolortbl;;} \margl1440\margr1440\vieww13380\viewh14600\viewkind0 \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0 @@ -37,13 +37,13 @@ \i security \i0 command line utility are no longer used as defaults by the Python \f1 ssl -\f0 module. For 3.6.0b1, a sample command script is included in +\f0 module. For 3.6.0, a sample command script is included in \f1 /Applications/Python 3.6 \f0 to install a curated bundle of default root certificates from the third-party \f1 certifi \f0 package ({\field{\*\fldinst{HYPERLINK "https://pypi.python.org/pypi/certifi"}}{\fldrslt https://pypi.python.org/pypi/certifi}}). If you choose to use \f1 certifi -\f0 , you should consider subscribing to the{\field{\*\fldinst{HYPERLINK "https://certifi.io/en/latest/"}}{\fldrslt project's email update service}} to be notified when the certificate bundle is updated. More options will be provided prior to the final release of 3.6.0.\ +\f0 , you should consider subscribing to the{\field{\*\fldinst{HYPERLINK "https://certifi.io/en/latest/"}}{\fldrslt project's email update service}} to be notified when the certificate bundle is updated.\ \ The bundled \f1 pip @@ -58,7 +58,7 @@ \i Tcl/Tk \i0 frameworks. Visit {\field{\*\fldinst{HYPERLINK "https://www.python.org/download/mac/tcltk/"}}{\fldrslt https://www.python.org/download/mac/tcltk/}} for current information about supported and recommended versions of \i Tcl/Tk -\i0 for this version of Python and of Mac OS X. For the initial preview releases of Python 3.6, the installer is still linked with Tcl/Tk 8.5; this will likely change prior to the final release of 3.6.0.\ +\i0 for this version of Python and of Mac OS X. For the initial release of Python 3.6, the installer is still linked with Tcl/Tk 8.5.\ \b \ul \ Other changes\ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 17:15:26 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 06 Dec 2016 22:15:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328835=3A_merge_from_3=2E6?= Message-ID: <20161206221526.28204.4652.3853588E@psf.io> https://hg.python.org/cpython/rev/7bca3bf6401a changeset: 105491:7bca3bf6401a parent: 105489:92432636b2f9 parent: 105490:aaee06743c61 user: Ned Deily date: Tue Dec 06 17:13:58 2016 -0500 summary: Issue #28835: merge from 3.6 files: Lib/warnings.py | 53 ++++++++++++++++++------------------ 1 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Lib/warnings.py b/Lib/warnings.py --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -80,32 +80,40 @@ return s # Keep a reference to check if the function was replaced -_showwarning = showwarning +_showwarning_orig = showwarning def _showwarnmsg(msg): """Hook to write a warning to a file; replace if you like.""" - showwarning = globals().get('showwarning', _showwarning) - if showwarning is not _showwarning: - # warnings.showwarning() was replaced - if not callable(showwarning): - raise TypeError("warnings.showwarning() must be set to a " - "function or method") + try: + sw = showwarning + except NameError: + pass + else: + if sw is not _showwarning_orig: + # warnings.showwarning() was replaced + if not callable(sw): + raise TypeError("warnings.showwarning() must be set to a " + "function or method") - showwarning(msg.message, msg.category, msg.filename, msg.lineno, - msg.file, msg.line) - return + sw(msg.message, msg.category, msg.filename, msg.lineno, + msg.file, msg.line) + return _showwarnmsg_impl(msg) # Keep a reference to check if the function was replaced -_formatwarning = formatwarning +_formatwarning_orig = formatwarning def _formatwarnmsg(msg): """Function to format a warning the standard way.""" - formatwarning = globals().get('formatwarning', _formatwarning) - if formatwarning is not _formatwarning: - # warnings.formatwarning() was replaced - return formatwarning(msg.message, msg.category, - msg.filename, msg.lineno, line=msg.line) + try: + fw = formatwarning + except NameError: + pass + else: + if fw is not _formatwarning_orig: + # warnings.formatwarning() was replaced + return fw(msg.message, msg.category, + msg.filename, msg.lineno, line=msg.line) return _formatwarnmsg_impl(msg) def filterwarnings(action, message="", category=Warning, module="", lineno=0, @@ -446,21 +454,13 @@ self._module.filters = self._filters[:] self._module._filters_mutated() self._showwarning = self._module.showwarning - self._showwarnmsg = self._module._showwarnmsg self._showwarnmsg_impl = self._module._showwarnmsg_impl if self._record: log = [] - - def showarnmsg_logger(msg): - nonlocal log - log.append(msg) - - self._module._showwarnmsg_impl = showarnmsg_logger - + self._module._showwarnmsg_impl = log.append # Reset showwarning() to the default implementation to make sure # that _showwarnmsg() calls _showwarnmsg_impl() - self._module.showwarning = self._module._showwarning - + self._module.showwarning = self._module._showwarning_orig return log else: return None @@ -471,7 +471,6 @@ self._module.filters = self._filters self._module._filters_mutated() self._module.showwarning = self._showwarning - self._module._showwarnmsg = self._showwarnmsg self._module._showwarnmsg_impl = self._showwarnmsg_impl -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 17:15:26 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 06 Dec 2016 22:15:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODM1?= =?utf-8?q?=3A_Tidy_previous_showwarning_changes_based_on_review_comments?= =?utf-8?q?=2E?= Message-ID: <20161206221526.72372.76095.1D46770B@psf.io> https://hg.python.org/cpython/rev/aaee06743c61 changeset: 105490:aaee06743c61 branch: 3.6 parent: 105488:c0f59410ccfc user: Ned Deily date: Tue Dec 06 17:12:47 2016 -0500 summary: Issue #28835: Tidy previous showwarning changes based on review comments. Patch by Serhiy Storchaka. files: Lib/warnings.py | 53 ++++++++++++++++++------------------ 1 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Lib/warnings.py b/Lib/warnings.py --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -80,32 +80,40 @@ return s # Keep a reference to check if the function was replaced -_showwarning = showwarning +_showwarning_orig = showwarning def _showwarnmsg(msg): """Hook to write a warning to a file; replace if you like.""" - showwarning = globals().get('showwarning', _showwarning) - if showwarning is not _showwarning: - # warnings.showwarning() was replaced - if not callable(showwarning): - raise TypeError("warnings.showwarning() must be set to a " - "function or method") + try: + sw = showwarning + except NameError: + pass + else: + if sw is not _showwarning_orig: + # warnings.showwarning() was replaced + if not callable(sw): + raise TypeError("warnings.showwarning() must be set to a " + "function or method") - showwarning(msg.message, msg.category, msg.filename, msg.lineno, - msg.file, msg.line) - return + sw(msg.message, msg.category, msg.filename, msg.lineno, + msg.file, msg.line) + return _showwarnmsg_impl(msg) # Keep a reference to check if the function was replaced -_formatwarning = formatwarning +_formatwarning_orig = formatwarning def _formatwarnmsg(msg): """Function to format a warning the standard way.""" - formatwarning = globals().get('formatwarning', _formatwarning) - if formatwarning is not _formatwarning: - # warnings.formatwarning() was replaced - return formatwarning(msg.message, msg.category, - msg.filename, msg.lineno, line=msg.line) + try: + fw = formatwarning + except NameError: + pass + else: + if fw is not _formatwarning_orig: + # warnings.formatwarning() was replaced + return fw(msg.message, msg.category, + msg.filename, msg.lineno, line=msg.line) return _formatwarnmsg_impl(msg) def filterwarnings(action, message="", category=Warning, module="", lineno=0, @@ -446,21 +454,13 @@ self._module.filters = self._filters[:] self._module._filters_mutated() self._showwarning = self._module.showwarning - self._showwarnmsg = self._module._showwarnmsg self._showwarnmsg_impl = self._module._showwarnmsg_impl if self._record: log = [] - - def showarnmsg_logger(msg): - nonlocal log - log.append(msg) - - self._module._showwarnmsg_impl = showarnmsg_logger - + self._module._showwarnmsg_impl = log.append # Reset showwarning() to the default implementation to make sure # that _showwarnmsg() calls _showwarnmsg_impl() - self._module.showwarning = self._module._showwarning - + self._module.showwarning = self._module._showwarning_orig return log else: return None @@ -471,7 +471,6 @@ self._module.filters = self._filters self._module._filters_mutated() self._module.showwarning = self._showwarning - self._module._showwarnmsg = self._showwarnmsg self._module._showwarnmsg_impl = self._showwarnmsg_impl -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 17:33:39 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 06 Dec 2016 22:33:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Regenerate_con?= =?utf-8?q?figure_with_autoconf_2=2E69=2E?= Message-ID: <20161206223337.117179.28322.E0D37B6F@psf.io> https://hg.python.org/cpython/rev/8de7771a0d2a changeset: 105492:8de7771a0d2a branch: 3.6 parent: 105490:aaee06743c61 user: Ned Deily date: Tue Dec 06 17:31:32 2016 -0500 summary: Regenerate configure with autoconf 2.69. files: configure | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -784,7 +784,6 @@ docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -895,7 +894,6 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1148,15 +1146,6 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1294,7 +1283,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1447,7 +1436,6 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 17:33:38 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 06 Dec 2016 22:33:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Regenerate_configure_with_autoconf_2=2E69=2E?= Message-ID: <20161206223338.117519.13805.01248DAD@psf.io> https://hg.python.org/cpython/rev/6a578f58bd44 changeset: 105493:6a578f58bd44 parent: 105491:7bca3bf6401a parent: 105492:8de7771a0d2a user: Ned Deily date: Tue Dec 06 17:33:19 2016 -0500 summary: Regenerate configure with autoconf 2.69. files: configure | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -784,7 +784,6 @@ docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -895,7 +894,6 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1148,15 +1146,6 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1294,7 +1283,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1447,7 +1436,6 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 6 18:42:15 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 06 Dec 2016 23:42:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_=5FPyObject=5FFastCallKeyw?= =?utf-8?q?ords=28=29_now_calls_directly_tp=5Fcall?= Message-ID: <20161206234215.20915.53688.7368CED0@psf.io> https://hg.python.org/cpython/rev/4b37328efa08 changeset: 105494:4b37328efa08 user: Victor Stinner date: Wed Dec 07 00:37:38 2016 +0100 summary: _PyObject_FastCallKeywords() now calls directly tp_call _PyObject_FastCallKeywords() doesn't call _PyObject_FastCallDict() anymore: call directly tp_call. files: Objects/abstract.c | 62 +++++++++++++++++++++++++-------- 1 files changed, 46 insertions(+), 16 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2456,12 +2456,9 @@ _PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs, PyObject *kwnames) { - PyObject *kwdict, *result; - Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); - 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: these checks are implemented in Python/ceval.c and _PyArg_ParseStack(). */ @@ -2469,24 +2466,57 @@ if (PyFunction_Check(callable)) { return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames); } - if (PyCFunction_Check(callable)) { return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames); } - - if (nkwargs > 0) { - kwdict = _PyStack_AsDict(stack + nargs, kwnames); - if (kwdict == NULL) { + else { + /* Slow-path: build a temporary tuple for positional arguments and a + temporary dictionary for keyword arguments (if any) */ + + ternaryfunc call; + PyObject *argtuple; + 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; + } + + argtuple = _PyStack_AsTuple(stack, nargs); + if (argtuple == NULL) { + goto exit; + } + + if (nkwargs > 0) { + kwdict = _PyStack_AsDict(stack + nargs, kwnames); + if (kwdict == NULL) { + Py_DECREF(argtuple); + goto exit; + } + } + else { + kwdict = NULL; + } + + result = (*call)(callable, argtuple, kwdict); + Py_DECREF(argtuple); + Py_XDECREF(kwdict); + + exit: + Py_LeaveRecursiveCall(); + return result; } - else { - kwdict = NULL; - } - - result = _PyObject_FastCallDict(callable, stack, nargs, kwdict); - Py_XDECREF(kwdict); - return result; } static PyObject* -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 02:07:42 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 07 Dec 2016 07:07:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Version_bump_f?= =?utf-8?q?or_3=2E6=2E0rc1?= Message-ID: <20161207070742.117179.18715.C7348B1C@psf.io> https://hg.python.org/cpython/rev/29a273eee9a5 changeset: 105496:29a273eee9a5 branch: 3.6 tag: v3.6.0rc1 user: Ned Deily date: Tue Dec 06 19:02:30 2016 -0500 summary: Version bump for 3.6.0rc1 files: Include/patchlevel.h | 6 +++--- Misc/NEWS | 2 +- README | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA -#define PY_RELEASE_SERIAL 4 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.6.0b4+" +#define PY_VERSION "3.6.0rc1" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.6.0 release candidate 1 ============================================== -*Release date: XXXX-XX-XX* +*Release date: 2016-12-06* Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.6.0 beta 4 -=================================== +This is Python version 3.6.0 release candidate 1 +================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 02:07:42 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 07 Dec 2016 07:07:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Update_pydoc_t?= =?utf-8?q?opics_for_3=2E6=2E0rc1?= Message-ID: <20161207070742.30631.37514.E34DA610@psf.io> https://hg.python.org/cpython/rev/37b9d1c45ea2 changeset: 105495:37b9d1c45ea2 branch: 3.6 parent: 105492:8de7771a0d2a user: Ned Deily date: Tue Dec 06 18:53:16 2016 -0500 summary: Update pydoc topics for 3.6.0rc1 files: Lib/pydoc_data/topics.py | 41 +++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon Nov 21 23:22:05 2016 +# Autogenerated by Sphinx on Tue Dec 6 18:51:51 2016 topics = {'assert': '\n' 'The "assert" statement\n' '**********************\n' @@ -8503,9 +8503,10 @@ 'defined at the\n' 'class scope. Class variables must be accessed through the ' 'first\n' - 'parameter of instance or class methods, and cannot be ' - 'accessed at all\n' - 'from static methods.\n' + 'parameter of instance or class methods, or through the ' + 'implicit\n' + 'lexically scoped "__class__" reference described in the next ' + 'section.\n' '\n' '\n' 'Creating the class object\n' @@ -8535,6 +8536,38 @@ 'passed to the\n' 'method.\n' '\n' + '**CPython implementation detail:** In CPython 3.6 and later, ' + 'the\n' + '"__class__" cell is passed to the metaclass as a ' + '"__classcell__" entry\n' + 'in the class namespace. If present, this must be propagated ' + 'up to the\n' + '"type.__new__" call in order for the class to be ' + 'initialised\n' + 'correctly. Failing to do so will result in a ' + '"DeprecationWarning" in\n' + 'Python 3.6, and a "RuntimeWarning" in the future.\n' + '\n' + 'When using the default metaclass "type", or any metaclass ' + 'that\n' + 'ultimately calls "type.__new__", the following additional\n' + 'customisation steps are invoked after creating the class ' + 'object:\n' + '\n' + '* first, "type.__new__" collects all of the descriptors in ' + 'the class\n' + ' namespace that define a "__set_name__()" method;\n' + '\n' + '* second, all of these "__set_name__" methods are called ' + 'with the\n' + ' class being defined and the assigned name of that ' + 'particular\n' + ' descriptor; and\n' + '\n' + '* finally, the "__init_subclass__()" hook is called on the ' + 'immediate\n' + ' parent of the new class in its method resolution order.\n' + '\n' 'After the class object is created, it is passed to the ' 'class\n' 'decorators included in the class definition (if any) and the ' -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 02:07:42 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 07 Dec 2016 07:07:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Added_tag_v3?= =?utf-8?q?=2E6=2E0rc1_for_changeset_29a273eee9a5?= Message-ID: <20161207070742.28059.43511.06142EA0@psf.io> https://hg.python.org/cpython/rev/27a35996becd changeset: 105497:27a35996becd branch: 3.6 user: Ned Deily date: Tue Dec 06 19:04:14 2016 -0500 summary: Added tag v3.6.0rc1 for changeset 29a273eee9a5 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -174,3 +174,4 @@ b9fadc7d1c3f9c3c77f32f35afbe1a1cc38070e6 v3.6.0b2 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 +29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 02:07:42 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 07 Dec 2016 07:07:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge_tag_from_3=2E6?= Message-ID: <20161207070742.13578.58483.7A4B048A@psf.io> https://hg.python.org/cpython/rev/04c6e0319c30 changeset: 105498:04c6e0319c30 parent: 105494:4b37328efa08 parent: 105497:27a35996becd user: Ned Deily date: Tue Dec 06 19:07:19 2016 -0500 summary: merge tag from 3.6 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -174,3 +174,4 @@ b9fadc7d1c3f9c3c77f32f35afbe1a1cc38070e6 v3.6.0b2 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 +29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 02:07:42 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 07 Dec 2016 07:07:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Prepare_for_3?= =?utf-8?q?=2E6=2E1=2E__Any_further_3=2E6=2E0_release_candidates_and_3=2E6?= =?utf-8?q?=2E0_final_will?= Message-ID: <20161207070742.13525.68358.B3F92EF1@psf.io> https://hg.python.org/cpython/rev/a8abec9182ea changeset: 105499:a8abec9182ea branch: 3.6 parent: 105497:27a35996becd user: Ned Deily date: Wed Dec 07 01:59:27 2016 -0500 summary: Prepare for 3.6.1. Any further 3.6.0 release candidates and 3.6.0 final will be cherrypicked and merged here. files: Include/patchlevel.h | 6 +++--- Misc/NEWS | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.6.0rc1" +#define PY_VERSION "3.6.0+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 3.6.1 release candidate 1 +============================================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.6.0 release candidate 1 ============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 02:07:42 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 07 Dec 2016 07:07:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_null_merge_from_3=2E6?= Message-ID: <20161207070742.117179.88915.C35FA5F5@psf.io> https://hg.python.org/cpython/rev/04f096b3ac9c changeset: 105500:04f096b3ac9c parent: 105498:04c6e0319c30 parent: 105499:a8abec9182ea user: Ned Deily date: Wed Dec 07 02:02:48 2016 -0500 summary: null merge from 3.6 files: -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Dec 7 04:05:01 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 07 Dec 2016 09:05:01 +0000 Subject: [Python-checkins] Daily reference leaks (4b37328efa08): sum=81 Message-ID: <20161207090501.99377.32047.0B4078B8@psf.io> results for 4b37328efa08 on branch "default" -------------------------------------------- test_asyncio leaked [0, 3, 0] memory blocks, sum=3 test_collections leaked [0, 7, 0] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [0, 44, 0] references, sum=44 test_multiprocessing_spawn leaked [0, 21, 0] memory blocks, sum=21 test_multiprocessing_spawn leaked [0, 2, 0] file descriptors, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog4EXtMJ', '--timeout', '7200'] From python-checkins at python.org Wed Dec 7 04:11:43 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:11:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328847=3A_dbm=2Edumb_now_supports_reading_read-o?= =?utf-8?q?nly_files_and_no_longer?= Message-ID: <20161207091143.99410.27030.369327F3@psf.io> https://hg.python.org/cpython/rev/2f59be67830c changeset: 105503:2f59be67830c parent: 105500:04f096b3ac9c parent: 105502:0c532bd28539 user: Serhiy Storchaka date: Wed Dec 07 11:02:18 2016 +0200 summary: Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. files: Lib/dbm/dumb.py | 7 +++++-- Lib/test/support/__init__.py | 4 ++-- Lib/test/test_dbm_dumb.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -97,8 +97,9 @@ try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: - pass + self._modified = not self._readonly else: + self._modified = False with f: for line in f: line = line.rstrip() @@ -113,7 +114,7 @@ # CAUTION: It's vital that _commit() succeed, and _commit() can # be called from __del__(). Therefore we must never reference a # global in this routine. - if self._index is None: + if self._index is None or not self._modified: return # nothing to do try: @@ -197,6 +198,7 @@ elif not isinstance(val, (bytes, bytearray)): raise TypeError("values must be bytes or strings") self._verify_open() + self._modified = True if key not in self._index: self._addkey(key, self._addval(val)) else: @@ -229,6 +231,7 @@ if isinstance(key, str): key = key.encode('utf-8') self._verify_open() + self._modified = True # The blocks used by the associated value are lost. del self._index[key] # XXX It's unclear why we do a _commit() here (the code always 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 @@ -360,9 +360,9 @@ mode = 0 if stat.S_ISDIR(mode): _waitfor(_rmtree_inner, fullname, waitall=True) - _force_run(path, os.rmdir, fullname) + _force_run(fullname, os.rmdir, fullname) else: - _force_run(path, os.unlink, fullname) + _force_run(fullname, os.unlink, fullname) _waitfor(_rmtree_inner, path, waitall=True) _waitfor(lambda p: _force_run(p, os.rmdir, p), path) else: diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -5,6 +5,7 @@ import io import operator import os +import stat import unittest import warnings import dbm.dumb as dumbdbm @@ -259,6 +260,21 @@ f = dumbdbm.open(_fname, flag) f.close() + @unittest.skipUnless(hasattr(os, 'chmod'), 'test needs os.chmod()') + def test_readonly_files(self): + with support.temp_dir() as dir: + fname = os.path.join(dir, 'db') + with dumbdbm.open(fname, 'n') as f: + self.assertEqual(list(f.keys()), []) + for key in self._dict: + f[key] = self._dict[key] + os.chmod(fname + ".dir", stat.S_IRUSR) + os.chmod(fname + ".dat", stat.S_IRUSR) + os.chmod(dir, stat.S_IRUSR|stat.S_IXUSR) + with dumbdbm.open(fname, 'r') as f: + self.assertEqual(sorted(f.keys()), sorted(self._dict)) + f.close() # don't write + def tearDown(self): _delete_files() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -165,6 +165,9 @@ Library ------- +- Issue #28847: dbm.dumb now supports reading read-only files and no longer + writes the index file when it is not changed. + - Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in re.sub() replacement templates regular expressions now are errors. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:11:43 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:11:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328847=3A_dbm=2Edumb_now_supports_reading_read-only_fi?= =?utf-8?q?les_and_no_longer?= Message-ID: <20161207091143.13359.93353.CCAE50AA@psf.io> https://hg.python.org/cpython/rev/0c532bd28539 changeset: 105502:0c532bd28539 branch: 3.6 parent: 105499:a8abec9182ea parent: 105501:0a74bc7ba462 user: Serhiy Storchaka date: Wed Dec 07 11:00:06 2016 +0200 summary: Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. files: Lib/dbm/dumb.py | 7 +++++-- Lib/test/support/__init__.py | 4 ++-- Lib/test/test_dbm_dumb.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -97,8 +97,9 @@ try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: - pass + self._modified = not self._readonly else: + self._modified = False with f: for line in f: line = line.rstrip() @@ -113,7 +114,7 @@ # CAUTION: It's vital that _commit() succeed, and _commit() can # be called from __del__(). Therefore we must never reference a # global in this routine. - if self._index is None: + if self._index is None or not self._modified: return # nothing to do try: @@ -197,6 +198,7 @@ elif not isinstance(val, (bytes, bytearray)): raise TypeError("values must be bytes or strings") self._verify_open() + self._modified = True if key not in self._index: self._addkey(key, self._addval(val)) else: @@ -229,6 +231,7 @@ if isinstance(key, str): key = key.encode('utf-8') self._verify_open() + self._modified = True # The blocks used by the associated value are lost. del self._index[key] # XXX It's unclear why we do a _commit() here (the code always 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 @@ -360,9 +360,9 @@ mode = 0 if stat.S_ISDIR(mode): _waitfor(_rmtree_inner, fullname, waitall=True) - _force_run(path, os.rmdir, fullname) + _force_run(fullname, os.rmdir, fullname) else: - _force_run(path, os.unlink, fullname) + _force_run(fullname, os.unlink, fullname) _waitfor(_rmtree_inner, path, waitall=True) _waitfor(lambda p: _force_run(p, os.rmdir, p), path) else: diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -5,6 +5,7 @@ import io import operator import os +import stat import unittest import warnings import dbm.dumb as dumbdbm @@ -259,6 +260,21 @@ f = dumbdbm.open(_fname, flag) f.close() + @unittest.skipUnless(hasattr(os, 'chmod'), 'test needs os.chmod()') + def test_readonly_files(self): + with support.temp_dir() as dir: + fname = os.path.join(dir, 'db') + with dumbdbm.open(fname, 'n') as f: + self.assertEqual(list(f.keys()), []) + for key in self._dict: + f[key] = self._dict[key] + os.chmod(fname + ".dir", stat.S_IRUSR) + os.chmod(fname + ".dat", stat.S_IRUSR) + os.chmod(dir, stat.S_IRUSR|stat.S_IXUSR) + with dumbdbm.open(fname, 'r') as f: + self.assertEqual(sorted(f.keys()), sorted(self._dict)) + f.close() # don't write + def tearDown(self): _delete_files() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #28847: dbm.dumb now supports reading read-only files and no longer + writes the index file when it is not changed. + What's New in Python 3.6.0 release candidate 1 ============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:11:43 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:11:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4ODQ3?= =?utf-8?q?=3A_dbm=2Edumb_now_supports_reading_read-only_files_and_no_long?= =?utf-8?q?er?= Message-ID: <20161207091142.30521.89058.2A0BEEDF@psf.io> https://hg.python.org/cpython/rev/0a74bc7ba462 changeset: 105501:0a74bc7ba462 branch: 3.5 parent: 105478:104fdc42bcd1 user: Serhiy Storchaka date: Wed Dec 07 10:56:39 2016 +0200 summary: Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. files: Lib/dbm/dumb.py | 8 ++++++-- Lib/test/support/__init__.py | 6 +++--- Lib/test/test_dbm_dumb.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -47,6 +47,7 @@ def __init__(self, filebasename, mode, flag='c'): self._mode = mode + self._readonly = (flag == 'r') # The directory file is a text file. Each line looks like # "%r, (%d, %d)\n" % (key, pos, siz) @@ -91,8 +92,9 @@ try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: - pass + self._modified = not self._readonly else: + self._modified = False with f: for line in f: line = line.rstrip() @@ -107,7 +109,7 @@ # CAUTION: It's vital that _commit() succeed, and _commit() can # be called from __del__(). Therefore we must never reference a # global in this routine. - if self._index is None: + if self._index is None or not self._modified: return # nothing to do try: @@ -187,6 +189,7 @@ elif not isinstance(val, (bytes, bytearray)): raise TypeError("values must be bytes or strings") self._verify_open() + self._modified = True if key not in self._index: self._addkey(key, self._addval(val)) else: @@ -215,6 +218,7 @@ if isinstance(key, str): key = key.encode('utf-8') self._verify_open() + self._modified = True # The blocks used by the associated value are lost. del self._index[key] # XXX It's unclear why we do a _commit() here (the code always 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 @@ -359,9 +359,9 @@ mode = 0 if stat.S_ISDIR(mode): _waitfor(_rmtree_inner, fullname, waitall=True) - _force_run(path, os.rmdir, fullname) + _force_run(fullname, os.rmdir, fullname) else: - _force_run(path, os.unlink, fullname) + _force_run(fullname, os.unlink, fullname) _waitfor(_rmtree_inner, path, waitall=True) _waitfor(lambda p: _force_run(p, os.rmdir, p), path) else: @@ -933,7 +933,7 @@ yield path finally: if dir_created: - shutil.rmtree(path) + rmtree(path) @contextlib.contextmanager def change_cwd(path, quiet=False): diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -5,6 +5,7 @@ import io import operator import os +import stat import unittest import dbm.dumb as dumbdbm from test import support @@ -234,6 +235,21 @@ pass self.assertEqual(stdout.getvalue(), '') + @unittest.skipUnless(hasattr(os, 'chmod'), 'test needs os.chmod()') + def test_readonly_files(self): + with support.temp_dir() as dir: + fname = os.path.join(dir, 'db') + with dumbdbm.open(fname, 'n') as f: + self.assertEqual(list(f.keys()), []) + for key in self._dict: + f[key] = self._dict[key] + os.chmod(fname + ".dir", stat.S_IRUSR) + os.chmod(fname + ".dat", stat.S_IRUSR) + os.chmod(dir, stat.S_IRUSR|stat.S_IXUSR) + with dumbdbm.open(fname, 'r') as f: + self.assertEqual(sorted(f.keys()), sorted(self._dict)) + f.close() # don't write + def tearDown(self): _delete_files() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -121,6 +121,9 @@ Library ------- +- Issue #28847: dbm.dumb now supports reading read-only files and no longer + writes the index file when it is not changed. + - Issue #25659: In ctypes, prevent a crash calling the from_buffer() and from_buffer_copy() methods on abstract classes like Array. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:11:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:11:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328847=3A_A_deprec?= =?utf-8?q?ation_warning_is_now_emitted_if_the_index_file_is_missed?= Message-ID: <20161207091143.117866.80581.40A49014@psf.io> https://hg.python.org/cpython/rev/a10361dfbf64 changeset: 105504:a10361dfbf64 user: Serhiy Storchaka date: Wed Dec 07 11:11:12 2016 +0200 summary: Issue #28847: A deprecation warning is now emitted if the index file is missed and recreated in the 'r' and 'w' modes (will be an error in future Python releases). files: Lib/dbm/dumb.py | 9 +++++++-- Lib/test/test_dbm_dumb.py | 14 ++++++++++++++ Misc/NEWS | 4 +++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Lib/dbm/dumb.py b/Lib/dbm/dumb.py --- a/Lib/dbm/dumb.py +++ b/Lib/dbm/dumb.py @@ -68,7 +68,7 @@ # Handle the creation self._create(flag) - self._update() + self._update(flag) def _create(self, flag): if flag == 'n': @@ -92,12 +92,17 @@ f.close() # Read directory file into the in-memory index dict. - def _update(self): + def _update(self, flag): self._index = {} try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: self._modified = not self._readonly + if flag not in ('c', 'n'): + import warnings + warnings.warn("The index file is missing, the " + "semantics of the 'c' flag will be used.", + DeprecationWarning, stacklevel=4) else: self._modified = False with f: diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -252,6 +252,20 @@ f = dumbdbm.open(_fname, value) f.close() + def test_missing_index(self): + with dumbdbm.open(_fname, 'n') as f: + pass + os.unlink(_fname + '.dir') + for value in ('r', 'w'): + with self.assertWarnsRegex(DeprecationWarning, + "The index file is missing, the " + "semantics of the 'c' flag will " + "be used."): + f = dumbdbm.open(_fname, value) + f.close() + self.assertEqual(os.path.exists(_fname + '.dir'), value == 'w') + self.assertFalse(os.path.exists(_fname + '.bak')) + def test_invalid_flag(self): for flag in ('x', 'rf', None): with self.assertWarnsRegex(DeprecationWarning, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -166,7 +166,9 @@ ------- - Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. + writes the index file when it is not changed. A deprecation warning is now + emitted if the index file is missed and recreated in the 'r' and 'w' modes + (will be an error in future Python releases). - Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in re.sub() replacement templates regular expressions now are errors. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:28:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:28:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=235322=3A_Fixed_setting_=5F=5Fnew=5F=5F_to_a_PyCFunctio?= =?utf-8?q?n_inside_Python_code=2E?= Message-ID: <20161207092810.117023.4340.CCC7D3E3@psf.io> https://hg.python.org/cpython/rev/747de8acb7e4 changeset: 105506:747de8acb7e4 branch: 3.6 parent: 105502:0c532bd28539 parent: 105505:1f31bf3f76f5 user: Serhiy Storchaka date: Wed Dec 07 11:26:49 2016 +0200 summary: Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. files: Lib/test/test_descr.py | 88 ++++++++++++++++++++++++++++++ Misc/NEWS | 3 + Objects/typeobject.c | 29 +++++++++- 3 files changed, 119 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -7,6 +7,7 @@ import sys import types import unittest +import warnings import weakref from copy import deepcopy @@ -1661,6 +1662,75 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + def test_bad_new(self): + self.assertRaises(TypeError, object.__new__) + self.assertRaises(TypeError, object.__new__, '') + self.assertRaises(TypeError, list.__new__, object) + self.assertRaises(TypeError, object.__new__, list) + class C(object): + __new__ = list.__new__ + self.assertRaises(TypeError, C) + class C(list): + __new__ = object.__new__ + self.assertRaises(TypeError, C) + + def test_object_new(self): + class A(object): + pass + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A()) + self.assertRaises(TypeError, object.__init__, A(), 5) + + class A(object): + def __init__(self, foo): + self.foo = foo + object.__new__(A) + object.__new__(A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + object.__init__(A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + def __init__(self, foo): + self.foo = foo + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + def test_restored_object_new(self): + class A(object): + def __new__(cls, *args, **kwargs): + raise AssertionError + self.assertRaises(AssertionError, A) + class B(A): + __new__ = object.__new__ + def __init__(self, foo): + self.foo = foo + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + del B.__new__ + self.assertRaises(AssertionError, B) + del A.__new__ + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3522,6 +3592,24 @@ self.assertIsInstance(d, D) self.assertEqual(d.foo, 1) + class C(object): + @staticmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, 1, 2)) + + class C(object): + @classmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, D, 1, 2)) + def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. + Original patch by Andreas St?hrk. + Library ------- diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6878,7 +6878,34 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - specific = (void *)type->tp_new; + PyObject *self = PyCFunction_GET_SELF(descr); + if (!self || !PyType_Check(self)) { + /* This should never happen because + tp_new_wrapper expects a type for self. + Use slot_tp_new which will call + tp_new_wrapper which will raise an + exception. */ + specific = (void *)slot_tp_new; + } + else { + PyTypeObject *staticbase; + specific = ((PyTypeObject *)self)->tp_new; + /* Check that the user does not do anything + silly and unsafe like object.__new__(dict). + To do this, we check that the most derived + base that's not a heap type is this type. */ + staticbase = type->tp_base; + while (staticbase && + (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) + staticbase = staticbase->tp_base; + if (staticbase && + staticbase->tp_new != specific) + /* Seems to be unsafe, better use + slot_tp_new which will call + tp_new_wrapper which will raise an + exception if it is unsafe. */ + specific = (void *)slot_tp_new; + } /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:28:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:28:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzUzMjI6?= =?utf-8?q?_Fixed_setting_=5F=5Fnew=5F=5F_to_a_PyCFunction_inside_Python_c?= =?utf-8?q?ode=2E?= Message-ID: <20161207092810.99494.45210.162D49F1@psf.io> https://hg.python.org/cpython/rev/1f31bf3f76f5 changeset: 105505:1f31bf3f76f5 branch: 3.5 parent: 105501:0a74bc7ba462 user: Serhiy Storchaka date: Fri Dec 02 08:42:43 2016 +0200 summary: Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. files: Lib/test/test_descr.py | 88 ++++++++++++++++++++++++++++++ Misc/NEWS | 3 + Objects/typeobject.c | 29 +++++++++- 3 files changed, 119 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -7,6 +7,7 @@ import sys import types import unittest +import warnings import weakref from copy import deepcopy @@ -1661,6 +1662,75 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + def test_bad_new(self): + self.assertRaises(TypeError, object.__new__) + self.assertRaises(TypeError, object.__new__, '') + self.assertRaises(TypeError, list.__new__, object) + self.assertRaises(TypeError, object.__new__, list) + class C(object): + __new__ = list.__new__ + self.assertRaises(TypeError, C) + class C(list): + __new__ = object.__new__ + self.assertRaises(TypeError, C) + + def test_object_new(self): + class A(object): + pass + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A()) + self.assertRaises(TypeError, object.__init__, A(), 5) + + class A(object): + def __init__(self, foo): + self.foo = foo + object.__new__(A) + object.__new__(A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + object.__init__(A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + def __init__(self, foo): + self.foo = foo + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + def test_restored_object_new(self): + class A(object): + def __new__(cls, *args, **kwargs): + raise AssertionError + self.assertRaises(AssertionError, A) + class B(A): + __new__ = object.__new__ + def __init__(self, foo): + self.foo = foo + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + del B.__new__ + self.assertRaises(AssertionError, B) + del A.__new__ + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3522,6 +3592,24 @@ self.assertIsInstance(d, D) self.assertEqual(d.foo, 1) + class C(object): + @staticmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, 1, 2)) + + class C(object): + @classmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, D, 1, 2)) + def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. + Original patch by Andreas St?hrk. + - Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode astral characters. Patch by Xiang Zhang. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6798,7 +6798,34 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - specific = (void *)type->tp_new; + PyObject *self = PyCFunction_GET_SELF(descr); + if (!self || !PyType_Check(self)) { + /* This should never happen because + tp_new_wrapper expects a type for self. + Use slot_tp_new which will call + tp_new_wrapper which will raise an + exception. */ + specific = (void *)slot_tp_new; + } + else { + PyTypeObject *staticbase; + specific = ((PyTypeObject *)self)->tp_new; + /* Check that the user does not do anything + silly and unsafe like object.__new__(dict). + To do this, we check that the most derived + base that's not a heap type is this type. */ + staticbase = type->tp_base; + while (staticbase && + (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) + staticbase = staticbase->tp_base; + if (staticbase && + staticbase->tp_new != specific) + /* Seems to be unsafe, better use + slot_tp_new which will call + tp_new_wrapper which will raise an + exception if it is unsafe. */ + specific = (void *)slot_tp_new; + } /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:28:12 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 09:28:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=235322=3A_Fixed_setting_=5F=5Fnew=5F=5F_to_a_PyCF?= =?utf-8?q?unction_inside_Python_code=2E?= Message-ID: <20161207092812.73309.81981.5E1CB918@psf.io> https://hg.python.org/cpython/rev/9605c558ab58 changeset: 105507:9605c558ab58 parent: 105504:a10361dfbf64 parent: 105506:747de8acb7e4 user: Serhiy Storchaka date: Wed Dec 07 11:27:55 2016 +0200 summary: Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. files: Lib/test/test_descr.py | 88 ++++++++++++++++++++++++++++++ Misc/NEWS | 3 + Objects/typeobject.c | 29 +++++++++- 3 files changed, 119 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -7,6 +7,7 @@ import sys import types import unittest +import warnings import weakref from copy import deepcopy @@ -1661,6 +1662,75 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + def test_bad_new(self): + self.assertRaises(TypeError, object.__new__) + self.assertRaises(TypeError, object.__new__, '') + self.assertRaises(TypeError, list.__new__, object) + self.assertRaises(TypeError, object.__new__, list) + class C(object): + __new__ = list.__new__ + self.assertRaises(TypeError, C) + class C(list): + __new__ = object.__new__ + self.assertRaises(TypeError, C) + + def test_object_new(self): + class A(object): + pass + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A()) + self.assertRaises(TypeError, object.__init__, A(), 5) + + class A(object): + def __init__(self, foo): + self.foo = foo + object.__new__(A) + object.__new__(A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + object.__init__(A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + def __init__(self, foo): + self.foo = foo + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + def test_restored_object_new(self): + class A(object): + def __new__(cls, *args, **kwargs): + raise AssertionError + self.assertRaises(AssertionError, A) + class B(A): + __new__ = object.__new__ + def __init__(self, foo): + self.foo = foo + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + del B.__new__ + self.assertRaises(AssertionError, B) + del A.__new__ + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3522,6 +3592,24 @@ self.assertIsInstance(d, D) self.assertEqual(d.foo, 1) + class C(object): + @staticmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, 1, 2)) + + class C(object): + @classmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, D, 1, 2)) + def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. + Original patch by Andreas St?hrk. + - Issue #23722: Rather than silently producing a class that doesn't support zero-argument ``super()`` in methods, failing to pass the new ``__classcell__`` namespace entry up to ``type.__new__`` now results in a diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6878,7 +6878,34 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - specific = (void *)type->tp_new; + PyObject *self = PyCFunction_GET_SELF(descr); + if (!self || !PyType_Check(self)) { + /* This should never happen because + tp_new_wrapper expects a type for self. + Use slot_tp_new which will call + tp_new_wrapper which will raise an + exception. */ + specific = (void *)slot_tp_new; + } + else { + PyTypeObject *staticbase; + specific = ((PyTypeObject *)self)->tp_new; + /* Check that the user does not do anything + silly and unsafe like object.__new__(dict). + To do this, we check that the most derived + base that's not a heap type is this type. */ + staticbase = type->tp_base; + while (staticbase && + (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) + staticbase = staticbase->tp_base; + if (staticbase && + staticbase->tp_new != specific) + /* Seems to be unsafe, better use + slot_tp_new which will call + tp_new_wrapper which will raise an + exception if it is unsafe. */ + specific = (void *)slot_tp_new; + } /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:39:34 2016 From: python-checkins at python.org (inada.naoki) Date: Wed, 07 Dec 2016 09:39:34 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NzMx?= =?utf-8?q?=3A_Optimize_=5FPyDict=5FNewPresized=28=29_to_create_correct_si?= =?utf-8?q?ze_dict=2E?= Message-ID: <20161207093934.21396.22555.63571DD5@psf.io> https://hg.python.org/cpython/rev/d03562dcbb82 changeset: 105508:d03562dcbb82 branch: 3.6 parent: 105506:747de8acb7e4 user: INADA Naoki date: Wed Dec 07 18:34:44 2016 +0900 summary: Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of dict literal with constant keys up to 30%. files: Misc/NEWS | 3 +++ Objects/dictobject.c | 24 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. + Improve speed of dict literal with constant keys up to 30%. + - Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -388,7 +388,7 @@ * This can be used to reserve enough size to insert n entries without * resizing. */ -#define ESTIMATE_SIZE(n) (((n)*3) >> 1) +#define ESTIMATE_SIZE(n) (((n)*3+1) >> 1) /* Alternative fraction that is otherwise close enough to 2n/3 to make * little difference. 8 * 2/3 == 8 * 5/8 == 5. 16 * 2/3 == 16 * 5/8 == 10. @@ -1357,12 +1357,26 @@ PyObject * _PyDict_NewPresized(Py_ssize_t minused) { + const Py_ssize_t max_presize = 128 * 1024; Py_ssize_t newsize; PyDictKeysObject *new_keys; - for (newsize = PyDict_MINSIZE; - newsize <= minused && newsize > 0; - newsize <<= 1) - ; + + /* There are no strict guarantee that returned dict can contain minused + * items without resize. So we create medium size dict instead of very + * large dict or MemoryError. + */ + if (minused > USABLE_FRACTION(max_presize)) { + newsize = max_presize; + } + else { + Py_ssize_t minsize = ESTIMATE_SIZE(minused); + newsize = PyDict_MINSIZE; + while (newsize < minsize) { + newsize <<= 1; + } + } + assert(IS_POWER_OF_2(newsize)); + new_keys = new_keys_object(newsize); if (new_keys == NULL) return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 04:39:34 2016 From: python-checkins at python.org (inada.naoki) Date: Wed, 07 Dec 2016 09:39:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_null_merge_from_3=2E6?= Message-ID: <20161207093934.14566.3356.917922E6@psf.io> https://hg.python.org/cpython/rev/450461b8b776 changeset: 105509:450461b8b776 parent: 105507:9605c558ab58 parent: 105508:d03562dcbb82 user: INADA Naoki date: Wed Dec 07 18:38:15 2016 +0900 summary: null merge from 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 06:32:24 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 11:32:24 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_from_3=2E5=2E?= Message-ID: <20161207113224.99792.73510.F9BE29BD@psf.io> https://hg.python.org/cpython/rev/c4f39b6f3176 changeset: 105511:c4f39b6f3176 branch: 3.6 parent: 105508:d03562dcbb82 parent: 105510:4a610bc8577b user: Serhiy Storchaka date: Wed Dec 07 13:31:47 2016 +0200 summary: Merge from 3.5. files: Lib/_pyio.py | 2 +- Modules/_io/_iomodule.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -277,7 +277,7 @@ try: UnsupportedOperation = io.UnsupportedOperation except AttributeError: - class UnsupportedOperation(ValueError, OSError): + class UnsupportedOperation(OSError, ValueError): pass diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -683,7 +683,7 @@ /* UnsupportedOperation inherits from ValueError and IOError */ state->unsupported_operation = PyObject_CallFunction( (PyObject *)&PyType_Type, "s(OO){}", - "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + "UnsupportedOperation", PyExc_OSError, PyExc_ValueError); if (state->unsupported_operation == NULL) goto fail; Py_INCREF(state->unsupported_operation); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 06:32:24 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 11:32:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgZnJvbSAzLjYu?= Message-ID: <20161207113224.72965.89394.C6A2E364@psf.io> https://hg.python.org/cpython/rev/5cb2e7f8d02a changeset: 105512:5cb2e7f8d02a parent: 105509:450461b8b776 parent: 105511:c4f39b6f3176 user: Serhiy Storchaka date: Wed Dec 07 13:32:09 2016 +0200 summary: Merge from 3.6. files: Lib/_pyio.py | 2 +- Modules/_io/_iomodule.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -277,7 +277,7 @@ try: UnsupportedOperation = io.UnsupportedOperation except AttributeError: - class UnsupportedOperation(ValueError, OSError): + class UnsupportedOperation(OSError, ValueError): pass diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -683,7 +683,7 @@ /* UnsupportedOperation inherits from ValueError and IOError */ state->unsupported_operation = PyObject_CallFunction( (PyObject *)&PyType_Type, "s(OO){}", - "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + "UnsupportedOperation", PyExc_OSError, PyExc_ValueError); if (state->unsupported_operation == NULL) goto fail; Py_INCREF(state->unsupported_operation); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 06:32:24 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 07 Dec 2016 11:32:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Change_order_o?= =?utf-8?q?f_io=2EUnsupportedOperation_base_classes=2E?= Message-ID: <20161207113224.118019.77923.7228C19B@psf.io> https://hg.python.org/cpython/rev/4a610bc8577b changeset: 105510:4a610bc8577b branch: 3.5 parent: 105505:1f31bf3f76f5 user: Serhiy Storchaka date: Wed Dec 07 13:31:20 2016 +0200 summary: Change order of io.UnsupportedOperation base classes. This makes tests passing after changes by issue #5322. files: Lib/_pyio.py | 2 +- Modules/_io/_iomodule.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -276,7 +276,7 @@ try: UnsupportedOperation = io.UnsupportedOperation except AttributeError: - class UnsupportedOperation(ValueError, OSError): + class UnsupportedOperation(OSError, ValueError): pass diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -654,7 +654,7 @@ /* UnsupportedOperation inherits from ValueError and IOError */ state->unsupported_operation = PyObject_CallFunction( (PyObject *)&PyType_Type, "s(OO){}", - "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + "UnsupportedOperation", PyExc_OSError, PyExc_ValueError); if (state->unsupported_operation == NULL) goto fail; Py_INCREF(state->unsupported_operation); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 06:42:14 2016 From: python-checkins at python.org (inada.naoki) Date: Wed, 07 Dec 2016 11:42:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328818=3A_Simplify?= =?utf-8?q?_lookdict_functions?= Message-ID: <20161207114214.72247.68354.5586C189@psf.io> https://hg.python.org/cpython/rev/8d4b2c6a0a7f changeset: 105513:8d4b2c6a0a7f user: INADA Naoki date: Wed Dec 07 20:41:42 2016 +0900 summary: Issue #28818: Simplify lookdict functions files: Objects/dict-common.h | 2 +- Objects/dictobject.c | 220 +++++++++++++---------------- Objects/odictobject.c | 4 +- 3 files changed, 99 insertions(+), 127 deletions(-) diff --git a/Objects/dict-common.h b/Objects/dict-common.h --- a/Objects/dict-common.h +++ b/Objects/dict-common.h @@ -12,7 +12,7 @@ * -1 when no entry found, -3 when compare raises error. */ typedef Py_ssize_t (*dict_lookup_func) -(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject ***value_addr, +(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos); #define DKIX_EMPTY (-1) diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -223,17 +223,17 @@ /* forward declarations */ static Py_ssize_t lookdict(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos); static Py_ssize_t lookdict_unicode(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos); static Py_ssize_t lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos); static Py_ssize_t lookdict_split(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos); static int dictresize(PyDictObject *mp, Py_ssize_t minused); @@ -685,7 +685,7 @@ */ static Py_ssize_t _Py_HOT_FUNCTION lookdict(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) { size_t i, mask; Py_ssize_t ix, freeslot; @@ -714,7 +714,7 @@ ep = &ep0[ix]; assert(ep->me_key != NULL); if (ep->me_key == key) { - *value_addr = &ep->me_value; + *value_addr = ep->me_value; if (hashpos != NULL) *hashpos = i; return ix; @@ -730,7 +730,7 @@ } if (dk == mp->ma_keys && ep->me_key == startkey) { if (cmp > 0) { - *value_addr = &ep->me_value; + *value_addr = ep->me_value; if (hashpos != NULL) *hashpos = i; return ix; @@ -766,7 +766,7 @@ if (hashpos != NULL) { *hashpos = i; } - *value_addr = &ep->me_value; + *value_addr = ep->me_value; return ix; } if (ep->me_hash == hash) { @@ -783,7 +783,7 @@ if (hashpos != NULL) { *hashpos = i; } - *value_addr = &ep->me_value; + *value_addr = ep->me_value; return ix; } } @@ -800,7 +800,7 @@ /* Specialized version for string-only keys */ static Py_ssize_t _Py_HOT_FUNCTION lookdict_unicode(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) { size_t i; size_t mask = DK_MASK(mp->ma_keys); @@ -834,7 +834,7 @@ || (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { if (hashpos != NULL) *hashpos = i; - *value_addr = &ep->me_value; + *value_addr = ep->me_value; return ix; } freeslot = -1; @@ -860,7 +860,7 @@ assert(ep->me_key != NULL); if (ep->me_key == key || (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { - *value_addr = &ep->me_value; + *value_addr = ep->me_value; if (hashpos != NULL) { *hashpos = i; } @@ -875,7 +875,7 @@ * will be present. */ static Py_ssize_t _Py_HOT_FUNCTION lookdict_unicode_nodummy(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) { size_t i; @@ -908,7 +908,7 @@ (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { if (hashpos != NULL) *hashpos = i; - *value_addr = &ep->me_value; + *value_addr = ep->me_value; return ix; } for (size_t perturb = hash;;) { @@ -928,7 +928,7 @@ (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { if (hashpos != NULL) *hashpos = i; - *value_addr = &ep->me_value; + *value_addr = ep->me_value; return ix; } } @@ -943,7 +943,7 @@ */ static Py_ssize_t _Py_HOT_FUNCTION lookdict_split(PyDictObject *mp, PyObject *key, - Py_hash_t hash, PyObject ***value_addr, Py_ssize_t *hashpos) + Py_hash_t hash, PyObject **value_addr, Py_ssize_t *hashpos) { size_t i; size_t mask = DK_MASK(mp->ma_keys); @@ -955,7 +955,7 @@ if (!PyUnicode_CheckExact(key)) { ix = lookdict(mp, key, hash, value_addr, hashpos); if (ix >= 0) { - *value_addr = &mp->ma_values[ix]; + *value_addr = mp->ma_values[ix]; } return ix; } @@ -975,7 +975,7 @@ (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { if (hashpos != NULL) *hashpos = i; - *value_addr = &mp->ma_values[ix]; + *value_addr = mp->ma_values[ix]; return ix; } for (size_t perturb = hash;;) { @@ -995,7 +995,7 @@ (ep->me_hash == hash && unicode_eq(ep->me_key, key))) { if (hashpos != NULL) *hashpos = i; - *value_addr = &mp->ma_values[ix]; + *value_addr = mp->ma_values[ix]; return ix; } } @@ -1068,32 +1068,24 @@ when it is known that the key is not present in the dict. The dict must be combined. */ -static void -find_empty_slot(PyDictObject *mp, PyObject *key, Py_hash_t hash, - PyObject ***value_addr, Py_ssize_t *hashpos) +static Py_ssize_t +find_empty_slot(PyDictKeysObject *keys, PyObject *key, Py_hash_t hash) { size_t i; - size_t mask = DK_MASK(mp->ma_keys); + size_t mask = DK_MASK(keys); Py_ssize_t ix; - PyDictKeyEntry *ep, *ep0 = DK_ENTRIES(mp->ma_keys); - - assert(!_PyDict_HasSplitTable(mp)); - assert(hashpos != NULL); + assert(key != NULL); - if (!PyUnicode_CheckExact(key)) - mp->ma_keys->dk_lookup = lookdict; i = hash & mask; - ix = dk_get_index(mp->ma_keys, i); + ix = dk_get_index(keys, i); for (size_t perturb = hash; ix != DKIX_EMPTY;) { perturb >>= PERTURB_SHIFT; i = (i << 2) + i + perturb + 1; - ix = dk_get_index(mp->ma_keys, i & mask); + ix = dk_get_index(keys, i & mask); } - ep = &ep0[mp->ma_keys->dk_nentries]; - *hashpos = i & mask; - assert(ep->me_value == NULL); - *value_addr = &ep->me_value; + assert(DK_ENTRIES(keys)[keys->dk_nentries].me_value == NULL); + return i & mask; } static int @@ -1111,8 +1103,7 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value) { PyObject *old_value; - PyObject **value_addr; - PyDictKeyEntry *ep, *ep0; + PyDictKeyEntry *ep; Py_ssize_t hashpos, ix; if (mp->ma_values != NULL && !PyUnicode_CheckExact(key)) { @@ -1120,7 +1111,7 @@ return -1; } - ix = mp->ma_keys->dk_lookup(mp, key, hash, &value_addr, &hashpos); + ix = mp->ma_keys->dk_lookup(mp, key, hash, &old_value, &hashpos); if (ix == DKIX_ERROR) { return -1; } @@ -1133,28 +1124,28 @@ * the key anymore. Convert this instance to combine table. */ if (_PyDict_HasSplitTable(mp) && - ((ix >= 0 && *value_addr == NULL && mp->ma_used != ix) || + ((ix >= 0 && old_value == NULL && mp->ma_used != ix) || (ix == DKIX_EMPTY && mp->ma_used != mp->ma_keys->dk_nentries))) { if (insertion_resize(mp) < 0) { Py_DECREF(value); return -1; } - find_empty_slot(mp, key, hash, &value_addr, &hashpos); + hashpos = find_empty_slot(mp->ma_keys, key, hash); ix = DKIX_EMPTY; } if (ix == DKIX_EMPTY) { /* Insert into new slot. */ + assert(old_value == NULL); if (mp->ma_keys->dk_usable <= 0) { /* Need to resize. */ if (insertion_resize(mp) < 0) { Py_DECREF(value); return -1; } - find_empty_slot(mp, key, hash, &value_addr, &hashpos); + hashpos = find_empty_slot(mp->ma_keys, key, hash); } - ep0 = DK_ENTRIES(mp->ma_keys); - ep = &ep0[mp->ma_keys->dk_nentries]; + ep = &DK_ENTRIES(mp->ma_keys)[mp->ma_keys->dk_nentries]; dk_set_index(mp->ma_keys, hashpos, mp->ma_keys->dk_nentries); Py_INCREF(key); ep->me_key = key; @@ -1175,24 +1166,21 @@ return 0; } - assert(value_addr != NULL); - - old_value = *value_addr; - if (old_value != NULL) { - *value_addr = value; - mp->ma_version_tag = DICT_NEXT_VERSION(); - assert(_PyDict_CheckConsistency(mp)); - - Py_DECREF(old_value); /* which **CAN** re-enter (see issue #22653) */ - return 0; + if (_PyDict_HasSplitTable(mp)) { + mp->ma_values[ix] = value; + if (old_value == NULL) { + /* pending state */ + assert(ix == mp->ma_used); + mp->ma_used++; + } } - - /* pending state */ - assert(_PyDict_HasSplitTable(mp)); - assert(ix == mp->ma_used); - *value_addr = value; - mp->ma_used++; + else { + assert(old_value != NULL); + DK_ENTRIES(mp->ma_keys)[ix].me_value = value; + } + mp->ma_version_tag = DICT_NEXT_VERSION(); + Py_XDECREF(old_value); /* which **CAN** re-enter (see issue #22653) */ assert(_PyDict_CheckConsistency(mp)); return 0; } @@ -1404,7 +1392,7 @@ Py_ssize_t ix; PyDictObject *mp = (PyDictObject *)op; PyThreadState *tstate; - PyObject **value_addr; + PyObject *value; if (!PyDict_Check(op)) return NULL; @@ -1428,20 +1416,20 @@ /* preserve the existing exception */ PyObject *err_type, *err_value, *err_tb; PyErr_Fetch(&err_type, &err_value, &err_tb); - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); /* ignore errors */ PyErr_Restore(err_type, err_value, err_tb); if (ix < 0) return NULL; } else { - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix < 0) { PyErr_Clear(); return NULL; } } - return *value_addr; + return value; } /* Same as PyDict_GetItemWithError() but with hash supplied by caller. @@ -1453,18 +1441,18 @@ { Py_ssize_t ix; PyDictObject *mp = (PyDictObject *)op; - PyObject **value_addr; + PyObject *value; if (!PyDict_Check(op)) { PyErr_BadInternalCall(); return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix < 0) { return NULL; } - return *value_addr; + return value; } /* Variant of PyDict_GetItem() that doesn't suppress exceptions. @@ -1477,7 +1465,7 @@ Py_ssize_t ix; Py_hash_t hash; PyDictObject*mp = (PyDictObject *)op; - PyObject **value_addr; + PyObject *value; if (!PyDict_Check(op)) { PyErr_BadInternalCall(); @@ -1492,10 +1480,10 @@ } } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix < 0) return NULL; - return *value_addr; + return value; } PyObject * @@ -1520,7 +1508,7 @@ { Py_ssize_t ix; Py_hash_t hash; - PyObject **value_addr; + PyObject *value; if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) @@ -1531,17 +1519,17 @@ } /* namespace 1: globals */ - ix = globals->ma_keys->dk_lookup(globals, key, hash, &value_addr, NULL); + ix = globals->ma_keys->dk_lookup(globals, key, hash, &value, NULL); if (ix == DKIX_ERROR) return NULL; - if (ix != DKIX_EMPTY && *value_addr != NULL) - return *value_addr; + if (ix != DKIX_EMPTY && value != NULL) + return value; /* namespace 2: builtins */ - ix = builtins->ma_keys->dk_lookup(builtins, key, hash, &value_addr, NULL); + ix = builtins->ma_keys->dk_lookup(builtins, key, hash, &value, NULL); if (ix < 0) return NULL; - return *value_addr; + return value; } /* CAUTION: PyDict_SetItem() must guarantee that it won't resize the @@ -1616,7 +1604,6 @@ PyDictObject *mp; PyDictKeyEntry *ep; PyObject *old_key, *old_value; - PyObject **value_addr; if (!PyDict_Check(op)) { PyErr_BadInternalCall(); @@ -1625,10 +1612,10 @@ assert(key); assert(hash != -1); mp = (PyDictObject *)op; - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); if (ix == DKIX_ERROR) return -1; - if (ix == DKIX_EMPTY || *value_addr == NULL) { + if (ix == DKIX_EMPTY || old_value == NULL) { _PyErr_SetKeyError(key); return -1; } @@ -1639,13 +1626,11 @@ if (dictresize(mp, DK_SIZE(mp->ma_keys))) { return -1; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); assert(ix >= 0); } - old_value = *value_addr; assert(old_value != NULL); - *value_addr = NULL; mp->ma_used--; mp->ma_version_tag = DICT_NEXT_VERSION(); ep = &DK_ENTRIES(mp->ma_keys)[ix]; @@ -1653,6 +1638,7 @@ ENSURE_ALLOWS_DELETIONS(mp); old_key = ep->me_key; ep->me_key = NULL; + ep->me_value = NULL; Py_DECREF(old_key); Py_DECREF(old_value); @@ -1777,7 +1763,6 @@ Py_ssize_t ix, hashpos; PyObject *old_value, *old_key; PyDictKeyEntry *ep; - PyObject **value_addr; PyDictObject *mp; assert(PyDict_Check(dict)); @@ -1797,10 +1782,10 @@ if (hash == -1) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); if (ix == DKIX_ERROR) return NULL; - if (ix == DKIX_EMPTY || *value_addr == NULL) { + if (ix == DKIX_EMPTY || old_value == NULL) { if (deflt) { Py_INCREF(deflt); return deflt; @@ -1814,13 +1799,11 @@ if (dictresize(mp, DK_SIZE(mp->ma_keys))) { return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); assert(ix >= 0); } - old_value = *value_addr; assert(old_value != NULL); - *value_addr = NULL; mp->ma_used--; mp->ma_version_tag = DICT_NEXT_VERSION(); dk_set_index(mp->ma_keys, hashpos, DKIX_DUMMY); @@ -1828,6 +1811,7 @@ ENSURE_ALLOWS_DELETIONS(mp); old_key = ep->me_key; ep->me_key = NULL; + ep->me_value = NULL; Py_DECREF(old_key); assert(_PyDict_CheckConsistency(mp)); @@ -2045,10 +2029,9 @@ static PyObject * dict_subscript(PyDictObject *mp, PyObject *key) { - PyObject *v; Py_ssize_t ix; Py_hash_t hash; - PyObject **value_addr; + PyObject *value; if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) { @@ -2056,10 +2039,10 @@ if (hash == -1) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix == DKIX_ERROR) return NULL; - if (ix == DKIX_EMPTY || *value_addr == NULL) { + if (ix == DKIX_EMPTY || value == NULL) { if (!PyDict_CheckExact(mp)) { /* Look up __missing__ method if we're a subclass. */ PyObject *missing, *res; @@ -2077,9 +2060,8 @@ _PyErr_SetKeyError(key); return NULL; } - v = *value_addr; - Py_INCREF(v); - return v; + Py_INCREF(value); + return value; } static int @@ -2651,7 +2633,6 @@ if (aval != NULL) { int cmp; PyObject *bval; - PyObject **vaddr; PyObject *key = ep->me_key; /* temporarily bump aval's refcount to ensure it stays alive until we're done with it */ @@ -2659,10 +2640,7 @@ /* ditto for key */ Py_INCREF(key); /* reuse the known hash value */ - if ((b->ma_keys->dk_lookup)(b, key, ep->me_hash, &vaddr, NULL) < 0) - bval = NULL; - else - bval = *vaddr; + b->ma_keys->dk_lookup(b, key, ep->me_hash, &bval, NULL); Py_DECREF(key); if (bval == NULL) { Py_DECREF(aval); @@ -2718,7 +2696,7 @@ register PyDictObject *mp = self; Py_hash_t hash; Py_ssize_t ix; - PyObject **value_addr; + PyObject *value; if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) { @@ -2726,10 +2704,10 @@ if (hash == -1) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix == DKIX_ERROR) return NULL; - if (ix == DKIX_EMPTY || *value_addr == NULL) + if (ix == DKIX_EMPTY || value == NULL) Py_RETURN_FALSE; Py_RETURN_TRUE; } @@ -2742,7 +2720,6 @@ PyObject *val = NULL; Py_hash_t hash; Py_ssize_t ix; - PyObject **value_addr; if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) return NULL; @@ -2753,13 +2730,12 @@ if (hash == -1) return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &val, NULL); if (ix == DKIX_ERROR) return NULL; - if (ix == DKIX_EMPTY || *value_addr == NULL) + if (ix == DKIX_EMPTY || val == NULL) { val = failobj; - else - val = *value_addr; + } Py_INCREF(val); return val; } @@ -2771,7 +2747,6 @@ PyObject *value; Py_hash_t hash; Py_ssize_t hashpos, ix; - PyObject **value_addr; if (!PyDict_Check(d)) { PyErr_BadInternalCall(); @@ -2790,17 +2765,17 @@ return NULL; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, &hashpos); if (ix == DKIX_ERROR) return NULL; if (_PyDict_HasSplitTable(mp) && - ((ix >= 0 && *value_addr == NULL && mp->ma_used != ix) || + ((ix >= 0 && value == NULL && mp->ma_used != ix) || (ix == DKIX_EMPTY && mp->ma_used != mp->ma_keys->dk_nentries))) { if (insertion_resize(mp) < 0) { return NULL; } - find_empty_slot(mp, key, hash, &value_addr, &hashpos); + hashpos = find_empty_slot(mp->ma_keys, key, hash); ix = DKIX_EMPTY; } @@ -2811,7 +2786,7 @@ if (insertion_resize(mp) < 0) { return NULL; } - find_empty_slot(mp, key, hash, &value_addr, &hashpos); + hashpos = find_empty_slot(mp->ma_keys, key, hash); } ep0 = DK_ENTRIES(mp->ma_keys); ep = &ep0[mp->ma_keys->dk_nentries]; @@ -2821,7 +2796,7 @@ MAINTAIN_TRACKING(mp, key, value); ep->me_key = key; ep->me_hash = hash; - if (mp->ma_values) { + if (_PyDict_HasSplitTable(mp)) { assert(mp->ma_values[mp->ma_keys->dk_nentries] == NULL); mp->ma_values[mp->ma_keys->dk_nentries] = value; } @@ -2834,19 +2809,16 @@ mp->ma_keys->dk_nentries++; assert(mp->ma_keys->dk_usable >= 0); } - else if (*value_addr == NULL) { + else if (value == NULL) { value = defaultobj; assert(_PyDict_HasSplitTable(mp)); assert(ix == mp->ma_used); Py_INCREF(value); MAINTAIN_TRACKING(mp, key, value); - *value_addr = value; + mp->ma_values[ix] = value; mp->ma_used++; mp->ma_version_tag = DICT_NEXT_VERSION(); } - else { - value = *value_addr; - } assert(_PyDict_CheckConsistency(mp)); return value; @@ -3100,7 +3072,7 @@ Py_hash_t hash; Py_ssize_t ix; PyDictObject *mp = (PyDictObject *)op; - PyObject **value_addr; + PyObject *value; if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) { @@ -3108,10 +3080,10 @@ if (hash == -1) return -1; } - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix == DKIX_ERROR) return -1; - return (ix != DKIX_EMPTY && *value_addr != NULL); + return (ix != DKIX_EMPTY && value != NULL); } /* Internal version of PyDict_Contains used when the hash value is already known */ @@ -3119,13 +3091,13 @@ _PyDict_Contains(PyObject *op, PyObject *key, Py_hash_t hash) { PyDictObject *mp = (PyDictObject *)op; - PyObject **value_addr; + PyObject *value; Py_ssize_t ix; - ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL); + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value, NULL); if (ix == DKIX_ERROR) return -1; - return (ix != DKIX_EMPTY && *value_addr != NULL); + return (ix != DKIX_EMPTY && value != NULL); } /* Hack to implement "key in dict" */ diff --git a/Objects/odictobject.c b/Objects/odictobject.c --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -535,11 +535,11 @@ static Py_ssize_t _odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash) { - PyObject **value_addr = NULL; + PyObject *value = NULL; PyDictKeysObject *keys = ((PyDictObject *)od)->ma_keys; Py_ssize_t ix; - ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value_addr, NULL); + ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value, NULL); if (ix == DKIX_EMPTY) { return keys->dk_nentries; /* index of new entry */ } -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Dec 7 12:07:45 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 7 Dec 2016 17:07:45 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-12-07 Message-ID: <898f9ebd-30c2-4261-ae32-86b19f9a803f@irsmsx151.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-07 03:46:08 +0000 commit: fdf2e778b88b previous commit: baf972859ec5 revision date: 2016-12-06 06:30:26 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.18% -2.31% 3.35% 6.93% :-) pybench 0.19% -0.00% 6.12% 3.75% :-( regex_v8 0.56% -0.15% -2.08% 10.79% :-) nbody 0.14% 0.75% 10.13% -1.61% :-) json_dump_v2 0.23% 0.11% 2.13% 10.69% :-| normal_startup 0.86% -0.53% -0.36% 2.74% :-| ssbench 0.12% -0.37% 1.93% 1.76% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-12-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 lp_benchmark_robot at intel.com Wed Dec 7 12:20:21 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 7 Dec 2016 17:20:21 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-12-07 Message-ID: <1841ca70-97a3-4df4-a366-919123fa86c2@irsmsx151.ger.corp.intel.com> Results for project Python default, build date 2016-12-07 03:03:05 +0000 commit: 4b37328efa08 previous commit: fa4d8276d0fb revision date: 2016-12-06 23:37:38 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.13% 1.55% -0.30% 12.07% :-| pybench 0.29% 0.17% 1.04% 5.32% :-| regex_v8 3.94% -0.22% 0.16% -5.17% :-| nbody 0.08% -0.71% -1.08% 3.32% :-) json_dump_v2 0.36% 0.02% 7.25% 11.91% :-( normal_startup 0.83% -0.11% -2.75% 6.12% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-07/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Dec 7 19:20:14 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 08 Dec 2016 00:20:14 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NjM1?= =?utf-8?q?=3A_Drop_the_note_that_whatsnew_is_incomplete?= Message-ID: <20161208002014.117023.19835.B416F9D9@psf.io> https://hg.python.org/cpython/rev/d12bc674b74e changeset: 105514:d12bc674b74e branch: 3.6 parent: 105511:c4f39b6f3176 user: Yury Selivanov date: Wed Dec 07 16:19:56 2016 -0800 summary: Issue #28635: Drop the note that whatsnew is incomplete files: Doc/whatsnew/3.6.rst | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -46,12 +46,6 @@ This saves the maintainer the effort of going through the Mercurial log when researching a change. -.. note:: - - Prerelease users should be aware that this document is currently in draft - form. It will be updated substantially as Python 3.6 moves towards release, - so it's worth checking back even after reading earlier versions. - This article explains the new features in Python 3.6, compared to 3.5. .. seealso:: @@ -62,9 +56,6 @@ Summary -- Release highlights ============================= -.. This section singles out the most important changes in Python 3.6. - Brevity is key. - New syntax features: * :ref:`PEP 498 `, formatted string literals. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 19:20:14 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 08 Dec 2016 00:20:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42IChpc3N1ZSAjMjg2MzUp?= Message-ID: <20161208002014.99377.63599.BB97D2AE@psf.io> https://hg.python.org/cpython/rev/1883072efc5f changeset: 105515:1883072efc5f parent: 105513:8d4b2c6a0a7f parent: 105514:d12bc674b74e user: Yury Selivanov date: Wed Dec 07 16:20:10 2016 -0800 summary: Merge 3.6 (issue #28635) files: Doc/whatsnew/3.6.rst | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -46,12 +46,6 @@ This saves the maintainer the effort of going through the Mercurial log when researching a change. -.. note:: - - Prerelease users should be aware that this document is currently in draft - form. It will be updated substantially as Python 3.6 moves towards release, - so it's worth checking back even after reading earlier versions. - This article explains the new features in Python 3.6, compared to 3.5. .. seealso:: @@ -62,9 +56,6 @@ Summary -- Release highlights ============================= -.. This section singles out the most important changes in Python 3.6. - Brevity is key. - New syntax features: * :ref:`PEP 498 `, formatted string literals. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 23:38:56 2016 From: python-checkins at python.org (ned.deily) Date: Thu, 08 Dec 2016 04:38:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTAw?= =?utf-8?q?=3A_Update_documentation_sidebar_for_3=2E6=2E0rc=2E?= Message-ID: <20161208043856.117023.79758.2F18197E@psf.io> https://hg.python.org/cpython/rev/d350fc4d78ff changeset: 105517:d350fc4d78ff branch: 3.5 parent: 105510:4a610bc8577b user: Ned Deily date: Wed Dec 07 23:34:49 2016 -0500 summary: Issue #28900: Update documentation sidebar for 3.6.0rc. files: Doc/tools/templates/indexsidebar.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -3,7 +3,8 @@

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 23:38:56 2016 From: python-checkins at python.org (ned.deily) Date: Thu, 08 Dec 2016 04:38:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328900=3A_Update_documentation_sidebar_for_3=2E6?= =?utf-8?b?LjByYy4=?= Message-ID: <20161208043856.99503.54543.BC77A074@psf.io> https://hg.python.org/cpython/rev/f200ff0a0057 changeset: 105519:f200ff0a0057 parent: 105515:1883072efc5f parent: 105518:148c46d180b2 user: Ned Deily date: Wed Dec 07 23:38:30 2016 -0500 summary: Issue #28900: Update documentation sidebar for 3.6.0rc. files: Doc/tools/templates/indexsidebar.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -3,7 +3,8 @@

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 23:38:56 2016 From: python-checkins at python.org (ned.deily) Date: Thu, 08 Dec 2016 04:38:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4OTAw?= =?utf-8?q?=3A_Update_documentation_sidebar_for_3=2E6=2E0rc=2E?= Message-ID: <20161208043856.118019.28335.664A03CA@psf.io> https://hg.python.org/cpython/rev/e414fb1640e0 changeset: 105516:e414fb1640e0 branch: 2.7 parent: 105470:fdf2e778b88b user: Ned Deily date: Wed Dec 07 23:34:23 2016 -0500 summary: Issue #28900: Update documentation sidebar for 3.6.0rc. files: Doc/tools/templates/indexsidebar.html | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -2,8 +2,9 @@

{% trans %}Download these documents{% endtrans %}

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 7 23:38:56 2016 From: python-checkins at python.org (ned.deily) Date: Thu, 08 Dec 2016 04:38:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328900=3A_Update_documentation_sidebar_for_3=2E6=2E0rc?= =?utf-8?q?=2E?= Message-ID: <20161208043856.117023.10882.596FE5FE@psf.io> https://hg.python.org/cpython/rev/148c46d180b2 changeset: 105518:148c46d180b2 branch: 3.6 parent: 105514:d12bc674b74e parent: 105517:d350fc4d78ff user: Ned Deily date: Wed Dec 07 23:37:12 2016 -0500 summary: Issue #28900: Update documentation sidebar for 3.6.0rc. files: Doc/tools/templates/indexsidebar.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -3,7 +3,8 @@

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 02:55:09 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 08 Dec 2016 07:55:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogZ3VhcmQgSEFWRV9M?= =?utf-8?q?ONG=5FLONG_definition_to_prevent_redefinition_=28=2328898=29?= Message-ID: <20161208075509.15079.56473.A4880625@psf.io> https://hg.python.org/cpython/rev/4745d801cae2 changeset: 105520:4745d801cae2 branch: 3.6 parent: 105518:148c46d180b2 user: Benjamin Peterson date: Wed Dec 07 23:54:28 2016 -0800 summary: guard HAVE_LONG_LONG definition to prevent redefinition (#28898) files: Include/pyport.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h --- a/Include/pyport.h +++ b/Include/pyport.h @@ -37,9 +37,10 @@ * integral synonyms. Only define the ones we actually need. */ -// long long is required now. Define HAVE_LONG_LONG unconditionally for -// compatibility. +// long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. +#ifndef HAVE_LONG_LONG #define HAVE_LONG_LONG +#endif #ifndef PY_LONG_LONG #define PY_LONG_LONG long long /* If LLONG_MAX is defined in limits.h, use that. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 02:55:10 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 08 Dec 2016 07:55:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy42ICgjMjg4OTgp?= Message-ID: <20161208075509.117560.29532.9E5BAA6C@psf.io> https://hg.python.org/cpython/rev/1afc3f4f5502 changeset: 105521:1afc3f4f5502 parent: 105519:f200ff0a0057 parent: 105520:4745d801cae2 user: Benjamin Peterson date: Wed Dec 07 23:55:03 2016 -0800 summary: merge 3.6 (#28898) files: Include/pyport.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h --- a/Include/pyport.h +++ b/Include/pyport.h @@ -37,9 +37,10 @@ * integral synonyms. Only define the ones we actually need. */ -// long long is required now. Define HAVE_LONG_LONG unconditionally for -// compatibility. +// long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. +#ifndef HAVE_LONG_LONG #define HAVE_LONG_LONG +#endif #ifndef PY_LONG_LONG #define PY_LONG_LONG long long /* If LLONG_MAX is defined in limits.h, use that. */ -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Dec 8 04:06:44 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 08 Dec 2016 09:06:44 +0000 Subject: [Python-checkins] Daily reference leaks (f200ff0a0057): sum=4 Message-ID: <20161208090644.72965.36895.7A61ECD0@psf.io> results for f200ff0a0057 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/refloggx59RF', '--timeout', '7200'] From python-checkins at python.org Thu Dec 8 05:10:34 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 08 Dec 2016 10:10:34 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI2OTM5?= =?utf-8?q?=3A_Add_the_support=2Esetswitchinterval=28=29_function_to_fix?= Message-ID: <20161208101034.28464.21563.9C4DBACB@psf.io> https://hg.python.org/cpython/rev/fd1718badb67 changeset: 105522:fd1718badb67 branch: 3.6 parent: 105520:4745d801cae2 user: Xavier de Gaye date: Thu Dec 08 11:06:56 2016 +0100 summary: Issue #26939: Add the support.setswitchinterval() function to fix test_functools hanging on the Android armv7 qemu emulator. files: Lib/test/support/__init__.py | 16 ++++++++++++++++ Lib/test/test_functools.py | 2 +- Misc/NEWS | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -93,6 +93,7 @@ "check__all__", "requires_android_level", "requires_multiprocessing_queue", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", + "setswitchinterval", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", # processes @@ -2547,3 +2548,18 @@ continue if spawn.find_executable(cmd[0]) is None: return cmd[0] + + +_is_android_emulator = None +def setswitchinterval(interval): + # Setting a very low gil interval on the Android emulator causes python + # to hang (issue #26939). + minimum_interval = 1e-5 + if is_android and interval < minimum_interval: + global _is_android_emulator + if _is_android_emulator is None: + _is_android_emulator = (subprocess.check_output( + ['getprop', 'ro.kernel.qemu']).strip() == b'1') + if _is_android_emulator: + interval = minimum_interval + return sys.setswitchinterval(interval) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1322,7 +1322,7 @@ f.cache_clear() orig_si = sys.getswitchinterval() - sys.setswitchinterval(1e-6) + support.setswitchinterval(1e-6) try: # create n threads in order to fill cache threads = [threading.Thread(target=full, args=[k]) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,12 @@ - Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. +Tests +----- + +- Issue #26939: Add the support.setswitchinterval() function to fix + test_functools hanging on the Android armv7 qemu emulator. + What's New in Python 3.6.0 release candidate 1 ============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 05:10:34 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 08 Dec 2016 10:10:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI2OTM5OiBNZXJnZSAzLjYu?= Message-ID: <20161208101034.21105.34795.27EF68C0@psf.io> https://hg.python.org/cpython/rev/c5d7e46926ac changeset: 105523:c5d7e46926ac parent: 105521:1afc3f4f5502 parent: 105522:fd1718badb67 user: Xavier de Gaye date: Thu Dec 08 11:09:54 2016 +0100 summary: Issue #26939: Merge 3.6. files: Lib/test/support/__init__.py | 16 ++++++++++++++++ Lib/test/test_functools.py | 2 +- Misc/NEWS | 3 +++ 3 files changed, 20 insertions(+), 1 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -93,6 +93,7 @@ "check__all__", "requires_android_level", "requires_multiprocessing_queue", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", + "setswitchinterval", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", # processes @@ -2552,3 +2553,18 @@ continue if spawn.find_executable(cmd[0]) is None: return cmd[0] + + +_is_android_emulator = None +def setswitchinterval(interval): + # Setting a very low gil interval on the Android emulator causes python + # to hang (issue #26939). + minimum_interval = 1e-5 + if is_android and interval < minimum_interval: + global _is_android_emulator + if _is_android_emulator is None: + _is_android_emulator = (subprocess.check_output( + ['getprop', 'ro.kernel.qemu']).strip() == b'1') + if _is_android_emulator: + interval = minimum_interval + return sys.setswitchinterval(interval) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1322,7 +1322,7 @@ f.cache_clear() orig_si = sys.getswitchinterval() - sys.setswitchinterval(1e-6) + support.setswitchinterval(1e-6) try: # create n threads in order to fill cache threads = [threading.Thread(target=full, args=[k]) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -579,6 +579,9 @@ - Issue #28217: Adds _testconsole module to test console input. +- Issue #26939: Add the support.setswitchinterval() function to fix + test_functools hanging on the Android armv7 qemu emulator. + What's New in Python 3.6.0 beta 1 ================================= -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 05:28:02 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 08 Dec 2016 10:28:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI2OTQw?= =?utf-8?q?=3A_Fix_test=5Fimportlib_that_hangs_on_the_Android_armv7_qemu_e?= =?utf-8?q?mulator=2E?= Message-ID: <20161208102802.99377.21456.42A03E73@psf.io> https://hg.python.org/cpython/rev/1bb2f4b8440e changeset: 105524:1bb2f4b8440e branch: 3.6 parent: 105522:fd1718badb67 user: Xavier de Gaye date: Thu Dec 08 11:26:18 2016 +0100 summary: Issue #26940: Fix test_importlib that hangs on the Android armv7 qemu emulator. files: Lib/test/test_importlib/test_locks.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py --- a/Lib/test/test_importlib/test_locks.py +++ b/Lib/test/test_importlib/test_locks.py @@ -57,7 +57,7 @@ def setUp(self): try: self.old_switchinterval = sys.getswitchinterval() - sys.setswitchinterval(0.000001) + support.setswitchinterval(0.000001) except AttributeError: self.old_switchinterval = None -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 05:28:02 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 08 Dec 2016 10:28:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI2OTQwOiBNZXJnZSAzLjYu?= Message-ID: <20161208102802.99503.11773.C8F0693D@psf.io> https://hg.python.org/cpython/rev/e401c5a95758 changeset: 105525:e401c5a95758 parent: 105523:c5d7e46926ac parent: 105524:1bb2f4b8440e user: Xavier de Gaye date: Thu Dec 08 11:27:27 2016 +0100 summary: Issue #26940: Merge 3.6. files: Lib/test/test_importlib/test_locks.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_importlib/test_locks.py b/Lib/test/test_importlib/test_locks.py --- a/Lib/test/test_importlib/test_locks.py +++ b/Lib/test/test_importlib/test_locks.py @@ -57,7 +57,7 @@ def setUp(self): try: self.old_switchinterval = sys.getswitchinterval() - sys.setswitchinterval(0.000001) + support.setswitchinterval(0.000001) except AttributeError: self.old_switchinterval = None -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 06:22:23 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 08 Dec 2016 11:22:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI2OTQx?= =?utf-8?q?=3A_Fix_test=5Fthreading_that_hangs_on_the_Android_armv7_qemu_e?= =?utf-8?q?mulator=2E?= Message-ID: <20161208112223.99172.25992.3497D8E8@psf.io> https://hg.python.org/cpython/rev/b64ba5604e48 changeset: 105526:b64ba5604e48 branch: 3.6 parent: 105524:1bb2f4b8440e user: Xavier de Gaye date: Thu Dec 08 12:21:00 2016 +0100 summary: Issue #26941: Fix test_threading that hangs on the Android armv7 qemu emulator. files: Lib/test/test_threading.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -462,7 +462,7 @@ self.addCleanup(sys.setswitchinterval, old_interval) # Make the bug more likely to manifest. - sys.setswitchinterval(1e-6) + test.support.setswitchinterval(1e-6) for i in range(20): t = threading.Thread(target=lambda: None) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 06:22:23 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 08 Dec 2016 11:22:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI2OTQxOiBNZXJnZSAzLjYu?= Message-ID: <20161208112223.13525.48757.1861C278@psf.io> https://hg.python.org/cpython/rev/8688a664995c changeset: 105527:8688a664995c parent: 105525:e401c5a95758 parent: 105526:b64ba5604e48 user: Xavier de Gaye date: Thu Dec 08 12:21:53 2016 +0100 summary: Issue #26941: Merge 3.6. files: Lib/test/test_threading.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -462,7 +462,7 @@ self.addCleanup(sys.setswitchinterval, old_interval) # Make the bug more likely to manifest. - sys.setswitchinterval(1e-6) + test.support.setswitchinterval(1e-6) for i in range(20): t = threading.Thread(target=lambda: None) -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Thu Dec 8 07:31:15 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 8 Dec 2016 12:31:15 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-12-08 Message-ID: <1808586f-6e55-451b-9d24-c6fe2ab882f4@irsmsx153.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-12-08 03:46:08 +0000 commit: fdf2e778b88b previous commit: baf972859ec5 revision date: 2016-12-06 06:30:26 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.18% -2.31% 3.35% 6.93% :-) pybench 0.19% -0.00% 6.12% 3.75% :-( regex_v8 0.56% -0.15% -2.08% 10.79% :-) nbody 0.14% 0.75% 10.13% -1.61% :-) json_dump_v2 0.23% 0.11% 2.13% 10.69% :-| normal_startup 0.86% -0.53% -0.36% 2.74% :-| ssbench 0.12% -0.37% 1.93% 1.76% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-12-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 Thu Dec 8 07:32:12 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 8 Dec 2016 12:32:12 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-12-08 Message-ID: <0e8f9cf8-f39f-42de-ade6-e4fb93f36ea4@irsmsx153.ger.corp.intel.com> Results for project Python default, build date 2016-12-08 03:03:08 +0000 commit: 1883072efc5f previous commit: 4b37328efa08 revision date: 2016-12-08 00:20: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 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.46% -1.77% 15.77% :-| pybench 0.30% -0.23% 0.81% 5.52% :-| regex_v8 3.88% 0.77% 0.93% 2.60% :-( nbody 0.31% -1.47% -2.56% 6.55% :-) json_dump_v2 0.36% -0.63% 6.67% 11.56% :-( normal_startup 0.95% 0.12% -2.89% 6.64% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-12-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 Thu Dec 8 11:17:23 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 08 Dec 2016 16:17:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4Nzcw?= =?utf-8?q?=3A_Update_python-gdb=2Epy_for_fastcalls?= Message-ID: <20161208161722.99494.32088.E8521E80@psf.io> https://hg.python.org/cpython/rev/f41d02d7da37 changeset: 105528:f41d02d7da37 branch: 3.6 parent: 105526:b64ba5604e48 user: Victor Stinner date: Tue Nov 22 22:53:18 2016 +0100 summary: Issue #28770: Update python-gdb.py for fastcalls Frame.is_other_python_frame() now also handles _PyCFunction_FastCallDict() frames. Thanks to the new code to handle fast calls, python-gdb.py is now also able to detect the frame. files: Lib/test/test_gdb.py | 20 ++++++------ Tools/gdb/libpython.py | 47 +++++++++++++++++++---------- 2 files changed, 41 insertions(+), 26 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 @@ -679,7 +679,7 @@ def test_pyup_command(self): 'Verify that the "py-up" command works' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up']) + cmds_after_breakpoint=['py-up', 'py-up']) self.assertMultilineMatches(bt, r'''^.* #[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\) @@ -698,7 +698,7 @@ def test_up_at_top(self): 'Verify handling of "py-up" at the top of the stack' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up'] * 4) + cmds_after_breakpoint=['py-up'] * 5) self.assertEndsWith(bt, 'Unable to find an older python frame\n') @@ -708,7 +708,7 @@ def test_up_then_down(self): 'Verify "py-up" followed by "py-down"' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up', 'py-down']) + cmds_after_breakpoint=['py-up', 'py-up', 'py-down']) self.assertMultilineMatches(bt, r'''^.* #[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\) @@ -727,6 +727,7 @@ self.assertMultilineMatches(bt, r'''^.* Traceback \(most recent call first\): + File ".*gdb_sample.py", line 10, in baz id\(42\) File ".*gdb_sample.py", line 7, in bar @@ -815,7 +816,6 @@ ) self.assertIn('Garbage-collecting', gdb_output) - @unittest.skip("FIXME: builtin method is not shown in py-bt and py-bt-full") @unittest.skipIf(python_is_optimized(), "Python was compiled with optimizations") # Some older versions of gdb will fail with @@ -854,7 +854,7 @@ def test_basic_command(self): 'Verify that the "py-print" command works' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-print args']) + cmds_after_breakpoint=['py-up', 'py-print args']) self.assertMultilineMatches(bt, r".*\nlocal 'args' = \(1, 2, 3\)\n.*") @@ -863,7 +863,7 @@ @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") def test_print_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up', 'py-print c', 'py-print b', 'py-print a']) + cmds_after_breakpoint=['py-up', 'py-up', 'py-print c', 'py-print b', 'py-print a']) self.assertMultilineMatches(bt, r".*\nlocal 'c' = 3\nlocal 'b' = 2\nlocal 'a' = 1\n.*") @@ -871,7 +871,7 @@ "Python was compiled with optimizations") def test_printing_global(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-print __name__']) + cmds_after_breakpoint=['py-up', 'py-print __name__']) self.assertMultilineMatches(bt, r".*\nglobal '__name__' = '__main__'\n.*") @@ -879,7 +879,7 @@ "Python was compiled with optimizations") def test_printing_builtin(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-print len']) + cmds_after_breakpoint=['py-up', 'py-print len']) self.assertMultilineMatches(bt, r".*\nbuiltin 'len' = \n.*") @@ -888,7 +888,7 @@ "Python was compiled with optimizations") def test_basic_command(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-locals']) + cmds_after_breakpoint=['py-up', 'py-locals']) self.assertMultilineMatches(bt, r".*\nargs = \(1, 2, 3\)\n.*") @@ -897,7 +897,7 @@ "Python was compiled with optimizations") def test_locals_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up', 'py-locals']) + cmds_after_breakpoint=['py-up', 'py-up', 'py-locals']) self.assertMultilineMatches(bt, r".*\na = 1\nb = 2\nc = 3\n.*") diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1492,23 +1492,38 @@ ''' if self.is_waiting_for_gil(): return 'Waiting for the GIL' - elif self.is_gc_collect(): + + if self.is_gc_collect(): return 'Garbage-collecting' - else: - # Detect invocations of PyCFunction instances: - older = self.older() - if older and older._gdbframe.name() == 'PyCFunction_Call': - # Within that frame: - # "func" is the local containing the PyObject* of the - # PyCFunctionObject instance - # "f" is the same value, but cast to (PyCFunctionObject*) - # "self" is the (PyObject*) of the 'self' - try: - # Use the prettyprinter for the func: - func = older._gdbframe.read_var('func') - return str(func) - except RuntimeError: - return 'PyCFunction invocation (unable to read "func")' + + # Detect invocations of PyCFunction instances: + older = self.older() + if not older: + return False + + caller = older._gdbframe.name() + if not caller: + return False + + if caller == 'PyCFunction_Call': + # Within that frame: + # "func" is the local containing the PyObject* of the + # PyCFunctionObject instance + # "f" is the same value, but cast to (PyCFunctionObject*) + # "self" is the (PyObject*) of the 'self' + try: + # Use the prettyprinter for the func: + func = older._gdbframe.read_var('func') + return str(func) + except RuntimeError: + return 'PyCFunction invocation (unable to read "func")' + + elif caller == '_PyCFunction_FastCallDict': + try: + func = older._gdbframe.read_var('func_obj') + return str(func) + except RuntimeError: + return 'PyCFunction invocation (unable to read "func_obj")' # This frame isn't worth reporting: return False -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 11:17:29 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 08 Dec 2016 16:17:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_3=2E6?= Message-ID: <20161208161729.21471.937.44E32B18@psf.io> https://hg.python.org/cpython/rev/e66481099b9b changeset: 105529:e66481099b9b parent: 105527:8688a664995c parent: 105528:f41d02d7da37 user: Victor Stinner date: Thu Dec 08 17:17:17 2016 +0100 summary: Null merge 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 12:02:11 2016 From: python-checkins at python.org (steve.dower) Date: Thu, 08 Dec 2016 17:02:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODk2?= =?utf-8?q?=3A_Deprecate_WindowsRegistryFinder?= Message-ID: <20161208170210.117052.70245.327A7044@psf.io> https://hg.python.org/cpython/rev/25df9671663b changeset: 105530:25df9671663b branch: 3.6 parent: 105528:f41d02d7da37 user: Steve Dower date: Wed Dec 07 13:02:27 2016 -0800 summary: Issue #28896: Deprecate WindowsRegistryFinder files: Doc/library/importlib.rst | 4 ++++ Doc/using/windows.rst | 8 ++++++++ Doc/whatsnew/3.6.rst | 4 ++++ Misc/NEWS | 5 +++++ 4 files changed, 21 insertions(+), 0 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -806,6 +806,10 @@ .. versionadded:: 3.3 + .. deprecated:: 3.6 + Use :mod:`site` configuration instead. Future versions of Python may + not enable this finder by default. + .. class:: PathFinder diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -823,6 +823,14 @@ * Adds ``pythonXX.zip`` as a potential landmark when directly adjacent to the executable. +.. deprecated:: + 3.6 + + Modules specified in the registry under ``Modules`` (not ``PythonPath``) + may be imported by :class:`importlib.machinery.WindowsRegistryFinder`. + This finder is enabled on Windows in 3.6.0 and earlier, but may need to + be explicitly added to :attr:`sys.meta_path` in the future. + Additional modules ================== diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -1938,6 +1938,10 @@ been deprecated in previous versions of Python in favour of :meth:`importlib.abc.Loader.exec_module`. +The :class:`importlib.machinery.WindowsRegistryFinder` class is now +deprecated. As of 3.6.0, it is still added to :attr:`sys.meta_path` by +default (on Windows), but this may change in future releases. + os ~~ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,11 @@ - Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. +Windows +------- + +- Issue #28896: Deprecate WindowsRegistryFinder + Tests ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 12:02:12 2016 From: python-checkins at python.org (steve.dower) Date: Thu, 08 Dec 2016 17:02:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328896=3A_Deprecate_WindowsRegistryFinder?= Message-ID: <20161208170210.27957.37746.D6F39C12@psf.io> https://hg.python.org/cpython/rev/5376b3a168c8 changeset: 105531:5376b3a168c8 parent: 105529:e66481099b9b parent: 105530:25df9671663b user: Steve Dower date: Thu Dec 08 09:01:39 2016 -0800 summary: Issue #28896: Deprecate WindowsRegistryFinder files: Doc/library/importlib.rst | 4 ++++ Doc/using/windows.rst | 8 ++++++++ Doc/whatsnew/3.6.rst | 4 ++++ Misc/NEWS | 2 ++ 4 files changed, 18 insertions(+), 0 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -806,6 +806,10 @@ .. versionadded:: 3.3 + .. deprecated:: 3.6 + Use :mod:`site` configuration instead. Future versions of Python may + not enable this finder by default. + .. class:: PathFinder diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -823,6 +823,14 @@ * Adds ``pythonXX.zip`` as a potential landmark when directly adjacent to the executable. +.. deprecated:: + 3.6 + + Modules specified in the registry under ``Modules`` (not ``PythonPath``) + may be imported by :class:`importlib.machinery.WindowsRegistryFinder`. + This finder is enabled on Windows in 3.6.0 and earlier, but may need to + be explicitly added to :attr:`sys.meta_path` in the future. + Additional modules ================== diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -1938,6 +1938,10 @@ been deprecated in previous versions of Python in favour of :meth:`importlib.abc.Loader.exec_module`. +The :class:`importlib.machinery.WindowsRegistryFinder` class is now +deprecated. As of 3.6.0, it is still added to :attr:`sys.meta_path` by +default (on Windows), but this may change in future releases. + os ~~ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -457,6 +457,8 @@ Windows ------- +- Issue #28896: Deprecate WindowsRegistryFinder + - Issue #28522: Fixes mishandled buffer reallocation in getpathp.c - Issue #28402: Adds signed catalog files for stdlib on Windows. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_=5FPy=5FVaBuildStack?= =?utf-8?q?=28=29_function?= Message-ID: <20161209011659.72965.69736.B5366EFF@psf.io> https://hg.python.org/cpython/rev/c1414b182232 changeset: 105536:c1414b182232 user: Victor Stinner date: Fri Dec 09 00:29:49 2016 +0100 summary: Add _Py_VaBuildStack() function Issue #28915: Similar to Py_VaBuildValue(), but work on a C array of PyObject*, instead of creating a tuple. files: Include/modsupport.h | 13 ++++ Python/modsupport.c | 98 ++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 0 deletions(-) diff --git a/Include/modsupport.h b/Include/modsupport.h --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -21,9 +21,16 @@ #endif /* !Py_LIMITED_API */ #define Py_BuildValue _Py_BuildValue_SizeT #define Py_VaBuildValue _Py_VaBuildValue_SizeT +#define _Py_VaBuildStack _Py_VaBuildStack_SizeT #else #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); +PyAPI_FUNC(PyObject **) _Py_VaBuildStack_SizeT( + PyObject **small_stack, + Py_ssize_t small_stack_len, + const char *format, + va_list va, + Py_ssize_t *p_nargs); #endif /* !Py_LIMITED_API */ #endif @@ -47,6 +54,12 @@ const char *, char **, va_list); #endif PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); +PyAPI_FUNC(PyObject **) _Py_VaBuildStack( + PyObject **small_stack, + Py_ssize_t small_stack_len, + const char *format, + va_list va, + Py_ssize_t *p_nargs); #ifndef Py_LIMITED_API typedef struct _PyArg_Parser { diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -7,6 +7,7 @@ typedef double va_double; static PyObject *va_build_value(const char *, va_list, int); +static PyObject **va_build_stack(PyObject **small_stack, Py_ssize_t small_stack_len, const char *, va_list, int, Py_ssize_t*); /* Package context -- the full module name for package imports */ const char *_Py_PackageContext = NULL; @@ -60,6 +61,7 @@ /* After an original idea and first implementation by Steven Miale */ static PyObject *do_mktuple(const char**, va_list *, char, Py_ssize_t, int); +static int do_mkstack(PyObject **, const char**, va_list *, char, Py_ssize_t, int); static PyObject *do_mklist(const char**, va_list *, char, Py_ssize_t, int); static PyObject *do_mkdict(const char**, va_list *, char, Py_ssize_t, int); static PyObject *do_mkvalue(const char**, va_list *, int); @@ -182,6 +184,43 @@ return v; } +static int +do_mkstack(PyObject **stack, const char **p_format, va_list *p_va, + char endchar, Py_ssize_t n, int flags) +{ + Py_ssize_t i; + + if (n < 0) { + return -1; + } + /* Note that we can't bail immediately on error as this will leak + refcounts on any 'N' arguments. */ + for (i = 0; i < n; i++) { + PyObject *w = do_mkvalue(p_format, p_va, flags); + if (w == NULL) { + do_ignore(p_format, p_va, endchar, n - i - 1, flags); + goto error; + } + stack[i] = w; + } + if (**p_format != endchar) { + PyErr_SetString(PyExc_SystemError, + "Unmatched paren in format"); + goto error; + } + if (endchar) { + ++*p_format; + } + return 0; + +error: + n = i; + for (i=0; i < n; i++) { + Py_DECREF(stack[i]); + } + return -1; +} + static PyObject * do_mktuple(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { @@ -488,6 +527,65 @@ return retval; } +PyObject ** +_Py_VaBuildStack(PyObject **small_stack, Py_ssize_t small_stack_len, + const char *format, va_list va, Py_ssize_t *p_nargs) +{ + return va_build_stack(small_stack, small_stack_len, format, va, 0, p_nargs); +} + +PyObject ** +_Py_VaBuildStack_SizeT(PyObject **small_stack, Py_ssize_t small_stack_len, + const char *format, va_list va, Py_ssize_t *p_nargs) +{ + return va_build_stack(small_stack, small_stack_len, format, va, FLAG_SIZE_T, p_nargs); +} + +static PyObject ** +va_build_stack(PyObject **small_stack, Py_ssize_t small_stack_len, + const char *format, va_list va, int flags, Py_ssize_t *p_nargs) +{ + const char *f; + Py_ssize_t n; + va_list lva; + PyObject **stack; + int res; + + n = countformat(format, '\0'); + if (n < 0) { + *p_nargs = 0; + return NULL; + } + + if (n == 0) { + *p_nargs = 0; + return small_stack; + } + + if (n <= small_stack_len) { + stack = small_stack; + } + else { + stack = PyMem_Malloc(n * sizeof(stack[0])); + if (stack == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + va_copy(lva, va); + f = format; + res = do_mkstack(stack, &f, &lva, '\0', n, flags); + va_end(lva); + + if (res < 0) { + return NULL; + } + + *p_nargs = n; + return stack; +} + PyObject * PyEval_CallFunction(PyObject *callable, const char *format, ...) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29?= Message-ID: <20161209011659.30759.8433.B32FAF0B@psf.io> https://hg.python.org/cpython/rev/67302e6caa29 changeset: 105539:67302e6caa29 user: Victor Stinner date: Fri Dec 09 00:36:19 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string only use the format 'O' for objects, like "(O)". _PyObject_CallMethodIdObjArgs() avoids the code to parse a format string and avoids the creation of a temporary tuple. files: Modules/_io/textio.c | 4 ++-- Objects/descrobject.c | 3 ++- Python/sysmodule.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -2435,7 +2435,7 @@ } finally: - res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, "(O)", saved_state); + res = _PyObject_CallMethodIdObjArgs(self->decoder, &PyId_setstate, saved_state, NULL); Py_DECREF(saved_state); if (res == NULL) return NULL; @@ -2449,7 +2449,7 @@ if (saved_state) { PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); - res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, "(O)", saved_state); + res = _PyObject_CallMethodIdObjArgs(self->decoder, &PyId_setstate, saved_state, NULL); _PyErr_ChainExceptions(type, value, traceback); Py_DECREF(saved_state); Py_XDECREF(res); diff --git a/Objects/descrobject.c b/Objects/descrobject.c --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -804,7 +804,8 @@ if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &def)) return NULL; - return _PyObject_CallMethodId(pp->mapping, &PyId_get, "(OO)", key, def); + return _PyObject_CallMethodIdObjArgs(pp->mapping, &PyId_get, + key, def, NULL); } static PyObject * diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -130,7 +130,7 @@ buffer = _PyObject_GetAttrId(outf, &PyId_buffer); if (buffer) { - result = _PyObject_CallMethodId(buffer, &PyId_write, "(O)", encoded); + result = _PyObject_CallMethodIdObjArgs(buffer, &PyId_write, encoded, NULL); Py_DECREF(buffer); Py_DECREF(encoded); if (result == NULL) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_=5FPyObject=5FFastCall?= =?utf-8?q?Va=28=29_helper?= Message-ID: <20161209011658.73309.35790.895589D7@psf.io> https://hg.python.org/cpython/rev/b771cf37714b changeset: 105532:b771cf37714b user: Victor Stinner date: Fri Dec 09 00:21:55 2016 +0100 summary: Add _PyObject_FastCallVa() helper Issue #28915: Add _PyObject_FastCallVa() helper to factorize code of functions: * PyObject_CallFunctionObjArgs() * PyObject_CallMethodObjArgs() * _PyObject_CallMethodIdObjArgs() Inline objargs_mkstack() into _PyObject_FastCallVa(), remove objargs_mkstack(). files: Objects/abstract.c | 118 +++++++++++--------------------- 1 files changed, 42 insertions(+), 76 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2715,80 +2715,77 @@ return retval; } -static PyObject ** -objargs_mkstack(PyObject **small_stack, Py_ssize_t small_stack_size, - va_list va, Py_ssize_t *p_nargs) +static PyObject * +_PyObject_FastCallVa(PyObject *callable, va_list vargs) { - Py_ssize_t i, n; + PyObject *small_stack[5]; + PyObject **stack; + Py_ssize_t nargs; + PyObject *result; + Py_ssize_t i; va_list countva; - PyObject **stack; + + if (callable == NULL) { + return null_error(); + } /* Count the number of arguments */ - va_copy(countva, va); - - n = 0; + va_copy(countva, vargs); + nargs = 0; while (1) { PyObject *arg = va_arg(countva, PyObject *); if (arg == NULL) { break; } - n++; + nargs++; } - *p_nargs = n; + va_end(countva); /* Copy arguments */ - if (n <= small_stack_size) { + if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { stack = small_stack; } else { - stack = PyMem_Malloc(n * sizeof(stack[0])); + stack = PyMem_Malloc(nargs * sizeof(stack[0])); if (stack == NULL) { - va_end(countva); PyErr_NoMemory(); return NULL; } } - for (i = 0; i < n; ++i) { - stack[i] = va_arg(va, PyObject *); + for (i = 0; i < nargs; ++i) { + stack[i] = va_arg(vargs, PyObject *); } - va_end(countva); - return stack; + + /* 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, ...) { - PyObject *small_stack[5]; - PyObject **stack; - Py_ssize_t nargs; + va_list vargs; PyObject *result; - va_list vargs; if (callable == NULL || name == NULL) { return null_error(); } callable = PyObject_GetAttr(callable, name); - if (callable == NULL) - return NULL; - - /* count the args */ - va_start(vargs, name); - stack = objargs_mkstack(small_stack, Py_ARRAY_LENGTH(small_stack), - vargs, &nargs); - va_end(vargs); - if (stack == NULL) { - Py_DECREF(callable); + if (callable == NULL) { return NULL; } - result = _PyObject_FastCall(callable, stack, nargs); + va_start(vargs, name); + result = _PyObject_FastCallVa(callable, vargs); + va_end(vargs); + Py_DECREF(callable); - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; } @@ -2796,66 +2793,35 @@ _PyObject_CallMethodIdObjArgs(PyObject *obj, struct _Py_Identifier *name, ...) { - PyObject *small_stack[5]; - PyObject **stack; - PyObject *callable; - Py_ssize_t nargs; - PyObject *result; va_list vargs; + PyObject *callable, *result; if (obj == NULL || name == NULL) { return null_error(); } callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) - return NULL; - - /* count the args */ - va_start(vargs, name); - stack = objargs_mkstack(small_stack, Py_ARRAY_LENGTH(small_stack), - vargs, &nargs); - va_end(vargs); - if (stack == NULL) { - Py_DECREF(callable); + if (callable == NULL) { return NULL; } - result = _PyObject_FastCall(callable, stack, nargs); + va_start(vargs, name); + result = _PyObject_FastCallVa(callable, vargs); + va_end(vargs); + Py_DECREF(callable); - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; } PyObject * PyObject_CallFunctionObjArgs(PyObject *callable, ...) { - PyObject *small_stack[5]; - PyObject **stack; - Py_ssize_t nargs; + va_list vargs; PyObject *result; - va_list vargs; - - if (callable == NULL) { - return null_error(); - } - - /* count the args */ + va_start(vargs, callable); - stack = objargs_mkstack(small_stack, Py_ARRAY_LENGTH(small_stack), - vargs, &nargs); + result = _PyObject_FastCallVa(callable, vargs); va_end(vargs); - if (stack == NULL) { - return NULL; - } - - result = _PyObject_FastCall(callable, stack, nargs); - if (stack != small_stack) { - PyMem_Free(stack); - } return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_=5FPyObject=5FCallFunction?= =?utf-8?q?Va=28=29_uses_fast_call?= Message-ID: <20161209011659.13469.20311.4B194EE8@psf.io> https://hg.python.org/cpython/rev/69948a157507 changeset: 105537:69948a157507 user: Victor Stinner date: Fri Dec 09 00:31:47 2016 +0100 summary: _PyObject_CallFunctionVa() uses fast call Issue #28915: Use _Py_VaBuildStack() to build a C array of PyObject* and then use _PyObject_FastCall(). The function has a special case if the stack only contains one parameter and the parameter is a tuple: "unpack" the tuple of arguments in this case. files: Objects/abstract.c | 34 +++++++++++++++++++++++++--------- 1 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2523,7 +2523,12 @@ _PyObject_CallFunctionVa(PyObject *callable, const char *format, va_list va, int is_size_t) { - PyObject *args, *result; + PyObject* small_stack[5]; + /*const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack);*/ + const Py_ssize_t small_stack_len = 0; + PyObject **stack; + Py_ssize_t nargs, i; + PyObject *result; if (callable == NULL) { return null_error(); @@ -2534,24 +2539,35 @@ } if (is_size_t) { - args = Py_VaBuildValue(format, va); + stack = _Py_VaBuildStack(small_stack, small_stack_len, format, va, &nargs); } else { - args = _Py_VaBuildValue_SizeT(format, va); + stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, format, va, &nargs); } - if (args == NULL) { + if (stack == NULL) { return NULL; } - if (!PyTuple_Check(args)) { - PyObject *stack[1] = {args}; - result = _PyObject_FastCall(callable, stack, 1); + if (nargs == 1 && PyTuple_Check(stack[0])) { + /* Special cases: + - 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_Call(callable, args, NULL); + result = _PyObject_FastCall(callable, stack, nargs); } - Py_DECREF(args); + for (i = 0; i < nargs; ++i) { + Py_DECREF(stack[i]); + } + if (stack != small_stack) { + PyMem_Free(stack); + } return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Don=27t_parenthesis_in_=5F?= =?utf-8?q?PyObject=5FCallMethodId=28=29_format?= Message-ID: <20161209011659.73309.73725.67BCE71D@psf.io> https://hg.python.org/cpython/rev/b9eb35435178 changeset: 105538:b9eb35435178 user: Victor Stinner date: Fri Dec 09 00:33:39 2016 +0100 summary: Don't parenthesis in _PyObject_CallMethodId() format Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation a temporary tuple, and so is more efficient. files: Modules/_datetimemodule.c | 2 +- Modules/_decimal/_decimal.c | 2 +- Modules/_json.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -4673,7 +4673,7 @@ static PyObject * datetime_str(PyDateTime_DateTime *self) { - return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "(s)", " "); + return _PyObject_CallMethodId((PyObject *)self, &PyId_isoformat, "s", " "); } static PyObject * diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -5716,7 +5716,7 @@ /* DecimalTuple */ ASSIGN_PTR(collections, PyImport_ImportModule("collections")); ASSIGN_PTR(DecimalTuple, (PyTypeObject *)PyObject_CallMethod(collections, - "namedtuple", "(ss)", "DecimalTuple", + "namedtuple", "ss", "DecimalTuple", "sign digits exponent")); ASSIGN_PTR(obj, PyUnicode_FromString("decimal")); diff --git a/Modules/_json.c b/Modules/_json.c --- a/Modules/_json.c +++ b/Modules/_json.c @@ -335,7 +335,7 @@ if (JSONDecodeError == NULL) return; } - exc = PyObject_CallFunction(JSONDecodeError, "(zOn)", msg, s, end); + exc = PyObject_CallFunction(JSONDecodeError, "zOn", msg, s, end); if (exc) { PyErr_SetObject(JSONDecodeError, exc); Py_DECREF(exc); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_=5FPyObject=5FCallFunc?= =?utf-8?q?tionVa=28=29_helper?= Message-ID: <20161209011658.72773.40433.4E52C438@psf.io> https://hg.python.org/cpython/rev/455169e87bb3 changeset: 105533:455169e87bb3 user: Victor Stinner date: Fri Dec 09 00:22:56 2016 +0100 summary: Add _PyObject_CallFunctionVa() helper Issue #28915: Add _PyObject_CallFunctionVa() helper to factorize code of functions: * PyObject_CallFunction() * _PyObject_CallFunction_SizeT() * callmethod() files: Objects/abstract.c | 89 ++++++++++++--------------------- 1 files changed, 32 insertions(+), 57 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2519,20 +2519,39 @@ } } -static PyObject* -call_function_tail(PyObject *callable, PyObject *args) +static PyObject * +_PyObject_CallFunctionVa(PyObject *callable, const char *format, + va_list va, int is_size_t) { - PyObject *result; - - assert(args != NULL); + PyObject *args, *result; + + if (callable == NULL) { + return null_error(); + } + + if (!format || !*format) { + return _PyObject_CallNoArg(callable); + } + + if (is_size_t) { + args = Py_VaBuildValue(format, va); + } + else { + args = _Py_VaBuildValue_SizeT(format, va); + } + if (args == NULL) { + return NULL; + } if (!PyTuple_Check(args)) { - result = PyObject_CallFunctionObjArgs(callable, args, NULL); + PyObject *stack[1] = {args}; + result = _PyObject_FastCall(callable, stack, 1); } else { result = PyObject_Call(callable, args, NULL); } + Py_DECREF(args); return result; } @@ -2540,25 +2559,12 @@ PyObject_CallFunction(PyObject *callable, const char *format, ...) { va_list va; - PyObject *args, *result; - - if (callable == NULL) { - return null_error(); - } - - if (!format || !*format) { - return _PyObject_CallNoArg(callable); - } + PyObject *result; va_start(va, format); - args = Py_VaBuildValue(format, va); + result = _PyObject_CallFunctionVa(callable, format, va, 0); va_end(va); - if (args == NULL) { - return NULL; - } - - result = call_function_tail(callable, args); - Py_DECREF(args); + return result; } @@ -2566,33 +2572,18 @@ _PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...) { va_list va; - PyObject *args, *result; - - if (callable == NULL) { - return null_error(); - } - - if (!format || !*format) { - return _PyObject_CallNoArg(callable); - } + PyObject *result; va_start(va, format); - args = _Py_VaBuildValue_SizeT(format, va); + result = _PyObject_CallFunctionVa(callable, format, va, 1); va_end(va); - if (args == NULL) { - return NULL; - } - - result = call_function_tail(callable, args); - Py_DECREF(args); + return result; } static PyObject* callmethod(PyObject* callable, const char *format, va_list va, int is_size_t) { - PyObject *args, *result; - assert(callable != NULL); if (!PyCallable_Check(callable)) { @@ -2600,23 +2591,7 @@ return NULL; } - if (!format || !*format) { - return _PyObject_CallNoArg(callable); - } - - if (is_size_t) { - args = _Py_VaBuildValue_SizeT(format, va); - } - else { - args = Py_VaBuildValue(format, va); - } - if (args == NULL) { - return NULL; - } - - result = call_function_tail(callable, args); - Py_DECREF(args); - return result; + return _PyObject_CallFunctionVa(callable, format, va, is_size_t); } PyObject * -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_modsupport=3A_replace_int_?= =?utf-8?q?with_Py=5Fssize=5Ft?= Message-ID: <20161209011658.99896.10658.6A6A3479@psf.io> https://hg.python.org/cpython/rev/dd0d162593c5 changeset: 105534:dd0d162593c5 user: Victor Stinner date: Fri Dec 09 00:24:47 2016 +0100 summary: modsupport: replace int with Py_ssize_t Issue #28915. files: Python/modsupport.c | 37 +++++++++++++++++--------------- 1 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -13,10 +13,10 @@ /* Helper for mkvalue() to scan the length of a format */ -static int +static Py_ssize_t countformat(const char *format, int endchar) { - int count = 0; + Py_ssize_t count = 0; int level = 0; while (level > 0 || *format != endchar) { switch (*format) { @@ -28,8 +28,9 @@ case '(': case '[': case '{': - if (level == 0) + if (level == 0) { count++; + } level++; break; case ')': @@ -45,8 +46,9 @@ case '\t': break; default: - if (level == 0) + if (level == 0) { count++; + } } format++; } @@ -57,17 +59,17 @@ /* Generic function to create a value -- the inverse of getargs() */ /* After an original idea and first implementation by Steven Miale */ -static PyObject *do_mktuple(const char**, va_list *, int, int, int); -static PyObject *do_mklist(const char**, va_list *, int, int, int); -static PyObject *do_mkdict(const char**, va_list *, int, int, int); +static PyObject *do_mktuple(const char**, va_list *, int, Py_ssize_t, int); +static PyObject *do_mklist(const char**, va_list *, int, Py_ssize_t, int); +static PyObject *do_mkdict(const char**, va_list *, int, Py_ssize_t, int); static PyObject *do_mkvalue(const char**, va_list *, int); static void -do_ignore(const char **p_format, va_list *p_va, int endchar, int n, int flags) +do_ignore(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) { PyObject *v; - int i; + Py_ssize_t i; assert(PyErr_Occurred()); v = PyTuple_New(n); for (i = 0; i < n; i++) { @@ -91,15 +93,16 @@ "Unmatched paren in format"); return; } - if (endchar) + if (endchar) { ++*p_format; + } } static PyObject * -do_mkdict(const char **p_format, va_list *p_va, int endchar, int n, int flags) +do_mkdict(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) { PyObject *d; - int i; + Py_ssize_t i; if (n < 0) return NULL; if (n % 2) { @@ -146,10 +149,10 @@ } static PyObject * -do_mklist(const char **p_format, va_list *p_va, int endchar, int n, int flags) +do_mklist(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) { PyObject *v; - int i; + Py_ssize_t i; if (n < 0) return NULL; /* Note that we can't bail immediately on error as this will leak @@ -180,10 +183,10 @@ } static PyObject * -do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags) +do_mktuple(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) { PyObject *v; - int i; + Py_ssize_t i; if (n < 0) return NULL; /* Note that we can't bail immediately on error as this will leak @@ -465,7 +468,7 @@ va_build_value(const char *format, va_list va, int flags) { const char *f = format; - int n = countformat(f, '\0'); + Py_ssize_t n = countformat(f, '\0'); va_list lva; PyObject *retval; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_time=5Fstrptime=28=29_uses?= =?utf-8?q?_PyObject=5FCall=28=29?= Message-ID: <20161209011659.117974.71782.6453C2BB@psf.io> https://hg.python.org/cpython/rev/49a7fdc0d40a changeset: 105541:49a7fdc0d40a user: Victor Stinner date: Fri Dec 09 00:38:53 2016 +0100 summary: time_strptime() uses PyObject_Call() Issue #28915: Use PyObject_Call() to pass a tuple of positional arguments, instead of relying on _PyObject_CallMethodId() weird behaviour to unpack the tuple. files: Modules/timemodule.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -717,16 +717,22 @@ static PyObject * time_strptime(PyObject *self, PyObject *args) { - PyObject *strptime_module = PyImport_ImportModuleNoBlock("_strptime"); - PyObject *strptime_result; + PyObject *module, *func, *result; _Py_IDENTIFIER(_strptime_time); - if (!strptime_module) + module = PyImport_ImportModuleNoBlock("_strptime"); + if (!module) return NULL; - strptime_result = _PyObject_CallMethodId(strptime_module, - &PyId__strptime_time, "O", args); - Py_DECREF(strptime_module); - return strptime_result; + + func = _PyObject_GetAttrId(module, &PyId__strptime_time); + Py_DECREF(module); + if (!func) { + return NULL; + } + + result = PyObject_Call(func, args, NULL); + Py_DECREF(func); + return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_build=5Fstruct=5Ftime=28?= =?utf-8?q?=29_uses_Py=5FBuildValue=28=29?= Message-ID: <20161209011659.13398.77885.B7D99059@psf.io> https://hg.python.org/cpython/rev/032cbdb596fe changeset: 105540:032cbdb596fe user: Victor Stinner date: Fri Dec 09 00:38:16 2016 +0100 summary: build_struct_time() uses Py_BuildValue() Issue #28915: Avoid calling _PyObject_CallMethodId() with "(...)" format to avoid the creation of a temporary tuple: use Py_BuildValue() with _PyObject_CallMethodIdObjArgs(). files: Modules/_datetimemodule.c | 31 +++++++++++++++++--------- 1 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1385,21 +1385,30 @@ build_struct_time(int y, int m, int d, int hh, int mm, int ss, int dstflag) { PyObject *time; - PyObject *result = NULL; + PyObject *result; + _Py_IDENTIFIER(struct_time); + PyObject *args; + time = PyImport_ImportModuleNoBlock("time"); - if (time != NULL) { - _Py_IDENTIFIER(struct_time); - - result = _PyObject_CallMethodId(time, &PyId_struct_time, - "((iiiiiiiii))", - y, m, d, - hh, mm, ss, - weekday(y, m, d), - days_before_month(y, m) + d, - dstflag); + if (time == NULL) { + return NULL; + } + + args = Py_BuildValue("iiiiiiiii", + y, m, d, + hh, mm, ss, + weekday(y, m, d), + days_before_month(y, m) + d, + dstflag); + if (args == NULL) { Py_DECREF(time); + return NULL; } + + result = _PyObject_CallMethodIdObjArgs(time, &PyId_struct_time, + args, NULL); + Py_DECREF(time); return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_modsupport=3A_replace_int_?= =?utf-8?q?with_Py=5Fssize=5Ft?= Message-ID: <20161209011659.72659.11712.56D51584@psf.io> https://hg.python.org/cpython/rev/69d5dcf31f4a changeset: 105535:69d5dcf31f4a user: Victor Stinner date: Fri Dec 09 00:27:22 2016 +0100 summary: modsupport: replace int with Py_ssize_t Issue #28915: Py_ssize_t type is better for indexes. The compiler might emit more efficient code for i++. Py_ssize_t is the type of a PyTuple index for example. Replace also "int endchar" with "char endchar". files: Python/modsupport.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -14,7 +14,7 @@ /* Helper for mkvalue() to scan the length of a format */ static Py_ssize_t -countformat(const char *format, int endchar) +countformat(const char *format, char endchar) { Py_ssize_t count = 0; int level = 0; @@ -59,14 +59,14 @@ /* Generic function to create a value -- the inverse of getargs() */ /* After an original idea and first implementation by Steven Miale */ -static PyObject *do_mktuple(const char**, va_list *, int, Py_ssize_t, int); -static PyObject *do_mklist(const char**, va_list *, int, Py_ssize_t, int); -static PyObject *do_mkdict(const char**, va_list *, int, Py_ssize_t, int); +static PyObject *do_mktuple(const char**, va_list *, char, Py_ssize_t, int); +static PyObject *do_mklist(const char**, va_list *, char, Py_ssize_t, int); +static PyObject *do_mkdict(const char**, va_list *, char, Py_ssize_t, int); static PyObject *do_mkvalue(const char**, va_list *, int); static void -do_ignore(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_ignore(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *v; Py_ssize_t i; @@ -99,7 +99,7 @@ } static PyObject * -do_mkdict(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_mkdict(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *d; Py_ssize_t i; @@ -149,7 +149,7 @@ } static PyObject * -do_mklist(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_mklist(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *v; Py_ssize_t i; @@ -183,7 +183,7 @@ } static PyObject * -do_mktuple(const char **p_format, va_list *p_va, int endchar, Py_ssize_t n, int flags) +do_mktuple(const char **p_format, va_list *p_va, char endchar, Py_ssize_t n, int flags) { PyObject *v; Py_ssize_t i; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FFastCall?= =?utf-8?q?Va=28=29_in_type_slots?= Message-ID: <20161209011659.117382.32970.F22F0960@psf.io> https://hg.python.org/cpython/rev/adcd9131b7c6 changeset: 105543:adcd9131b7c6 user: Victor Stinner date: Fri Dec 09 00:41:46 2016 +0100 summary: Use _PyObject_FastCallVa() in type slots Issue #28915: Replace Py_VaBuildValue()+PyObject_Call() with _PyObject_FastCallVa() to avoid the creation of temporary tuple. files: Objects/typeobject.c | 133 +++++++++++------------------- 1 files changed, 51 insertions(+), 82 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1420,15 +1420,15 @@ return lookup_maybe(self, attrid); } -/* A variation of PyObject_CallMethod that uses lookup_method() +/* A variation of PyObject_CallMethodObjArgs that uses lookup_method() instead of PyObject_GetAttrString(). This uses the same convention as lookup_method to cache the interned name string object. */ static PyObject * -call_method(PyObject *obj, _Py_Identifier *name, const char *format, ...) +call_method(PyObject *obj, _Py_Identifier *name, ...) { va_list va; - PyObject *func = NULL, *retval; + PyObject *func, *retval; func = lookup_maybe(obj, name); if (func == NULL) { @@ -1437,25 +1437,9 @@ return NULL; } - if (format && *format) { - PyObject *args; - - va_start(va, format); - args = Py_VaBuildValue(format, va); - va_end(va); - - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - assert(PyTuple_Check(args)); - - retval = PyObject_Call(func, args, NULL); - Py_DECREF(args); - } - else { - retval = _PyObject_CallNoArg(func); - } + va_start(va, name); + retval = _PyObject_VaCallFunctionObjArgs(func, va); + va_end(va); Py_DECREF(func); @@ -1465,10 +1449,10 @@ /* Clone of call_method() that returns NotImplemented when the lookup fails. */ static PyObject * -call_maybe(PyObject *obj, _Py_Identifier *name, const char *format, ...) +call_maybe(PyObject *obj, _Py_Identifier *name, ...) { va_list va; - PyObject *func = NULL, *retval; + PyObject *func, *retval; func = lookup_maybe(obj, name); if (func == NULL) { @@ -1477,25 +1461,9 @@ return NULL; } - if (format && *format) { - PyObject *args; - - va_start(va, format); - args = Py_VaBuildValue(format, va); - va_end(va); - - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - assert(PyTuple_Check(args)); - - retval = PyObject_Call(func, args, NULL); - Py_DECREF(args); - } - else { - retval = _PyObject_CallNoArg(func); - } + va_start(va, name); + retval = _PyObject_VaCallFunctionObjArgs(func, va); + va_end(va); Py_DECREF(func); @@ -5736,12 +5704,12 @@ return call_method(self, &id, NULL); \ } -#define SLOT1(FUNCNAME, OPSTR, ARG1TYPE, ARGCODES) \ +#define SLOT1(FUNCNAME, OPSTR, ARG1TYPE) \ static PyObject * \ FUNCNAME(PyObject *self, ARG1TYPE arg1) \ { \ _Py_static_string(id, OPSTR); \ - return call_method(self, &id, "(" ARGCODES ")", arg1); \ + return call_method(self, &id, arg1, NULL); \ } /* Boolean helper for SLOT1BINFULL(). @@ -5794,20 +5762,20 @@ if (do_other && \ PyType_IsSubtype(Py_TYPE(other), Py_TYPE(self)) && \ method_is_overloaded(self, other, &rop_id)) { \ - r = call_maybe(other, &rop_id, "(O)", self); \ + r = call_maybe(other, &rop_id, self, NULL); \ if (r != Py_NotImplemented) \ return r; \ Py_DECREF(r); \ do_other = 0; \ } \ - r = call_maybe(self, &op_id, "(O)", other); \ + r = call_maybe(self, &op_id, other, NULL); \ if (r != Py_NotImplemented || \ Py_TYPE(other) == Py_TYPE(self)) \ return r; \ Py_DECREF(r); \ } \ if (do_other) { \ - return call_maybe(other, &rop_id, "(O)", self); \ + return call_maybe(other, &rop_id, self, NULL); \ } \ Py_RETURN_NOTIMPLEMENTED; \ } @@ -5815,14 +5783,6 @@ #define SLOT1BIN(FUNCNAME, SLOTNAME, OPSTR, ROPSTR) \ SLOT1BINFULL(FUNCNAME, FUNCNAME, SLOTNAME, OPSTR, ROPSTR) -#define SLOT2(FUNCNAME, OPSTR, ARG1TYPE, ARG2TYPE, ARGCODES) \ -static PyObject * \ -FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \ -{ \ - _Py_static_string(id, #OPSTR); \ - return call_method(self, &id, "(" ARGCODES ")", arg1, arg2); \ -} - static Py_ssize_t slot_sq_length(PyObject *self) { @@ -5887,13 +5847,22 @@ slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value) { PyObject *res; + PyObject *index_obj; + + index_obj = PyLong_FromSsize_t(index); + if (index_obj == NULL) { + return -1; + } if (value == NULL) - res = call_method(self, &PyId___delitem__, "(n)", index); + res = call_method(self, &PyId___delitem__, index_obj, NULL); else - res = call_method(self, &PyId___setitem__, "(nO)", index, value); - if (res == NULL) + res = call_method(self, &PyId___setitem__, index_obj, value, NULL); + Py_DECREF(index_obj); + + if (res == NULL) { return -1; + } Py_DECREF(res); return 0; } @@ -5931,7 +5900,7 @@ #define slot_mp_length slot_sq_length -SLOT1(slot_mp_subscript, "__getitem__", PyObject *, "O") +SLOT1(slot_mp_subscript, "__getitem__", PyObject *) static int slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value) @@ -5939,9 +5908,9 @@ PyObject *res; if (value == NULL) - res = call_method(self, &PyId___delitem__, "(O)", key); + res = call_method(self, &PyId___delitem__, key, NULL); else - res = call_method(self, &PyId___setitem__, "(OO)", key, value); + res = call_method(self, &PyId___setitem__, key, value, NULL); if (res == NULL) return -1; @@ -5973,7 +5942,7 @@ slot_nb_power, so check before calling self.__pow__. */ if (Py_TYPE(self)->tp_as_number != NULL && Py_TYPE(self)->tp_as_number->nb_power == slot_nb_power) { - return call_method(self, &PyId___pow__, "(OO)", other, modulus); + return call_method(self, &PyId___pow__, other, modulus, NULL); } Py_RETURN_NOTIMPLEMENTED; } @@ -6053,28 +6022,28 @@ SLOT0(slot_nb_int, "__int__") SLOT0(slot_nb_float, "__float__") -SLOT1(slot_nb_inplace_add, "__iadd__", PyObject *, "O") -SLOT1(slot_nb_inplace_subtract, "__isub__", PyObject *, "O") -SLOT1(slot_nb_inplace_multiply, "__imul__", PyObject *, "O") -SLOT1(slot_nb_inplace_matrix_multiply, "__imatmul__", PyObject *, "O") -SLOT1(slot_nb_inplace_remainder, "__imod__", PyObject *, "O") +SLOT1(slot_nb_inplace_add, "__iadd__", PyObject *) +SLOT1(slot_nb_inplace_subtract, "__isub__", PyObject *) +SLOT1(slot_nb_inplace_multiply, "__imul__", PyObject *) +SLOT1(slot_nb_inplace_matrix_multiply, "__imatmul__", PyObject *) +SLOT1(slot_nb_inplace_remainder, "__imod__", PyObject *) /* Can't use SLOT1 here, because nb_inplace_power is ternary */ static PyObject * slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2) { _Py_IDENTIFIER(__ipow__); - return call_method(self, &PyId___ipow__, "(" "O" ")", arg1); -} -SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *, "O") -SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *, "O") -SLOT1(slot_nb_inplace_and, "__iand__", PyObject *, "O") -SLOT1(slot_nb_inplace_xor, "__ixor__", PyObject *, "O") -SLOT1(slot_nb_inplace_or, "__ior__", PyObject *, "O") + return call_method(self, &PyId___ipow__, arg1, NULL); +} +SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *) +SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *) +SLOT1(slot_nb_inplace_and, "__iand__", PyObject *) +SLOT1(slot_nb_inplace_xor, "__ixor__", PyObject *) +SLOT1(slot_nb_inplace_or, "__ior__", PyObject *) SLOT1BIN(slot_nb_floor_divide, nb_floor_divide, "__floordiv__", "__rfloordiv__") SLOT1BIN(slot_nb_true_divide, nb_true_divide, "__truediv__", "__rtruediv__") -SLOT1(slot_nb_inplace_floor_divide, "__ifloordiv__", PyObject *, "O") -SLOT1(slot_nb_inplace_true_divide, "__itruediv__", PyObject *, "O") +SLOT1(slot_nb_inplace_floor_divide, "__ifloordiv__", PyObject *) +SLOT1(slot_nb_inplace_true_divide, "__itruediv__", PyObject *) static PyObject * slot_tp_repr(PyObject *self) @@ -6184,7 +6153,7 @@ static PyObject * slot_tp_getattro(PyObject *self, PyObject *name) { - return call_method(self, &PyId___getattribute__, "(O)", name); + return call_method(self, &PyId___getattribute__, name, NULL); } static PyObject * @@ -6256,9 +6225,9 @@ _Py_IDENTIFIER(__setattr__); if (value == NULL) - res = call_method(self, &PyId___delattr__, "(O)", name); + res = call_method(self, &PyId___delattr__, name, NULL); else - res = call_method(self, &PyId___setattr__, "(OO)", name, value); + res = call_method(self, &PyId___setattr__, name, value, NULL); if (res == NULL) return -1; Py_DECREF(res); @@ -6359,9 +6328,9 @@ _Py_IDENTIFIER(__set__); if (value == NULL) - res = call_method(self, &PyId___delete__, "(O)", target); + res = call_method(self, &PyId___delete__, target, NULL); else - res = call_method(self, &PyId___set__, "(OO)", target, value); + res = call_method(self, &PyId___set__, target, value, NULL); if (res == NULL) return -1; Py_DECREF(res); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 8 20:16:59 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 01:16:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_=5FPyObject=5FVaCallFu?= =?utf-8?q?nctionObjArgs=28=29_private_function?= Message-ID: <20161209011659.30521.40168.90590C8C@psf.io> https://hg.python.org/cpython/rev/6e748eb79038 changeset: 105542:6e748eb79038 user: Victor Stinner date: Fri Dec 09 00:40:33 2016 +0100 summary: Add _PyObject_VaCallFunctionObjArgs() private function Issue #28915: Similar to _PyObject_CallFunctionObjArgs() but use va_list to pass arguments. files: Include/abstract.h | 6 ++++++ Objects/abstract.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -437,6 +437,12 @@ PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, ...); +#ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyObject_VaCallFunctionObjArgs( + PyObject *callable, + va_list vargs); +#endif + /* Call the method named 'name' of object 'obj' with a variable number of C arguments. The C arguments are provided as PyObject * diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2706,8 +2706,8 @@ return retval; } -static PyObject * -_PyObject_FastCallVa(PyObject *callable, va_list vargs) +PyObject * +_PyObject_VaCallFunctionObjArgs(PyObject *callable, va_list vargs) { PyObject *small_stack[5]; PyObject **stack; @@ -2773,7 +2773,7 @@ } va_start(vargs, name); - result = _PyObject_FastCallVa(callable, vargs); + result = _PyObject_VaCallFunctionObjArgs(callable, vargs); va_end(vargs); Py_DECREF(callable); @@ -2797,7 +2797,7 @@ } va_start(vargs, name); - result = _PyObject_FastCallVa(callable, vargs); + result = _PyObject_VaCallFunctionObjArgs(callable, vargs); va_end(vargs); Py_DECREF(callable); @@ -2811,7 +2811,7 @@ PyObject *result; va_start(vargs, callable); - result = _PyObject_FastCallVa(callable, vargs); + result = _PyObject_VaCallFunctionObjArgs(callable, vargs); va_end(vargs); return result; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 03:36:20 2016 From: python-checkins at python.org (xavier.degaye) Date: Fri, 09 Dec 2016 08:36:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI2OTM3?= =?utf-8?q?=3A_The_chown=28=29_method_of_the_tarfile=2ETarFile_class_does_?= =?utf-8?q?not_fail_now?= Message-ID: <20161209083620.117382.72941.6621911B@psf.io> https://hg.python.org/cpython/rev/e4e7bc640865 changeset: 105544:e4e7bc640865 branch: 3.6 parent: 105530:25df9671663b user: Xavier de Gaye date: Fri Dec 09 09:33:09 2016 +0100 summary: Issue #26937: The chown() method of the tarfile.TarFile class does not fail now when the grp module cannot be imported, as for example on Android platforms. files: Lib/tarfile.py | 31 +++++++++++++++++++------------ Misc/NEWS | 4 ++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -50,9 +50,13 @@ import re try: - import grp, pwd + import pwd except ImportError: - grp = pwd = None + pwd = None +try: + import grp +except ImportError: + grp = None # os.symlink on Windows prior to 6.0 raises NotImplementedError symlink_exception = (AttributeError, NotImplementedError) @@ -2219,22 +2223,25 @@ def chown(self, tarinfo, targetpath, numeric_owner): """Set owner of targetpath according to tarinfo. If numeric_owner - is True, use .gid/.uid instead of .gname/.uname. + is True, use .gid/.uid instead of .gname/.uname. If numeric_owner + is False, fall back to .gid/.uid when the search based on name + fails. """ - if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: + if hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. - if numeric_owner: - g = tarinfo.gid - u = tarinfo.uid - else: + g = tarinfo.gid + u = tarinfo.uid + if not numeric_owner: try: - g = grp.getgrnam(tarinfo.gname)[2] + if grp: + g = grp.getgrnam(tarinfo.gname)[2] except KeyError: - g = tarinfo.gid + pass try: - u = pwd.getpwnam(tarinfo.uname)[2] + if pwd: + u = pwd.getpwnam(tarinfo.uname)[2] except KeyError: - u = tarinfo.uid + pass try: if tarinfo.issym() and hasattr(os, "lchown"): os.lchown(targetpath, u, g) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,10 @@ - Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. +- Issue #26937: The chown() method of the tarfile.TarFile class does not fail + now when the grp module cannot be imported, as for example on Android + platforms. + Windows ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 03:36:25 2016 From: python-checkins at python.org (xavier.degaye) Date: Fri, 09 Dec 2016 08:36:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI2OTM3OiBNZXJnZSAzLjYu?= Message-ID: <20161209083620.21460.9642.2E5231A7@psf.io> https://hg.python.org/cpython/rev/da510d1aa683 changeset: 105545:da510d1aa683 parent: 105543:adcd9131b7c6 parent: 105544:e4e7bc640865 user: Xavier de Gaye date: Fri Dec 09 09:35:49 2016 +0100 summary: Issue #26937: Merge 3.6. files: Lib/tarfile.py | 31 +++++++++++++++++++------------ Misc/NEWS | 4 ++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -50,9 +50,13 @@ import re try: - import grp, pwd + import pwd except ImportError: - grp = pwd = None + pwd = None +try: + import grp +except ImportError: + grp = None # os.symlink on Windows prior to 6.0 raises NotImplementedError symlink_exception = (AttributeError, NotImplementedError) @@ -2219,22 +2223,25 @@ def chown(self, tarinfo, targetpath, numeric_owner): """Set owner of targetpath according to tarinfo. If numeric_owner - is True, use .gid/.uid instead of .gname/.uname. + is True, use .gid/.uid instead of .gname/.uname. If numeric_owner + is False, fall back to .gid/.uid when the search based on name + fails. """ - if pwd and hasattr(os, "geteuid") and os.geteuid() == 0: + if hasattr(os, "geteuid") and os.geteuid() == 0: # We have to be root to do so. - if numeric_owner: - g = tarinfo.gid - u = tarinfo.uid - else: + g = tarinfo.gid + u = tarinfo.uid + if not numeric_owner: try: - g = grp.getgrnam(tarinfo.gname)[2] + if grp: + g = grp.getgrnam(tarinfo.gname)[2] except KeyError: - g = tarinfo.gid + pass try: - u = pwd.getpwnam(tarinfo.uname)[2] + if pwd: + u = pwd.getpwnam(tarinfo.uname)[2] except KeyError: - u = tarinfo.uid + pass try: if tarinfo.issym() and hasattr(os, "lchown"): os.lchown(targetpath, u, g) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -168,6 +168,10 @@ Library ------- +- Issue #26937: The chown() method of the tarfile.TarFile class does not fail + now when the grp module cannot be imported, as for example on Android + platforms. + - Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. A deprecation warning is now emitted if the index file is missed and recreated in the 'r' and 'w' modes -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Dec 9 04:04:19 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 09 Dec 2016 09:04:19 +0000 Subject: [Python-checkins] Daily reference leaks (adcd9131b7c6): sum=145511 Message-ID: <20161209090417.27957.59665.72473D62@psf.io> results for adcd9131b7c6 on branch "default" -------------------------------------------- test_asyncio leaked [0, 3, 0] memory blocks, sum=3 test_calendar leaked [5420, 5420, 5420] references, sum=16260 test_calendar leaked [1130, 1132, 1132] memory blocks, sum=3394 test_collections leaked [-7, 8, -7] memory blocks, sum=-6 test_datetime leaked [2980, 2980, 2980] references, sum=8940 test_datetime leaked [542, 544, 544] memory blocks, sum=1630 test_docxmlrpc leaked [70, 70, 70] references, sum=210 test_docxmlrpc leaked [21, 21, 21] memory blocks, sum=63 test_email leaked [370, 370, 370] references, sum=1110 test_email leaked [97, 98, 98] memory blocks, sum=293 test_enum leaked [120, 120, 120] references, sum=360 test_enum leaked [24, 24, 24] memory blocks, sum=72 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_httplib leaked [30, 30, 30] references, sum=90 test_httplib leaked [10, 9, 9] memory blocks, sum=28 test_httpservers leaked [830, 830, 830] references, sum=2490 test_httpservers leaked [249, 250, 250] memory blocks, sum=749 test_imaplib leaked [120, 120, 120] references, sum=360 test_imaplib leaked [24, 24, 24] memory blocks, sum=72 test_logging leaked [90, 90, 90] references, sum=270 test_logging leaked [26, 26, 26] memory blocks, sum=78 test_robotparser leaked [10, 10, 10] references, sum=30 test_robotparser leaked [3, 3, 3] memory blocks, sum=9 test_ssl leaked [20, 20, 20] references, sum=60 test_ssl leaked [5, 5, 5] memory blocks, sum=15 test_strftime leaked [12550, 12550, 12550] references, sum=37650 test_strftime leaked [2723, 2725, 2725] memory blocks, sum=8173 test_strptime leaked [15820, 15820, 15820] references, sum=47460 test_strptime leaked [3602, 3604, 3604] memory blocks, sum=10810 test_unicode leaked [10, 10, 10] references, sum=30 test_unicode leaked [2, 2, 2] memory blocks, sum=6 test_urllib leaked [180, 180, 180] references, sum=540 test_urllib leaked [54, 54, 54] memory blocks, sum=162 test_urllib2 leaked [120, 120, 120] references, sum=360 test_urllib2 leaked [36, 36, 36] memory blocks, sum=108 test_urllib2_localnet leaked [300, 300, 300] references, sum=900 test_urllib2_localnet leaked [90, 91, 91] memory blocks, sum=272 test_urllib2net leaked [10, 10, 10] references, sum=30 test_urllib2net leaked [3, 3, 3] memory blocks, sum=9 test_wsgiref leaked [10, 10, 10] references, sum=30 test_wsgiref leaked [3, 3, 3] memory blocks, sum=9 test_xmlrpc leaked [620, 620, 620] references, sum=1860 test_xmlrpc leaked [172, 173, 173] memory blocks, sum=518 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/refloglRCM0o', '--timeout', '7200'] From lp_benchmark_robot at intel.com Fri Dec 9 07:57:35 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 9 Dec 2016 12:57:35 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-12-09 Message-ID: <6a8087f2-14a2-4fda-803e-30f770a6bb2e@irsmsx103.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-09 03:46:12 +0000 commit: e414fb1640e0 previous commit: fdf2e778b88b revision date: 2016-12-08 04:34:23 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% 2.63% 5.89% 5.61% :-) pybench 0.15% 0.20% 6.30% 3.18% :-( regex_v8 0.57% 0.04% -2.03% 10.61% :-) nbody 0.13% -0.12% 10.02% -0.34% :-| json_dump_v2 0.19% -0.52% 1.62% 11.00% :-| normal_startup 0.74% 0.12% -0.24% 2.62% :-) ssbench 0.18% 0.36% 2.29% 1.48% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-12-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 Fri Dec 9 08:01:04 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 9 Dec 2016 13:01:04 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-12-09 Message-ID: <0db658a4-98ad-4b60-b62d-ad904dfe6177@irsmsx103.ger.corp.intel.com> Results for project Python default, build date 2016-12-09 03:03:16 +0000 commit: adcd9131b7c6 previous commit: 1883072efc5f revision date: 2016-12-08 23:41:46 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.20% 0.64% -1.11% 16.10% :-| pybench 0.32% -0.11% 0.71% 5.22% :-| regex_v8 3.79% -1.15% -0.21% -6.08% :-( nbody 0.18% -2.44% -5.06% 9.41% :-) json_dump_v2 0.34% 1.79% 8.34% 10.30% :-( normal_startup 1.03% 0.16% -2.83% 6.56% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-12-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 Fri Dec 9 08:43:17 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 13:43:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328915=3A_Use_=5FP?= =?utf-8?q?yObject=5FCallNoArg=28=29?= Message-ID: <20161209134316.72463.31927.0EE16445@psf.io> https://hg.python.org/cpython/rev/39bed12135c1 changeset: 105546:39bed12135c1 user: Victor Stinner date: Fri Dec 09 12:29:18 2016 +0100 summary: Issue #28915: Use _PyObject_CallNoArg() Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func). files: Modules/_ctypes/callbacks.c | 2 +- Modules/_sqlite/connection.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c --- a/Modules/_ctypes/callbacks.c +++ b/Modules/_ctypes/callbacks.c @@ -535,7 +535,7 @@ return E_FAIL; } - result = PyObject_CallFunction(func, NULL); + result = _PyObject_CallNoArg(func); Py_DECREF(func); if (!result) { PyErr_WriteUnraisable(context ? context : Py_None); diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -645,7 +645,7 @@ aggregate_instance = (PyObject**)sqlite3_aggregate_context(context, sizeof(PyObject*)); if (*aggregate_instance == 0) { - *aggregate_instance = PyObject_CallFunction(aggregate_class, NULL); + *aggregate_instance = _PyObject_CallNoArg(aggregate_class); if (PyErr_Occurred()) { *aggregate_instance = 0; @@ -933,7 +933,7 @@ gilstate = PyGILState_Ensure(); #endif - ret = PyObject_CallFunction((PyObject*)user_arg, NULL); + ret = _PyObject_CallNoArg((PyObject*)user_arg); if (!ret) { if (_enable_callback_tracebacks) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 08:43:17 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 13:43:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29_in_=5Fasyncio?= Message-ID: <20161209134316.73233.79881.7B70F4C6@psf.io> https://hg.python.org/cpython/rev/b29c719d5992 changeset: 105547:b29c719d5992 user: Victor Stinner date: Fri Dec 09 14:24:02 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() in _asyncio Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. files: Modules/_asynciomodule.c | 36 ++++++++++++++------------- 1 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -118,8 +118,8 @@ PyObject *handle = NULL; PyObject *cb = PyList_GET_ITEM(iters, i); - handle = _PyObject_CallMethodId( - fut->fut_loop, &PyId_call_soon, "OO", cb, fut, NULL); + handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, &PyId_call_soon, + cb, fut, NULL); if (handle == NULL) { Py_DECREF(iters); @@ -283,8 +283,9 @@ future_add_done_callback(FutureObj *fut, PyObject *arg) { if (fut->fut_state != STATE_PENDING) { - PyObject *handle = _PyObject_CallMethodId( - fut->fut_loop, &PyId_call_soon, "OO", arg, fut, NULL); + PyObject *handle = _PyObject_CallMethodIdObjArgs(fut->fut_loop, + &PyId_call_soon, + arg, fut, NULL); if (handle == NULL) { return NULL; @@ -1327,7 +1328,7 @@ return -1; } - res = _PyObject_CallMethodId(all_tasks, &PyId_add, "O", self, NULL); + res = _PyObject_CallMethodIdObjArgs(all_tasks, &PyId_add, self, NULL); if (res == NULL) { return -1; } @@ -1838,8 +1839,8 @@ } else { /* `task` is a subclass of Task */ - return _PyObject_CallMethodId( - (PyObject*)task, &PyId__wakeup, "O", fut, NULL); + return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__wakeup, + fut, NULL); } } @@ -1854,8 +1855,8 @@ if (arg == NULL) { arg = Py_None; } - return _PyObject_CallMethodId( - (PyObject*)task, &PyId__step, "O", arg, NULL); + return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__step, + arg, NULL); } } @@ -1869,8 +1870,8 @@ return -1; } - handle = _PyObject_CallMethodId( - task->task_loop, &PyId_call_soon, "O", cb, NULL); + handle = _PyObject_CallMethodIdObjArgs(task->task_loop, &PyId_call_soon, + cb, NULL); Py_DECREF(cb); if (handle == NULL) { return -1; @@ -1965,13 +1966,13 @@ result = _PyGen_Send((PyGenObject*)coro, Py_None); } else { - result = _PyObject_CallMethodIdObjArgs( - coro, &PyId_send, Py_None, NULL); + result = _PyObject_CallMethodIdObjArgs(coro, &PyId_send, + Py_None, NULL); } } else { - result = _PyObject_CallMethodIdObjArgs( - coro, &PyId_throw, exc, NULL); + result = _PyObject_CallMethodIdObjArgs(coro, &PyId_throw, + exc, NULL); if (clear_exc) { /* We created 'exc' during this call */ Py_CLEAR(exc); @@ -2135,8 +2136,9 @@ if (wrapper == NULL) { goto fail; } - res = _PyObject_CallMethodId( - result, &PyId_add_done_callback, "O", wrapper, NULL); + res = _PyObject_CallMethodIdObjArgs(result, + &PyId_add_done_callback, + wrapper, NULL); Py_DECREF(wrapper); if (res == NULL) { goto fail; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:39 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_regrtest_--fromfile_now_ac?= =?utf-8?q?cepts_a_list_of_filenames?= Message-ID: <20161209153139.99922.61442.A5A8633C@psf.io> https://hg.python.org/cpython/rev/d8222c197831 changeset: 105548:d8222c197831 user: Victor Stinner date: Fri Dec 09 16:05:51 2016 +0100 summary: regrtest --fromfile now accepts a list of filenames files: Lib/test/libregrtest/main.py | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 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 @@ -179,19 +179,17 @@ self.tests = [] # regex to match 'test_builtin' in line: # '0:00:00 [ 4/400] test_builtin -- test_dict took 1 sec' - regex = (r'^(?:[0-9]+:[0-9]+:[0-9]+ *)?' + regex = (r'(?:[0-9]+:[0-9]+:[0-9]+ *)?' r'(?:\[[0-9/ ]+\] *)?' - r'(test_[a-zA-Z0-9_]+)') + r'(test_[a-zA-Z0-9_]+)\b(?:\.py)?') regex = re.compile(regex) with open(os.path.join(support.SAVEDCWD, self.ns.fromfile)) as fp: for line in fp: + line = line.split('#', 1)[0] line = line.strip() - if line.startswith('#'): - continue - match = regex.match(line) - if match is None: - continue - self.tests.append(match.group(1)) + match = regex.search(line) + if match is not None: + self.tests.append(match.group(1)) removepy(self.tests) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:39 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29_in_=5Fdatetime?= Message-ID: <20161209153139.117653.85107.35C64BF6@psf.io> https://hg.python.org/cpython/rev/5b41b92a7ccf changeset: 105552:5b41b92a7ccf user: Victor Stinner date: Fri Dec 09 15:24:31 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() in _datetime Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. files: Modules/_datetimemodule.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -987,7 +987,8 @@ if (tzinfo == Py_None) Py_RETURN_NONE; - result = _PyObject_CallMethodId(tzinfo, &PyId_tzname, "O", tzinfoarg); + result = _PyObject_CallMethodIdObjArgs(tzinfo, &PyId_tzname, + tzinfoarg, NULL); if (result == NULL || result == Py_None) return result; @@ -1343,8 +1344,8 @@ goto Done; format = PyUnicode_FromString(PyBytes_AS_STRING(newfmt)); if (format != NULL) { - result = _PyObject_CallMethodId(time, &PyId_strftime, "OO", - format, timetuple, NULL); + result = _PyObject_CallMethodIdObjArgs(time, &PyId_strftime, + format, timetuple, NULL); Py_DECREF(format); } Py_DECREF(time); @@ -2558,7 +2559,8 @@ * time.time() delivers; if someone were gonzo about optimization, * date.today() could get away with plain C time(). */ - result = _PyObject_CallMethodId(cls, &PyId_fromtimestamp, "O", time); + result = _PyObject_CallMethodIdObjArgs(cls, &PyId_fromtimestamp, + time, NULL); Py_DECREF(time); return result; } @@ -2746,7 +2748,8 @@ if (PyUnicode_GetLength(format) == 0) return PyObject_Str((PyObject *)self); - return _PyObject_CallMethodId((PyObject *)self, &PyId_strftime, "O", format); + return _PyObject_CallMethodIdObjArgs((PyObject *)self, &PyId_strftime, + format, NULL); } /* ISO methods. */ @@ -4429,8 +4432,8 @@ if (module == NULL) return NULL; } - return _PyObject_CallMethodId(module, &PyId__strptime_datetime, "OOO", - cls, string, format); + return _PyObject_CallMethodIdObjArgs(module, &PyId__strptime_datetime, + cls, string, format, NULL); } /* Return new datetime from date/datetime and time arguments. */ @@ -5227,7 +5230,7 @@ temp = (PyObject *)result; result = (PyDateTime_DateTime *) - _PyObject_CallMethodId(tzinfo, &PyId_fromutc, "O", temp); + _PyObject_CallMethodIdObjArgs(tzinfo, &PyId_fromutc, temp, NULL); Py_DECREF(temp); return result; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:39 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_refleak_introduced_in_?= =?utf-8?q?change_032cbdb596fe?= Message-ID: <20161209153139.117023.50210.DFEEA6A6@psf.io> https://hg.python.org/cpython/rev/807688539b56 changeset: 105549:807688539b56 user: Victor Stinner date: Fri Dec 09 15:35:40 2016 +0100 summary: Fix refleak introduced in change 032cbdb596fe Issue #28915. files: Modules/_datetimemodule.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1409,6 +1409,7 @@ result = _PyObject_CallMethodIdObjArgs(time, &PyId_struct_time, args, NULL); Py_DECREF(time); + Py_DECREF(args); return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:39 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29_in_=5Fctypes?= Message-ID: <20161209153139.117052.58684.323CFE55@psf.io> https://hg.python.org/cpython/rev/ceb22b8f6d32 changeset: 105550:ceb22b8f6d32 user: Victor Stinner date: Fri Dec 09 15:18:31 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() in _ctypes Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() in unpickle(). _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. Replace _PyObject_CallMethodId() with _PyObject_GetAttrId()+PyObject_Call() for the second call since it requires to "unpack" a tuple. Add also a check in the type of the second parameter (state): it must be a tuple. files: Modules/_ctypes/callproc.c | 34 ++++++++++++++++--------- 1 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1631,25 +1631,33 @@ static PyObject * unpickle(PyObject *self, PyObject *args) { - PyObject *typ; - PyObject *state; - PyObject *result; - PyObject *tmp; + PyObject *typ, *state, *meth, *obj, *result; _Py_IDENTIFIER(__new__); _Py_IDENTIFIER(__setstate__); - if (!PyArg_ParseTuple(args, "OO", &typ, &state)) + if (!PyArg_ParseTuple(args, "OO!", &typ, &PyTuple_Type, &state)) return NULL; - result = _PyObject_CallMethodId(typ, &PyId___new__, "O", typ); - if (result == NULL) + obj = _PyObject_CallMethodIdObjArgs(typ, &PyId___new__, typ, NULL); + if (obj == NULL) return NULL; - tmp = _PyObject_CallMethodId(result, &PyId___setstate__, "O", state); - if (tmp == NULL) { - Py_DECREF(result); - return NULL; + + meth = _PyObject_GetAttrId(obj, &PyId___setstate__); + if (meth == NULL) { + goto error; } - Py_DECREF(tmp); - return result; + + result = PyObject_Call(meth, state, NULL); + Py_DECREF(meth); + if (result == NULL) { + goto error; + } + Py_DECREF(result); + + return obj; + +error: + Py_DECREF(obj); + return NULL; } static PyObject * -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:39 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29_in_=5Felementtree?= Message-ID: <20161209153139.100042.12304.D0EE667B@psf.io> https://hg.python.org/cpython/rev/ef05cc5cc651 changeset: 105551:ef05cc5cc651 user: Victor Stinner date: Fri Dec 09 15:26:00 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() in _elementtree Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. files: Modules/_elementtree.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1171,8 +1171,8 @@ if (checkpath(path) || namespaces != Py_None) { _Py_IDENTIFIER(find); - return _PyObject_CallMethodId( - st->elementpath_obj, &PyId_find, "OOO", self, path, namespaces + return _PyObject_CallMethodIdObjArgs( + st->elementpath_obj, &PyId_find, self, path, namespaces, NULL ); } @@ -1216,8 +1216,9 @@ elementtreestate *st = ET_STATE_GLOBAL; if (checkpath(path) || namespaces != Py_None) - return _PyObject_CallMethodId( - st->elementpath_obj, &PyId_findtext, "OOOO", self, path, default_value, namespaces + return _PyObject_CallMethodIdObjArgs( + st->elementpath_obj, &PyId_findtext, + self, path, default_value, namespaces, NULL ); if (!self->extra) { @@ -1271,8 +1272,8 @@ if (checkpath(tag) || namespaces != Py_None) { _Py_IDENTIFIER(findall); - return _PyObject_CallMethodId( - st->elementpath_obj, &PyId_findall, "OOO", self, tag, namespaces + return _PyObject_CallMethodIdObjArgs( + st->elementpath_obj, &PyId_findall, self, tag, namespaces, NULL ); } @@ -1318,8 +1319,8 @@ _Py_IDENTIFIER(iterfind); elementtreestate *st = ET_STATE_GLOBAL; - return _PyObject_CallMethodId( - st->elementpath_obj, &PyId_iterfind, "OOO", self, tag, namespaces); + return _PyObject_CallMethodIdObjArgs( + st->elementpath_obj, &PyId_iterfind, self, tag, namespaces, NULL); } /*[clinic input] @@ -2440,7 +2441,7 @@ } else { PyObject *res; - res = _PyObject_CallMethodId(element, &PyId_append, "O", child); + res = _PyObject_CallMethodIdObjArgs(element, &PyId_append, child, NULL); if (res == NULL) return -1; Py_DECREF(res); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:39 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29_in_=5Fio?= Message-ID: <20161209153139.117382.71037.07396BF2@psf.io> https://hg.python.org/cpython/rev/434e76e0ee17 changeset: 105553:434e76e0ee17 user: Victor Stinner date: Fri Dec 09 15:39:28 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() in _io Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. files: Modules/_io/bufferedio.c | 3 ++- Modules/_io/fileio.c | 4 ++-- Modules/_io/iobase.c | 3 ++- Modules/_io/textio.c | 8 +++++--- Modules/_io/winconsoleio.c | 6 +++--- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -454,7 +454,8 @@ { if (self->ok && self->raw) { PyObject *r; - r = _PyObject_CallMethodId(self->raw, &PyId__dealloc_warn, "O", source); + r = _PyObject_CallMethodIdObjArgs(self->raw, &PyId__dealloc_warn, + source, NULL); if (r) Py_DECREF(r); else diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -150,8 +150,8 @@ PyObject *exc, *val, *tb; int rc; _Py_IDENTIFIER(close); - res = _PyObject_CallMethodId((PyObject*)&PyRawIOBase_Type, - &PyId_close, "O", self); + res = _PyObject_CallMethodIdObjArgs((PyObject*)&PyRawIOBase_Type, + &PyId_close, self, NULL); if (!self->closefd) { self->fd = -1; return res; diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -661,7 +661,8 @@ to remove the bytecode interpretation overhead, but it could probably be removed here. */ _Py_IDENTIFIER(extend); - PyObject *ret = _PyObject_CallMethodId(result, &PyId_extend, "O", self); + PyObject *ret = _PyObject_CallMethodIdObjArgs(result, &PyId_extend, + self, NULL); if (ret == NULL) { Py_DECREF(result); diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -899,8 +899,8 @@ PyObject *locale_module = _PyIO_get_locale_module(state); if (locale_module == NULL) goto catch_ImportError; - self->encoding = _PyObject_CallMethodId( - locale_module, &PyId_getpreferredencoding, "O", Py_False); + self->encoding = _PyObject_CallMethodIdObjArgs( + locale_module, &PyId_getpreferredencoding, Py_False, NULL); Py_DECREF(locale_module); if (self->encoding == NULL) { catch_ImportError: @@ -2644,7 +2644,9 @@ else { PyObject *exc = NULL, *val, *tb; if (self->finalizing) { - res = _PyObject_CallMethodId(self->buffer, &PyId__dealloc_warn, "O", self); + res = _PyObject_CallMethodIdObjArgs(self->buffer, + &PyId__dealloc_warn, + self, NULL); if (res) Py_DECREF(res); else diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -85,7 +85,7 @@ Py_CLEAR(decoded); return '\0'; } - decoded_upper = PyObject_CallMethod(decoded, "upper", ""); + decoded_upper = PyObject_CallMethod(decoded, "upper", NULL); Py_CLEAR(decoded); if (!decoded_upper) { PyErr_Clear(); @@ -181,8 +181,8 @@ PyObject *exc, *val, *tb; int rc; _Py_IDENTIFIER(close); - res = _PyObject_CallMethodId((PyObject*)&PyRawIOBase_Type, - &PyId_close, "O", self); + res = _PyObject_CallMethodIdObjArgs((PyObject*)&PyRawIOBase_Type, + &PyId_close, self, NULL); if (!self->closehandle) { self->handle = INVALID_HANDLE_VALUE; return res; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:56 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyObject=5FCallMeth?= =?utf-8?q?odIdObjArgs=28=29?= Message-ID: <20161209153156.28000.13291.AC442074@psf.io> https://hg.python.org/cpython/rev/4545a2293e01 changeset: 105554:4545a2293e01 user: Victor Stinner date: Fri Dec 09 16:09:30 2016 +0100 summary: Use _PyObject_CallMethodIdObjArgs() Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() in various modules when the format string was only made of "O" formats, PyObject* arguments. _PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. files: Modules/_pickle.c | 6 +++--- Modules/arraymodule.c | 2 +- Modules/cjkcodecs/multibytecodec.c | 4 ++-- Python/_warnings.c | 2 +- Python/import.c | 2 +- Python/marshal.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -4571,8 +4571,8 @@ { _Py_IDENTIFIER(find_class); - return _PyObject_CallMethodId((PyObject *)self, &PyId_find_class, "OO", - module_name, global_name); + return _PyObject_CallMethodIdObjArgs((PyObject *)self, &PyId_find_class, + module_name, global_name, NULL); } static Py_ssize_t @@ -5184,7 +5184,7 @@ else { _Py_IDENTIFIER(__new__); - result = _PyObject_CallMethodId(cls, &PyId___new__, "O", cls); + result = _PyObject_CallMethodIdObjArgs(cls, &PyId___new__, cls, NULL); } return result; } diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1445,7 +1445,7 @@ bytes = PyBytes_FromStringAndSize(ptr, size); if (bytes == NULL) return NULL; - res = _PyObject_CallMethodId(f, &PyId_write, "O", bytes); + res = _PyObject_CallMethodIdObjArgs(f, &PyId_write, bytes, NULL); Py_DECREF(bytes); if (res == NULL) return NULL; diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c --- a/Modules/cjkcodecs/multibytecodec.c +++ b/Modules/cjkcodecs/multibytecodec.c @@ -1611,7 +1611,7 @@ if (str == NULL) return -1; - wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", str); + wr = _PyObject_CallMethodIdObjArgs(self->stream, &PyId_write, str, NULL); Py_DECREF(str); if (wr == NULL) return -1; @@ -1702,7 +1702,7 @@ if (PyBytes_Size(pwrt) > 0) { PyObject *wr; - wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", pwrt); + wr = _PyObject_CallMethodIdObjArgs(self->stream, &PyId_write, pwrt); if (wr == NULL) { Py_DECREF(pwrt); return NULL; diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -26,7 +26,7 @@ if (obj == Py_None) return 1; - result = _PyObject_CallMethodId(obj, &PyId_match, "O", arg); + result = _PyObject_CallMethodIdObjArgs(obj, &PyId_match, arg, NULL); if (result == NULL) return -1; diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -1705,7 +1705,7 @@ Py_INCREF(imp); } - reloaded_module = _PyObject_CallMethodId(imp, &PyId_reload, "O", m); + reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL); Py_DECREF(imp); return reloaded_module; } diff --git a/Python/marshal.c b/Python/marshal.c --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1649,7 +1649,7 @@ s = PyMarshal_WriteObjectToString(x, version); if (s == NULL) return NULL; - res = _PyObject_CallMethodId(f, &PyId_write, "O", s); + res = _PyObject_CallMethodIdObjArgs(f, &PyId_write, s, NULL); Py_DECREF(s); return res; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 10:31:58 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 15:31:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_PyObject=5FCallFunctio?= =?utf-8?q?nObjArgs=28=29?= Message-ID: <20161209153158.72567.51902.2690560A@psf.io> https://hg.python.org/cpython/rev/4321f833a4e0 changeset: 105555:4321f833a4e0 user: Victor Stinner date: Fri Dec 09 16:22:32 2016 +0100 summary: Use PyObject_CallFunctionObjArgs() Issue #28915: Replace PyObject_CallFunction() with PyObject_CallFunctionObjArgs() when the format string was only made of "O" formats, PyObject* arguments. PyObject_CallFunctionObjArgs() avoids the creation of a temporary tuple and doesn't have to parse a format string. files: Modules/_elementtree.c | 22 ++++++++++++++-------- Objects/abstract.c | 2 +- Objects/descrobject.c | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -2496,11 +2496,13 @@ attrib = PyDict_New(); if (!attrib) return NULL; - node = PyObject_CallFunction(self->element_factory, "OO", tag, attrib); + node = PyObject_CallFunctionObjArgs(self->element_factory, + tag, attrib, NULL); Py_DECREF(attrib); } else { - node = PyObject_CallFunction(self->element_factory, "OO", tag, attrib); + node = PyObject_CallFunctionObjArgs(self->element_factory, + tag, attrib, NULL); } if (!node) { return NULL; @@ -2977,7 +2979,8 @@ return; } } - res = PyObject_CallFunction(self->handle_start, "OO", tag, attrib); + res = PyObject_CallFunctionObjArgs(self->handle_start, + tag, attrib, NULL); } else res = NULL; @@ -3143,8 +3146,9 @@ /* If the target has a handler for doctype, call it. */ if (self->handle_doctype) { - res = PyObject_CallFunction(self->handle_doctype, "OOO", - doctype_name_obj, pubid_obj, sysid_obj); + res = PyObject_CallFunctionObjArgs(self->handle_doctype, + doctype_name_obj, pubid_obj, + sysid_obj, NULL); Py_CLEAR(res); } else { @@ -3163,8 +3167,9 @@ if (!res) goto clear; Py_DECREF(res); - res = PyObject_CallFunction(parser_doctype, "OOO", - doctype_name_obj, pubid_obj, sysid_obj); + res = PyObject_CallFunctionObjArgs(parser_doctype, + doctype_name_obj, pubid_obj, + sysid_obj, NULL); Py_CLEAR(res); } } @@ -3191,7 +3196,8 @@ target = PyUnicode_DecodeUTF8(target_in, strlen(target_in), "strict"); data = PyUnicode_DecodeUTF8(data_in, strlen(data_in), "strict"); if (target && data) { - res = PyObject_CallFunction(self->handle_pi, "OO", target, data); + res = PyObject_CallFunctionObjArgs(self->handle_pi, + target, data, NULL); Py_XDECREF(res); Py_DECREF(data); Py_DECREF(target); diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2549,7 +2549,7 @@ } if (nargs == 1 && PyTuple_Check(stack[0])) { - /* Special cases: + /* 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) */ diff --git a/Objects/descrobject.c b/Objects/descrobject.c --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1454,7 +1454,7 @@ doc = pold->prop_doc ? pold->prop_doc : Py_None; } - new = PyObject_CallFunction(type, "OOOO", get, set, del, doc); + new = PyObject_CallFunctionObjArgs(type, get, set, del, doc, NULL); Py_DECREF(type); if (new == NULL) return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 11:09:10 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 16:09:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Remove_useless_variable_in?= =?utf-8?q?itialization?= Message-ID: <20161209160909.21046.68573.4739F525@psf.io> https://hg.python.org/cpython/rev/96cd41d6de1d changeset: 105557:96cd41d6de1d user: Victor Stinner date: Fri Dec 09 17:08:59 2016 +0100 summary: Remove useless variable initialization Don't initialize variables which are not used before they are assigned. files: Objects/abstract.c | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2614,8 +2614,7 @@ PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) { va_list va; - PyObject *callable = NULL; - PyObject *retval = NULL; + PyObject *callable, *retval; if (obj == NULL || name == NULL) { return null_error(); @@ -2638,8 +2637,7 @@ const char *format, ...) { va_list va; - PyObject *callable = NULL; - PyObject *retval = NULL; + PyObject *callable, *retval; if (obj == NULL || name == NULL) { return null_error(); @@ -2662,8 +2660,7 @@ const char *format, ...) { va_list va; - PyObject *callable = NULL; - PyObject *retval; + PyObject *callable, *retval; if (obj == NULL || name == NULL) { return null_error(); @@ -2686,8 +2683,7 @@ const char *format, ...) { va_list va; - PyObject *callable = NULL; - PyObject *retval; + PyObject *callable, *retval; if (obj == NULL || name == NULL) { return null_error(); @@ -3112,7 +3108,8 @@ PyObject_GetIter(PyObject *o) { PyTypeObject *t = o->ob_type; - getiterfunc f = NULL; + getiterfunc f; + f = t->tp_iter; if (f == NULL) { if (PySequence_Check(o)) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 11:09:10 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 16:09:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Initialize_variables_to_fi?= =?utf-8?q?x_compiler_warnings?= Message-ID: <20161209160909.99377.68395.67AF7B04@psf.io> https://hg.python.org/cpython/rev/4417634f7a30 changeset: 105556:4417634f7a30 user: Victor Stinner date: Fri Dec 09 17:06:43 2016 +0100 summary: Initialize variables to fix compiler warnings Warnings seen on the "AMD64 Debian PGO 3.x" buildbot. Warnings are false positive, but variable initialization should not harm performances. files: Modules/_cursesmodule.c | 2 +- Modules/_pickle.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -594,7 +594,7 @@ int attr_group = group_right_1; int rtn; int type; - chtype cch; + chtype cch = 0; #ifdef HAVE_NCURSESW wchar_t wstr[2]; cchar_t wcval; diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -4762,7 +4762,7 @@ load_long(UnpicklerObject *self) { PyObject *value; - char *s; + char *s = NULL; Py_ssize_t len; if ((len = _Unpickler_Readline(self, &s)) < 0) @@ -4993,7 +4993,7 @@ { PyObject *str; Py_ssize_t len; - char *s; + char *s = NULL; if ((len = _Unpickler_Readline(self, &s)) < 0) return -1; @@ -5732,7 +5732,7 @@ PyObject *key, *value; Py_ssize_t idx; Py_ssize_t len; - char *s; + char *s = NULL; if ((len = _Unpickler_Readline(self, &s)) < 0) return -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 12:20:33 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 17:20:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320185=3A_Convert_?= =?utf-8?q?=5Fwarnings=2Ewarn=28=29_to_Argument_Clinic?= Message-ID: <20161209172032.118019.7663.D969D8A9@psf.io> https://hg.python.org/cpython/rev/c62352ec21bc changeset: 105559:c62352ec21bc user: Victor Stinner date: Fri Dec 09 18:08:18 2016 +0100 summary: Issue #20185: Convert _warnings.warn() to Argument Clinic Fix warn_explicit(): interpret source=None as source=NULL. files: Python/_warnings.c | 37 +++++++++++++---------- Python/clinic/_warnings.c.h | 38 +++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 16 deletions(-) diff --git a/Python/_warnings.c b/Python/_warnings.c --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -1,5 +1,6 @@ #include "Python.h" #include "frameobject.h" +#include "clinic/_warnings.c.h" #define MODULE_NAME "_warnings" @@ -485,6 +486,10 @@ if (lineno_obj == NULL) goto cleanup; + if (source == Py_None) { + source = NULL; + } + /* Create key. */ key = PyTuple_Pack(3, text, category, lineno_obj); if (key == NULL) @@ -805,22 +810,26 @@ return res; } +/*[clinic input] +warn as warnings_warn + + message: object + category: object = None + stacklevel: Py_ssize_t = 1 + source: object = None + +Issue a warning, or maybe ignore it or raise an exception. +[clinic start generated code]*/ + static PyObject * -warnings_warn(PyObject *self, PyObject *args, PyObject *kwds) +warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category, + Py_ssize_t stacklevel, PyObject *source) +/*[clinic end generated code: output=31ed5ab7d8d760b2 input=bfdf5cf99f6c4edd]*/ { - static char *kw_list[] = {"message", "category", "stacklevel", - "source", NULL}; - PyObject *message, *category = NULL, *source = NULL; - Py_ssize_t stack_level = 1; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OnO:warn", kw_list, - &message, &category, &stack_level, &source)) - return NULL; - category = get_category(message, category); if (category == NULL) return NULL; - return do_warn(message, category, stack_level, source); + return do_warn(message, category, stacklevel, source); } static PyObject * @@ -1098,15 +1107,11 @@ } -PyDoc_STRVAR(warn_doc, -"Issue a warning, or maybe ignore it or raise an exception."); - PyDoc_STRVAR(warn_explicit_doc, "Low-level inferface to warnings functionality."); static PyMethodDef warnings_functions[] = { - {"warn", (PyCFunction)warnings_warn, METH_VARARGS | METH_KEYWORDS, - warn_doc}, + WARNINGS_WARN_METHODDEF {"warn_explicit", (PyCFunction)warnings_warn_explicit, METH_VARARGS | METH_KEYWORDS, warn_explicit_doc}, {"_filters_mutated", (PyCFunction)warnings_filters_mutated, METH_NOARGS, diff --git a/Python/clinic/_warnings.c.h b/Python/clinic/_warnings.c.h new file mode 100644 --- /dev/null +++ b/Python/clinic/_warnings.c.h @@ -0,0 +1,38 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(warnings_warn__doc__, +"warn($module, /, message, category=None, stacklevel=1, source=None)\n" +"--\n" +"\n" +"Issue a warning, or maybe ignore it or raise an exception."); + +#define WARNINGS_WARN_METHODDEF \ + {"warn", (PyCFunction)warnings_warn, METH_FASTCALL, warnings_warn__doc__}, + +static PyObject * +warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category, + Py_ssize_t stacklevel, PyObject *source); + +static PyObject * +warnings_warn(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"message", "category", "stacklevel", "source", NULL}; + static _PyArg_Parser _parser = {"O|OnO:warn", _keywords, 0}; + PyObject *message; + PyObject *category = Py_None; + Py_ssize_t stacklevel = 1; + PyObject *source = Py_None; + + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, + &message, &category, &stacklevel, &source)) { + goto exit; + } + return_value = warnings_warn_impl(module, message, category, stacklevel, source); + +exit: + return return_value; +} +/*[clinic end generated code: output=b3c5297c2c55778c input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 12:20:33 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 17:20:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Inline_PyEval=5FEvalFrameE?= =?utf-8?q?x=28=29_in_callers?= Message-ID: <20161209172032.20848.85449.F34A4469@psf.io> https://hg.python.org/cpython/rev/99c34e47348b changeset: 105558:99c34e47348b user: Victor Stinner date: Fri Dec 09 17:12:17 2016 +0100 summary: Inline PyEval_EvalFrameEx() in callers The PEP 523 modified PyEval_EvalFrameEx(): it's now an indirection to interp->eval_frame(). Inline the call in performance critical code. Leave PyEval_EvalFrame() unchanged, this function is only kept for backward compatibility. files: Objects/genobject.c | 2 +- Python/ceval.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -186,7 +186,7 @@ f->f_back = tstate->frame; gen->gi_running = 1; - result = PyEval_EvalFrameEx(f, exc); + result = tstate->interp->eval_frame(f, exc); gen->gi_running = 0; /* Don't keep the reference to f_back any longer than necessary. It diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4069,7 +4069,7 @@ return gen; } - retval = PyEval_EvalFrameEx(f,0); + retval = tstate->interp->eval_frame(f, 0); fail: /* Jump here from prelude on failure */ @@ -4822,7 +4822,7 @@ Py_INCREF(*args); fastlocals[i] = *args++; } - result = PyEval_EvalFrameEx(f,0); + result = tstate->interp->eval_frame(f,0); ++tstate->recursion_depth; Py_DECREF(f); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 12:52:08 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 09 Dec 2016 17:52:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Backed_out_changeset_99c34?= =?utf-8?q?e47348b?= Message-ID: <20161209175208.117171.40300.73F1DEE2@psf.io> https://hg.python.org/cpython/rev/7deeecfc49b3 changeset: 105560:7deeecfc49b3 user: Victor Stinner date: Fri Dec 09 18:51:13 2016 +0100 summary: Backed out changeset 99c34e47348b The change broke test_gdb. files: Objects/genobject.c | 2 +- Python/ceval.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -186,7 +186,7 @@ f->f_back = tstate->frame; gen->gi_running = 1; - result = tstate->interp->eval_frame(f, exc); + result = PyEval_EvalFrameEx(f, exc); gen->gi_running = 0; /* Don't keep the reference to f_back any longer than necessary. It diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4069,7 +4069,7 @@ return gen; } - retval = tstate->interp->eval_frame(f, 0); + retval = PyEval_EvalFrameEx(f,0); fail: /* Jump here from prelude on failure */ @@ -4822,7 +4822,7 @@ Py_INCREF(*args); fastlocals[i] = *args++; } - result = tstate->interp->eval_frame(f,0); + result = PyEval_EvalFrameEx(f,0); ++tstate->recursion_depth; Py_DECREF(f); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 23:23:10 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 04:23:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgMjg3NTM6?= =?utf-8?q?_Argument_Clinic_howto_docfix=2C_courtesy_Julien_Palard=2E?= Message-ID: <20161210042310.28464.37312.3AA311EB@psf.io> https://hg.python.org/cpython/rev/7a93d1a0a1cf changeset: 105561:7a93d1a0a1cf branch: 3.5 parent: 105517:d350fc4d78ff user: Martin Panter date: Sat Dec 10 03:49:12 2016 +0000 summary: Issue 28753: Argument Clinic howto docfix, courtesy Julien Palard. files: Doc/howto/clinic.rst | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst --- a/Doc/howto/clinic.rst +++ b/Doc/howto/clinic.rst @@ -375,15 +375,12 @@ Write a pickled representation of obj to the open file. [clinic start generated code]*/ -12. Save and close the file, then run ``Tools/clinic/clinic.py`` on it. - With luck everything worked and your block now has output! Reopen - the file in your text editor to see:: +12. Save and close the file, then run ``Tools/clinic/clinic.py`` on + it. With luck everything worked---your block now has output, and + a ``.c.h`` file has been generated! Reopen the file in your + text editor to see: - /*[clinic input] - module _pickle - class _pickle.Pickler "PicklerObject *" "&Pickler_Type" - [clinic start generated code]*/ - /*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ + .. code-block:: c /*[clinic input] _pickle.Pickler.dump @@ -395,18 +392,22 @@ Write a pickled representation of obj to the open file. [clinic start generated code]*/ - PyDoc_STRVAR(_pickle_Pickler_dump__doc__, - "Write a pickled representation of obj to the open file.\n" - "\n" - ... static PyObject * - _pickle_Pickler_dump_impl(PicklerObject *self, PyObject *obj) - /*[clinic end generated code: checksum=3bd30745bf206a48f8b576a1da3d90f55a0a4187]*/ + _pickle_Pickler_dump(PicklerObject *self, PyObject *obj) + /*[clinic end generated code: output=87ecad1261e02ac7 input=552eb1c0f52260d9]*/ Obviously, if Argument Clinic didn't produce any output, it's because it found an error in your input. Keep fixing your errors and retrying until Argument Clinic processes your file without complaint. + For readability, most of the glue code has been generated to a ``.c.h`` + file. You'll need to include that in your original ``.c`` file, + typically right after the clinic module block: + + .. code-block:: c + + #include "clinic/_pickle.c.h" + 13. Double-check that the argument-parsing code Argument Clinic generated looks basically the same as the existing code. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 23:23:10 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 04:23:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issues_=2328755=2C_=2328753=3A_Merge_Arg_Clinic_howto_from_3?= =?utf-8?q?=2E5?= Message-ID: <20161210042310.117974.89330.1C5E4658@psf.io> https://hg.python.org/cpython/rev/d0859a11322c changeset: 105563:d0859a11322c branch: 3.6 parent: 105544:e4e7bc640865 parent: 105562:3795ba7490b1 user: Martin Panter date: Sat Dec 10 04:14:02 2016 +0000 summary: Issues #28755, #28753: Merge Arg Clinic howto from 3.5 files: Doc/howto/clinic.rst | 63 +++++++++++++++++++------------ 1 files changed, 39 insertions(+), 24 deletions(-) diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst --- a/Doc/howto/clinic.rst +++ b/Doc/howto/clinic.rst @@ -1,3 +1,5 @@ +.. highlightlang:: c + ********************** Argument Clinic How-To ********************** @@ -78,17 +80,23 @@ ======================== Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic.py``. -If you run that script, specifying a C file as an argument:: +If you run that script, specifying a C file as an argument: - % python3 Tools/clinic/clinic.py foo.c +.. code-block:: shell-session + + $ python3 Tools/clinic/clinic.py foo.c Argument Clinic will scan over the file looking for lines that -look exactly like this:: +look exactly like this: + +.. code-block:: none /*[clinic input] When it finds one, it reads everything up to a line that looks -exactly like this:: +exactly like this: + +.. code-block:: none [clinic start generated code]*/ @@ -99,7 +107,9 @@ When Argument Clinic parses one of these blocks, it generates output. This output is rewritten into the C file immediately after the block, followed by a comment containing a checksum. -The Argument Clinic block now looks like this:: +The Argument Clinic block now looks like this: + +.. code-block:: none /*[clinic input] ... clinic input goes here ... @@ -375,15 +385,10 @@ Write a pickled representation of obj to the open file. [clinic start generated code]*/ -12. Save and close the file, then run ``Tools/clinic/clinic.py`` on it. - With luck everything worked and your block now has output! Reopen - the file in your text editor to see:: - - /*[clinic input] - module _pickle - class _pickle.Pickler "PicklerObject *" "&Pickler_Type" - [clinic start generated code]*/ - /*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +12. Save and close the file, then run ``Tools/clinic/clinic.py`` on + it. With luck everything worked---your block now has output, and + a ``.c.h`` file has been generated! Reopen the file in your + text editor to see:: /*[clinic input] _pickle.Pickler.dump @@ -395,18 +400,20 @@ Write a pickled representation of obj to the open file. [clinic start generated code]*/ - PyDoc_STRVAR(_pickle_Pickler_dump__doc__, - "Write a pickled representation of obj to the open file.\n" - "\n" - ... static PyObject * - _pickle_Pickler_dump_impl(PicklerObject *self, PyObject *obj) - /*[clinic end generated code: checksum=3bd30745bf206a48f8b576a1da3d90f55a0a4187]*/ + _pickle_Pickler_dump(PicklerObject *self, PyObject *obj) + /*[clinic end generated code: output=87ecad1261e02ac7 input=552eb1c0f52260d9]*/ Obviously, if Argument Clinic didn't produce any output, it's because it found an error in your input. Keep fixing your errors and retrying until Argument Clinic processes your file without complaint. + For readability, most of the glue code has been generated to a ``.c.h`` + file. You'll need to include that in your original ``.c`` file, + typically right after the clinic module block:: + + #include "clinic/_pickle.c.h" + 13. Double-check that the argument-parsing code Argument Clinic generated looks basically the same as the existing code. @@ -1027,7 +1034,9 @@ value), then the generated code will propagate the error. Otherwise it will encode the value you return like normal. -Currently Argument Clinic supports only a few return converters:: +Currently Argument Clinic supports only a few return converters: + +.. code-block:: none bool int @@ -1606,7 +1615,9 @@ #endif /* HAVE_FUNCTIONNAME */ And then in the ``PyMethodDef`` structure at the bottom the existing code -will have:: +will have: + +.. code-block:: none #ifdef HAVE_FUNCTIONNAME {'functionname', ... }, @@ -1656,7 +1667,9 @@ because that could be deactivated by the ``#ifdef``. (That's the whole point!) In this situation, Argument Clinic writes the extra code to the "buffer" destination. -This may mean that you get a complaint from Argument Clinic:: +This may mean that you get a complaint from Argument Clinic: + +.. code-block:: none Warning in file "Modules/posixmodule.c" on line 12357: Destination buffer 'buffer' not empty at end of file, emptying. @@ -1676,7 +1689,9 @@ to run Python blocks lets you use Python as a Python preprocessor! Since Python comments are different from C comments, Argument Clinic -blocks embedded in Python files look slightly different. They look like this:: +blocks embedded in Python files look slightly different. They look like this: + +.. code-block:: python3 #/*[python input] #print("def foo(): pass") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 23:23:10 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 04:23:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4NzU1?= =?utf-8?q?=3A_Improve_syntax_highlighting_in_Arg_Clinic_howto?= Message-ID: <20161210042310.21418.63549.94E48E9A@psf.io> https://hg.python.org/cpython/rev/3795ba7490b1 changeset: 105562:3795ba7490b1 branch: 3.5 user: Martin Panter date: Sat Dec 10 04:10:45 2016 +0000 summary: Issue #28755: Improve syntax highlighting in Arg Clinic howto files: Doc/howto/clinic.rst | 44 +++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst --- a/Doc/howto/clinic.rst +++ b/Doc/howto/clinic.rst @@ -1,3 +1,5 @@ +.. highlightlang:: c + ********************** Argument Clinic How-To ********************** @@ -78,17 +80,23 @@ ======================== Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic.py``. -If you run that script, specifying a C file as an argument:: +If you run that script, specifying a C file as an argument: - % python3 Tools/clinic/clinic.py foo.c +.. code-block:: shell-session + + $ python3 Tools/clinic/clinic.py foo.c Argument Clinic will scan over the file looking for lines that -look exactly like this:: +look exactly like this: + +.. code-block:: none /*[clinic input] When it finds one, it reads everything up to a line that looks -exactly like this:: +exactly like this: + +.. code-block:: none [clinic start generated code]*/ @@ -99,7 +107,9 @@ When Argument Clinic parses one of these blocks, it generates output. This output is rewritten into the C file immediately after the block, followed by a comment containing a checksum. -The Argument Clinic block now looks like this:: +The Argument Clinic block now looks like this: + +.. code-block:: none /*[clinic input] ... clinic input goes here ... @@ -378,9 +388,7 @@ 12. Save and close the file, then run ``Tools/clinic/clinic.py`` on it. With luck everything worked---your block now has output, and a ``.c.h`` file has been generated! Reopen the file in your - text editor to see: - - .. code-block:: c + text editor to see:: /*[clinic input] _pickle.Pickler.dump @@ -402,9 +410,7 @@ For readability, most of the glue code has been generated to a ``.c.h`` file. You'll need to include that in your original ``.c`` file, - typically right after the clinic module block: - - .. code-block:: c + typically right after the clinic module block:: #include "clinic/_pickle.c.h" @@ -1028,7 +1034,9 @@ value), then the generated code will propagate the error. Otherwise it will encode the value you return like normal. -Currently Argument Clinic supports only a few return converters:: +Currently Argument Clinic supports only a few return converters: + +.. code-block:: none bool int @@ -1607,7 +1615,9 @@ #endif /* HAVE_FUNCTIONNAME */ And then in the ``PyMethodDef`` structure at the bottom the existing code -will have:: +will have: + +.. code-block:: none #ifdef HAVE_FUNCTIONNAME {'functionname', ... }, @@ -1657,7 +1667,9 @@ because that could be deactivated by the ``#ifdef``. (That's the whole point!) In this situation, Argument Clinic writes the extra code to the "buffer" destination. -This may mean that you get a complaint from Argument Clinic:: +This may mean that you get a complaint from Argument Clinic: + +.. code-block:: none Warning in file "Modules/posixmodule.c" on line 12357: Destination buffer 'buffer' not empty at end of file, emptying. @@ -1677,7 +1689,9 @@ to run Python blocks lets you use Python as a Python preprocessor! Since Python comments are different from C comments, Argument Clinic -blocks embedded in Python files look slightly different. They look like this:: +blocks embedded in Python files look slightly different. They look like this: + +.. code-block:: python3 #/*[python input] #print("def foo(): pass") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 9 23:23:10 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 04:23:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328755=3A_Merge_Arg_Clinic_howto_from_3=2E6?= Message-ID: <20161210042310.125522.85052.3F708313@psf.io> https://hg.python.org/cpython/rev/889cb7ebc38d changeset: 105564:889cb7ebc38d parent: 105560:7deeecfc49b3 parent: 105563:d0859a11322c user: Martin Panter date: Sat Dec 10 04:22:27 2016 +0000 summary: Issue #28755: Merge Arg Clinic howto from 3.6 files: Doc/howto/clinic.rst | 44 +++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Doc/howto/clinic.rst b/Doc/howto/clinic.rst --- a/Doc/howto/clinic.rst +++ b/Doc/howto/clinic.rst @@ -1,3 +1,5 @@ +.. highlightlang:: c + ********************** Argument Clinic How-To ********************** @@ -78,17 +80,23 @@ ======================== Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic.py``. -If you run that script, specifying a C file as an argument:: +If you run that script, specifying a C file as an argument: - % python3 Tools/clinic/clinic.py foo.c +.. code-block:: shell-session + + $ python3 Tools/clinic/clinic.py foo.c Argument Clinic will scan over the file looking for lines that -look exactly like this:: +look exactly like this: + +.. code-block:: none /*[clinic input] When it finds one, it reads everything up to a line that looks -exactly like this:: +exactly like this: + +.. code-block:: none [clinic start generated code]*/ @@ -99,7 +107,9 @@ When Argument Clinic parses one of these blocks, it generates output. This output is rewritten into the C file immediately after the block, followed by a comment containing a checksum. -The Argument Clinic block now looks like this:: +The Argument Clinic block now looks like this: + +.. code-block:: none /*[clinic input] ... clinic input goes here ... @@ -378,9 +388,7 @@ 12. Save and close the file, then run ``Tools/clinic/clinic.py`` on it. With luck everything worked---your block now has output, and a ``.c.h`` file has been generated! Reopen the file in your - text editor to see: - - .. code-block:: c + text editor to see:: /*[clinic input] _pickle.Pickler.dump @@ -402,9 +410,7 @@ For readability, most of the glue code has been generated to a ``.c.h`` file. You'll need to include that in your original ``.c`` file, - typically right after the clinic module block: - - .. code-block:: c + typically right after the clinic module block:: #include "clinic/_pickle.c.h" @@ -1028,7 +1034,9 @@ value), then the generated code will propagate the error. Otherwise it will encode the value you return like normal. -Currently Argument Clinic supports only a few return converters:: +Currently Argument Clinic supports only a few return converters: + +.. code-block:: none bool int @@ -1607,7 +1615,9 @@ #endif /* HAVE_FUNCTIONNAME */ And then in the ``PyMethodDef`` structure at the bottom the existing code -will have:: +will have: + +.. code-block:: none #ifdef HAVE_FUNCTIONNAME {'functionname', ... }, @@ -1657,7 +1667,9 @@ because that could be deactivated by the ``#ifdef``. (That's the whole point!) In this situation, Argument Clinic writes the extra code to the "buffer" destination. -This may mean that you get a complaint from Argument Clinic:: +This may mean that you get a complaint from Argument Clinic: + +.. code-block:: none Warning in file "Modules/posixmodule.c" on line 12357: Destination buffer 'buffer' not empty at end of file, emptying. @@ -1677,7 +1689,9 @@ to run Python blocks lets you use Python as a Python preprocessor! Since Python comments are different from C comments, Argument Clinic -blocks embedded in Python files look slightly different. They look like this:: +blocks embedded in Python files look slightly different. They look like this: + +.. code-block:: python3 #/*[python input] #print("def foo(): pass") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 00:40:02 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 05:40:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4ODIw?= =?utf-8?q?=3A_Fix_spelling_of_=E2=80=9Cpractice=E2=80=9D_as_a_noun?= Message-ID: <20161210054002.117974.84273.57CF7DD2@psf.io> https://hg.python.org/cpython/rev/8e36c04d0e3e changeset: 105565:8e36c04d0e3e branch: 3.5 parent: 105562:3795ba7490b1 user: Martin Panter date: Sat Dec 10 05:12:56 2016 +0000 summary: Issue #28820: Fix spelling of ?practice? as a noun files: Doc/howto/urllib2.rst | 2 +- Doc/tutorial/modules.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -578,7 +578,7 @@ This document was reviewed and revised by John Lee. .. [#] Google for example. -.. [#] Browser sniffing is a very bad practise for website design - building +.. [#] Browser sniffing is a very bad practice for website design - building sites using web standards is much more sensible. Unfortunately a lot of sites still send different versions to different browsers. .. [#] The user agent for MSIE 6 is diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -501,7 +501,7 @@ ``__all__`` is defined.) Although certain modules are designed to export only names that follow certain -patterns when you use ``import *``, it is still considered bad practise in +patterns when you use ``import *``, it is still considered bad practice in production code. Remember, there is nothing wrong with using ``from Package import -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 00:40:04 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 05:40:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328820=3A_Merge_spelling_fixes_from_3=2E5?= Message-ID: <20161210054002.125155.48157.70B72A07@psf.io> https://hg.python.org/cpython/rev/e9b78a42e6c0 changeset: 105566:e9b78a42e6c0 branch: 3.6 parent: 105563:d0859a11322c parent: 105565:8e36c04d0e3e user: Martin Panter date: Sat Dec 10 05:38:25 2016 +0000 summary: Issue #28820: Merge spelling fixes from 3.5 files: Doc/howto/urllib2.rst | 2 +- Doc/tutorial/modules.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -578,7 +578,7 @@ This document was reviewed and revised by John Lee. .. [#] Google for example. -.. [#] Browser sniffing is a very bad practise for website design - building +.. [#] Browser sniffing is a very bad practice for website design - building sites using web standards is much more sensible. Unfortunately a lot of sites still send different versions to different browsers. .. [#] The user agent for MSIE 6 is diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -501,7 +501,7 @@ ``__all__`` is defined.) Although certain modules are designed to export only names that follow certain -patterns when you use ``import *``, it is still considered bad practise in +patterns when you use ``import *``, it is still considered bad practice in production code. Remember, there is nothing wrong with using ``from Package import -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 00:40:04 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 05:40:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Fix_typos_in_c?= =?utf-8?q?omment_and_documentation?= Message-ID: <20161210054004.28507.31119.07CAD163@psf.io> https://hg.python.org/cpython/rev/44d0086cc264 changeset: 105567:44d0086cc264 branch: 3.6 user: Martin Panter date: Sat Dec 10 05:32:55 2016 +0000 summary: Fix typos in comment and documentation files: Doc/library/re.rst | 2 +- Objects/abstract.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -762,7 +762,7 @@ now are errors. .. deprecated-removed:: 3.5 3.7 - Unknown escapes in *repl* consist of ``'\'`` and ASCII letter now raise + Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter now raise a deprecation warning and will be forbidden in Python 3.7. diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2325,7 +2325,7 @@ return result; } -/* Positional arguments are obj followed args. */ +/* Positional arguments are obj followed by args. */ PyObject * _PyObject_Call_Prepend(PyObject *func, PyObject *obj, PyObject *args, PyObject *kwargs) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 00:40:04 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 05:40:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328820=3A_Merge_typo_fixes_from_3=2E6?= Message-ID: <20161210054004.99792.71284.DE2A073A@psf.io> https://hg.python.org/cpython/rev/d786c620838c changeset: 105568:d786c620838c parent: 105564:889cb7ebc38d parent: 105567:44d0086cc264 user: Martin Panter date: Sat Dec 10 05:39:12 2016 +0000 summary: Issue #28820: Merge typo fixes from 3.6 files: Doc/howto/urllib2.rst | 2 +- Doc/tutorial/modules.rst | 2 +- Objects/abstract.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -578,7 +578,7 @@ This document was reviewed and revised by John Lee. .. [#] Google for example. -.. [#] Browser sniffing is a very bad practise for website design - building +.. [#] Browser sniffing is a very bad practice for website design - building sites using web standards is much more sensible. Unfortunately a lot of sites still send different versions to different browsers. .. [#] The user agent for MSIE 6 is diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -501,7 +501,7 @@ ``__all__`` is defined.) Although certain modules are designed to export only names that follow certain -patterns when you use ``import *``, it is still considered bad practise in +patterns when you use ``import *``, it is still considered bad practice in production code. Remember, there is nothing wrong with using ``from Package import diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2331,7 +2331,7 @@ return result; } -/* Positional arguments are obj followed args: +/* Positional arguments are obj followed by args: call callable(obj, *args, **kwargs) */ PyObject * _PyObject_Call_Prepend(PyObject *callable, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 01:11:18 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 06:11:18 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4Nzcx?= =?utf-8?q?=3A_Update_tp=5Fget/setattr_signature_documentation?= Message-ID: <20161210061111.125432.6475.48CA7351@psf.io> https://hg.python.org/cpython/rev/5d51ac0be72a changeset: 105569:5d51ac0be72a branch: 3.5 parent: 105565:8e36c04d0e3e user: Martin Panter date: Sat Dec 10 05:56:13 2016 +0000 summary: Issue #28771: Update tp_get/setattr signature documentation files: Doc/c-api/typeobj.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -199,8 +199,9 @@ This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, but taking a C string - instead of a Python string object to give the attribute name. The signature is - the same as for :c:func:`PyObject_GetAttrString`. + instead of a Python string object to give the attribute name. The signature is :: + + PyObject * tp_getattr(PyObject *o, char *attr_name); This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when @@ -213,10 +214,11 @@ This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string - instead of a Python string object to give the attribute name. The signature is - the same as for :c:func:`PyObject_SetAttrString`, but setting - *v* to *NULL* to delete an attribute must be supported. + instead of a Python string object to give the attribute name. The signature is :: + PyObject * tp_setattr(PyObject *o, char *attr_name, PyObject *v); + + The *v* argument is set to *NULL* to delete the attribute. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both *NULL*. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 01:11:18 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 06:11:18 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328771=3A_Merge_C_API_doc_fix_from_3=2E5?= Message-ID: <20161210061111.124831.93827.8BA57BFC@psf.io> https://hg.python.org/cpython/rev/ee8c8b79d1d5 changeset: 105570:ee8c8b79d1d5 branch: 3.6 parent: 105567:44d0086cc264 parent: 105569:5d51ac0be72a user: Martin Panter date: Sat Dec 10 05:57:38 2016 +0000 summary: Issue #28771: Merge C API doc fix from 3.5 files: Doc/c-api/typeobj.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -199,8 +199,9 @@ This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, but taking a C string - instead of a Python string object to give the attribute name. The signature is - the same as for :c:func:`PyObject_GetAttrString`. + instead of a Python string object to give the attribute name. The signature is :: + + PyObject * tp_getattr(PyObject *o, char *attr_name); This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when @@ -213,10 +214,11 @@ This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string - instead of a Python string object to give the attribute name. The signature is - the same as for :c:func:`PyObject_SetAttrString`, but setting - *v* to *NULL* to delete an attribute must be supported. + instead of a Python string object to give the attribute name. The signature is :: + PyObject * tp_setattr(PyObject *o, char *attr_name, PyObject *v); + + The *v* argument is set to *NULL* to delete the attribute. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both *NULL*. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 01:11:18 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 10 Dec 2016 06:11:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328771=3A_Merge_C_API_doc_fix_from_3=2E6?= Message-ID: <20161210061111.117866.37058.5001BC55@psf.io> https://hg.python.org/cpython/rev/c4865975b804 changeset: 105571:c4865975b804 parent: 105568:d786c620838c parent: 105570:ee8c8b79d1d5 user: Martin Panter date: Sat Dec 10 05:57:49 2016 +0000 summary: Issue #28771: Merge C API doc fix from 3.6 files: Doc/c-api/typeobj.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst --- a/Doc/c-api/typeobj.rst +++ b/Doc/c-api/typeobj.rst @@ -199,8 +199,9 @@ This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, but taking a C string - instead of a Python string object to give the attribute name. The signature is - the same as for :c:func:`PyObject_GetAttrString`. + instead of a Python string object to give the attribute name. The signature is :: + + PyObject * tp_getattr(PyObject *o, char *attr_name); This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject.tp_getattro` from its base type when @@ -213,10 +214,11 @@ This field is deprecated. When it is defined, it should point to a function that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, but taking a C string - instead of a Python string object to give the attribute name. The signature is - the same as for :c:func:`PyObject_SetAttrString`, but setting - *v* to *NULL* to delete an attribute must be supported. + instead of a Python string object to give the attribute name. The signature is :: + PyObject * tp_setattr(PyObject *o, char *attr_name, PyObject *v); + + The *v* argument is set to *NULL* to delete the attribute. This field is inherited by subtypes together with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` from its base type when the subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject.tp_setattro` are both *NULL*. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Dec 10 04:05:50 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 10 Dec 2016 09:05:50 +0000 Subject: [Python-checkins] Daily reference leaks (d786c620838c): sum=66 Message-ID: <20161210090549.30564.88434.33AA9E5D@psf.io> results for d786c620838c 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 [0, 44, 0] references, sum=44 test_multiprocessing_fork leaked [0, 22, 0] memory blocks, sum=22 test_multiprocessing_fork leaked [0, 2, 0] file descriptors, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog7p1Gic', '--timeout', '7200'] From python-checkins at python.org Sat Dec 10 10:48:43 2016 From: python-checkins at python.org (xavier.degaye) Date: Sat, 10 Dec 2016 15:48:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTE4?= =?utf-8?q?=3A_Fix_the_cross_compilation_of_xxlimited_when_Python?= Message-ID: <20161210154843.99657.42000.48CC5694@psf.io> https://hg.python.org/cpython/rev/f9e0c864157c changeset: 105572:f9e0c864157c branch: 3.6 parent: 105570:ee8c8b79d1d5 user: Xavier de Gaye date: Sat Dec 10 16:45:53 2016 +0100 summary: Issue #28918: Fix the cross compilation of xxlimited when Python has been built with Py_DEBUG defined. files: Misc/NEWS | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28918: Fix the cross compilation of xxlimited when Python has been + built with Py_DEBUG defined. + - Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of dict literal with constant keys up to 30%. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1630,7 +1630,7 @@ ## ext = Extension('xx', ['xxmodule.c']) ## self.extensions.append(ext) - if 'd' not in sys.abiflags: + if 'd' not in sysconfig.get_config_var('ABIFLAGS'): ext = Extension('xxlimited', ['xxlimited.c'], define_macros=[('Py_LIMITED_API', '0x03050000')]) self.extensions.append(ext) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 10:48:43 2016 From: python-checkins at python.org (xavier.degaye) Date: Sat, 10 Dec 2016 15:48:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4OTE4OiBNZXJnZSAzLjYu?= Message-ID: <20161210154843.99922.71964.2CA60650@psf.io> https://hg.python.org/cpython/rev/ff82dfd558df changeset: 105573:ff82dfd558df parent: 105571:c4865975b804 parent: 105572:f9e0c864157c user: Xavier de Gaye date: Sat Dec 10 16:48:07 2016 +0100 summary: Issue #28918: Merge 3.6. files: Misc/NEWS | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28918: Fix the cross compilation of xxlimited when Python has been + built with Py_DEBUG defined. + - Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1631,7 +1631,7 @@ ## ext = Extension('xx', ['xxmodule.c']) ## self.extensions.append(ext) - if 'd' not in sys.abiflags: + if 'd' not in sysconfig.get_config_var('ABIFLAGS'): ext = Extension('xxlimited', ['xxlimited.c'], define_macros=[('Py_LIMITED_API', '0x03050000')]) self.extensions.append(ext) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 11:22:09 2016 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 10 Dec 2016 16:22:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4Nzc5?= =?utf-8?q?=3A_multiprocessing=2Eset=5Fforkserver=5Fpreload=28=29_would_cr?= =?utf-8?q?ash_the?= Message-ID: <20161210162209.15102.89405.ECD0F1C0@psf.io> https://hg.python.org/cpython/rev/1a955981b263 changeset: 105574:1a955981b263 branch: 3.5 parent: 105569:5d51ac0be72a user: Antoine Pitrou date: Sat Dec 10 17:13:16 2016 +0100 summary: Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks. files: Lib/multiprocessing/context.py | 2 +- Lib/multiprocessing/spawn.py | 2 +- Lib/test/_test_multiprocessing.py | 13 +++++++++++++ Lib/test/mp_preload.py | 18 ++++++++++++++++++ Misc/NEWS | 4 ++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -195,7 +195,7 @@ def get_start_method(self, allow_none=False): return self._name - def set_start_method(self, method=None): + def set_start_method(self, method, force=False): raise ValueError('cannot set start method of concrete context') def _check_available(self): diff --git a/Lib/multiprocessing/spawn.py b/Lib/multiprocessing/spawn.py --- a/Lib/multiprocessing/spawn.py +++ b/Lib/multiprocessing/spawn.py @@ -218,7 +218,7 @@ process.ORIGINAL_DIR = data['orig_dir'] if 'start_method' in data: - set_start_method(data['start_method']) + set_start_method(data['start_method'], force=True) if 'init_main_from_name' in data: _fixup_main_from_name(data['init_main_from_name']) diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3728,6 +3728,19 @@ self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) + def test_preload_resources(self): + if multiprocessing.get_start_method() != 'forkserver': + self.skipTest("test only relevant for 'forkserver' method") + name = os.path.join(os.path.dirname(__file__), 'mp_preload.py') + rc, out, err = test.support.script_helper.assert_python_ok(name) + out = out.decode() + err = err.decode() + if out.rstrip() != 'ok' or err != '': + print(out) + print(err) + self.fail("failed spawning forkserver or grandchild") + + # # Check that killing process does not leak named semaphores # diff --git a/Lib/test/mp_preload.py b/Lib/test/mp_preload.py new file mode 100644 --- /dev/null +++ b/Lib/test/mp_preload.py @@ -0,0 +1,18 @@ +import multiprocessing + +multiprocessing.Lock() + + +def f(): + print("ok") + + +if __name__ == "__main__": + ctx = multiprocessing.get_context("forkserver") + modname = "test.mp_preload" + # Make sure it's importable + __import__(modname) + ctx.set_forkserver_preload([modname]) + proc = ctx.Process(target=f) + proc.start() + proc.join() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -124,6 +124,10 @@ Library ------- +- Issue #28779: multiprocessing.set_forkserver_preload() would crash the + forkserver process if a preloaded module instantiated some + multiprocessing objects such as locks. + - Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 11:22:10 2016 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 10 Dec 2016 16:22:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328779=3A_multiprocessing=2Eset=5Fforkserver=5Fp?= =?utf-8?q?reload=28=29_would_crash_the?= Message-ID: <20161210162209.124831.72163.BD7D677A@psf.io> https://hg.python.org/cpython/rev/5456b699788f changeset: 105576:5456b699788f parent: 105573:ff82dfd558df parent: 105575:f3b9fd41b5cb user: Antoine Pitrou date: Sat Dec 10 17:19:21 2016 +0100 summary: Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks. files: Lib/multiprocessing/context.py | 2 +- Lib/multiprocessing/spawn.py | 2 +- Lib/test/_test_multiprocessing.py | 13 +++++++++++++ Lib/test/mp_preload.py | 18 ++++++++++++++++++ Misc/NEWS | 4 ++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -196,7 +196,7 @@ def get_start_method(self, allow_none=False): return self._name - def set_start_method(self, method=None): + def set_start_method(self, method, force=False): raise ValueError('cannot set start method of concrete context') @property diff --git a/Lib/multiprocessing/spawn.py b/Lib/multiprocessing/spawn.py --- a/Lib/multiprocessing/spawn.py +++ b/Lib/multiprocessing/spawn.py @@ -217,7 +217,7 @@ process.ORIGINAL_DIR = data['orig_dir'] if 'start_method' in data: - set_start_method(data['start_method']) + set_start_method(data['start_method'], force=True) if 'init_main_from_name' in data: _fixup_main_from_name(data['init_main_from_name']) diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3818,6 +3818,19 @@ self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) + def test_preload_resources(self): + if multiprocessing.get_start_method() != 'forkserver': + self.skipTest("test only relevant for 'forkserver' method") + name = os.path.join(os.path.dirname(__file__), 'mp_preload.py') + rc, out, err = test.support.script_helper.assert_python_ok(name) + out = out.decode() + err = err.decode() + if out.rstrip() != 'ok' or err != '': + print(out) + print(err) + self.fail("failed spawning forkserver or grandchild") + + # # Check that killing process does not leak named semaphores # diff --git a/Lib/test/mp_preload.py b/Lib/test/mp_preload.py new file mode 100644 --- /dev/null +++ b/Lib/test/mp_preload.py @@ -0,0 +1,18 @@ +import multiprocessing + +multiprocessing.Lock() + + +def f(): + print("ok") + + +if __name__ == "__main__": + ctx = multiprocessing.get_context("forkserver") + modname = "test.mp_preload" + # Make sure it's importable + __import__(modname) + ctx.set_forkserver_preload([modname]) + proc = ctx.Process(target=f) + proc.start() + proc.join() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -171,6 +171,10 @@ Library ------- +- Issue #28779: multiprocessing.set_forkserver_preload() would crash the + forkserver process if a preloaded module instantiated some + multiprocessing objects such as locks. + - Issue #26937: The chown() method of the tarfile.TarFile class does not fail now when the grp module cannot be imported, as for example on Android platforms. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 11:22:10 2016 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 10 Dec 2016 16:22:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328779=3A_multiprocessing=2Eset=5Fforkserver=5Fpreload?= =?utf-8?q?=28=29_would_crash_the?= Message-ID: <20161210162209.125355.87378.97C44DE5@psf.io> https://hg.python.org/cpython/rev/f3b9fd41b5cb changeset: 105575:f3b9fd41b5cb branch: 3.6 parent: 105572:f9e0c864157c parent: 105574:1a955981b263 user: Antoine Pitrou date: Sat Dec 10 17:16:17 2016 +0100 summary: Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks. files: Lib/multiprocessing/context.py | 2 +- Lib/multiprocessing/spawn.py | 2 +- Lib/test/_test_multiprocessing.py | 13 +++++++++++++ Lib/test/mp_preload.py | 18 ++++++++++++++++++ Misc/NEWS | 4 ++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -196,7 +196,7 @@ def get_start_method(self, allow_none=False): return self._name - def set_start_method(self, method=None): + def set_start_method(self, method, force=False): raise ValueError('cannot set start method of concrete context') @property diff --git a/Lib/multiprocessing/spawn.py b/Lib/multiprocessing/spawn.py --- a/Lib/multiprocessing/spawn.py +++ b/Lib/multiprocessing/spawn.py @@ -217,7 +217,7 @@ process.ORIGINAL_DIR = data['orig_dir'] if 'start_method' in data: - set_start_method(data['start_method']) + set_start_method(data['start_method'], force=True) if 'init_main_from_name' in data: _fixup_main_from_name(data['init_main_from_name']) diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -3818,6 +3818,19 @@ self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) + def test_preload_resources(self): + if multiprocessing.get_start_method() != 'forkserver': + self.skipTest("test only relevant for 'forkserver' method") + name = os.path.join(os.path.dirname(__file__), 'mp_preload.py') + rc, out, err = test.support.script_helper.assert_python_ok(name) + out = out.decode() + err = err.decode() + if out.rstrip() != 'ok' or err != '': + print(out) + print(err) + self.fail("failed spawning forkserver or grandchild") + + # # Check that killing process does not leak named semaphores # diff --git a/Lib/test/mp_preload.py b/Lib/test/mp_preload.py new file mode 100644 --- /dev/null +++ b/Lib/test/mp_preload.py @@ -0,0 +1,18 @@ +import multiprocessing + +multiprocessing.Lock() + + +def f(): + print("ok") + + +if __name__ == "__main__": + ctx = multiprocessing.get_context("forkserver") + modname = "test.mp_preload" + # Make sure it's importable + __import__(modname) + ctx.set_forkserver_preload([modname]) + proc = ctx.Process(target=f) + proc.start() + proc.join() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,10 @@ Library ------- +- Issue #28779: multiprocessing.set_forkserver_preload() would crash the + forkserver process if a preloaded module instantiated some + multiprocessing objects such as locks. + - Issue #28847: dbm.dumb now supports reading read-only files and no longer writes the index file when it is not changed. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 11:35:16 2016 From: python-checkins at python.org (xavier.degaye) Date: Sat, 10 Dec 2016 16:35:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODQ5?= =?utf-8?q?=3A_Do_not_define_sys=2Eimplementation=2E=5Fmultiarch_on_Androi?= =?utf-8?q?d=2E?= Message-ID: <20161210163516.117179.46271.0A758E98@psf.io> https://hg.python.org/cpython/rev/b3ba41bf92c7 changeset: 105577:b3ba41bf92c7 branch: 3.6 parent: 105575:f3b9fd41b5cb user: Xavier de Gaye date: Sat Dec 10 17:31:28 2016 +0100 summary: Issue #28849: Do not define sys.implementation._multiarch on Android. files: Lib/test/test_sysconfig.py | 4 ++-- Misc/NEWS | 5 +++++ configure | 24 +----------------------- configure.ac | 24 +----------------------- 4 files changed, 9 insertions(+), 48 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -385,7 +385,8 @@ self.assertIsNotNone(vars['SO']) self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) - @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test') + @unittest.skipUnless(hasattr(sys.implementation, '_multiarch'), + 'multiarch-specific test') def test_triplet_in_ext_suffix(self): import ctypes, platform, re machine = platform.machine() @@ -395,7 +396,6 @@ if re.match('(i[3-6]86|x86_64)$', machine): if ctypes.sizeof(ctypes.c_char_p()) == 4: self.assertTrue(suffix.endswith('i386-linux-gnu.so') or - suffix.endswith('i686-linux-android.so') or suffix.endswith('x86_64-linux-gnux32.so'), suffix) else: # 8 byte pointer size diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,6 +44,11 @@ - Issue #26939: Add the support.setswitchinterval() function to fix test_functools hanging on the Android armv7 qemu emulator. +Build +----- + +- Issue #28849: Do not define sys.implementation._multiarch on Android. + What's New in Python 3.6.0 release candidate 1 ============================================== diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5218,29 +5218,7 @@ #undef sparc #undef unix #if defined(__ANDROID__) -# if defined(__x86_64__) && defined(__LP64__) - x86_64-linux-android -# elif defined(__i386__) - i686-linux-android -# elif defined(__aarch64__) && defined(__AARCH64EL__) -# if defined(__ILP32__) - aarch64_ilp32-linux-android -# else - aarch64-linux-android -# endif -# elif defined(__ARM_EABI__) && defined(__ARMEL__) - arm-linux-androideabi -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-android -# elif _MIPS_SIM == _ABI64 - mips64el-linux-android -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif + # Android is not a multiarch system. #elif defined(__linux__) # if defined(__x86_64__) && defined(__LP64__) x86_64-linux-gnu diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -770,29 +770,7 @@ #undef sparc #undef unix #if defined(__ANDROID__) -# if defined(__x86_64__) && defined(__LP64__) - x86_64-linux-android -# elif defined(__i386__) - i686-linux-android -# elif defined(__aarch64__) && defined(__AARCH64EL__) -# if defined(__ILP32__) - aarch64_ilp32-linux-android -# else - aarch64-linux-android -# endif -# elif defined(__ARM_EABI__) && defined(__ARMEL__) - arm-linux-androideabi -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-android -# elif _MIPS_SIM == _ABI64 - mips64el-linux-android -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif + # Android is not a multiarch system. #elif defined(__linux__) # if defined(__x86_64__) && defined(__LP64__) x86_64-linux-gnu -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 11:35:17 2016 From: python-checkins at python.org (xavier.degaye) Date: Sat, 10 Dec 2016 16:35:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4ODQ5OiBNZXJnZSAzLjYu?= Message-ID: <20161210163517.99494.34375.5AE0B867@psf.io> https://hg.python.org/cpython/rev/40e8b39199da changeset: 105578:40e8b39199da parent: 105576:5456b699788f parent: 105577:b3ba41bf92c7 user: Xavier de Gaye date: Sat Dec 10 17:34:46 2016 +0100 summary: Issue #28849: Merge 3.6. files: Lib/test/test_sysconfig.py | 4 ++-- Misc/NEWS | 2 ++ configure | 24 +----------------------- configure.ac | 24 +----------------------- 4 files changed, 6 insertions(+), 48 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -385,7 +385,8 @@ self.assertIsNotNone(vars['SO']) self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) - @unittest.skipUnless(sys.platform == 'linux', 'Linux-specific test') + @unittest.skipUnless(hasattr(sys.implementation, '_multiarch'), + 'multiarch-specific test') def test_triplet_in_ext_suffix(self): ctypes = import_module('ctypes') import platform, re @@ -396,7 +397,6 @@ if re.match('(i[3-6]86|x86_64)$', machine): if ctypes.sizeof(ctypes.c_char_p()) == 4: self.assertTrue(suffix.endswith('i386-linux-gnu.so') or - suffix.endswith('i686-linux-android.so') or suffix.endswith('x86_64-linux-gnux32.so'), suffix) else: # 8 byte pointer size diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -528,6 +528,8 @@ Build ----- +- Issue #28849: Do not define sys.implementation._multiarch on Android. + - Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael Haubenwallner. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -5218,29 +5218,7 @@ #undef sparc #undef unix #if defined(__ANDROID__) -# if defined(__x86_64__) && defined(__LP64__) - x86_64-linux-android -# elif defined(__i386__) - i686-linux-android -# elif defined(__aarch64__) && defined(__AARCH64EL__) -# if defined(__ILP32__) - aarch64_ilp32-linux-android -# else - aarch64-linux-android -# endif -# elif defined(__ARM_EABI__) && defined(__ARMEL__) - arm-linux-androideabi -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-android -# elif _MIPS_SIM == _ABI64 - mips64el-linux-android -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif + # Android is not a multiarch system. #elif defined(__linux__) # if defined(__x86_64__) && defined(__LP64__) x86_64-linux-gnu diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -770,29 +770,7 @@ #undef sparc #undef unix #if defined(__ANDROID__) -# if defined(__x86_64__) && defined(__LP64__) - x86_64-linux-android -# elif defined(__i386__) - i686-linux-android -# elif defined(__aarch64__) && defined(__AARCH64EL__) -# if defined(__ILP32__) - aarch64_ilp32-linux-android -# else - aarch64-linux-android -# endif -# elif defined(__ARM_EABI__) && defined(__ARMEL__) - arm-linux-androideabi -# elif defined(__mips_hard_float) && defined(_MIPSEL) -# if _MIPS_SIM == _ABIO32 - mipsel-linux-android -# elif _MIPS_SIM == _ABI64 - mips64el-linux-android -# else -# error unknown platform triplet -# endif -# else -# error unknown platform triplet -# endif + # Android is not a multiarch system. #elif defined(__linux__) # if defined(__x86_64__) && defined(__LP64__) x86_64-linux-gnu -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 17:15:30 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 10 Dec 2016 22:15:30 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4NDI0?= =?utf-8?q?=3A_Document_pkgutil=2Eget=5Fdata=28=29_doesn=27t_work_with_nam?= =?utf-8?q?espace_packages=2E?= Message-ID: <20161210221528.124877.8003.45F3839B@psf.io> https://hg.python.org/cpython/rev/3484933ba904 changeset: 105579:3484933ba904 branch: 3.5 parent: 105574:1a955981b263 user: Brett Cannon date: Sat Dec 10 14:13:38 2016 -0800 summary: Issue #28424: Document pkgutil.get_data() doesn't work with namespace packages. Thanks to Douglas Greiman for the patch. files: Doc/library/pkgutil.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst --- a/Doc/library/pkgutil.rst +++ b/Doc/library/pkgutil.rst @@ -219,4 +219,6 @@ If the package cannot be located or loaded, or it uses a :term:`loader` which does not support :meth:`get_data `, - then ``None`` is returned. + then ``None`` is returned. In particular, the :term:`loader` for + :term:`namespace packages ` does not support + :meth:`get_data `. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 17:15:30 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 10 Dec 2016 22:15:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_for_issue_=2328424?= Message-ID: <20161210221530.32764.92135.61E08AC4@psf.io> https://hg.python.org/cpython/rev/b396a2c97871 changeset: 105581:b396a2c97871 parent: 105578:40e8b39199da parent: 105580:c17d2a37d610 user: Brett Cannon date: Sat Dec 10 14:15:22 2016 -0800 summary: Merge for issue #28424 files: Doc/library/pkgutil.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst --- a/Doc/library/pkgutil.rst +++ b/Doc/library/pkgutil.rst @@ -224,4 +224,6 @@ If the package cannot be located or loaded, or it uses a :term:`loader` which does not support :meth:`get_data `, - then ``None`` is returned. + then ``None`` is returned. In particular, the :term:`loader` for + :term:`namespace packages ` does not support + :meth:`get_data `. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 17:15:30 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 10 Dec 2016 22:15:30 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_for_issue_=2328424?= Message-ID: <20161210221530.32675.81041.26585E46@psf.io> https://hg.python.org/cpython/rev/c17d2a37d610 changeset: 105580:c17d2a37d610 branch: 3.6 parent: 105577:b3ba41bf92c7 parent: 105579:3484933ba904 user: Brett Cannon date: Sat Dec 10 14:14:47 2016 -0800 summary: Merge for issue #28424 files: Doc/library/pkgutil.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst --- a/Doc/library/pkgutil.rst +++ b/Doc/library/pkgutil.rst @@ -224,4 +224,6 @@ If the package cannot be located or loaded, or it uses a :term:`loader` which does not support :meth:`get_data `, - then ``None`` is returned. + then ``None`` is returned. In particular, the :term:`loader` for + :term:`namespace packages ` does not support + :meth:`get_data `. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 23:10:45 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 11 Dec 2016 04:10:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2NDgz?= =?utf-8?q?=3A_Clarify_str=2Eisdecimal=28=29_and_isdigit=28=29?= Message-ID: <20161211041045.388.30642.6D4961B4@psf.io> https://hg.python.org/cpython/rev/c15f122617d5 changeset: 105583:c15f122617d5 branch: 3.5 user: Martin Panter date: Sun Dec 11 01:08:25 2016 +0000 summary: Issue #26483: Clarify str.isdecimal() and isdigit() Patch by Julien Palard. files: Doc/library/stdtypes.rst | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1639,18 +1639,20 @@ Return true if all characters in the string are decimal characters and there is at least one character, false - otherwise. Decimal characters are those from general category "Nd". This category - includes digit characters, and all characters - that can be used to form decimal-radix numbers, e.g. U+0660, - ARABIC-INDIC DIGIT ZERO. + otherwise. Decimal characters are those that can be used to form + numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT + ZERO. Formally a decimal character is a character in the Unicode + General Category "Nd". .. method:: str.isdigit() Return true if all characters in the string are digits and there is at least one character, false otherwise. Digits include decimal characters and digits that need - special handling, such as the compatibility superscript digits. Formally, a digit - is a character that has the property value Numeric_Type=Digit or Numeric_Type=Decimal. + special handling, such as the compatibility superscript digits. + This covers digits which cannot be used to form numbers in base 10, + like the Kharosthi numbers. Formally, a digit is a character that has the + property value Numeric_Type=Digit or Numeric_Type=Decimal. .. method:: str.isidentifier() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 23:10:45 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 11 Dec 2016 04:10:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTE2?= =?utf-8?q?=3A_Correct_description_of_=25o_and_=25x_alternative_forms?= Message-ID: <20161211041044.124943.84227.41AE2338@psf.io> https://hg.python.org/cpython/rev/35e66eb101da changeset: 105582:35e66eb101da branch: 3.5 parent: 105579:3484933ba904 user: Martin Panter date: Sun Dec 11 01:07:29 2016 +0000 summary: Issue #28916: Correct description of %o and %x alternative forms * In Python 3, the specifier is 0o * There is no special case for leading zeros * Remove duplicate tests * Clarify other existing tests and comments files: Doc/library/stdtypes.rst | 18 ++++++------------ Lib/test/test_format.py | 26 ++++++-------------------- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2193,15 +2193,12 @@ Notes: (1) - The alternate form causes a leading zero (``'0'``) to be inserted between - left-hand padding and the formatting of the number if the leading character - of the result is not already a zero. + The alternate form causes a leading octal specifier (``'0o'``) to be + inserted before the first digit. (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if @@ -3294,15 +3291,12 @@ Notes: (1) - The alternate form causes a leading zero (``'0'``) to be inserted between - left-hand padding and the formatting of the number if the leading character - of the result is not already a zero. + The alternate form causes a leading octal specifier (``'0o'``) to be + inserted before the first digit. (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -200,42 +200,28 @@ testcommon("%#+37.34o", big, "+0o0012345670123456701234567012345670") # next one gets one leading zero from precision testcommon("%.33o", big, "012345670123456701234567012345670") - # base marker shouldn't change that, since "0" is redundant + # base marker added in spite of leading zero (different to Python 2) testcommon("%#.33o", big, "0o012345670123456701234567012345670") - # but reduce precision, and base marker should add a zero + # reduce precision, and base marker is always added testcommon("%#.32o", big, "0o12345670123456701234567012345670") - # one leading zero from precision, and another from "0" flag & width - testcommon("%034.33o", big, "0012345670123456701234567012345670") - # base marker shouldn't change that - testcommon("%0#34.33o", big, "0o012345670123456701234567012345670") + # one leading zero from precision, plus two from "0" flag & width + testcommon("%035.33o", big, "00012345670123456701234567012345670") + # base marker shouldn't change the size + testcommon("%0#35.33o", big, "0o012345670123456701234567012345670") # Some small ints, in both Python int and flavors). testcommon("%d", 42, "42") testcommon("%d", -42, "-42") - testcommon("%d", 42, "42") - testcommon("%d", -42, "-42") testcommon("%d", 42.0, "42") testcommon("%#x", 1, "0x1") - testcommon("%#x", 1, "0x1") - testcommon("%#X", 1, "0X1") testcommon("%#X", 1, "0X1") testcommon("%#o", 1, "0o1") - testcommon("%#o", 1, "0o1") - testcommon("%#o", 0, "0o0") testcommon("%#o", 0, "0o0") testcommon("%o", 0, "0") - testcommon("%o", 0, "0") - testcommon("%d", 0, "0") testcommon("%d", 0, "0") testcommon("%#x", 0, "0x0") - testcommon("%#x", 0, "0x0") - testcommon("%#X", 0, "0X0") testcommon("%#X", 0, "0X0") testcommon("%x", 0x42, "42") testcommon("%x", -0x42, "-42") - testcommon("%x", 0x42, "42") - testcommon("%x", -0x42, "-42") - testcommon("%o", 0o42, "42") - testcommon("%o", -0o42, "-42") testcommon("%o", 0o42, "42") testcommon("%o", -0o42, "-42") # alternate float formatting -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 23:10:45 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 11 Dec 2016 04:10:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issues_=2328916=2C_=2326483=3A_Merge_stdtypes=2Erst_from_3=2E5?= Message-ID: <20161211041045.32704.4150.EAAFB1C3@psf.io> https://hg.python.org/cpython/rev/bc7fc85beed1 changeset: 105584:bc7fc85beed1 branch: 3.6 parent: 105580:c17d2a37d610 parent: 105583:c15f122617d5 user: Martin Panter date: Sun Dec 11 02:31:32 2016 +0000 summary: Issues #28916, #26483: Merge stdtypes.rst from 3.5 files: Doc/library/stdtypes.rst | 32 ++++++++++++--------------- Lib/test/test_format.py | 26 +++++----------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1644,18 +1644,20 @@ Return true if all characters in the string are decimal characters and there is at least one character, false - otherwise. Decimal characters are those from general category "Nd". This category - includes digit characters, and all characters - that can be used to form decimal-radix numbers, e.g. U+0660, - ARABIC-INDIC DIGIT ZERO. + otherwise. Decimal characters are those that can be used to form + numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT + ZERO. Formally a decimal character is a character in the Unicode + General Category "Nd". .. method:: str.isdigit() Return true if all characters in the string are digits and there is at least one character, false otherwise. Digits include decimal characters and digits that need - special handling, such as the compatibility superscript digits. Formally, a digit - is a character that has the property value Numeric_Type=Digit or Numeric_Type=Decimal. + special handling, such as the compatibility superscript digits. + This covers digits which cannot be used to form numbers in base 10, + like the Kharosthi numbers. Formally, a digit is a character that has the + property value Numeric_Type=Digit or Numeric_Type=Decimal. .. method:: str.isidentifier() @@ -2199,15 +2201,12 @@ Notes: (1) - The alternate form causes a leading zero (``'0'``) to be inserted between - left-hand padding and the formatting of the number if the leading character - of the result is not already a zero. + The alternate form causes a leading octal specifier (``'0o'``) to be + inserted before the first digit. (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if @@ -3303,15 +3302,12 @@ Notes: (1) - The alternate form causes a leading zero (``'0'``) to be inserted between - left-hand padding and the formatting of the number if the leading character - of the result is not already a zero. + The alternate form causes a leading octal specifier (``'0o'``) to be + inserted before the first digit. (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -200,42 +200,28 @@ testcommon("%#+37.34o", big, "+0o0012345670123456701234567012345670") # next one gets one leading zero from precision testcommon("%.33o", big, "012345670123456701234567012345670") - # base marker shouldn't change that, since "0" is redundant + # base marker added in spite of leading zero (different to Python 2) testcommon("%#.33o", big, "0o012345670123456701234567012345670") - # but reduce precision, and base marker should add a zero + # reduce precision, and base marker is always added testcommon("%#.32o", big, "0o12345670123456701234567012345670") - # one leading zero from precision, and another from "0" flag & width - testcommon("%034.33o", big, "0012345670123456701234567012345670") - # base marker shouldn't change that - testcommon("%0#34.33o", big, "0o012345670123456701234567012345670") + # one leading zero from precision, plus two from "0" flag & width + testcommon("%035.33o", big, "00012345670123456701234567012345670") + # base marker shouldn't change the size + testcommon("%0#35.33o", big, "0o012345670123456701234567012345670") # Some small ints, in both Python int and flavors). testcommon("%d", 42, "42") testcommon("%d", -42, "-42") - testcommon("%d", 42, "42") - testcommon("%d", -42, "-42") testcommon("%d", 42.0, "42") testcommon("%#x", 1, "0x1") - testcommon("%#x", 1, "0x1") - testcommon("%#X", 1, "0X1") testcommon("%#X", 1, "0X1") testcommon("%#o", 1, "0o1") - testcommon("%#o", 1, "0o1") - testcommon("%#o", 0, "0o0") testcommon("%#o", 0, "0o0") testcommon("%o", 0, "0") - testcommon("%o", 0, "0") - testcommon("%d", 0, "0") testcommon("%d", 0, "0") testcommon("%#x", 0, "0x0") - testcommon("%#x", 0, "0x0") - testcommon("%#X", 0, "0X0") testcommon("%#X", 0, "0X0") testcommon("%x", 0x42, "42") testcommon("%x", -0x42, "-42") - testcommon("%x", 0x42, "42") - testcommon("%x", -0x42, "-42") - testcommon("%o", 0o42, "42") - testcommon("%o", -0o42, "-42") testcommon("%o", 0o42, "42") testcommon("%o", -0o42, "-42") # alternate float formatting -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 23:10:45 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 11 Dec 2016 04:10:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issues_=2328916=2C_=2326483=3A_Merge_stdtypes=2Erst_from?= =?utf-8?q?_3=2E6?= Message-ID: <20161211041045.99896.83955.9805F7F8@psf.io> https://hg.python.org/cpython/rev/b11850871300 changeset: 105585:b11850871300 parent: 105581:b396a2c97871 parent: 105584:bc7fc85beed1 user: Martin Panter date: Sun Dec 11 03:17:06 2016 +0000 summary: Issues #28916, #26483: Merge stdtypes.rst from 3.6 files: Doc/library/stdtypes.rst | 32 ++++++++++++--------------- Lib/test/test_format.py | 26 +++++----------------- 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1644,18 +1644,20 @@ Return true if all characters in the string are decimal characters and there is at least one character, false - otherwise. Decimal characters are those from general category "Nd". This category - includes digit characters, and all characters - that can be used to form decimal-radix numbers, e.g. U+0660, - ARABIC-INDIC DIGIT ZERO. + otherwise. Decimal characters are those that can be used to form + numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT + ZERO. Formally a decimal character is a character in the Unicode + General Category "Nd". .. method:: str.isdigit() Return true if all characters in the string are digits and there is at least one character, false otherwise. Digits include decimal characters and digits that need - special handling, such as the compatibility superscript digits. Formally, a digit - is a character that has the property value Numeric_Type=Digit or Numeric_Type=Decimal. + special handling, such as the compatibility superscript digits. + This covers digits which cannot be used to form numbers in base 10, + like the Kharosthi numbers. Formally, a digit is a character that has the + property value Numeric_Type=Digit or Numeric_Type=Decimal. .. method:: str.isidentifier() @@ -2199,15 +2201,12 @@ Notes: (1) - The alternate form causes a leading zero (``'0'``) to be inserted between - left-hand padding and the formatting of the number if the leading character - of the result is not already a zero. + The alternate form causes a leading octal specifier (``'0o'``) to be + inserted before the first digit. (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if @@ -3303,15 +3302,12 @@ Notes: (1) - The alternate form causes a leading zero (``'0'``) to be inserted between - left-hand padding and the formatting of the number if the leading character - of the result is not already a zero. + The alternate form causes a leading octal specifier (``'0o'``) to be + inserted before the first digit. (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -200,42 +200,28 @@ testcommon("%#+37.34o", big, "+0o0012345670123456701234567012345670") # next one gets one leading zero from precision testcommon("%.33o", big, "012345670123456701234567012345670") - # base marker shouldn't change that, since "0" is redundant + # base marker added in spite of leading zero (different to Python 2) testcommon("%#.33o", big, "0o012345670123456701234567012345670") - # but reduce precision, and base marker should add a zero + # reduce precision, and base marker is always added testcommon("%#.32o", big, "0o12345670123456701234567012345670") - # one leading zero from precision, and another from "0" flag & width - testcommon("%034.33o", big, "0012345670123456701234567012345670") - # base marker shouldn't change that - testcommon("%0#34.33o", big, "0o012345670123456701234567012345670") + # one leading zero from precision, plus two from "0" flag & width + testcommon("%035.33o", big, "00012345670123456701234567012345670") + # base marker shouldn't change the size + testcommon("%0#35.33o", big, "0o012345670123456701234567012345670") # Some small ints, in both Python int and flavors). testcommon("%d", 42, "42") testcommon("%d", -42, "-42") - testcommon("%d", 42, "42") - testcommon("%d", -42, "-42") testcommon("%d", 42.0, "42") testcommon("%#x", 1, "0x1") - testcommon("%#x", 1, "0x1") - testcommon("%#X", 1, "0X1") testcommon("%#X", 1, "0X1") testcommon("%#o", 1, "0o1") - testcommon("%#o", 1, "0o1") - testcommon("%#o", 0, "0o0") testcommon("%#o", 0, "0o0") testcommon("%o", 0, "0") - testcommon("%o", 0, "0") - testcommon("%d", 0, "0") testcommon("%d", 0, "0") testcommon("%#x", 0, "0x0") - testcommon("%#x", 0, "0x0") - testcommon("%#X", 0, "0X0") testcommon("%#X", 0, "0X0") testcommon("%x", 0x42, "42") testcommon("%x", -0x42, "-42") - testcommon("%x", 0x42, "42") - testcommon("%x", -0x42, "-42") - testcommon("%o", 0o42, "42") - testcommon("%o", -0o42, "-42") testcommon("%o", 0o42, "42") testcommon("%o", -0o42, "-42") # alternate float formatting -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 10 23:10:45 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 11 Dec 2016 04:10:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4OTE2?= =?utf-8?q?=3A_No_special_case_for_leading_zeros_with_=25x_alternative_for?= =?utf-8?q?m?= Message-ID: <20161211041045.32665.22474.A4BFE160@psf.io> https://hg.python.org/cpython/rev/8359ee62dde3 changeset: 105586:8359ee62dde3 branch: 2.7 parent: 105516:e414fb1640e0 user: Martin Panter date: Sun Dec 11 03:51:44 2016 +0000 summary: Issue #28916: No special case for leading zeros with %x alternative form files: Doc/library/stdtypes.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1551,9 +1551,7 @@ (2) The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether - the ``'x'`` or ``'X'`` format was used) to be inserted between left-hand padding - and the formatting of the number if the leading character of the result is not - already a zero. + the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit. (3) The alternate form causes the result to always contain a decimal point, even if -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Dec 11 04:08:19 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 11 Dec 2016 09:08:19 +0000 Subject: [Python-checkins] Daily reference leaks (b11850871300): sum=4 Message-ID: <20161211090342.15424.41804.87C075E6@psf.io> results for b11850871300 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/refloglXdfYu', '--timeout', '7200'] From python-checkins at python.org Sun Dec 11 07:44:50 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 11 Dec 2016 12:44:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328512=3A_Fixed_setting_the_offset_attribute_of_?= =?utf-8?q?SyntaxError_by?= Message-ID: <20161211124450.99792.52147.C3F6A36A@psf.io> https://hg.python.org/cpython/rev/72aaef2d144b changeset: 105589:72aaef2d144b parent: 105585:b11850871300 parent: 105588:df59faf7fa59 user: Serhiy Storchaka date: Sun Dec 11 14:44:21 2016 +0200 summary: Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). files: Lib/test/support/__init__.py | 13 +++- Lib/test/test_future.py | 63 ++++++++--------------- Lib/test/test_global.py | 6 +- Lib/test/test_support.py | 2 +- Lib/test/test_symtable.py | 8 +- Lib/test/test_syntax.py | 9 ++- Misc/NEWS | 3 + Python/errors.c | 12 +--- 8 files changed, 56 insertions(+), 60 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 @@ -1060,9 +1060,16 @@ file.close() unlink(TESTFN) -def check_syntax_error(testcase, statement): - testcase.assertRaises(SyntaxError, compile, statement, - '', 'exec') +def check_syntax_error(testcase, statement, *, lineno=None, offset=None): + with testcase.assertRaises(SyntaxError) as cm: + compile(statement, '', 'exec') + err = cm.exception + testcase.assertIsNotNone(err.lineno) + if lineno is not None: + testcase.assertEqual(err.lineno, lineno) + testcase.assertIsNotNone(err.offset) + if offset is not None: + testcase.assertEqual(err.offset, offset) def open_urlresource(url, *args, **kw): import urllib.request, urllib.parse diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@ -2,6 +2,7 @@ import unittest from test import support +import os import re rx = re.compile(r'\((\S+).py, line (\d+)') @@ -12,6 +13,12 @@ class FutureTest(unittest.TestCase): + def check_syntax_error(self, err, basename, lineno, offset=0): + self.assertIn('%s.py, line %d' % (basename, lineno), str(err)) + self.assertEqual(os.path.basename(err.filename), basename + '.py') + self.assertEqual(err.lineno, lineno) + self.assertEqual(err.offset, offset) + def test_future1(self): with support.CleanImport('future_test1'): from test import future_test1 @@ -27,68 +34,44 @@ from test import test_future3 def test_badfuture3(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future3 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future3", 3) def test_badfuture4(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future4 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future4", 3) def test_badfuture5(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future5 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future5", 4) def test_badfuture6(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future6 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future6", 3) def test_badfuture7(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future7 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 53) def test_badfuture8(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future8 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future8", 3) def test_badfuture9(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future9 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future9", 3, 0) def test_badfuture10(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future10 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future10", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future10", 3, 0) def test_parserhack(self): # test that the parser.c::future_hack function works as expected diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py --- a/Lib/test/test_global.py +++ b/Lib/test/test_global.py @@ -24,7 +24,7 @@ global a global b """ - check_syntax_error(self, prog_text_1) + check_syntax_error(self, prog_text_1, lineno=4, offset=4) def test2(self): prog_text_2 = """\ @@ -32,7 +32,7 @@ print(x) global x """ - check_syntax_error(self, prog_text_2) + check_syntax_error(self, prog_text_2, lineno=3, offset=4) def test3(self): prog_text_3 = """\ @@ -41,7 +41,7 @@ x = 2 global x """ - check_syntax_error(self, prog_text_3) + check_syntax_error(self, prog_text_3, lineno=4, offset=4) def test4(self): prog_text_4 = """\ 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 @@ -240,7 +240,7 @@ self.assertEqual(cm.exception.errno, errno.EBADF) def test_check_syntax_error(self): - support.check_syntax_error(self, "def class") + support.check_syntax_error(self, "def class", lineno=1, offset=9) with self.assertRaises(AssertionError): support.check_syntax_error(self, "x=1") diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -159,15 +159,17 @@ def test_filename_correct(self): ### Bug tickler: SyntaxError file name correct whether error raised ### while parsing or building symbol table. - def checkfilename(brokencode): + def checkfilename(brokencode, offset): try: symtable.symtable(brokencode, "spam", "exec") except SyntaxError as e: self.assertEqual(e.filename, "spam") + self.assertEqual(e.lineno, 1) + self.assertEqual(e.offset, offset) else: self.fail("no SyntaxError for %r" % (brokencode,)) - checkfilename("def f(x): foo)(") # parse-time - checkfilename("def f(x): global x") # symtable-build-time + checkfilename("def f(x): foo)(", 14) # parse-time + checkfilename("def f(x): global x", 10) # symtable-build-time symtable.symtable("pass", b"spam", "exec") with self.assertWarns(DeprecationWarning), \ self.assertRaises(TypeError): diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -548,7 +548,7 @@ class SyntaxTestCase(unittest.TestCase): def _check_error(self, code, errtext, - filename="", mode="exec", subclass=None): + filename="", mode="exec", subclass=None, lineno=None, offset=None): """Check that compiling code raises SyntaxError with errtext. errtest is a regular expression that must be present in the @@ -563,6 +563,11 @@ mo = re.search(errtext, str(err)) if mo is None: self.fail("SyntaxError did not contain '%r'" % (errtext,)) + self.assertEqual(err.filename, filename) + if lineno is not None: + self.assertEqual(err.lineno, lineno) + if offset is not None: + self.assertEqual(err.offset, offset) else: self.fail("compile() did not raise SyntaxError") @@ -573,7 +578,7 @@ self._check_error("del f()", "delete") def test_global_err_then_warn(self): - # Bug tickler: The SyntaxError raised for one global statement + # Bug #763201: The SyntaxError raised for one global statement # shouldn't be clobbered by a SyntaxWarning issued for a later one. source = """if 1: def error(a): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28512: Fixed setting the offset attribute of SyntaxError by + PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + - Issue #28918: Fix the cross compilation of xxlimited when Python has been built with Py_DEBUG defined. diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -1053,16 +1053,15 @@ PyErr_Clear(); Py_DECREF(tmp); } + tmp = NULL; if (col_offset >= 0) { tmp = PyLong_FromLong(col_offset); if (tmp == NULL) PyErr_Clear(); - else { - if (_PyObject_SetAttrId(v, &PyId_offset, tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } } + if (_PyObject_SetAttrId(v, &PyId_offset, tmp ? tmp : Py_None)) + PyErr_Clear(); + Py_XDECREF(tmp); if (filename != NULL) { if (_PyObject_SetAttrId(v, &PyId_filename, filename)) PyErr_Clear(); @@ -1074,9 +1073,6 @@ Py_DECREF(tmp); } } - if (_PyObject_SetAttrId(v, &PyId_offset, Py_None)) { - PyErr_Clear(); - } if (exc != PyExc_SyntaxError) { if (!_PyObject_HasAttrId(v, &PyId_msg)) { tmp = PyObject_Str(v); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 07:44:49 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 11 Dec 2016 12:44:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328512=3A_Fixed_setting_the_offset_attribute_of_Syntax?= =?utf-8?q?Error_by?= Message-ID: <20161211124449.12985.59127.9924D02B@psf.io> https://hg.python.org/cpython/rev/df59faf7fa59 changeset: 105588:df59faf7fa59 branch: 3.6 parent: 105584:bc7fc85beed1 parent: 105587:ea1c49ea8136 user: Serhiy Storchaka date: Sun Dec 11 14:43:18 2016 +0200 summary: Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). files: Lib/test/support/__init__.py | 13 +++- Lib/test/test_future.py | 63 ++++++++--------------- Lib/test/test_global.py | 6 +- Lib/test/test_support.py | 2 +- Lib/test/test_symtable.py | 8 +- Lib/test/test_syntax.py | 9 ++- Misc/NEWS | 3 + Python/errors.c | 12 +--- 8 files changed, 56 insertions(+), 60 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 @@ -1055,9 +1055,16 @@ file.close() unlink(TESTFN) -def check_syntax_error(testcase, statement): - testcase.assertRaises(SyntaxError, compile, statement, - '', 'exec') +def check_syntax_error(testcase, statement, *, lineno=None, offset=None): + with testcase.assertRaises(SyntaxError) as cm: + compile(statement, '', 'exec') + err = cm.exception + testcase.assertIsNotNone(err.lineno) + if lineno is not None: + testcase.assertEqual(err.lineno, lineno) + testcase.assertIsNotNone(err.offset) + if offset is not None: + testcase.assertEqual(err.offset, offset) def open_urlresource(url, *args, **kw): import urllib.request, urllib.parse diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@ -2,6 +2,7 @@ import unittest from test import support +import os import re rx = re.compile(r'\((\S+).py, line (\d+)') @@ -12,6 +13,12 @@ class FutureTest(unittest.TestCase): + def check_syntax_error(self, err, basename, lineno, offset=0): + self.assertIn('%s.py, line %d' % (basename, lineno), str(err)) + self.assertEqual(os.path.basename(err.filename), basename + '.py') + self.assertEqual(err.lineno, lineno) + self.assertEqual(err.offset, offset) + def test_future1(self): with support.CleanImport('future_test1'): from test import future_test1 @@ -27,68 +34,44 @@ from test import test_future3 def test_badfuture3(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future3 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future3", 3) def test_badfuture4(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future4 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future4", 3) def test_badfuture5(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future5 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future5", 4) def test_badfuture6(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future6 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future6", 3) def test_badfuture7(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future7 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 53) def test_badfuture8(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future8 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future8", 3) def test_badfuture9(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future9 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future9", 3, 0) def test_badfuture10(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future10 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future10", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future10", 3, 0) def test_parserhack(self): # test that the parser.c::future_hack function works as expected diff --git a/Lib/test/test_global.py b/Lib/test/test_global.py --- a/Lib/test/test_global.py +++ b/Lib/test/test_global.py @@ -24,7 +24,7 @@ global a global b """ - check_syntax_error(self, prog_text_1) + check_syntax_error(self, prog_text_1, lineno=4, offset=4) def test2(self): prog_text_2 = """\ @@ -32,7 +32,7 @@ print(x) global x """ - check_syntax_error(self, prog_text_2) + check_syntax_error(self, prog_text_2, lineno=3, offset=4) def test3(self): prog_text_3 = """\ @@ -41,7 +41,7 @@ x = 2 global x """ - check_syntax_error(self, prog_text_3) + check_syntax_error(self, prog_text_3, lineno=4, offset=4) def test4(self): prog_text_4 = """\ 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 @@ -240,7 +240,7 @@ self.assertEqual(cm.exception.errno, errno.EBADF) def test_check_syntax_error(self): - support.check_syntax_error(self, "def class") + support.check_syntax_error(self, "def class", lineno=1, offset=9) with self.assertRaises(AssertionError): support.check_syntax_error(self, "x=1") diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -159,15 +159,17 @@ def test_filename_correct(self): ### Bug tickler: SyntaxError file name correct whether error raised ### while parsing or building symbol table. - def checkfilename(brokencode): + def checkfilename(brokencode, offset): try: symtable.symtable(brokencode, "spam", "exec") except SyntaxError as e: self.assertEqual(e.filename, "spam") + self.assertEqual(e.lineno, 1) + self.assertEqual(e.offset, offset) else: self.fail("no SyntaxError for %r" % (brokencode,)) - checkfilename("def f(x): foo)(") # parse-time - checkfilename("def f(x): global x") # symtable-build-time + checkfilename("def f(x): foo)(", 14) # parse-time + checkfilename("def f(x): global x", 10) # symtable-build-time symtable.symtable("pass", b"spam", "exec") with self.assertWarns(DeprecationWarning), \ self.assertRaises(TypeError): diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -544,7 +544,7 @@ class SyntaxTestCase(unittest.TestCase): def _check_error(self, code, errtext, - filename="", mode="exec", subclass=None): + filename="", mode="exec", subclass=None, lineno=None, offset=None): """Check that compiling code raises SyntaxError with errtext. errtest is a regular expression that must be present in the @@ -559,6 +559,11 @@ mo = re.search(errtext, str(err)) if mo is None: self.fail("SyntaxError did not contain '%r'" % (errtext,)) + self.assertEqual(err.filename, filename) + if lineno is not None: + self.assertEqual(err.lineno, lineno) + if offset is not None: + self.assertEqual(err.offset, offset) else: self.fail("compile() did not raise SyntaxError") @@ -569,7 +574,7 @@ self._check_error("del f()", "delete") def test_global_err_then_warn(self): - # Bug tickler: The SyntaxError raised for one global statement + # Bug #763201: The SyntaxError raised for one global statement # shouldn't be clobbered by a SyntaxWarning issued for a later one. source = """if 1: def error(a): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28512: Fixed setting the offset attribute of SyntaxError by + PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + - Issue #28918: Fix the cross compilation of xxlimited when Python has been built with Py_DEBUG defined. diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -1059,16 +1059,15 @@ PyErr_Clear(); Py_DECREF(tmp); } + tmp = NULL; if (col_offset >= 0) { tmp = PyLong_FromLong(col_offset); if (tmp == NULL) PyErr_Clear(); - else { - if (_PyObject_SetAttrId(v, &PyId_offset, tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } } + if (_PyObject_SetAttrId(v, &PyId_offset, tmp ? tmp : Py_None)) + PyErr_Clear(); + Py_XDECREF(tmp); if (filename != NULL) { if (_PyObject_SetAttrId(v, &PyId_filename, filename)) PyErr_Clear(); @@ -1080,9 +1079,6 @@ Py_DECREF(tmp); } } - if (_PyObject_SetAttrId(v, &PyId_offset, Py_None)) { - PyErr_Clear(); - } if (exc != PyExc_SyntaxError) { if (!_PyObject_HasAttrId(v, &PyId_msg)) { tmp = PyObject_Str(v); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 07:44:49 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 11 Dec 2016 12:44:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4NTEy?= =?utf-8?q?=3A_Fixed_setting_the_offset_attribute_of_SyntaxError_by?= Message-ID: <20161211124449.124831.728.C1D5E172@psf.io> https://hg.python.org/cpython/rev/ea1c49ea8136 changeset: 105587:ea1c49ea8136 branch: 3.5 parent: 105583:c15f122617d5 user: Serhiy Storchaka date: Sun Dec 11 14:39:01 2016 +0200 summary: Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). files: Lib/test/support/__init__.py | 13 +++- Lib/test/test_future.py | 63 ++++++++--------------- Lib/test/test_support.py | 4 +- Lib/test/test_symtable.py | 8 +- Lib/test/test_syntax.py | 11 +++- Misc/NEWS | 3 + Python/errors.c | 12 +--- 7 files changed, 56 insertions(+), 58 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 @@ -1041,9 +1041,16 @@ file.close() unlink(TESTFN) -def check_syntax_error(testcase, statement): - testcase.assertRaises(SyntaxError, compile, statement, - '', 'exec') +def check_syntax_error(testcase, statement, *, lineno=None, offset=None): + with testcase.assertRaises(SyntaxError) as cm: + compile(statement, '', 'exec') + err = cm.exception + testcase.assertIsNotNone(err.lineno) + if lineno is not None: + testcase.assertEqual(err.lineno, lineno) + testcase.assertIsNotNone(err.offset) + if offset is not None: + testcase.assertEqual(err.offset, offset) def open_urlresource(url, *args, **kw): import urllib.request, urllib.parse diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py --- a/Lib/test/test_future.py +++ b/Lib/test/test_future.py @@ -2,6 +2,7 @@ import unittest from test import support +import os import re rx = re.compile('\((\S+).py, line (\d+)') @@ -12,6 +13,12 @@ class FutureTest(unittest.TestCase): + def check_syntax_error(self, err, basename, lineno, offset=0): + self.assertIn('%s.py, line %d' % (basename, lineno), str(err)) + self.assertEqual(os.path.basename(err.filename), basename + '.py') + self.assertEqual(err.lineno, lineno) + self.assertEqual(err.offset, offset) + def test_future1(self): with support.CleanImport('future_test1'): from test import future_test1 @@ -27,68 +34,44 @@ from test import test_future3 def test_badfuture3(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future3 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future3", 3) def test_badfuture4(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future4 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future4", 3) def test_badfuture5(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future5 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future5", 4) def test_badfuture6(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future6 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future6", 3) def test_badfuture7(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future7 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future7", 3, 53) def test_badfuture8(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future8 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future8", 3) def test_badfuture9(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future9 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future9", 3, 0) def test_badfuture10(self): - try: + with self.assertRaises(SyntaxError) as cm: from test import badsyntax_future10 - except SyntaxError as msg: - self.assertEqual(get_error_location(msg), ("badsyntax_future10", '3')) - else: - self.fail("expected exception didn't occur") + self.check_syntax_error(cm.exception, "badsyntax_future10", 3, 0) def test_parserhack(self): # test that the parser.c::future_hack function works as expected 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 @@ -240,8 +240,10 @@ self.assertEqual(cm.exception.errno, errno.EBADF) def test_check_syntax_error(self): - support.check_syntax_error(self, "def class") + support.check_syntax_error(self, "def class", lineno=1, offset=9) self.assertRaises(AssertionError, support.check_syntax_error, self, "1") + #with self.assertRaises(AssertionError): + #support.check_syntax_error(self, "x=1") def test_CleanImport(self): import importlib diff --git a/Lib/test/test_symtable.py b/Lib/test/test_symtable.py --- a/Lib/test/test_symtable.py +++ b/Lib/test/test_symtable.py @@ -148,15 +148,17 @@ def test_filename_correct(self): ### Bug tickler: SyntaxError file name correct whether error raised ### while parsing or building symbol table. - def checkfilename(brokencode): + def checkfilename(brokencode, offset): try: symtable.symtable(brokencode, "spam", "exec") except SyntaxError as e: self.assertEqual(e.filename, "spam") + self.assertEqual(e.lineno, 1) + self.assertEqual(e.offset, offset) else: self.fail("no SyntaxError for %r" % (brokencode,)) - checkfilename("def f(x): foo)(") # parse-time - checkfilename("def f(x): global x") # symtable-build-time + checkfilename("def f(x): foo)(", 14) # parse-time + checkfilename("def f(x): global x", 10) # symtable-build-time symtable.symtable("pass", b"spam", "exec") with self.assertRaises(TypeError): symtable.symtable("pass", bytearray(b"spam"), "exec") diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -540,7 +540,7 @@ class SyntaxTestCase(unittest.TestCase): def _check_error(self, code, errtext, - filename="", mode="exec", subclass=None): + filename="", mode="exec", subclass=None, lineno=None, offset=None): """Check that compiling code raises SyntaxError with errtext. errtest is a regular expression that must be present in the @@ -555,6 +555,11 @@ mo = re.search(errtext, str(err)) if mo is None: self.fail("SyntaxError did not contain '%r'" % (errtext,)) + self.assertEqual(err.filename, filename) + if lineno is not None: + self.assertEqual(err.lineno, lineno) + if offset is not None: + self.assertEqual(err.offset, offset) else: self.fail("compile() did not raise SyntaxError") @@ -565,7 +570,7 @@ self._check_error("del f()", "delete") def test_global_err_then_warn(self): - # Bug tickler: The SyntaxError raised for one global statement + # Bug #763201: The SyntaxError raised for one global statement # shouldn't be clobbered by a SyntaxWarning issued for a later one. source = """if 1: def error(a): @@ -575,7 +580,7 @@ global b # SyntaxWarning """ warnings.filterwarnings(action='ignore', category=SyntaxWarning) - self._check_error(source, "global") + self._check_error(source, "global", lineno=3, offset=16) warnings.filters.pop(0) def test_break_outside_loop(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28512: Fixed setting the offset attribute of SyntaxError by + PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + - Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. Original patch by Andreas St?hrk. diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -1009,16 +1009,15 @@ PyErr_Clear(); Py_DECREF(tmp); } + tmp = NULL; if (col_offset >= 0) { tmp = PyLong_FromLong(col_offset); if (tmp == NULL) PyErr_Clear(); - else { - if (_PyObject_SetAttrId(v, &PyId_offset, tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } } + if (_PyObject_SetAttrId(v, &PyId_offset, tmp ? tmp : Py_None)) + PyErr_Clear(); + Py_XDECREF(tmp); if (filename != NULL) { if (_PyObject_SetAttrId(v, &PyId_filename, filename)) PyErr_Clear(); @@ -1030,9 +1029,6 @@ Py_DECREF(tmp); } } - if (_PyObject_SetAttrId(v, &PyId_offset, Py_None)) { - PyErr_Clear(); - } if (exc != PyExc_SyntaxError) { if (!_PyObject_HasAttrId(v, &PyId_msg)) { tmp = PyObject_Str(v); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 12:39:53 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 11 Dec 2016 17:39:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328739=3A_f-string_expressions_no_longer_accepte?= =?utf-8?q?d_as_docstrings_and?= Message-ID: <20161211173953.99172.127.789C2691@psf.io> https://hg.python.org/cpython/rev/8e0f147dfa3d changeset: 105591:8e0f147dfa3d parent: 105589:72aaef2d144b parent: 105590:30341d5c1423 user: Serhiy Storchaka date: Sun Dec 11 19:39:36 2016 +0200 summary: Issue #28739: f-string expressions no longer accepted as docstrings and by ast.literal_eval() even if they do not include subexpressions. files: Lib/test/test_fstring.py | 20 ++++++++++---------- Misc/NEWS | 3 +++ Python/ast.c | 11 +++++------ Python/compile.c | 3 ++- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -70,18 +70,18 @@ # Make sure x was called. self.assertTrue(x.called) + def test_docstring(self): + def f(): + f'''Not a docstring''' + self.assertIsNone(f.__doc__) + def g(): + '''Not a docstring''' \ + f'' + self.assertIsNone(g.__doc__) + def test_literal_eval(self): - # With no expressions, an f-string is okay. - self.assertEqual(ast.literal_eval("f'x'"), 'x') - self.assertEqual(ast.literal_eval("f'x' 'y'"), 'xy') - - # But this should raise an error. with self.assertRaisesRegex(ValueError, 'malformed node or string'): - ast.literal_eval("f'x{3}'") - - # As should this, which uses a different ast node - with self.assertRaisesRegex(ValueError, 'malformed node or string'): - ast.literal_eval("f'{3}'") + ast.literal_eval("f'x'") def test_ast_compile_time_concat(self): x = [''] diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28739: f-string expressions no longer accepted as docstrings and + by ast.literal_eval() even if they do not include expressions. + - Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -4784,6 +4784,7 @@ typedef struct { PyObject *last_str; ExprList expr_list; + int fmode; } FstringParser; #ifdef NDEBUG @@ -4802,6 +4803,7 @@ FstringParser_Init(FstringParser *state) { state->last_str = NULL; + state->fmode = 0; ExprList_Init(&state->expr_list); FstringParser_check_invariants(state); } @@ -4864,6 +4866,7 @@ struct compiling *c, const node *n) { FstringParser_check_invariants(state); + state->fmode = 1; /* Parse the f-string. */ while (1) { @@ -4955,7 +4958,8 @@ /* If we're just a constant string with no expressions, return that. */ - if(state->expr_list.size == 0) { + if (!state->fmode) { + assert(!state->expr_list.size); if (!state->last_str) { /* Create a zero length string. */ state->last_str = PyUnicode_FromStringAndSize(NULL, 0); @@ -4979,11 +4983,6 @@ if (!seq) goto error; - /* If there's only one expression, return it. Otherwise, we need - to join them together. */ - if (seq->size == 1) - return seq->elements[0]; - return JoinedStr(seq, LINENO(n), n->n_col_offset, c->c_arena); error: diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -3412,7 +3412,8 @@ compiler_joined_str(struct compiler *c, expr_ty e) { VISIT_SEQ(c, expr, e->v.JoinedStr.values); - ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values)); + if (asdl_seq_LEN(e->v.JoinedStr.values) != 1) + ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values)); return 1; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 12:39:53 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 11 Dec 2016 17:39:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NzM5?= =?utf-8?q?=3A_f-string_expressions_no_longer_accepted_as_docstrings_and?= Message-ID: <20161211173953.124877.50746.45EE1978@psf.io> https://hg.python.org/cpython/rev/30341d5c1423 changeset: 105590:30341d5c1423 branch: 3.6 parent: 105588:df59faf7fa59 user: Serhiy Storchaka date: Sun Dec 11 19:37:19 2016 +0200 summary: Issue #28739: f-string expressions no longer accepted as docstrings and by ast.literal_eval() even if they do not include subexpressions. files: Lib/test/test_fstring.py | 20 ++++++++++---------- Misc/NEWS | 3 +++ Python/ast.c | 11 +++++------ Python/compile.c | 3 ++- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py --- a/Lib/test/test_fstring.py +++ b/Lib/test/test_fstring.py @@ -70,18 +70,18 @@ # Make sure x was called. self.assertTrue(x.called) + def test_docstring(self): + def f(): + f'''Not a docstring''' + self.assertIsNone(f.__doc__) + def g(): + '''Not a docstring''' \ + f'' + self.assertIsNone(g.__doc__) + def test_literal_eval(self): - # With no expressions, an f-string is okay. - self.assertEqual(ast.literal_eval("f'x'"), 'x') - self.assertEqual(ast.literal_eval("f'x' 'y'"), 'xy') - - # But this should raise an error. with self.assertRaisesRegex(ValueError, 'malformed node or string'): - ast.literal_eval("f'x{3}'") - - # As should this, which uses a different ast node - with self.assertRaisesRegex(ValueError, 'malformed node or string'): - ast.literal_eval("f'{3}'") + ast.literal_eval("f'x'") def test_ast_compile_time_concat(self): x = [''] diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28739: f-string expressions no longer accepted as docstrings and + by ast.literal_eval() even if they do not include expressions. + - Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -4789,6 +4789,7 @@ typedef struct { PyObject *last_str; ExprList expr_list; + int fmode; } FstringParser; #ifdef NDEBUG @@ -4807,6 +4808,7 @@ FstringParser_Init(FstringParser *state) { state->last_str = NULL; + state->fmode = 0; ExprList_Init(&state->expr_list); FstringParser_check_invariants(state); } @@ -4869,6 +4871,7 @@ struct compiling *c, const node *n) { FstringParser_check_invariants(state); + state->fmode = 1; /* Parse the f-string. */ while (1) { @@ -4960,7 +4963,8 @@ /* If we're just a constant string with no expressions, return that. */ - if(state->expr_list.size == 0) { + if (!state->fmode) { + assert(!state->expr_list.size); if (!state->last_str) { /* Create a zero length string. */ state->last_str = PyUnicode_FromStringAndSize(NULL, 0); @@ -4984,11 +4988,6 @@ if (!seq) goto error; - /* If there's only one expression, return it. Otherwise, we need - to join them together. */ - if (seq->size == 1) - return seq->elements[0]; - return JoinedStr(seq, LINENO(n), n->n_col_offset, c->c_arena); error: diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -3415,7 +3415,8 @@ compiler_joined_str(struct compiler *c, expr_ty e) { VISIT_SEQ(c, expr, e->v.JoinedStr.values); - ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values)); + if (asdl_seq_LEN(e->v.JoinedStr.values) != 1) + ADDOP_I(c, BUILD_STRING, asdl_seq_LEN(e->v.JoinedStr.values)); return 1; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 17:48:53 2016 From: python-checkins at python.org (steve.dower) Date: Sun, 11 Dec 2016 22:48:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4Nzgz?= =?utf-8?q?=3A_Replaces_bdist=5Fwininst_in_nuget_packages_with_stub?= Message-ID: <20161211224852.125595.80583.E3744CA1@psf.io> https://hg.python.org/cpython/rev/47bf09270027 changeset: 105592:47bf09270027 branch: 3.5 parent: 105587:ea1c49ea8136 user: Steve Dower date: Sun Dec 11 14:35:07 2016 -0800 summary: Issue #28783: Replaces bdist_wininst in nuget packages with stub files: Tools/msi/distutils.command.bdist_wininst.py | 48 +++------ Tools/msi/make_zip.py | 8 +- 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/Tools/msi/distutils.command.__init__.py b/Tools/msi/distutils.command.bdist_wininst.py rename from Tools/msi/distutils.command.__init__.py rename to Tools/msi/distutils.command.bdist_wininst.py --- a/Tools/msi/distutils.command.__init__.py +++ b/Tools/msi/distutils.command.bdist_wininst.py @@ -1,32 +1,20 @@ -"""distutils.command +"""distutils.command.bdist_wininst -Package containing implementation of all the standard Distutils -commands.""" +Suppresses the 'bdist_wininst' command, while still allowing +setuptools to import it without breaking.""" -__all__ = ['build', - 'build_py', - 'build_ext', - 'build_clib', - 'build_scripts', - 'clean', - 'install', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data', - 'sdist', - 'register', - 'bdist', - 'bdist_dumb', - 'bdist_rpm', - # This command is not included in this package - #'bdist_wininst', - 'check', - 'upload', - # These two are reserved for future use: - #'bdist_sdux', - #'bdist_pkgtool', - # Note: - # bdist_packager is not included because it only provides - # an abstract base class - ] +from distutils.core import Command +from distutils.errors import DistutilsPlatformError + +class bdist_wininst(Command): + description = "create an executable installer for MS Windows" + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + raise DistutilsPlatformError("bdist_wininst is not supported " + "in this Python distribution") diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -75,10 +75,6 @@ if name in EXCLUDE_FILE_FROM_LIBRARY: return False - # Special code is included below to patch this file back in - if [d.lower() for d in p.parts[-3:]] == ['distutils', 'command', '__init__.py']: - return False - suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} @@ -215,8 +211,8 @@ extra_files = [] if s == 'Lib' and p == '**/*': extra_files.append(( - source / 'tools' / 'msi' / 'distutils.command.__init__.py', - Path('distutils') / 'command' / '__init__.py' + source / 'tools' / 'msi' / 'distutils.command.bdist_wininst.py', + Path('distutils') / 'command' / 'bdist_wininst.py' )) copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files)) print('Copied {} files'.format(copied)) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 17:48:53 2016 From: python-checkins at python.org (steve.dower) Date: Sun, 11 Dec 2016 22:48:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328783=3A_Replaces_bdist=5Fwininst_in_nuget_pack?= =?utf-8?q?ages_with_stub?= Message-ID: <20161211224853.12861.73147.70D590DD@psf.io> https://hg.python.org/cpython/rev/402a227564f5 changeset: 105594:402a227564f5 parent: 105591:8e0f147dfa3d parent: 105593:b8b1ad21e073 user: Steve Dower date: Sun Dec 11 14:48:44 2016 -0800 summary: Issue #28783: Replaces bdist_wininst in nuget packages with stub files: Tools/msi/distutils.command.bdist_wininst.py | 48 +++------ Tools/msi/make_zip.py | 8 +- 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/Tools/msi/distutils.command.__init__.py b/Tools/msi/distutils.command.bdist_wininst.py rename from Tools/msi/distutils.command.__init__.py rename to Tools/msi/distutils.command.bdist_wininst.py --- a/Tools/msi/distutils.command.__init__.py +++ b/Tools/msi/distutils.command.bdist_wininst.py @@ -1,32 +1,20 @@ -"""distutils.command +"""distutils.command.bdist_wininst -Package containing implementation of all the standard Distutils -commands.""" +Suppresses the 'bdist_wininst' command, while still allowing +setuptools to import it without breaking.""" -__all__ = ['build', - 'build_py', - 'build_ext', - 'build_clib', - 'build_scripts', - 'clean', - 'install', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data', - 'sdist', - 'register', - 'bdist', - 'bdist_dumb', - 'bdist_rpm', - # This command is not included in this package - #'bdist_wininst', - 'check', - 'upload', - # These two are reserved for future use: - #'bdist_sdux', - #'bdist_pkgtool', - # Note: - # bdist_packager is not included because it only provides - # an abstract base class - ] +from distutils.core import Command +from distutils.errors import DistutilsPlatformError + +class bdist_wininst(Command): + description = "create an executable installer for MS Windows" + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + raise DistutilsPlatformError("bdist_wininst is not supported " + "in this Python distribution") 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 @@ -79,10 +79,6 @@ if name in EXCLUDE_FILE_FROM_LIBRARY: return False - # Special code is included below to patch this file back in - if [d.lower() for d in p.parts[-3:]] == ['distutils', 'command', '__init__.py']: - return False - suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} @@ -218,8 +214,8 @@ extra_files = [] if s == 'Lib' and p == '**/*': extra_files.append(( - source / 'tools' / 'msi' / 'distutils.command.__init__.py', - Path('distutils') / 'command' / '__init__.py' + source / 'tools' / 'msi' / 'distutils.command.bdist_wininst.py', + Path('distutils') / 'command' / 'bdist_wininst.py' )) copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files)) print('Copied {} files'.format(copied)) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 11 17:48:53 2016 From: python-checkins at python.org (steve.dower) Date: Sun, 11 Dec 2016 22:48:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328783=3A_Replaces_bdist=5Fwininst_in_nuget_packages_w?= =?utf-8?q?ith_stub?= Message-ID: <20161211224853.32542.29672.A433BA09@psf.io> https://hg.python.org/cpython/rev/b8b1ad21e073 changeset: 105593:b8b1ad21e073 branch: 3.6 parent: 105590:30341d5c1423 parent: 105592:47bf09270027 user: Steve Dower date: Sun Dec 11 14:48:32 2016 -0800 summary: Issue #28783: Replaces bdist_wininst in nuget packages with stub files: Tools/msi/distutils.command.bdist_wininst.py | 48 +++------ Tools/msi/make_zip.py | 8 +- 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/Tools/msi/distutils.command.__init__.py b/Tools/msi/distutils.command.bdist_wininst.py rename from Tools/msi/distutils.command.__init__.py rename to Tools/msi/distutils.command.bdist_wininst.py --- a/Tools/msi/distutils.command.__init__.py +++ b/Tools/msi/distutils.command.bdist_wininst.py @@ -1,32 +1,20 @@ -"""distutils.command +"""distutils.command.bdist_wininst -Package containing implementation of all the standard Distutils -commands.""" +Suppresses the 'bdist_wininst' command, while still allowing +setuptools to import it without breaking.""" -__all__ = ['build', - 'build_py', - 'build_ext', - 'build_clib', - 'build_scripts', - 'clean', - 'install', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data', - 'sdist', - 'register', - 'bdist', - 'bdist_dumb', - 'bdist_rpm', - # This command is not included in this package - #'bdist_wininst', - 'check', - 'upload', - # These two are reserved for future use: - #'bdist_sdux', - #'bdist_pkgtool', - # Note: - # bdist_packager is not included because it only provides - # an abstract base class - ] +from distutils.core import Command +from distutils.errors import DistutilsPlatformError + +class bdist_wininst(Command): + description = "create an executable installer for MS Windows" + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + raise DistutilsPlatformError("bdist_wininst is not supported " + "in this Python distribution") 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 @@ -79,10 +79,6 @@ if name in EXCLUDE_FILE_FROM_LIBRARY: return False - # Special code is included below to patch this file back in - if [d.lower() for d in p.parts[-3:]] == ['distutils', 'command', '__init__.py']: - return False - suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} @@ -218,8 +214,8 @@ extra_files = [] if s == 'Lib' and p == '**/*': extra_files.append(( - source / 'tools' / 'msi' / 'distutils.command.__init__.py', - Path('distutils') / 'command' / '__init__.py' + source / 'tools' / 'msi' / 'distutils.command.bdist_wininst.py', + Path('distutils') / 'command' / 'bdist_wininst.py' )) copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files)) print('Copied {} files'.format(copied)) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 12 03:57:28 2016 From: python-checkins at python.org (xavier.degaye) Date: Mon, 12 Dec 2016 08:57:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NzY0?= =?utf-8?q?=3A_Fix_a_test=5Fmailbox_failure_on_Android_API_24_when_run_as_?= =?utf-8?q?a?= Message-ID: <20161212085728.99305.36771.7FDE9136@psf.io> https://hg.python.org/cpython/rev/51573ef25903 changeset: 105595:51573ef25903 branch: 3.6 parent: 105593:b8b1ad21e073 user: Xavier de Gaye date: Mon Dec 12 09:55:57 2016 +0100 summary: Issue #28764: Fix a test_mailbox failure on Android API 24 when run as a non-root user. files: Lib/mailbox.py | 21 ++++++++++++--------- Lib/test/test_mailbox.py | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Lib/mailbox.py b/Lib/mailbox.py --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -313,11 +313,12 @@ # final position in order to prevent race conditions with changes # from other programs try: - if hasattr(os, 'link'): + try: os.link(tmp_file.name, dest) + except (AttributeError, PermissionError): + os.rename(tmp_file.name, dest) + else: os.remove(tmp_file.name) - else: - os.rename(tmp_file.name, dest) except OSError as e: os.remove(tmp_file.name) if e.errno == errno.EEXIST: @@ -1200,13 +1201,14 @@ for key in self.iterkeys(): if key - 1 != prev: changes.append((key, prev + 1)) - if hasattr(os, 'link'): + try: os.link(os.path.join(self._path, str(key)), os.path.join(self._path, str(prev + 1))) - os.unlink(os.path.join(self._path, str(key))) - else: + except (AttributeError, PermissionError): os.rename(os.path.join(self._path, str(key)), os.path.join(self._path, str(prev + 1))) + else: + os.unlink(os.path.join(self._path, str(key))) prev += 1 self._next_key = prev + 1 if len(changes) == 0: @@ -2076,13 +2078,14 @@ else: raise try: - if hasattr(os, 'link'): + try: os.link(pre_lock.name, f.name + '.lock') dotlock_done = True - os.unlink(pre_lock.name) - else: + except (AttributeError, PermissionError): os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True + else: + os.unlink(pre_lock.name) except FileExistsError: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -2137,9 +2137,9 @@ if mbox: fp.write(FROM_) fp.write(DUMMY_MESSAGE) - if hasattr(os, "link"): + try: os.link(tmpname, newname) - else: + except (AttributeError, PermissionError): with open(newname, "w") as fp: fp.write(DUMMY_MESSAGE) self._msgfiles.append(newname) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 12 03:57:29 2016 From: python-checkins at python.org (xavier.degaye) Date: Mon, 12 Dec 2016 08:57:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4NzY0OiBNZXJnZSAzLjYu?= Message-ID: <20161212085728.117519.69788.396D977C@psf.io> https://hg.python.org/cpython/rev/3a451c67008d changeset: 105596:3a451c67008d parent: 105594:402a227564f5 parent: 105595:51573ef25903 user: Xavier de Gaye date: Mon Dec 12 09:56:55 2016 +0100 summary: Issue #28764: Merge 3.6. files: Lib/mailbox.py | 21 ++++++++++++--------- Lib/test/test_mailbox.py | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Lib/mailbox.py b/Lib/mailbox.py --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -313,11 +313,12 @@ # final position in order to prevent race conditions with changes # from other programs try: - if hasattr(os, 'link'): + try: os.link(tmp_file.name, dest) + except (AttributeError, PermissionError): + os.rename(tmp_file.name, dest) + else: os.remove(tmp_file.name) - else: - os.rename(tmp_file.name, dest) except OSError as e: os.remove(tmp_file.name) if e.errno == errno.EEXIST: @@ -1200,13 +1201,14 @@ for key in self.iterkeys(): if key - 1 != prev: changes.append((key, prev + 1)) - if hasattr(os, 'link'): + try: os.link(os.path.join(self._path, str(key)), os.path.join(self._path, str(prev + 1))) - os.unlink(os.path.join(self._path, str(key))) - else: + except (AttributeError, PermissionError): os.rename(os.path.join(self._path, str(key)), os.path.join(self._path, str(prev + 1))) + else: + os.unlink(os.path.join(self._path, str(key))) prev += 1 self._next_key = prev + 1 if len(changes) == 0: @@ -2076,13 +2078,14 @@ else: raise try: - if hasattr(os, 'link'): + try: os.link(pre_lock.name, f.name + '.lock') dotlock_done = True - os.unlink(pre_lock.name) - else: + except (AttributeError, PermissionError): os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True + else: + os.unlink(pre_lock.name) except FileExistsError: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -2137,9 +2137,9 @@ if mbox: fp.write(FROM_) fp.write(DUMMY_MESSAGE) - if hasattr(os, "link"): + try: os.link(tmpname, newname) - else: + except (AttributeError, PermissionError): with open(newname, "w") as fp: fp.write(DUMMY_MESSAGE) self._msgfiles.append(newname) -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Dec 12 04:05:08 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 12 Dec 2016 09:05:08 +0000 Subject: [Python-checkins] Daily reference leaks (402a227564f5): sum=-2 Message-ID: <20161212090507.99297.59684.E11C7A88@psf.io> results for 402a227564f5 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/reflog8ZxnUp', '--timeout', '7200'] From lp_benchmark_robot at intel.com Mon Dec 12 11:12:51 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 12 Dec 2016 16:12:51 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-12-12 Message-ID: Results for project Python default, build date 2016-12-12 03:03:10 +0000 commit: 402a227564f5 previous commit: adcd9131b7c6 revision date: 2016-12-11 22:48:44 +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.16% 2.05% 0.96% 14.69% :-| pybench 0.32% -0.17% 0.54% 5.09% :-| regex_v8 3.75% -0.09% -0.30% -4.20% :-( nbody 0.12% -0.25% -5.33% 8.79% :-) json_dump_v2 0.46% -0.52% 7.86% 11.70% :-( normal_startup 0.96% 0.01% -2.76% 6.40% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-12/ 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 Dec 12 13:51:45 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 12 Dec 2016 18:51:45 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-12-12 Message-ID: <92996f6b-604b-400d-bc70-24bae156e7c9@irsmsx104.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-12 03:49:37 +0000 commit: 8359ee62dde3 previous commit: e414fb1640e0 revision date: 2016-12-11 03:51:44 +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.50% 3.47% 6.68% 5.34% :-) pybench 0.13% -0.10% 8.01% 3.82% :-| regex_v8 0.55% 0.09% 0.20% 10.23% :-) nbody 0.14% 0.06% 14.03% 2.34% :-| json_dump_v2 0.32% 0.02% 0.05% 8.88% :-| normal_startup 1.85% -0.20% -1.54% 2.40% :-| ssbench 0.12% 0.18% -0.03% 1.66% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-12-12/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Mon Dec 12 14:20:36 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 12 Dec 2016 19:20:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODk2?= =?utf-8?q?=3A_Disable_WindowsRegistryFinder_by_default=2E?= Message-ID: <20161212192036.99139.24838.2088485A@psf.io> https://hg.python.org/cpython/rev/5bd248c2cc75 changeset: 105597:5bd248c2cc75 branch: 3.6 parent: 105595:51573ef25903 user: Steve Dower date: Mon Dec 12 11:17:59 2016 -0800 summary: Issue #28896: Disable WindowsRegistryFinder by default. files: Lib/importlib/_bootstrap_external.py | 2 - Misc/NEWS | 2 +- PCbuild/_freeze_importlib.vcxproj | 37 +++- PCbuild/pcbuild.proj | 10 +- Python/importlib_external.h | 109 +++++++------- 5 files changed, 83 insertions(+), 77 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1440,6 +1440,4 @@ _setup(_bootstrap_module) supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) - if _os.__name__ == 'nt': - sys.meta_path.append(WindowsRegistryFinder) sys.meta_path.append(PathFinder) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -42,7 +42,7 @@ Windows ------- -- Issue #28896: Deprecate WindowsRegistryFinder +- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. Tests ----- diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj --- a/PCbuild/_freeze_importlib.vcxproj +++ b/PCbuild/_freeze_importlib.vcxproj @@ -76,31 +76,44 @@ - + + $(IntDir)importlib.g.h + $(PySourcePath)Python\importlib.h + + + $(IntDir)importlib_external.g.h + $(PySourcePath)Python\importlib_external.h + - - + + - <_OldContent Condition="Exists('$(PySourcePath)Python\importlib.h')">$([System.IO.File]::ReadAllText('$(PySourcePath)Python\importlib.h').Replace(` `, ` `)) - <_NewContent Condition="Exists('$(IntDir)importlib.g.h')">$([System.IO.File]::ReadAllText('$(IntDir)importlib.g.h').Replace(` `, ` `)) + <_OldContent Condition="Exists($(OutTargetPath))"> + <_NewContent Condition="Exists($(IntTargetPath))">$([System.IO.File]::ReadAllText($(IntTargetPath)).Replace(` `, ` `)) - + + + - - + + + + + diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -28,7 +28,7 @@ Build Clean CleanAll - true + false @@ -48,8 +48,6 @@ - - @@ -68,10 +66,10 @@ false + + - - false - + diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -2334,7 +2334,7 @@ 111,111,116,115,116,114,97,112,32,109,111,100,117,108,101,46, 10,10,32,32,32,32,114,52,0,0,0,114,63,0,0,0, 218,8,98,117,105,108,116,105,110,115,114,140,0,0,0,90, - 5,112,111,115,105,120,250,1,47,218,2,110,116,250,1,92, + 5,112,111,115,105,120,250,1,47,90,2,110,116,250,1,92, 99,1,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1, 116,0,124,1,131,1,100,0,107,2,86,0,1,0,113,2, @@ -2376,61 +2376,58 @@ 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, - 1,10,1,10,1,114,32,1,0,0,99,1,0,0,0,0, + 1,10,1,10,1,114,31,1,0,0,99,1,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 72,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, + 50,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, 125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0, - 103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56, - 116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9, - 106,10,116,12,131,1,1,0,100,2,83,0,41,3,122,41, - 73,110,115,116,97,108,108,32,116,104,101,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,32,99,111, - 109,112,111,110,101,110,116,115,46,114,27,1,0,0,78,41, - 13,114,32,1,0,0,114,159,0,0,0,114,8,0,0,0, - 114,253,0,0,0,114,147,0,0,0,114,5,1,0,0,114, - 18,1,0,0,114,3,0,0,0,114,109,0,0,0,218,9, - 109,101,116,97,95,112,97,116,104,114,161,0,0,0,114,166, - 0,0,0,114,248,0,0,0,41,2,114,31,1,0,0,90, - 17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101, - 114,115,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,8,95,105,110,115,116,97,108,108,158,5,0,0,115, - 12,0,0,0,0,2,8,1,6,1,20,1,10,1,12,1, - 114,34,1,0,0,41,1,114,0,0,0,0,41,2,114,1, - 0,0,0,114,2,0,0,0,41,1,114,49,0,0,0,41, - 1,78,41,3,78,78,78,41,3,78,78,78,41,2,114,62, - 0,0,0,114,62,0,0,0,41,1,78,41,1,78,41,58, - 114,111,0,0,0,114,12,0,0,0,90,37,95,67,65,83, - 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, - 65,84,70,79,82,77,83,95,66,89,84,69,83,95,75,69, - 89,114,11,0,0,0,114,13,0,0,0,114,19,0,0,0, - 114,21,0,0,0,114,30,0,0,0,114,40,0,0,0,114, - 41,0,0,0,114,45,0,0,0,114,46,0,0,0,114,48, - 0,0,0,114,58,0,0,0,218,4,116,121,112,101,218,8, - 95,95,99,111,100,101,95,95,114,142,0,0,0,114,17,0, - 0,0,114,132,0,0,0,114,16,0,0,0,114,20,0,0, - 0,90,17,95,82,65,87,95,77,65,71,73,67,95,78,85, - 77,66,69,82,114,77,0,0,0,114,76,0,0,0,114,88, - 0,0,0,114,78,0,0,0,90,23,68,69,66,85,71,95, - 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, - 83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84, - 69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,83, - 0,0,0,114,89,0,0,0,114,95,0,0,0,114,99,0, - 0,0,114,101,0,0,0,114,120,0,0,0,114,127,0,0, - 0,114,139,0,0,0,114,145,0,0,0,114,148,0,0,0, - 114,153,0,0,0,218,6,111,98,106,101,99,116,114,160,0, - 0,0,114,165,0,0,0,114,166,0,0,0,114,181,0,0, - 0,114,191,0,0,0,114,207,0,0,0,114,215,0,0,0, - 114,220,0,0,0,114,226,0,0,0,114,221,0,0,0,114, - 227,0,0,0,114,246,0,0,0,114,248,0,0,0,114,5, - 1,0,0,114,23,1,0,0,114,159,0,0,0,114,32,1, - 0,0,114,34,1,0,0,114,4,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,218,8,60,109,111, - 100,117,108,101,62,8,0,0,0,115,108,0,0,0,4,16, - 4,1,4,1,2,1,6,3,8,17,8,5,8,5,8,6, - 8,12,8,10,8,9,8,5,8,7,10,22,10,123,16,1, - 12,2,4,1,4,2,6,2,6,2,8,2,16,45,8,34, - 8,19,8,12,8,12,8,28,8,17,10,55,10,12,10,10, - 8,14,6,3,4,1,14,67,14,64,14,29,16,110,14,41, - 18,45,18,16,4,3,18,53,14,60,14,42,14,127,0,5, - 14,127,0,22,10,23,8,11,8,68, + 103,1,131,1,1,0,116,2,106,7,106,8,116,9,131,1, + 1,0,100,1,83,0,41,2,122,41,73,110,115,116,97,108, + 108,32,116,104,101,32,112,97,116,104,45,98,97,115,101,100, + 32,105,109,112,111,114,116,32,99,111,109,112,111,110,101,110, + 116,115,46,78,41,10,114,31,1,0,0,114,159,0,0,0, + 114,8,0,0,0,114,253,0,0,0,114,147,0,0,0,114, + 5,1,0,0,114,18,1,0,0,218,9,109,101,116,97,95, + 112,97,116,104,114,161,0,0,0,114,248,0,0,0,41,2, + 114,30,1,0,0,90,17,115,117,112,112,111,114,116,101,100, + 95,108,111,97,100,101,114,115,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,218,8,95,105,110,115,116,97,108, + 108,158,5,0,0,115,8,0,0,0,0,2,8,1,6,1, + 20,1,114,33,1,0,0,41,1,114,0,0,0,0,41,2, + 114,1,0,0,0,114,2,0,0,0,41,1,114,49,0,0, + 0,41,1,78,41,3,78,78,78,41,3,78,78,78,41,2, + 114,62,0,0,0,114,62,0,0,0,41,1,78,41,1,78, + 41,58,114,111,0,0,0,114,12,0,0,0,90,37,95,67, + 65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,95, + 80,76,65,84,70,79,82,77,83,95,66,89,84,69,83,95, + 75,69,89,114,11,0,0,0,114,13,0,0,0,114,19,0, + 0,0,114,21,0,0,0,114,30,0,0,0,114,40,0,0, + 0,114,41,0,0,0,114,45,0,0,0,114,46,0,0,0, + 114,48,0,0,0,114,58,0,0,0,218,4,116,121,112,101, + 218,8,95,95,99,111,100,101,95,95,114,142,0,0,0,114, + 17,0,0,0,114,132,0,0,0,114,16,0,0,0,114,20, + 0,0,0,90,17,95,82,65,87,95,77,65,71,73,67,95, + 78,85,77,66,69,82,114,77,0,0,0,114,76,0,0,0, + 114,88,0,0,0,114,78,0,0,0,90,23,68,69,66,85, + 71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,73, + 88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,66, + 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, + 114,83,0,0,0,114,89,0,0,0,114,95,0,0,0,114, + 99,0,0,0,114,101,0,0,0,114,120,0,0,0,114,127, + 0,0,0,114,139,0,0,0,114,145,0,0,0,114,148,0, + 0,0,114,153,0,0,0,218,6,111,98,106,101,99,116,114, + 160,0,0,0,114,165,0,0,0,114,166,0,0,0,114,181, + 0,0,0,114,191,0,0,0,114,207,0,0,0,114,215,0, + 0,0,114,220,0,0,0,114,226,0,0,0,114,221,0,0, + 0,114,227,0,0,0,114,246,0,0,0,114,248,0,0,0, + 114,5,1,0,0,114,23,1,0,0,114,159,0,0,0,114, + 31,1,0,0,114,33,1,0,0,114,4,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,60, + 109,111,100,117,108,101,62,8,0,0,0,115,108,0,0,0, + 4,16,4,1,4,1,2,1,6,3,8,17,8,5,8,5, + 8,6,8,12,8,10,8,9,8,5,8,7,10,22,10,123, + 16,1,12,2,4,1,4,2,6,2,6,2,8,2,16,45, + 8,34,8,19,8,12,8,12,8,28,8,17,10,55,10,12, + 10,10,8,14,6,3,4,1,14,67,14,64,14,29,16,110, + 14,41,18,45,18,16,4,3,18,53,14,60,14,42,14,127, + 0,5,14,127,0,22,10,23,8,11,8,68, }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 12 14:20:37 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 12 Dec 2016 19:20:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328896=3A_Disable_WindowsRegistryFinder_by_defau?= =?utf-8?b?bHQu?= Message-ID: <20161212192036.125432.9804.7E48998D@psf.io> https://hg.python.org/cpython/rev/4bd131b028ce changeset: 105598:4bd131b028ce parent: 105596:3a451c67008d parent: 105597:5bd248c2cc75 user: Steve Dower date: Mon Dec 12 11:19:03 2016 -0800 summary: Issue #28896: Disable WindowsRegistryFinder by default. files: Lib/importlib/_bootstrap_external.py | 2 - Misc/NEWS | 2 +- PCbuild/_freeze_importlib.vcxproj | 37 +++- PCbuild/pcbuild.proj | 10 +- Python/importlib_external.h | 109 +++++++------- 5 files changed, 83 insertions(+), 77 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -1440,6 +1440,4 @@ _setup(_bootstrap_module) supported_loaders = _get_supported_file_loaders() sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)]) - if _os.__name__ == 'nt': - sys.meta_path.append(WindowsRegistryFinder) sys.meta_path.append(PathFinder) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -474,7 +474,7 @@ Windows ------- -- Issue #28896: Deprecate WindowsRegistryFinder +- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default - Issue #28522: Fixes mishandled buffer reallocation in getpathp.c diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj --- a/PCbuild/_freeze_importlib.vcxproj +++ b/PCbuild/_freeze_importlib.vcxproj @@ -76,31 +76,44 @@ - + + $(IntDir)importlib.g.h + $(PySourcePath)Python\importlib.h + + + $(IntDir)importlib_external.g.h + $(PySourcePath)Python\importlib_external.h + - - + + - <_OldContent Condition="Exists('$(PySourcePath)Python\importlib.h')">$([System.IO.File]::ReadAllText('$(PySourcePath)Python\importlib.h').Replace(` `, ` `)) - <_NewContent Condition="Exists('$(IntDir)importlib.g.h')">$([System.IO.File]::ReadAllText('$(IntDir)importlib.g.h').Replace(` `, ` `)) + <_OldContent Condition="Exists($(OutTargetPath))"> + <_NewContent Condition="Exists($(IntTargetPath))">$([System.IO.File]::ReadAllText($(IntTargetPath)).Replace(` `, ` `)) - + + + - - + + + + + diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -28,7 +28,7 @@ Build Clean CleanAll - true + false @@ -48,8 +48,6 @@ - - @@ -68,10 +66,10 @@ false + + - - false - + diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -2334,7 +2334,7 @@ 111,111,116,115,116,114,97,112,32,109,111,100,117,108,101,46, 10,10,32,32,32,32,114,52,0,0,0,114,63,0,0,0, 218,8,98,117,105,108,116,105,110,115,114,140,0,0,0,90, - 5,112,111,115,105,120,250,1,47,218,2,110,116,250,1,92, + 5,112,111,115,105,120,250,1,47,90,2,110,116,250,1,92, 99,1,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,115,0,0,0,115,26,0,0,0,124,0,93,18,125,1, 116,0,124,1,131,1,100,0,107,2,86,0,1,0,113,2, @@ -2376,61 +2376,58 @@ 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, - 1,10,1,10,1,114,32,1,0,0,99,1,0,0,0,0, + 1,10,1,10,1,114,31,1,0,0,99,1,0,0,0,0, 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 72,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, + 50,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, 125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0, - 103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56, - 116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9, - 106,10,116,12,131,1,1,0,100,2,83,0,41,3,122,41, - 73,110,115,116,97,108,108,32,116,104,101,32,112,97,116,104, - 45,98,97,115,101,100,32,105,109,112,111,114,116,32,99,111, - 109,112,111,110,101,110,116,115,46,114,27,1,0,0,78,41, - 13,114,32,1,0,0,114,159,0,0,0,114,8,0,0,0, - 114,253,0,0,0,114,147,0,0,0,114,5,1,0,0,114, - 18,1,0,0,114,3,0,0,0,114,109,0,0,0,218,9, - 109,101,116,97,95,112,97,116,104,114,161,0,0,0,114,166, - 0,0,0,114,248,0,0,0,41,2,114,31,1,0,0,90, - 17,115,117,112,112,111,114,116,101,100,95,108,111,97,100,101, - 114,115,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,8,95,105,110,115,116,97,108,108,158,5,0,0,115, - 12,0,0,0,0,2,8,1,6,1,20,1,10,1,12,1, - 114,34,1,0,0,41,1,114,0,0,0,0,41,2,114,1, - 0,0,0,114,2,0,0,0,41,1,114,49,0,0,0,41, - 1,78,41,3,78,78,78,41,3,78,78,78,41,2,114,62, - 0,0,0,114,62,0,0,0,41,1,78,41,1,78,41,58, - 114,111,0,0,0,114,12,0,0,0,90,37,95,67,65,83, - 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, - 65,84,70,79,82,77,83,95,66,89,84,69,83,95,75,69, - 89,114,11,0,0,0,114,13,0,0,0,114,19,0,0,0, - 114,21,0,0,0,114,30,0,0,0,114,40,0,0,0,114, - 41,0,0,0,114,45,0,0,0,114,46,0,0,0,114,48, - 0,0,0,114,58,0,0,0,218,4,116,121,112,101,218,8, - 95,95,99,111,100,101,95,95,114,142,0,0,0,114,17,0, - 0,0,114,132,0,0,0,114,16,0,0,0,114,20,0,0, - 0,90,17,95,82,65,87,95,77,65,71,73,67,95,78,85, - 77,66,69,82,114,77,0,0,0,114,76,0,0,0,114,88, - 0,0,0,114,78,0,0,0,90,23,68,69,66,85,71,95, - 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, - 83,90,27,79,80,84,73,77,73,90,69,68,95,66,89,84, - 69,67,79,68,69,95,83,85,70,70,73,88,69,83,114,83, - 0,0,0,114,89,0,0,0,114,95,0,0,0,114,99,0, - 0,0,114,101,0,0,0,114,120,0,0,0,114,127,0,0, - 0,114,139,0,0,0,114,145,0,0,0,114,148,0,0,0, - 114,153,0,0,0,218,6,111,98,106,101,99,116,114,160,0, - 0,0,114,165,0,0,0,114,166,0,0,0,114,181,0,0, - 0,114,191,0,0,0,114,207,0,0,0,114,215,0,0,0, - 114,220,0,0,0,114,226,0,0,0,114,221,0,0,0,114, - 227,0,0,0,114,246,0,0,0,114,248,0,0,0,114,5, - 1,0,0,114,23,1,0,0,114,159,0,0,0,114,32,1, - 0,0,114,34,1,0,0,114,4,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,6,0,0,0,218,8,60,109,111, - 100,117,108,101,62,8,0,0,0,115,108,0,0,0,4,16, - 4,1,4,1,2,1,6,3,8,17,8,5,8,5,8,6, - 8,12,8,10,8,9,8,5,8,7,10,22,10,123,16,1, - 12,2,4,1,4,2,6,2,6,2,8,2,16,45,8,34, - 8,19,8,12,8,12,8,28,8,17,10,55,10,12,10,10, - 8,14,6,3,4,1,14,67,14,64,14,29,16,110,14,41, - 18,45,18,16,4,3,18,53,14,60,14,42,14,127,0,5, - 14,127,0,22,10,23,8,11,8,68, + 103,1,131,1,1,0,116,2,106,7,106,8,116,9,131,1, + 1,0,100,1,83,0,41,2,122,41,73,110,115,116,97,108, + 108,32,116,104,101,32,112,97,116,104,45,98,97,115,101,100, + 32,105,109,112,111,114,116,32,99,111,109,112,111,110,101,110, + 116,115,46,78,41,10,114,31,1,0,0,114,159,0,0,0, + 114,8,0,0,0,114,253,0,0,0,114,147,0,0,0,114, + 5,1,0,0,114,18,1,0,0,218,9,109,101,116,97,95, + 112,97,116,104,114,161,0,0,0,114,248,0,0,0,41,2, + 114,30,1,0,0,90,17,115,117,112,112,111,114,116,101,100, + 95,108,111,97,100,101,114,115,114,4,0,0,0,114,4,0, + 0,0,114,6,0,0,0,218,8,95,105,110,115,116,97,108, + 108,158,5,0,0,115,8,0,0,0,0,2,8,1,6,1, + 20,1,114,33,1,0,0,41,1,114,0,0,0,0,41,2, + 114,1,0,0,0,114,2,0,0,0,41,1,114,49,0,0, + 0,41,1,78,41,3,78,78,78,41,3,78,78,78,41,2, + 114,62,0,0,0,114,62,0,0,0,41,1,78,41,1,78, + 41,58,114,111,0,0,0,114,12,0,0,0,90,37,95,67, + 65,83,69,95,73,78,83,69,78,83,73,84,73,86,69,95, + 80,76,65,84,70,79,82,77,83,95,66,89,84,69,83,95, + 75,69,89,114,11,0,0,0,114,13,0,0,0,114,19,0, + 0,0,114,21,0,0,0,114,30,0,0,0,114,40,0,0, + 0,114,41,0,0,0,114,45,0,0,0,114,46,0,0,0, + 114,48,0,0,0,114,58,0,0,0,218,4,116,121,112,101, + 218,8,95,95,99,111,100,101,95,95,114,142,0,0,0,114, + 17,0,0,0,114,132,0,0,0,114,16,0,0,0,114,20, + 0,0,0,90,17,95,82,65,87,95,77,65,71,73,67,95, + 78,85,77,66,69,82,114,77,0,0,0,114,76,0,0,0, + 114,88,0,0,0,114,78,0,0,0,90,23,68,69,66,85, + 71,95,66,89,84,69,67,79,68,69,95,83,85,70,70,73, + 88,69,83,90,27,79,80,84,73,77,73,90,69,68,95,66, + 89,84,69,67,79,68,69,95,83,85,70,70,73,88,69,83, + 114,83,0,0,0,114,89,0,0,0,114,95,0,0,0,114, + 99,0,0,0,114,101,0,0,0,114,120,0,0,0,114,127, + 0,0,0,114,139,0,0,0,114,145,0,0,0,114,148,0, + 0,0,114,153,0,0,0,218,6,111,98,106,101,99,116,114, + 160,0,0,0,114,165,0,0,0,114,166,0,0,0,114,181, + 0,0,0,114,191,0,0,0,114,207,0,0,0,114,215,0, + 0,0,114,220,0,0,0,114,226,0,0,0,114,221,0,0, + 0,114,227,0,0,0,114,246,0,0,0,114,248,0,0,0, + 114,5,1,0,0,114,23,1,0,0,114,159,0,0,0,114, + 31,1,0,0,114,33,1,0,0,114,4,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,60, + 109,111,100,117,108,101,62,8,0,0,0,115,108,0,0,0, + 4,16,4,1,4,1,2,1,6,3,8,17,8,5,8,5, + 8,6,8,12,8,10,8,9,8,5,8,7,10,22,10,123, + 16,1,12,2,4,1,4,2,6,2,6,2,8,2,16,45, + 8,34,8,19,8,12,8,12,8,28,8,17,10,55,10,12, + 10,10,8,14,6,3,4,1,14,67,14,64,14,29,16,110, + 14,41,18,45,18,16,4,3,18,53,14,60,14,42,14,127, + 0,5,14,127,0,22,10,23,8,11,8,68, }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 12 16:45:26 2016 From: python-checkins at python.org (yury.selivanov) Date: Mon, 12 Dec 2016 21:45:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MDg5?= =?utf-8?q?=3A_Document_TCP=5FNODELAY_in_asyncio?= Message-ID: <20161212214526.125645.18868.389D0218@psf.io> https://hg.python.org/cpython/rev/853e3f4d6cd9 changeset: 105599:853e3f4d6cd9 branch: 3.6 parent: 105597:5bd248c2cc75 user: Yury Selivanov date: Mon Dec 12 16:44:58 2016 -0500 summary: Issue #28089: Document TCP_NODELAY in asyncio Initial patch by Mariatta Wijaya. files: Doc/library/asyncio-protocol.rst | 3 +++ Doc/whatsnew/3.6.rst | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -25,6 +25,9 @@ The transport classes are :ref:`not thread safe `. +.. versionchanged:: 3.6 + The socket option ``TCP_NODELAY`` is now set by default. + BaseTransport ------------- diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -875,6 +875,9 @@ but that use asyncio to handle them. (Contributed by Jim Fulton in :issue:`27392`.) +* ``TCP_NODELAY`` flag is now set for all TCP transports by default. + (Contributed by Yury Selivanov in :issue:`27456`.) + binascii -------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 12 16:45:26 2016 From: python-checkins at python.org (yury.selivanov) Date: Mon, 12 Dec 2016 21:45:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42IChpc3N1ZSAjMjgwODkp?= Message-ID: <20161212214526.100042.90679.F0108E09@psf.io> https://hg.python.org/cpython/rev/0d209cc7ffdc changeset: 105600:0d209cc7ffdc parent: 105598:4bd131b028ce parent: 105599:853e3f4d6cd9 user: Yury Selivanov date: Mon Dec 12 16:45:21 2016 -0500 summary: Merge 3.6 (issue #28089) files: Doc/library/asyncio-protocol.rst | 3 +++ Doc/whatsnew/3.6.rst | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -25,6 +25,9 @@ The transport classes are :ref:`not thread safe `. +.. versionchanged:: 3.6 + The socket option ``TCP_NODELAY`` is now set by default. + BaseTransport ------------- diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -875,6 +875,9 @@ but that use asyncio to handle them. (Contributed by Jim Fulton in :issue:`27392`.) +* ``TCP_NODELAY`` flag is now set for all TCP transports by default. + (Contributed by Yury Selivanov in :issue:`27456`.) + binascii -------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 03:13:23 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 08:13:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI2ODU2?= =?utf-8?q?=3A_Fix_the_tests_assuming_that_the_pwd_module_has_getpwall=28?= =?utf-8?q?=29_and?= Message-ID: <20161213081323.99377.26039.7D8A03A6@psf.io> https://hg.python.org/cpython/rev/e89c9ab46d77 changeset: 105601:e89c9ab46d77 branch: 3.6 parent: 105599:853e3f4d6cd9 user: Xavier de Gaye date: Tue Dec 13 09:11:38 2016 +0100 summary: Issue #26856: Fix the tests assuming that the pwd module has getpwall() and assuming some invariants about uids that are not valid for Android. files: Lib/test/test_pathlib.py | 2 ++ Lib/test/test_pwd.py | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) 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 @@ -2080,6 +2080,8 @@ self.assertEqual(given, expect) self.assertEqual(set(p.rglob("FILEd*")), set()) + @unittest.skipUnless(hasattr(pwd, 'getpwall'), + 'pwd module does not expose getpwall()') def test_expanduser(self): P = self.cls support.import_module('pwd') diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -4,10 +4,19 @@ pwd = support.import_module('pwd') +def _getpwall(): + # Android does not have getpwall. + if hasattr(pwd, 'getpwall'): + return pwd.getpwall() + elif hasattr(pwd, 'getpwuid'): + return [pwd.getpwuid(0)] + else: + return [] + class PwdTest(unittest.TestCase): def test_values(self): - entries = pwd.getpwall() + entries = _getpwall() for e in entries: self.assertEqual(len(e), 7) @@ -33,7 +42,7 @@ # and check afterwards (done in test_values_extended) def test_values_extended(self): - entries = pwd.getpwall() + entries = _getpwall() entriesbyname = {} entriesbyuid = {} @@ -57,12 +66,13 @@ self.assertRaises(TypeError, pwd.getpwuid, 3.14) self.assertRaises(TypeError, pwd.getpwnam) self.assertRaises(TypeError, pwd.getpwnam, 42) - self.assertRaises(TypeError, pwd.getpwall, 42) + if hasattr(pwd, 'getpwall'): + self.assertRaises(TypeError, pwd.getpwall, 42) # try to get some errors bynames = {} byuids = {} - for (n, p, u, g, gecos, d, s) in pwd.getpwall(): + for (n, p, u, g, gecos, d, s) in _getpwall(): bynames[n] = u byuids[u] = n @@ -96,13 +106,17 @@ # loop, say), pwd.getpwuid() might still be able to find data for that # uid. Using sys.maxint may provoke the same problems, but hopefully # it will be a more repeatable failure. + # Android accepts a very large span of uids including sys.maxsize and + # -1; it raises KeyError with 1 or 2 for example. fakeuid = sys.maxsize self.assertNotIn(fakeuid, byuids) - self.assertRaises(KeyError, pwd.getpwuid, fakeuid) + if not support.is_android: + self.assertRaises(KeyError, pwd.getpwuid, fakeuid) # -1 shouldn't be a valid uid because it has a special meaning in many # uid-related functions - self.assertRaises(KeyError, pwd.getpwuid, -1) + if not support.is_android: + self.assertRaises(KeyError, pwd.getpwuid, -1) # should be out of uid_t range self.assertRaises(KeyError, pwd.getpwuid, 2**128) self.assertRaises(KeyError, pwd.getpwuid, -2**128) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 03:13:23 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 08:13:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI2ODU2OiBNZXJnZSAzLjYu?= Message-ID: <20161213081323.117866.60804.5AF15099@psf.io> https://hg.python.org/cpython/rev/692083f85981 changeset: 105602:692083f85981 parent: 105600:0d209cc7ffdc parent: 105601:e89c9ab46d77 user: Xavier de Gaye date: Tue Dec 13 09:12:49 2016 +0100 summary: Issue #26856: Merge 3.6. files: Lib/test/test_pathlib.py | 2 ++ Lib/test/test_pwd.py | 26 ++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) 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 @@ -2080,6 +2080,8 @@ self.assertEqual(given, expect) self.assertEqual(set(p.rglob("FILEd*")), set()) + @unittest.skipUnless(hasattr(pwd, 'getpwall'), + 'pwd module does not expose getpwall()') def test_expanduser(self): P = self.cls support.import_module('pwd') diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -4,10 +4,19 @@ pwd = support.import_module('pwd') +def _getpwall(): + # Android does not have getpwall. + if hasattr(pwd, 'getpwall'): + return pwd.getpwall() + elif hasattr(pwd, 'getpwuid'): + return [pwd.getpwuid(0)] + else: + return [] + class PwdTest(unittest.TestCase): def test_values(self): - entries = pwd.getpwall() + entries = _getpwall() for e in entries: self.assertEqual(len(e), 7) @@ -33,7 +42,7 @@ # and check afterwards (done in test_values_extended) def test_values_extended(self): - entries = pwd.getpwall() + entries = _getpwall() entriesbyname = {} entriesbyuid = {} @@ -57,12 +66,13 @@ self.assertRaises(TypeError, pwd.getpwuid, 3.14) self.assertRaises(TypeError, pwd.getpwnam) self.assertRaises(TypeError, pwd.getpwnam, 42) - self.assertRaises(TypeError, pwd.getpwall, 42) + if hasattr(pwd, 'getpwall'): + self.assertRaises(TypeError, pwd.getpwall, 42) # try to get some errors bynames = {} byuids = {} - for (n, p, u, g, gecos, d, s) in pwd.getpwall(): + for (n, p, u, g, gecos, d, s) in _getpwall(): bynames[n] = u byuids[u] = n @@ -96,13 +106,17 @@ # loop, say), pwd.getpwuid() might still be able to find data for that # uid. Using sys.maxint may provoke the same problems, but hopefully # it will be a more repeatable failure. + # Android accepts a very large span of uids including sys.maxsize and + # -1; it raises KeyError with 1 or 2 for example. fakeuid = sys.maxsize self.assertNotIn(fakeuid, byuids) - self.assertRaises(KeyError, pwd.getpwuid, fakeuid) + if not support.is_android: + self.assertRaises(KeyError, pwd.getpwuid, fakeuid) # -1 shouldn't be a valid uid because it has a special meaning in many # uid-related functions - self.assertRaises(KeyError, pwd.getpwuid, -1) + if not support.is_android: + self.assertRaises(KeyError, pwd.getpwuid, -1) # should be out of uid_t range self.assertRaises(KeyError, pwd.getpwuid, 2**128) self.assertRaises(KeyError, pwd.getpwuid, -2**128) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 03:22:41 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 08:22:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326936=3A_Fix_the_?= =?utf-8?q?test=5Fsocket_failures_on_Android_-_getservbyname=28=29=2C?= Message-ID: <20161213082241.117097.89635.6F543082@psf.io> https://hg.python.org/cpython/rev/95140ff32239 changeset: 105603:95140ff32239 user: Xavier de Gaye date: Tue Dec 13 09:22:01 2016 +0100 summary: Issue #26936: Fix the test_socket failures on Android - getservbyname(), getservbyport() and getaddrinfo() are broken on some Android API levels. files: Lib/test/test_socket.py | 16 ++++++++++++---- Misc/NEWS | 3 +++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -932,8 +932,11 @@ else: raise OSError # Try same call with optional protocol omitted - port2 = socket.getservbyname(service) - eq(port, port2) + # Issue #26936: Android getservbyname() was broken before API 23. + if (not hasattr(sys, 'getandroidapilevel') or + sys.getandroidapilevel() >= 23): + port2 = socket.getservbyname(service) + eq(port, port2) # Try udp, but don't barf if it doesn't exist try: udpport = socket.getservbyname(service, 'udp') @@ -942,7 +945,9 @@ else: eq(udpport, port) # Now make sure the lookup by port returns the same service name - eq(socket.getservbyport(port2), service) + # Issue #26936: Android getservbyport() is broken. + if not support.is_android: + eq(socket.getservbyport(port2), service) eq(socket.getservbyport(port, 'tcp'), service) if udpport is not None: eq(socket.getservbyport(udpport, 'udp'), service) @@ -1275,7 +1280,10 @@ socket.getaddrinfo('::1', 80) # port can be a string service name such as "http", a numeric # port number or None - socket.getaddrinfo(HOST, "http") + # Issue #26936: Android getaddrinfo() was broken before API level 23. + if (not hasattr(sys, 'getandroidapilevel') or + sys.getandroidapilevel() >= 23): + socket.getaddrinfo(HOST, "http") socket.getaddrinfo(HOST, 80) socket.getaddrinfo(HOST, None) # test family and socktype filters diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -588,6 +588,9 @@ Tests ----- + - Issue #26936: Fix the test_socket failures on Android - getservbyname(), + getservbyport() and getaddrinfo() are broken on some Android API levels. + - Issue #28666: Now test.support.rmtree is able to remove unwritable or unreadable directories. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 04:04:08 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 09:04:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NzU5?= =?utf-8?q?=3A_Fix_the_tests_that_fail_with_PermissionError_when_run_as?= Message-ID: <20161213090407.125522.59308.22C52AA7@psf.io> https://hg.python.org/cpython/rev/43f9366d8883 changeset: 105604:43f9366d8883 branch: 3.6 parent: 105601:e89c9ab46d77 user: Xavier de Gaye date: Tue Dec 13 10:00:01 2016 +0100 summary: Issue #28759: Fix the tests that fail with PermissionError when run as a non-root user on Android where access rights are controled by SELinux MAC. files: Lib/test/eintrdata/eintr_tester.py | 2 ++ Lib/test/support/__init__.py | 3 ++- Lib/test/test_genericpath.py | 3 +++ Lib/test/test_pathlib.py | 2 ++ Lib/test/test_posix.py | 6 ++++++ Lib/test/test_shutil.py | 6 +++++- Lib/test/test_stat.py | 3 ++- 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -20,6 +20,7 @@ import unittest from test import support +android_not_root = support.android_not_root @contextlib.contextmanager def kill_on_error(proc): @@ -311,6 +312,7 @@ # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203162 @support.requires_freebsd_version(10, 3) @unittest.skipUnless(hasattr(os, 'mkfifo'), 'needs mkfifo()') + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def _test_open(self, do_open_close_reader, do_open_close_writer): filename = support.TESTFN 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 @@ -93,7 +93,7 @@ "check__all__", "requires_android_level", "requires_multiprocessing_queue", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", - "setswitchinterval", + "setswitchinterval", "android_not_root", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", # processes @@ -769,6 +769,7 @@ _ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL') is_android = (_ANDROID_API_LEVEL is not None and _ANDROID_API_LEVEL > 0) +android_not_root = (is_android and os.geteuid() != 0) if sys.platform != 'win32': unix_shell = '/system/bin/sh' if is_android else '/bin/sh' diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -8,6 +8,7 @@ import unittest import warnings from test import support +android_not_root = support.android_not_root def create_file(filename, data=b'foo'): @@ -212,6 +213,7 @@ def test_samefile_on_symlink(self): self._test_samefile_on_link_func(os.symlink) + @unittest.skipIf(android_not_root, "hard links not allowed, non root user") def test_samefile_on_link(self): self._test_samefile_on_link_func(os.link) @@ -251,6 +253,7 @@ def test_samestat_on_symlink(self): self._test_samestat_on_link_func(os.symlink) + @unittest.skipIf(android_not_root, "hard links not allowed, non root user") def test_samestat_on_link(self): self._test_samestat_on_link_func(os.link) 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 @@ -10,6 +10,7 @@ import unittest from test import support +android_not_root = support.android_not_root TESTFN = support.TESTFN try: @@ -1864,6 +1865,7 @@ self.assertFalse((P / 'fileA' / 'bah').is_fifo()) @unittest.skipUnless(hasattr(os, "mkfifo"), "os.mkfifo() required") + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_is_fifo_true(self): P = self.cls(BASE, 'myfifo') os.mkfifo(str(P)) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1,6 +1,7 @@ "Test posix functions" from test import support +android_not_root = support.android_not_root # Skip these tests if there is no posix module. posix = support.import_module('posix') @@ -422,6 +423,7 @@ posix.stat, list(os.fsencode(support.TESTFN))) @unittest.skipUnless(hasattr(posix, 'mkfifo'), "don't have mkfifo()") + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_mkfifo(self): support.unlink(support.TESTFN) posix.mkfifo(support.TESTFN, stat.S_IRUSR | stat.S_IWUSR) @@ -429,6 +431,7 @@ @unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'), "don't have mknod()/S_IFIFO") + @unittest.skipIf(android_not_root, "mknod not allowed, non root user") def test_mknod(self): # Test using mknod() to create a FIFO (the only use specified # by POSIX). @@ -907,6 +910,7 @@ posix.close(f) @unittest.skipUnless(os.link in os.supports_dir_fd, "test needs dir_fd support in os.link()") + @unittest.skipIf(android_not_root, "hard link not allowed, non root user") def test_link_dir_fd(self): f = posix.open(posix.getcwd(), posix.O_RDONLY) try: @@ -930,6 +934,7 @@ @unittest.skipUnless((os.mknod in os.supports_dir_fd) and hasattr(stat, 'S_IFIFO'), "test requires both stat.S_IFIFO and dir_fd support for os.mknod()") + @unittest.skipIf(android_not_root, "mknod not allowed, non root user") def test_mknod_dir_fd(self): # Test using mknodat() to create a FIFO (the only use specified # by POSIX). @@ -1013,6 +1018,7 @@ posix.close(f) @unittest.skipUnless(os.mkfifo in os.supports_dir_fd, "test needs dir_fd support in os.mkfifo()") + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_mkfifo_dir_fd(self): support.unlink(support.TESTFN) f = posix.open(posix.getcwd(), posix.O_RDONLY) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -22,7 +22,8 @@ import warnings from test import support -from test.support import TESTFN, check_warnings, captured_stdout, requires_zlib +from test.support import (TESTFN, check_warnings, captured_stdout, + requires_zlib, android_not_root) try: import bz2 @@ -787,6 +788,7 @@ @unittest.skipIf(os.name == 'nt', 'temporarily disabled on Windows') @unittest.skipUnless(hasattr(os, 'link'), 'requires os.link') + @unittest.skipIf(android_not_root, "hard links not allowed, non root user") def test_dont_copy_file_onto_link_to_itself(self): # bug 851123. os.mkdir(TESTFN) @@ -839,6 +841,7 @@ # Issue #3002: copyfile and copytree block indefinitely on named pipes @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_copyfile_named_pipe(self): os.mkfifo(TESTFN) try: @@ -849,6 +852,7 @@ finally: os.remove(TESTFN) + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') @support.skip_unless_symlink def test_copytree_named_pipe(self): diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py --- a/Lib/test/test_stat.py +++ b/Lib/test/test_stat.py @@ -1,7 +1,7 @@ import unittest import os import sys -from test.support import TESTFN, import_fresh_module +from test.support import TESTFN, import_fresh_module, android_not_root c_stat = import_fresh_module('stat', fresh=['_stat']) py_stat = import_fresh_module('stat', blocked=['_stat']) @@ -168,6 +168,7 @@ self.assertS_IS("LNK", st_mode) @unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available') + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_fifo(self): os.mkfifo(TESTFN, 0o700) st_mode, modestr = self.get_mode() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 04:04:08 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 09:04:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4NzU5OiBNZXJnZSAzLjYu?= Message-ID: <20161213090408.117974.28779.819E56D8@psf.io> https://hg.python.org/cpython/rev/db1d20825d71 changeset: 105605:db1d20825d71 parent: 105603:95140ff32239 parent: 105604:43f9366d8883 user: Xavier de Gaye date: Tue Dec 13 10:03:34 2016 +0100 summary: Issue #28759: Merge 3.6. files: Lib/test/eintrdata/eintr_tester.py | 2 ++ Lib/test/support/__init__.py | 3 ++- Lib/test/test_genericpath.py | 3 +++ Lib/test/test_pathlib.py | 2 ++ Lib/test/test_posix.py | 6 ++++++ Lib/test/test_shutil.py | 6 +++++- Lib/test/test_stat.py | 3 ++- 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Lib/test/eintrdata/eintr_tester.py b/Lib/test/eintrdata/eintr_tester.py --- a/Lib/test/eintrdata/eintr_tester.py +++ b/Lib/test/eintrdata/eintr_tester.py @@ -20,6 +20,7 @@ import unittest from test import support +android_not_root = support.android_not_root @contextlib.contextmanager def kill_on_error(proc): @@ -311,6 +312,7 @@ # https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203162 @support.requires_freebsd_version(10, 3) @unittest.skipUnless(hasattr(os, 'mkfifo'), 'needs mkfifo()') + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def _test_open(self, do_open_close_reader, do_open_close_writer): filename = support.TESTFN 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 @@ -93,7 +93,7 @@ "check__all__", "requires_android_level", "requires_multiprocessing_queue", # sys "is_jython", "is_android", "check_impl_detail", "unix_shell", - "setswitchinterval", + "setswitchinterval", "android_not_root", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", # processes @@ -774,6 +774,7 @@ except AttributeError: # sys.getandroidapilevel() is only available on Android is_android = False +android_not_root = (is_android and os.geteuid() != 0) if sys.platform != 'win32': unix_shell = '/system/bin/sh' if is_android else '/bin/sh' diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -8,6 +8,7 @@ import unittest import warnings from test import support +android_not_root = support.android_not_root def create_file(filename, data=b'foo'): @@ -212,6 +213,7 @@ def test_samefile_on_symlink(self): self._test_samefile_on_link_func(os.symlink) + @unittest.skipIf(android_not_root, "hard links not allowed, non root user") def test_samefile_on_link(self): self._test_samefile_on_link_func(os.link) @@ -251,6 +253,7 @@ def test_samestat_on_symlink(self): self._test_samestat_on_link_func(os.symlink) + @unittest.skipIf(android_not_root, "hard links not allowed, non root user") def test_samestat_on_link(self): self._test_samestat_on_link_func(os.link) 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 @@ -10,6 +10,7 @@ import unittest from test import support +android_not_root = support.android_not_root TESTFN = support.TESTFN try: @@ -1864,6 +1865,7 @@ self.assertFalse((P / 'fileA' / 'bah').is_fifo()) @unittest.skipUnless(hasattr(os, "mkfifo"), "os.mkfifo() required") + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_is_fifo_true(self): P = self.cls(BASE, 'myfifo') os.mkfifo(str(P)) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1,6 +1,7 @@ "Test posix functions" from test import support +android_not_root = support.android_not_root # Skip these tests if there is no posix module. posix = support.import_module('posix') @@ -422,6 +423,7 @@ posix.stat, list(os.fsencode(support.TESTFN))) @unittest.skipUnless(hasattr(posix, 'mkfifo'), "don't have mkfifo()") + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_mkfifo(self): support.unlink(support.TESTFN) posix.mkfifo(support.TESTFN, stat.S_IRUSR | stat.S_IWUSR) @@ -429,6 +431,7 @@ @unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'), "don't have mknod()/S_IFIFO") + @unittest.skipIf(android_not_root, "mknod not allowed, non root user") def test_mknod(self): # Test using mknod() to create a FIFO (the only use specified # by POSIX). @@ -907,6 +910,7 @@ posix.close(f) @unittest.skipUnless(os.link in os.supports_dir_fd, "test needs dir_fd support in os.link()") + @unittest.skipIf(android_not_root, "hard link not allowed, non root user") def test_link_dir_fd(self): f = posix.open(posix.getcwd(), posix.O_RDONLY) try: @@ -930,6 +934,7 @@ @unittest.skipUnless((os.mknod in os.supports_dir_fd) and hasattr(stat, 'S_IFIFO'), "test requires both stat.S_IFIFO and dir_fd support for os.mknod()") + @unittest.skipIf(android_not_root, "mknod not allowed, non root user") def test_mknod_dir_fd(self): # Test using mknodat() to create a FIFO (the only use specified # by POSIX). @@ -1013,6 +1018,7 @@ posix.close(f) @unittest.skipUnless(os.mkfifo in os.supports_dir_fd, "test needs dir_fd support in os.mkfifo()") + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_mkfifo_dir_fd(self): support.unlink(support.TESTFN) f = posix.open(posix.getcwd(), posix.O_RDONLY) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -22,7 +22,8 @@ import warnings from test import support -from test.support import TESTFN, check_warnings, captured_stdout, requires_zlib +from test.support import (TESTFN, check_warnings, captured_stdout, + requires_zlib, android_not_root) try: import bz2 @@ -787,6 +788,7 @@ @unittest.skipIf(os.name == 'nt', 'temporarily disabled on Windows') @unittest.skipUnless(hasattr(os, 'link'), 'requires os.link') + @unittest.skipIf(android_not_root, "hard links not allowed, non root user") def test_dont_copy_file_onto_link_to_itself(self): # bug 851123. os.mkdir(TESTFN) @@ -839,6 +841,7 @@ # Issue #3002: copyfile and copytree block indefinitely on named pipes @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_copyfile_named_pipe(self): os.mkfifo(TESTFN) try: @@ -849,6 +852,7 @@ finally: os.remove(TESTFN) + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') @support.skip_unless_symlink def test_copytree_named_pipe(self): diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py --- a/Lib/test/test_stat.py +++ b/Lib/test/test_stat.py @@ -1,7 +1,7 @@ import unittest import os import sys -from test.support import TESTFN, import_fresh_module +from test.support import TESTFN, import_fresh_module, android_not_root c_stat = import_fresh_module('stat', fresh=['_stat']) py_stat = import_fresh_module('stat', blocked=['_stat']) @@ -168,6 +168,7 @@ self.assertS_IS("LNK", st_mode) @unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available') + @unittest.skipIf(android_not_root, "mkfifo not allowed, non root user") def test_fifo(self): os.mkfifo(TESTFN, 0o700) st_mode, modestr = self.get_mode() -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Dec 13 04:05:09 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 13 Dec 2016 09:05:09 +0000 Subject: [Python-checkins] Daily reference leaks (0d209cc7ffdc): sum=5 Message-ID: <20161213090508.124943.64182.965BDFDA@psf.io> results for 0d209cc7ffdc 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 [2, 0, 0] memory blocks, sum=2 test_multiprocessing_forkserver leaked [-2, 1, -1] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogpNGq1l', '--timeout', '7200'] From python-checkins at python.org Tue Dec 13 10:06:20 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 15:06:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4MTkwOiBNZXJnZSAzLjYu?= Message-ID: <20161213150611.117023.38328.DAA31AD2@psf.io> https://hg.python.org/cpython/rev/bdf92b4e02f2 changeset: 105607:bdf92b4e02f2 parent: 105605:db1d20825d71 parent: 105606:8c78d844d6f0 user: Xavier de Gaye date: Tue Dec 13 16:05:15 2016 +0100 summary: Issue #28190: Merge 3.6. files: configure | 4 +++- configure.ac | 4 +++- setup.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -15706,7 +15706,9 @@ # first curses header check ac_save_cppflags="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +if test "$cross_compiling" = no; then + CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +fi for ac_header in curses.h ncurses.h do : diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -4889,7 +4889,9 @@ # first curses header check ac_save_cppflags="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +if test "$cross_compiling" = no; then + CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +fi AC_CHECK_HEADERS(curses.h ncurses.h) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1350,7 +1350,8 @@ panel_library = 'panel' if curses_library == 'ncursesw': curses_defines.append(('HAVE_NCURSESW', '1')) - curses_includes.append('/usr/include/ncursesw') + if not cross_compiling: + curses_includes.append('/usr/include/ncursesw') # Bug 1464056: If _curses.so links with ncursesw, # _curses_panel.so must link with panelw. panel_library = 'panelw' -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 10:06:36 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 15:06:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MTkw?= =?utf-8?q?=3A_Cross_compiling_the_=5Fcurses_module_does_not_use_anymore?= Message-ID: <20161213150611.15322.95429.32542779@psf.io> https://hg.python.org/cpython/rev/8c78d844d6f0 changeset: 105606:8c78d844d6f0 branch: 3.6 parent: 105604:43f9366d8883 user: Xavier de Gaye date: Tue Dec 13 16:04:14 2016 +0100 summary: Issue #28190: Cross compiling the _curses module does not use anymore /usr/include/ncursesw as a headers search path. files: configure | 4 +++- configure.ac | 4 +++- setup.py | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -15690,7 +15690,9 @@ # first curses header check ac_save_cppflags="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +if test "$cross_compiling" = no; then + CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +fi for ac_header in curses.h ncurses.h do : diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -4885,7 +4885,9 @@ # first curses header check ac_save_cppflags="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +if test "$cross_compiling" = no; then + CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" +fi AC_CHECK_HEADERS(curses.h ncurses.h) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1349,7 +1349,8 @@ panel_library = 'panel' if curses_library == 'ncursesw': curses_defines.append(('HAVE_NCURSESW', '1')) - curses_includes.append('/usr/include/ncursesw') + if not cross_compiling: + curses_includes.append('/usr/include/ncursesw') # Bug 1464056: If _curses.so links with ncursesw, # _curses_panel.so must link with panelw. panel_library = 'panelw' -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 10:32:58 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 13 Dec 2016 15:32:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316255=3A_subroces?= =?utf-8?q?s=2EPopen_uses_/system/bin/sh_on_Android_as_the_shell=2C?= Message-ID: <20161213153252.12781.68340.2C4944E4@psf.io> https://hg.python.org/cpython/rev/96a9992d1003 changeset: 105608:96a9992d1003 user: Xavier de Gaye date: Tue Dec 13 16:32:21 2016 +0100 summary: Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, instead of /bin/sh. files: Lib/subprocess.py | 5 ++++- Misc/NEWS | 3 +++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1204,7 +1204,10 @@ args = list(args) if shell: - args = ["/bin/sh", "-c"] + args + # On Android the default shell is at '/system/bin/sh'. + unix_shell = ('/system/bin/sh' if + hasattr(sys, 'getandroidapilevel') else '/bin/sh') + args = [unix_shell, "-c"] + args if executable: args[0] = executable diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -177,6 +177,9 @@ Library ------- +- Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, + instead of /bin/sh. + - Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 12:07:45 2016 From: python-checkins at python.org (steve.dower) Date: Tue, 13 Dec 2016 17:07:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2326071=3A_Fixes_preprocessor_definition_and_rebuilds?= Message-ID: <20161213170743.125113.34594.2219B500@psf.io> https://hg.python.org/cpython/rev/0528a6743018 changeset: 105610:0528a6743018 branch: 3.6 parent: 105606:8c78d844d6f0 parent: 105609:c3da1ee47e6b user: Steve Dower date: Tue Dec 13 09:06:42 2016 -0800 summary: Issue #26071: Fixes preprocessor definition and rebuilds wininst-14.0[-amd64].exe files: Lib/distutils/command/wininst-14.0-amd64.exe | Bin Lib/distutils/command/wininst-14.0.exe | Bin PC/bdist_wininst/install.c | 2 +- 3 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/command/wininst-14.0-amd64.exe b/Lib/distutils/command/wininst-14.0-amd64.exe index 22299543a97ffc1525a3b1c778cb158d6c6430ad..253c2e2eccefa79393827f44f85680536906574a GIT binary patch [stripped] diff --git a/Lib/distutils/command/wininst-14.0.exe b/Lib/distutils/command/wininst-14.0.exe index 0dac1103d98db0af1e9027c41fe921136c5f6396..46f5f356676c800f99742deb6bf4c0a96aa166c0 GIT binary patch [stripped] diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -154,7 +154,7 @@ char *bitmap_bytes; static const char *REGISTRY_SUFFIX_6432 = -#ifdef MS_WIN64 +#ifdef _WIN64 ""; #else "-32"; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 12:12:51 2016 From: python-checkins at python.org (steve.dower) Date: Tue, 13 Dec 2016 17:12:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326071=3A_Fixes_preprocessor_definition_and_rebu?= =?utf-8?q?ilds?= Message-ID: <20161213170744.117560.72186.44392483@psf.io> https://hg.python.org/cpython/rev/4e9d899fcb65 changeset: 105611:4e9d899fcb65 parent: 105608:96a9992d1003 parent: 105610:0528a6743018 user: Steve Dower date: Tue Dec 13 09:06:55 2016 -0800 summary: Issue #26071: Fixes preprocessor definition and rebuilds wininst-14.0[-amd64].exe files: Lib/distutils/command/wininst-14.0-amd64.exe | Bin Lib/distutils/command/wininst-14.0.exe | Bin PC/bdist_wininst/install.c | 2 +- 3 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/command/wininst-14.0-amd64.exe b/Lib/distutils/command/wininst-14.0-amd64.exe index 22299543a97ffc1525a3b1c778cb158d6c6430ad..253c2e2eccefa79393827f44f85680536906574a GIT binary patch [stripped] diff --git a/Lib/distutils/command/wininst-14.0.exe b/Lib/distutils/command/wininst-14.0.exe index 0dac1103d98db0af1e9027c41fe921136c5f6396..46f5f356676c800f99742deb6bf4c0a96aa166c0 GIT binary patch [stripped] diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -154,7 +154,7 @@ char *bitmap_bytes; static const char *REGISTRY_SUFFIX_6432 = -#ifdef MS_WIN64 +#ifdef _WIN64 ""; #else "-32"; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 13 12:12:51 2016 From: python-checkins at python.org (steve.dower) Date: Tue, 13 Dec 2016 17:12:51 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2MDcx?= =?utf-8?q?=3A_Fixes_preprocessor_definition_and_rebuilds?= Message-ID: <20161213170721.124831.52227.F0FCFE22@psf.io> https://hg.python.org/cpython/rev/c3da1ee47e6b changeset: 105609:c3da1ee47e6b branch: 3.5 parent: 105592:47bf09270027 user: Steve Dower date: Tue Dec 13 09:06:24 2016 -0800 summary: Issue #26071: Fixes preprocessor definition and rebuilds wininst-14.0[-amd64].exe files: Lib/distutils/command/wininst-14.0-amd64.exe | Bin Lib/distutils/command/wininst-14.0.exe | Bin PC/bdist_wininst/install.c | 2 +- 3 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/command/wininst-14.0-amd64.exe b/Lib/distutils/command/wininst-14.0-amd64.exe index 22299543a97ffc1525a3b1c778cb158d6c6430ad..253c2e2eccefa79393827f44f85680536906574a GIT binary patch [stripped] diff --git a/Lib/distutils/command/wininst-14.0.exe b/Lib/distutils/command/wininst-14.0.exe index 0dac1103d98db0af1e9027c41fe921136c5f6396..46f5f356676c800f99742deb6bf4c0a96aa166c0 GIT binary patch [stripped] diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -154,7 +154,7 @@ char *bitmap_bytes; static const char *REGISTRY_SUFFIX_6432 = -#ifdef MS_WIN64 +#ifdef _WIN64 ""; #else "-32"; -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Dec 13 12:31:30 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 13 Dec 2016 17:31:30 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-12-13 Message-ID: <338e23bc-956b-4998-b6da-047b884a243f@irsmsx106.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-12-13 03:49:28 +0000 commit: 8359ee62dde3 previous commit: e414fb1640e0 revision date: 2016-12-11 03:51:44 +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.50% 3.47% 6.68% 5.34% :-) pybench 0.13% -0.10% 8.01% 3.82% :-| regex_v8 0.55% 0.09% 0.20% 10.23% :-) nbody 0.14% 0.06% 14.03% 2.34% :-| json_dump_v2 0.32% 0.02% 0.05% 8.88% :-| normal_startup 1.85% -0.20% -1.54% 2.40% :-| ssbench 0.12% 0.18% -0.03% 1.66% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-12-13/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Tue Dec 13 12:32:50 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 13 Dec 2016 17:32:50 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-12-13 Message-ID: <89e05b0b-dd7a-4f8f-9467-14fed8f5d6d0@irsmsx106.ger.corp.intel.com> Results for project Python default, build date 2016-12-13 03:03:04 +0000 commit: 0d209cc7ffdc previous commit: 402a227564f5 revision date: 2016-12-12 21:45: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.18% -0.28% 0.68% 14.33% :-| pybench 0.17% 0.11% 0.65% 4.99% :-| regex_v8 3.88% 1.13% 0.83% 3.15% :-( nbody 0.14% -0.14% -5.48% 11.36% :-) json_dump_v2 0.31% 0.64% 8.45% 11.43% :-| normal_startup 0.85% 0.10% 0.32% 6.01% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-13/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Tue Dec 13 19:04:20 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 14 Dec 2016 00:04:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326110=3A_Add_LOAD?= =?utf-8?q?=5FMETHOD/CALL=5FMETHOD_opcodes=2E?= Message-ID: <20161214000419.12959.4278.94985869@psf.io> https://hg.python.org/cpython/rev/64afd5cab40a changeset: 105612:64afd5cab40a user: Yury Selivanov date: Tue Dec 13 19:03:51 2016 -0500 summary: Issue #26110: Add LOAD_METHOD/CALL_METHOD opcodes. Special thanks to INADA Naoki for pushing the patch through the last mile, Serhiy Storchaka for reviewing the code, and to Victor Stinner for suggesting the idea (originally implemented in the PyPy project). files: Doc/whatsnew/3.7.rst | 5 + Include/opcode.h | 2 + Lib/importlib/_bootstrap_external.py | 3 +- Lib/opcode.py | 3 + Lib/test/test_syntax.py | 27 + Misc/NEWS | 3 + Objects/object.c | 90 +- PC/launcher.c | 1 + Python/ceval.c | 97 ++ Python/compile.c | 37 + Python/importlib.h | 274 +++--- Python/importlib_external.h | 684 +++++++------- Python/opcode_targets.h | 4 +- 13 files changed, 747 insertions(+), 483 deletions(-) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -92,6 +92,11 @@ Optimizations ============= +* Added two new opcodes: ``LOAD_METHOD`` and ``CALL_METHOD`` to avoid + instantiation of bound method objects for method calls, which results + in method calls being faster up to 20%. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.) + Build and C API Changes ======================= diff --git a/Include/opcode.h b/Include/opcode.h --- a/Include/opcode.h +++ b/Include/opcode.h @@ -126,6 +126,8 @@ #define BUILD_CONST_KEY_MAP 156 #define BUILD_STRING 157 #define BUILD_TUPLE_UNPACK_WITH_CALL 158 +#define LOAD_METHOD 160 +#define CALL_METHOD 161 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -240,6 +240,7 @@ # Python 3.6b1 3377 (set __class__ cell from type.__new__ #23722) # Python 3.6b2 3378 (add BUILD_TUPLE_UNPACK_WITH_CALL #28257) # Python 3.6rc1 3379 (more thorough __class__ validation #23722) +# Python 3.7a0 3390 (add LOAD_METHOD and CALL_METHOD opcodes) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -248,7 +249,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3379).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3390).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -212,4 +212,7 @@ def_op('BUILD_STRING', 157) def_op('BUILD_TUPLE_UNPACK_WITH_CALL', 158) +name_op('LOAD_METHOD', 160) +def_op('CALL_METHOD', 161) + del def_op, name_op, jrel_op, jabs_op diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -207,6 +207,33 @@ ... # doctest: +ELLIPSIS () [('a000', 0), ('a001', 1), ('a002', 2), ..., ('a298', 298), ('a299', 299)] +>>> class C: +... def meth(self, *args): +... return args +>>> obj = C() +>>> obj.meth( +... 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, +... 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, +... 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, +... 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, +... 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, +... 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, +... 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, +... 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, +... 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, +... 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, +... 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, +... 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, +... 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, +... 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, +... 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, +... 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, +... 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, +... 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, +... 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, +... 290, 291, 292, 293, 294, 295, 296, 297, 298, 299) # doctest: +ELLIPSIS +(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..., 297, 298, 299) + >>> f(lambda x: x[0] = 3) Traceback (most recent call last): SyntaxError: lambda cannot contain assignment diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -174,6 +174,9 @@ - Issue #28721: Fix asynchronous generators aclose() and athrow() to handle StopAsyncIteration propagation properly. +- Issue #26110: Speed-up method calls: add LOAD_METHOD and CALL_METHOD + opcodes. + Library ------- diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -1025,11 +1025,99 @@ return NULL; } -/* Generic GetAttr functions - put these in your tp_[gs]etattro slot */ + +/* Specialized version of _PyObject_GenericGetAttrWithDict + specifically for the LOAD_METHOD opcode. + + Return 1 if a method is found, 0 if it's a regular attribute + from __dict__ or something returned by using a descriptor + protocol. + + `method` will point to the resolved attribute or NULL. In the + latter case, an error will be set. +*/ +int +_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) +{ + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + PyObject *attr; + int meth_found = 0; + + assert(*method == NULL); + + if (Py_TYPE(obj)->tp_getattro != PyObject_GenericGetAttr + || !PyUnicode_Check(name)) { + *method = PyObject_GetAttr(obj, name); + return 0; + } + + if (tp->tp_dict == NULL && PyType_Ready(tp) < 0) + return 0; + + descr = _PyType_Lookup(tp, name); + if (descr != NULL) { + Py_INCREF(descr); + if (PyFunction_Check(descr)) { + /* A python method. */ + meth_found = 1; + } else { + f = descr->ob_type->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + *method = f(descr, obj, (PyObject *)obj->ob_type); + Py_DECREF(descr); + return 0; + } + } + } + + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = PyDict_GetItem(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + *method = attr; + Py_DECREF(dict); + Py_XDECREF(descr); + return 0; + } + Py_DECREF(dict); + } + + if (meth_found) { + *method = descr; + return 1; + } + + if (f != NULL) { + *method = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + return 0; + } + + if (descr != NULL) { + *method = descr; + return 0; + } + + PyErr_Format(PyExc_AttributeError, + "'%.50s' object has no attribute '%U'", + tp->tp_name, name); + return 0; +} + +/* Generic GetAttr functions - put these in your tp_[gs]etattro slot. */ PyObject * _PyObject_GenericGetAttrWithDict(PyObject *obj, PyObject *name, PyObject *dict) { + /* Make sure the logic of _PyObject_GetMethod is in sync with + this method. + */ + PyTypeObject *tp = Py_TYPE(obj); PyObject *descr = NULL; PyObject *res = NULL; diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1090,6 +1090,7 @@ { 3250, 3310, L"3.4" }, { 3320, 3351, L"3.5" }, { 3360, 3379, L"3.6" }, + { 3390, 3399, L"3.7" }, { 0 } }; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -30,6 +30,9 @@ #define CHECKEXC 1 /* Double-check exception checking */ #endif +/* Private API for the LOAD_METHOD opcode. */ +extern int _PyObject_GetMethod(PyObject *, PyObject *, PyObject **); + typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *); /* Forward declarations */ @@ -3225,6 +3228,100 @@ DISPATCH(); } + TARGET(LOAD_METHOD) { + /* Designed to work in tamdem with CALL_METHOD. */ + PyObject *name = GETITEM(names, oparg); + PyObject *obj = TOP(); + PyObject *meth = NULL; + + int meth_found = _PyObject_GetMethod(obj, name, &meth); + + SET_TOP(meth); /* Replace `obj` on top; OK if NULL. */ + if (meth == NULL) { + /* Most likely attribute wasn't found. */ + Py_DECREF(obj); + goto error; + } + + if (meth_found) { + /* The method object is now on top of the stack. + Push `obj` back to the stack, so that the stack + layout would be: + + method | obj | arg1 | ... | argN + */ + PUSH(obj); + } + else { + /* Not a method (but a regular attr, or something + was returned by a descriptor protocol). Push + NULL to the top of the stack, to signal + CALL_METHOD that it's not a method call. + */ + Py_DECREF(obj); + PUSH(NULL); + } + DISPATCH(); + } + + TARGET(CALL_METHOD) { + /* Designed to work in tamdem with LOAD_METHOD. */ + PyObject **sp, *res, *obj; + + sp = stack_pointer; + + obj = PEEK(oparg + 1); + if (obj == NULL) { + /* `obj` is NULL when LOAD_METHOD thinks that it's not + a method call. Swap the NULL and callable. + + Stack layout: + + ... | callable | NULL | arg1 | ... | argN + ^- TOP() + ^- (-oparg) + ^- (-oparg-1) + ^- (-oparg-2) + + after the next line it will be: + + ... | callable | callable | arg1 | ... | argN + ^- TOP() + ^- (-oparg) + ^- (-oparg-1) + ^- (-oparg-2) + + Right side `callable` will be POPed by call_funtion. + Left side `callable` will be POPed manually later + (one of "callbale" refs on the stack is borrowed.) + */ + SET_VALUE(oparg + 1, PEEK(oparg + 2)); + res = call_function(&sp, oparg, NULL); + stack_pointer = sp; + (void)POP(); /* POP the left side callable. */ + } + else { + /* This is a method call. Stack layout: + + ... | method | obj | arg1 | ... | argN + ^- TOP() + ^- (-oparg) + ^- (-oparg-1) + + `obj` and `method` will be POPed by call_function. + We'll be passing `oparg + 1` to call_function, to + make it accept the `obj` as a first argument. + */ + res = call_function(&sp, oparg + 1, NULL); + stack_pointer = sp; + } + + PUSH(res); + if (res == NULL) + goto error; + DISPATCH(); + } + PREDICTED(CALL_FUNCTION); TARGET(CALL_FUNCTION) { PyObject **sp, *res; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1040,6 +1040,8 @@ return -oparg; case CALL_FUNCTION: return -oparg; + case CALL_METHOD: + return -oparg-1; case CALL_FUNCTION_KW: return -oparg-1; case CALL_FUNCTION_EX: @@ -1078,6 +1080,8 @@ /* If there's a fmt_spec on the stack, we go from 2->1, else 1->1. */ return (oparg & FVS_MASK) == FVS_HAVE_SPEC ? -1 : 0; + case LOAD_METHOD: + return 1; default: return PY_INVALID_STACK_EFFECT; } @@ -3400,8 +3404,41 @@ } static int +maybe_optimize_method_call(struct compiler *c, expr_ty e) +{ + Py_ssize_t argsl, i; + expr_ty meth = e->v.Call.func; + asdl_seq *args = e->v.Call.args; + + /* Check that the call node is an attribute access, and that + the call doesn't have keyword parameters. */ + if (meth->kind != Attribute_kind || meth->v.Attribute.ctx != Load || + asdl_seq_LEN(e->v.Call.keywords)) + return -1; + + /* Check that there are no *varargs types of arguments. */ + argsl = asdl_seq_LEN(args); + for (i = 0; i < argsl; i++) { + expr_ty elt = asdl_seq_GET(args, i); + if (elt->kind == Starred_kind) { + return -1; + } + } + + /* Alright, we can optimize the code. */ + VISIT(c, expr, meth->v.Attribute.value); + ADDOP_NAME(c, LOAD_METHOD, meth->v.Attribute.attr, names); + VISIT_SEQ(c, expr, e->v.Call.args); + ADDOP_I(c, CALL_METHOD, asdl_seq_LEN(e->v.Call.args)); + return 1; +} + +static int compiler_call(struct compiler *c, expr_ty e) { + if (maybe_optimize_method_call(c, e) > 0) + return 1; + VISIT(c, expr, e->v.Call.func); return compiler_call_helper(c, 0, e->v.Call.args, diff --git a/Python/importlib.h b/Python/importlib.h --- a/Python/importlib.h +++ b/Python/importlib.h [stripped] diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -8,9 +8,9 @@ 100,13,132,0,90,8,100,14,100,15,132,0,90,9,100,16, 100,17,132,0,90,10,100,18,100,19,132,0,90,11,100,20, 100,21,132,0,90,12,100,93,100,23,100,24,132,1,90,13, - 101,14,101,13,106,15,131,1,90,16,100,25,106,17,100,26, - 100,27,131,2,100,28,23,0,90,18,101,19,106,20,101,18, - 100,27,131,2,90,21,100,29,90,22,100,30,90,23,100,31, + 101,14,101,13,106,15,131,1,90,16,100,25,160,17,100,26, + 100,27,161,2,100,28,23,0,90,18,101,19,160,20,101,18, + 100,27,161,2,90,21,100,29,90,22,100,30,90,23,100,31, 103,1,90,24,100,32,103,1,90,25,101,25,4,0,90,26, 90,27,100,94,100,33,100,34,156,1,100,35,100,36,132,3, 90,28,100,37,100,38,132,0,90,29,100,39,100,40,132,0, @@ -58,8 +58,8 @@ 100,117,108,101,46,10,10,218,3,119,105,110,218,6,99,121, 103,119,105,110,218,6,100,97,114,119,105,110,99,0,0,0, 0,0,0,0,0,1,0,0,0,3,0,0,0,3,0,0, - 0,115,60,0,0,0,116,0,106,1,106,2,116,3,131,1, - 114,48,116,0,106,1,106,2,116,4,131,1,114,30,100,1, + 0,115,60,0,0,0,116,0,106,1,160,2,116,3,161,1, + 114,48,116,0,106,1,160,2,116,4,161,1,114,30,100,1, 137,0,110,4,100,2,137,0,135,0,102,1,100,3,100,4, 132,8,125,0,110,8,100,5,100,4,132,0,125,0,124,0, 83,0,41,6,78,90,12,80,89,84,72,79,78,67,65,83, @@ -97,9 +97,9 @@ 95,109,97,107,101,95,114,101,108,97,120,95,99,97,115,101, 30,0,0,0,115,14,0,0,0,0,1,12,1,12,1,6, 2,4,2,14,4,8,3,114,13,0,0,0,99,1,0,0, - 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, + 0,0,0,0,0,1,0,0,0,4,0,0,0,67,0,0, 0,115,20,0,0,0,116,0,124,0,131,1,100,1,64,0, - 106,1,100,2,100,3,131,2,83,0,41,4,122,42,67,111, + 160,1,100,2,100,3,161,2,83,0,41,4,122,42,67,111, 110,118,101,114,116,32,97,32,51,50,45,98,105,116,32,105, 110,116,101,103,101,114,32,116,111,32,108,105,116,116,108,101, 45,101,110,100,105,97,110,46,108,3,0,0,0,255,127,255, @@ -108,9 +108,9 @@ 115,41,1,218,1,120,114,4,0,0,0,114,4,0,0,0, 114,6,0,0,0,218,7,95,119,95,108,111,110,103,47,0, 0,0,115,2,0,0,0,0,2,114,19,0,0,0,99,1, - 0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,67, - 0,0,0,115,12,0,0,0,116,0,106,1,124,0,100,1, - 131,2,83,0,41,2,122,47,67,111,110,118,101,114,116,32, + 0,0,0,0,0,0,0,1,0,0,0,4,0,0,0,67, + 0,0,0,115,12,0,0,0,116,0,160,1,124,0,100,1, + 161,2,83,0,41,2,122,47,67,111,110,118,101,114,116,32, 52,32,98,121,116,101,115,32,105,110,32,108,105,116,116,108, 101,45,101,110,100,105,97,110,32,116,111,32,97,110,32,105, 110,116,101,103,101,114,46,114,15,0,0,0,41,2,114,16, @@ -119,14 +119,14 @@ 0,114,4,0,0,0,114,6,0,0,0,218,7,95,114,95, 108,111,110,103,52,0,0,0,115,2,0,0,0,0,2,114, 21,0,0,0,99,0,0,0,0,0,0,0,0,1,0,0, - 0,3,0,0,0,71,0,0,0,115,20,0,0,0,116,0, - 106,1,100,1,100,2,132,0,124,0,68,0,131,1,131,1, + 0,4,0,0,0,71,0,0,0,115,20,0,0,0,116,0, + 160,1,100,1,100,2,132,0,124,0,68,0,131,1,161,1, 83,0,41,3,122,31,82,101,112,108,97,99,101,109,101,110, 116,32,102,111,114,32,111,115,46,112,97,116,104,46,106,111, 105,110,40,41,46,99,1,0,0,0,0,0,0,0,2,0, - 0,0,4,0,0,0,83,0,0,0,115,26,0,0,0,103, - 0,124,0,93,18,125,1,124,1,114,4,124,1,106,0,116, - 1,131,1,145,2,113,4,83,0,114,4,0,0,0,41,2, + 0,0,5,0,0,0,83,0,0,0,115,26,0,0,0,103, + 0,124,0,93,18,125,1,124,1,114,4,124,1,160,0,116, + 1,161,1,145,2,113,4,83,0,114,4,0,0,0,41,2, 218,6,114,115,116,114,105,112,218,15,112,97,116,104,95,115, 101,112,97,114,97,116,111,114,115,41,2,218,2,46,48,218, 4,112,97,114,116,114,4,0,0,0,114,4,0,0,0,114, @@ -141,7 +141,7 @@ 2,10,1,114,30,0,0,0,99,1,0,0,0,0,0,0, 0,5,0,0,0,5,0,0,0,67,0,0,0,115,96,0, 0,0,116,0,116,1,131,1,100,1,107,2,114,36,124,0, - 106,2,116,3,131,1,92,3,125,1,125,2,125,3,124,1, + 160,2,116,3,161,1,92,3,125,1,125,2,125,3,124,1, 124,3,102,2,83,0,120,50,116,4,124,0,131,1,68,0, 93,38,125,4,124,4,116,1,107,6,114,46,124,0,106,5, 124,4,100,1,100,2,141,2,92,2,125,1,125,3,124,1, @@ -158,8 +158,8 @@ 6,0,0,0,218,11,95,112,97,116,104,95,115,112,108,105, 116,63,0,0,0,115,16,0,0,0,0,2,12,1,16,1, 8,1,14,1,8,1,18,1,12,1,114,40,0,0,0,99, - 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, - 67,0,0,0,115,10,0,0,0,116,0,106,1,124,0,131, + 1,0,0,0,0,0,0,0,1,0,0,0,3,0,0,0, + 67,0,0,0,115,10,0,0,0,116,0,160,1,124,0,161, 1,83,0,41,1,122,126,83,116,97,116,32,116,104,101,32, 112,97,116,104,46,10,10,32,32,32,32,77,97,100,101,32, 97,32,115,101,112,97,114,97,116,101,32,102,117,110,99,116, @@ -197,7 +197,7 @@ 95,112,97,116,104,95,105,115,102,105,108,101,94,0,0,0, 115,2,0,0,0,0,2,114,46,0,0,0,99,1,0,0, 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, - 0,115,22,0,0,0,124,0,115,12,116,0,106,1,131,0, + 0,115,22,0,0,0,124,0,115,12,116,0,160,1,161,0, 125,0,116,2,124,0,100,1,131,2,83,0,41,2,122,30, 82,101,112,108,97,99,101,109,101,110,116,32,102,111,114,32, 111,115,46,112,97,116,104,46,105,115,100,105,114,46,105,0, @@ -207,15 +207,15 @@ 112,97,116,104,95,105,115,100,105,114,99,0,0,0,115,6, 0,0,0,0,2,4,1,8,1,114,48,0,0,0,233,182, 1,0,0,99,3,0,0,0,0,0,0,0,6,0,0,0, - 17,0,0,0,67,0,0,0,115,162,0,0,0,100,1,106, - 0,124,0,116,1,124,0,131,1,131,2,125,3,116,2,106, + 17,0,0,0,67,0,0,0,115,162,0,0,0,100,1,160, + 0,124,0,116,1,124,0,131,1,161,2,125,3,116,2,160, 3,124,3,116,2,106,4,116,2,106,5,66,0,116,2,106, - 6,66,0,124,2,100,2,64,0,131,3,125,4,121,50,116, - 7,106,8,124,4,100,3,131,2,143,16,125,5,124,5,106, - 9,124,1,131,1,1,0,87,0,100,4,81,0,82,0,88, - 0,116,2,106,10,124,3,124,0,131,2,1,0,87,0,110, + 6,66,0,124,2,100,2,64,0,161,3,125,4,121,50,116, + 7,160,8,124,4,100,3,161,2,143,16,125,5,124,5,160, + 9,124,1,161,1,1,0,87,0,100,4,81,0,82,0,88, + 0,116,2,160,10,124,3,124,0,161,2,1,0,87,0,110, 58,4,0,116,11,107,10,114,156,1,0,1,0,1,0,121, - 14,116,2,106,12,124,3,131,1,1,0,87,0,110,20,4, + 14,116,2,160,12,124,3,161,1,1,0,87,0,110,20,4, 0,116,11,107,10,114,148,1,0,1,0,1,0,89,0,110, 2,88,0,130,0,89,0,110,2,88,0,100,4,83,0,41, 5,122,162,66,101,115,116,45,101,102,102,111,114,116,32,102, @@ -242,26 +242,26 @@ 101,95,97,116,111,109,105,99,106,0,0,0,115,26,0,0, 0,0,5,16,1,6,1,26,1,2,3,14,1,20,1,16, 1,14,1,2,1,14,1,14,1,6,1,114,58,0,0,0, - 105,51,13,0,0,233,2,0,0,0,114,15,0,0,0,115, + 105,62,13,0,0,233,2,0,0,0,114,15,0,0,0,115, 2,0,0,0,13,10,90,11,95,95,112,121,99,97,99,104, 101,95,95,122,4,111,112,116,45,122,3,46,112,121,122,4, 46,112,121,99,78,41,1,218,12,111,112,116,105,109,105,122, 97,116,105,111,110,99,2,0,0,0,1,0,0,0,11,0, 0,0,6,0,0,0,67,0,0,0,115,244,0,0,0,124, - 1,100,1,107,9,114,52,116,0,106,1,100,2,116,2,131, + 1,100,1,107,9,114,52,116,0,160,1,100,2,116,2,161, 2,1,0,124,2,100,1,107,9,114,40,100,3,125,3,116, 3,124,3,131,1,130,1,124,1,114,48,100,4,110,2,100, - 5,125,2,116,4,106,5,124,0,131,1,125,0,116,6,124, - 0,131,1,92,2,125,4,125,5,124,5,106,7,100,6,131, + 5,125,2,116,4,160,5,124,0,161,1,125,0,116,6,124, + 0,131,1,92,2,125,4,125,5,124,5,160,7,100,6,161, 1,92,3,125,6,125,7,125,8,116,8,106,9,106,10,125, 9,124,9,100,1,107,8,114,114,116,11,100,7,131,1,130, - 1,100,4,106,12,124,6,114,126,124,6,110,2,124,8,124, - 7,124,9,103,3,131,1,125,10,124,2,100,1,107,8,114, + 1,100,4,160,12,124,6,114,126,124,6,110,2,124,8,124, + 7,124,9,103,3,161,1,125,10,124,2,100,1,107,8,114, 172,116,8,106,13,106,14,100,8,107,2,114,164,100,4,125, 2,110,8,116,8,106,13,106,14,125,2,116,15,124,2,131, - 1,125,2,124,2,100,4,107,3,114,224,124,2,106,16,131, - 0,115,210,116,17,100,9,106,18,124,2,131,1,131,1,130, - 1,100,10,106,18,124,10,116,19,124,2,131,3,125,10,116, + 1,125,2,124,2,100,4,107,3,114,224,124,2,160,16,161, + 0,115,210,116,17,100,9,160,18,124,2,161,1,131,1,130, + 1,100,10,160,18,124,10,116,19,124,2,161,3,125,10,116, 20,124,4,116,21,124,10,116,22,100,8,25,0,23,0,131, 3,83,0,41,11,97,254,2,0,0,71,105,118,101,110,32, 116,104,101,32,112,97,116,104,32,116,111,32,97,32,46,112, @@ -346,25 +346,25 @@ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,6,0,0, 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,7,1,0,0,115,48,0,0,0,0,18,8, + 117,114,99,101,8,1,0,0,115,48,0,0,0,0,18,8, 1,6,1,6,1,8,1,4,1,8,1,12,1,10,1,12, 1,16,1,8,1,8,1,8,1,24,1,8,1,12,1,6, 2,8,1,8,1,8,1,8,1,14,1,14,1,114,83,0, 0,0,99,1,0,0,0,0,0,0,0,8,0,0,0,5, 0,0,0,67,0,0,0,115,230,0,0,0,116,0,106,1, 106,2,100,1,107,8,114,20,116,3,100,2,131,1,130,1, - 116,4,106,5,124,0,131,1,125,0,116,6,124,0,131,1, + 116,4,160,5,124,0,161,1,125,0,116,6,124,0,131,1, 92,2,125,1,125,2,116,6,124,1,131,1,92,2,125,1, - 125,3,124,3,116,7,107,3,114,78,116,8,100,3,106,9, - 116,7,124,0,131,2,131,1,130,1,124,2,106,10,100,4, - 131,1,125,4,124,4,100,11,107,7,114,112,116,8,100,7, - 106,9,124,2,131,1,131,1,130,1,110,86,124,4,100,6, - 107,2,114,198,124,2,106,11,100,4,100,5,131,2,100,12, - 25,0,125,5,124,5,106,12,116,13,131,1,115,160,116,8, - 100,8,106,9,116,13,131,1,131,1,130,1,124,5,116,14, - 116,13,131,1,100,1,133,2,25,0,125,6,124,6,106,15, - 131,0,115,198,116,8,100,9,106,9,124,5,131,1,131,1, - 130,1,124,2,106,16,100,4,131,1,100,10,25,0,125,7, + 125,3,124,3,116,7,107,3,114,78,116,8,100,3,160,9, + 116,7,124,0,161,2,131,1,130,1,124,2,160,10,100,4, + 161,1,125,4,124,4,100,11,107,7,114,112,116,8,100,7, + 160,9,124,2,161,1,131,1,130,1,110,86,124,4,100,6, + 107,2,114,198,124,2,160,11,100,4,100,5,161,2,100,12, + 25,0,125,5,124,5,160,12,116,13,161,1,115,160,116,8, + 100,8,160,9,116,13,161,1,131,1,130,1,124,5,116,14, + 116,13,131,1,100,1,133,2,25,0,125,6,124,6,160,15, + 161,0,115,198,116,8,100,9,160,9,124,5,161,1,131,1, + 130,1,124,2,160,16,100,4,161,1,100,10,25,0,125,7, 116,17,124,1,124,7,116,18,100,10,25,0,23,0,131,2, 83,0,41,13,97,110,1,0,0,71,105,118,101,110,32,116, 104,101,32,112,97,116,104,32,116,111,32,97,32,46,112,121, @@ -420,15 +420,15 @@ 112,116,95,108,101,118,101,108,90,13,98,97,115,101,95,102, 105,108,101,110,97,109,101,114,4,0,0,0,114,4,0,0, 0,114,6,0,0,0,218,17,115,111,117,114,99,101,95,102, - 114,111,109,95,99,97,99,104,101,52,1,0,0,115,46,0, + 114,111,109,95,99,97,99,104,101,53,1,0,0,115,46,0, 0,0,0,9,12,1,8,1,10,1,12,1,12,1,8,1, 6,1,10,1,10,1,8,1,6,1,10,1,8,1,16,1, 10,1,6,1,8,1,16,1,8,1,6,1,8,1,14,1, 114,89,0,0,0,99,1,0,0,0,0,0,0,0,5,0, 0,0,12,0,0,0,67,0,0,0,115,128,0,0,0,116, 0,124,0,131,1,100,1,107,2,114,16,100,2,83,0,124, - 0,106,1,100,3,131,1,92,3,125,1,125,2,125,3,124, - 1,12,0,115,58,124,3,106,2,131,0,100,7,100,8,133, + 0,160,1,100,3,161,1,92,3,125,1,125,2,125,3,124, + 1,12,0,115,58,124,3,160,2,161,0,100,7,100,8,133, 2,25,0,100,6,107,3,114,62,124,0,83,0,121,12,116, 3,124,0,131,1,125,4,87,0,110,36,4,0,116,4,116, 5,102,2,107,10,114,110,1,0,1,0,1,0,124,0,100, @@ -456,20 +456,20 @@ 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116, 104,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108, - 101,86,1,0,0,115,20,0,0,0,0,7,12,1,4,1, + 101,87,1,0,0,115,20,0,0,0,0,7,12,1,4,1, 16,1,26,1,4,1,2,1,12,1,18,1,18,1,114,95, 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, - 11,0,0,0,67,0,0,0,115,72,0,0,0,124,0,106, - 0,116,1,116,2,131,1,131,1,114,46,121,8,116,3,124, + 11,0,0,0,67,0,0,0,115,72,0,0,0,124,0,160, + 0,116,1,116,2,131,1,161,1,114,46,121,8,116,3,124, 0,131,1,83,0,4,0,116,4,107,10,114,42,1,0,1, - 0,1,0,89,0,113,68,88,0,110,22,124,0,106,0,116, - 1,116,5,131,1,131,1,114,64,124,0,83,0,100,0,83, + 0,1,0,89,0,113,68,88,0,110,22,124,0,160,0,116, + 1,116,5,131,1,161,1,114,64,124,0,83,0,100,0,83, 0,100,0,83,0,41,1,78,41,6,218,8,101,110,100,115, 119,105,116,104,218,5,116,117,112,108,101,114,88,0,0,0, 114,83,0,0,0,114,70,0,0,0,114,78,0,0,0,41, 1,218,8,102,105,108,101,110,97,109,101,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,11,95,103,101,116, - 95,99,97,99,104,101,100,105,1,0,0,115,16,0,0,0, + 95,99,97,99,104,101,100,106,1,0,0,115,16,0,0,0, 0,1,14,1,2,1,8,1,14,1,8,1,14,1,4,2, 114,99,0,0,0,99,1,0,0,0,0,0,0,0,2,0, 0,0,11,0,0,0,67,0,0,0,115,52,0,0,0,121, @@ -483,7 +483,7 @@ 128,0,0,0,41,3,114,41,0,0,0,114,43,0,0,0, 114,42,0,0,0,41,2,114,37,0,0,0,114,44,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,95,99,97,108,99,95,109,111,100,101,117,1,0,0, + 218,10,95,99,97,108,99,95,109,111,100,101,118,1,0,0, 115,12,0,0,0,0,2,2,1,14,1,14,1,10,3,8, 1,114,101,0,0,0,99,1,0,0,0,0,0,0,0,3, 0,0,0,11,0,0,0,3,0,0,0,115,68,0,0,0, @@ -521,7 +521,7 @@ 114,103,115,90,6,107,119,97,114,103,115,41,1,218,6,109, 101,116,104,111,100,114,4,0,0,0,114,6,0,0,0,218, 19,95,99,104,101,99,107,95,110,97,109,101,95,119,114,97, - 112,112,101,114,137,1,0,0,115,12,0,0,0,0,1,8, + 112,112,101,114,138,1,0,0,115,12,0,0,0,0,1,8, 1,8,1,10,1,4,1,18,1,122,40,95,99,104,101,99, 107,95,110,97,109,101,46,60,108,111,99,97,108,115,62,46, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, @@ -529,8 +529,8 @@ 7,0,0,0,83,0,0,0,115,60,0,0,0,120,40,100, 5,68,0,93,32,125,2,116,0,124,1,124,2,131,2,114, 6,116,1,124,0,124,2,116,2,124,1,124,2,131,2,131, - 3,1,0,113,6,87,0,124,0,106,3,106,4,124,1,106, - 3,131,1,1,0,100,0,83,0,41,6,78,218,10,95,95, + 3,1,0,113,6,87,0,124,0,106,3,160,4,124,1,106, + 3,161,1,1,0,100,0,83,0,41,6,78,218,10,95,95, 109,111,100,117,108,101,95,95,218,8,95,95,110,97,109,101, 95,95,218,12,95,95,113,117,97,108,110,97,109,101,95,95, 218,7,95,95,100,111,99,95,95,41,4,114,108,0,0,0, @@ -540,7 +540,7 @@ 100,105,99,116,95,95,218,6,117,112,100,97,116,101,41,3, 90,3,110,101,119,90,3,111,108,100,114,55,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,5, - 95,119,114,97,112,148,1,0,0,115,8,0,0,0,0,1, + 95,119,114,97,112,149,1,0,0,115,8,0,0,0,0,1, 10,1,10,1,22,1,122,26,95,99,104,101,99,107,95,110, 97,109,101,46,60,108,111,99,97,108,115,62,46,95,119,114, 97,112,41,1,78,41,3,218,10,95,98,111,111,116,115,116, @@ -548,13 +548,13 @@ 114,111,114,41,3,114,106,0,0,0,114,107,0,0,0,114, 117,0,0,0,114,4,0,0,0,41,1,114,106,0,0,0, 114,6,0,0,0,218,11,95,99,104,101,99,107,95,110,97, - 109,101,129,1,0,0,115,14,0,0,0,0,8,14,7,2, + 109,101,130,1,0,0,115,14,0,0,0,0,8,14,7,2, 1,10,1,14,2,14,5,10,1,114,120,0,0,0,99,2, - 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, - 0,0,0,115,60,0,0,0,124,0,106,0,124,1,131,1, + 0,0,0,0,0,0,0,5,0,0,0,6,0,0,0,67, + 0,0,0,115,60,0,0,0,124,0,160,0,124,1,161,1, 92,2,125,2,125,3,124,2,100,1,107,8,114,56,116,1, - 124,3,131,1,114,56,100,2,125,4,116,2,106,3,124,4, - 106,4,124,3,100,3,25,0,131,1,116,5,131,2,1,0, + 124,3,131,1,114,56,100,2,125,4,116,2,160,3,124,4, + 160,4,124,3,100,3,25,0,161,1,116,5,161,2,1,0, 124,2,83,0,41,4,122,155,84,114,121,32,116,111,32,102, 105,110,100,32,97,32,108,111,97,100,101,114,32,102,111,114, 32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,109, @@ -576,7 +576,7 @@ 101,114,218,8,112,111,114,116,105,111,110,115,218,3,109,115, 103,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, 218,17,95,102,105,110,100,95,109,111,100,117,108,101,95,115, - 104,105,109,157,1,0,0,115,10,0,0,0,0,10,14,1, + 104,105,109,158,1,0,0,115,10,0,0,0,0,10,14,1, 16,1,4,1,22,1,114,127,0,0,0,99,4,0,0,0, 0,0,0,0,11,0,0,0,22,0,0,0,67,0,0,0, 115,136,1,0,0,105,0,125,4,124,2,100,1,107,9,114, @@ -584,25 +584,25 @@ 3,100,1,107,9,114,42,124,3,124,4,100,4,60,0,124, 0,100,1,100,5,133,2,25,0,125,5,124,0,100,5,100, 6,133,2,25,0,125,6,124,0,100,6,100,7,133,2,25, - 0,125,7,124,5,116,0,107,3,114,124,100,8,106,1,124, - 2,124,5,131,2,125,8,116,2,106,3,100,9,124,8,131, + 0,125,7,124,5,116,0,107,3,114,124,100,8,160,1,124, + 2,124,5,161,2,125,8,116,2,160,3,100,9,124,8,161, 2,1,0,116,4,124,8,102,1,124,4,142,1,130,1,110, - 86,116,5,124,6,131,1,100,5,107,3,114,168,100,10,106, - 1,124,2,131,1,125,8,116,2,106,3,100,9,124,8,131, + 86,116,5,124,6,131,1,100,5,107,3,114,168,100,10,160, + 1,124,2,161,1,125,8,116,2,160,3,100,9,124,8,161, 2,1,0,116,6,124,8,131,1,130,1,110,42,116,5,124, - 7,131,1,100,5,107,3,114,210,100,11,106,1,124,2,131, - 1,125,8,116,2,106,3,100,9,124,8,131,2,1,0,116, + 7,131,1,100,5,107,3,114,210,100,11,160,1,124,2,161, + 1,125,8,116,2,160,3,100,9,124,8,161,2,1,0,116, 6,124,8,131,1,130,1,124,1,100,1,107,9,144,1,114, 124,121,16,116,7,124,1,100,12,25,0,131,1,125,9,87, 0,110,22,4,0,116,8,107,10,144,1,114,2,1,0,1, 0,1,0,89,0,110,50,88,0,116,9,124,6,131,1,124, - 9,107,3,144,1,114,52,100,13,106,1,124,2,131,1,125, - 8,116,2,106,3,100,9,124,8,131,2,1,0,116,4,124, + 9,107,3,144,1,114,52,100,13,160,1,124,2,161,1,125, + 8,116,2,160,3,100,9,124,8,161,2,1,0,116,4,124, 8,102,1,124,4,142,1,130,1,121,16,124,1,100,14,25, 0,100,15,64,0,125,10,87,0,110,22,4,0,116,8,107, 10,144,1,114,90,1,0,1,0,1,0,89,0,110,34,88, 0,116,9,124,7,131,1,124,10,107,3,144,1,114,124,116, - 4,100,13,106,1,124,2,131,1,102,1,124,4,142,1,130, + 4,100,13,160,1,124,2,161,1,102,1,124,4,142,1,130, 1,124,0,100,7,100,1,133,2,25,0,83,0,41,16,97, 122,1,0,0,86,97,108,105,100,97,116,101,32,116,104,101, 32,104,101,97,100,101,114,32,111,102,32,116,104,101,32,112, @@ -656,18 +656,18 @@ 115,111,117,114,99,101,95,115,105,122,101,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,25,95,118,97,108, 105,100,97,116,101,95,98,121,116,101,99,111,100,101,95,104, - 101,97,100,101,114,174,1,0,0,115,76,0,0,0,0,11, + 101,97,100,101,114,175,1,0,0,115,76,0,0,0,0,11, 4,1,8,1,10,3,4,1,8,1,8,1,12,1,12,1, 12,1,8,1,12,1,12,1,14,1,12,1,10,1,12,1, 10,1,12,1,10,1,12,1,8,1,10,1,2,1,16,1, 16,1,6,2,14,1,10,1,12,1,12,1,2,1,16,1, 16,1,6,2,14,1,12,1,6,1,114,139,0,0,0,99, 4,0,0,0,0,0,0,0,5,0,0,0,5,0,0,0, - 67,0,0,0,115,80,0,0,0,116,0,106,1,124,0,131, - 1,125,4,116,2,124,4,116,3,131,2,114,56,116,4,106, - 5,100,1,124,2,131,2,1,0,124,3,100,2,107,9,114, - 52,116,6,106,7,124,4,124,3,131,2,1,0,124,4,83, - 0,116,8,100,3,106,9,124,2,131,1,124,1,124,2,100, + 67,0,0,0,115,80,0,0,0,116,0,160,1,124,0,161, + 1,125,4,116,2,124,4,116,3,131,2,114,56,116,4,160, + 5,100,1,124,2,161,2,1,0,124,3,100,2,107,9,114, + 52,116,6,160,7,124,4,124,3,161,2,1,0,124,4,83, + 0,116,8,100,3,160,9,124,2,161,1,124,1,124,2,100, 4,141,3,130,1,100,2,83,0,41,5,122,60,67,111,109, 112,105,108,101,32,98,121,116,101,99,111,100,101,32,97,115, 32,114,101,116,117,114,110,101,100,32,98,121,32,95,118,97, @@ -685,14 +685,14 @@ 0,0,0,114,102,0,0,0,114,93,0,0,0,114,94,0, 0,0,218,4,99,111,100,101,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,17,95,99,111,109,112,105,108, - 101,95,98,121,116,101,99,111,100,101,229,1,0,0,115,16, + 101,95,98,121,116,101,99,111,100,101,230,1,0,0,115,16, 0,0,0,0,2,10,1,10,1,12,1,8,1,12,1,4, 2,10,1,114,145,0,0,0,114,62,0,0,0,99,3,0, - 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, + 0,0,0,0,0,0,4,0,0,0,5,0,0,0,67,0, 0,0,115,56,0,0,0,116,0,116,1,131,1,125,3,124, - 3,106,2,116,3,124,1,131,1,131,1,1,0,124,3,106, - 2,116,3,124,2,131,1,131,1,1,0,124,3,106,2,116, - 4,106,5,124,0,131,1,131,1,1,0,124,3,83,0,41, + 3,160,2,116,3,124,1,131,1,161,1,1,0,124,3,160, + 2,116,3,124,2,131,1,161,1,1,0,124,3,160,2,116, + 4,160,5,124,0,161,1,161,1,1,0,124,3,83,0,41, 1,122,80,67,111,109,112,105,108,101,32,97,32,99,111,100, 101,32,111,98,106,101,99,116,32,105,110,116,111,32,98,121, 116,101,99,111,100,101,32,102,111,114,32,119,114,105,116,105, @@ -704,14 +704,14 @@ 114,144,0,0,0,114,130,0,0,0,114,138,0,0,0,114, 56,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, 0,0,0,218,17,95,99,111,100,101,95,116,111,95,98,121, - 116,101,99,111,100,101,241,1,0,0,115,10,0,0,0,0, + 116,101,99,111,100,101,242,1,0,0,115,10,0,0,0,0, 3,8,1,14,1,14,1,16,1,114,148,0,0,0,99,1, - 0,0,0,0,0,0,0,5,0,0,0,4,0,0,0,67, + 0,0,0,0,0,0,0,5,0,0,0,6,0,0,0,67, 0,0,0,115,62,0,0,0,100,1,100,2,108,0,125,1, - 116,1,106,2,124,0,131,1,106,3,125,2,124,1,106,4, - 124,2,131,1,125,3,116,1,106,5,100,2,100,3,131,2, - 125,4,124,4,106,6,124,0,106,6,124,3,100,1,25,0, - 131,1,131,1,83,0,41,4,122,121,68,101,99,111,100,101, + 116,1,160,2,124,0,161,1,106,3,125,2,124,1,160,4, + 124,2,161,1,125,3,116,1,160,5,100,2,100,3,161,2, + 125,4,124,4,160,6,124,0,160,6,124,3,100,1,25,0, + 161,1,161,1,83,0,41,4,122,121,68,101,99,111,100,101, 32,98,121,116,101,115,32,114,101,112,114,101,115,101,110,116, 105,110,103,32,115,111,117,114,99,101,32,99,111,100,101,32, 97,110,100,32,114,101,116,117,114,110,32,116,104,101,32,115, @@ -731,29 +731,29 @@ 101,110,99,111,100,105,110,103,90,15,110,101,119,108,105,110, 101,95,100,101,99,111,100,101,114,114,4,0,0,0,114,4, 0,0,0,114,6,0,0,0,218,13,100,101,99,111,100,101, - 95,115,111,117,114,99,101,251,1,0,0,115,10,0,0,0, + 95,115,111,117,114,99,101,252,1,0,0,115,10,0,0,0, 0,5,8,1,12,1,10,1,12,1,114,153,0,0,0,41, 2,114,124,0,0,0,218,26,115,117,98,109,111,100,117,108, 101,95,115,101,97,114,99,104,95,108,111,99,97,116,105,111, 110,115,99,2,0,0,0,2,0,0,0,9,0,0,0,19, 0,0,0,67,0,0,0,115,18,1,0,0,124,1,100,1, 107,8,114,60,100,2,125,1,116,0,124,2,100,3,131,2, - 114,70,121,14,124,2,106,1,124,0,131,1,125,1,87,0, + 114,70,121,14,124,2,160,1,124,0,161,1,125,1,87,0, 113,70,4,0,116,2,107,10,114,56,1,0,1,0,1,0, - 89,0,113,70,88,0,110,10,116,3,106,4,124,1,131,1, + 89,0,113,70,88,0,110,10,116,3,160,4,124,1,161,1, 125,1,116,5,106,6,124,0,124,2,124,1,100,4,141,3, 125,4,100,5,124,4,95,7,124,2,100,1,107,8,114,156, 120,54,116,8,131,0,68,0,93,40,92,2,125,5,125,6, - 124,1,106,9,116,10,124,6,131,1,131,1,114,108,124,5, + 124,1,160,9,116,10,124,6,131,1,161,1,114,108,124,5, 124,0,124,1,131,2,125,2,124,2,124,4,95,11,80,0, 113,108,87,0,100,1,83,0,124,3,116,12,107,8,114,222, - 116,0,124,2,100,6,131,2,114,228,121,14,124,2,106,13, - 124,0,131,1,125,7,87,0,110,20,4,0,116,2,107,10, + 116,0,124,2,100,6,131,2,114,228,121,14,124,2,160,13, + 124,0,161,1,125,7,87,0,110,20,4,0,116,2,107,10, 114,208,1,0,1,0,1,0,89,0,113,228,88,0,124,7, 114,228,103,0,124,4,95,14,110,6,124,3,124,4,95,14, 124,4,106,14,103,0,107,2,144,1,114,14,124,1,144,1, 114,14,116,15,124,1,131,1,100,7,25,0,125,8,124,4, - 106,14,106,16,124,8,131,1,1,0,124,4,83,0,41,8, + 106,14,160,16,124,8,161,1,1,0,124,4,83,0,41,8, 97,61,1,0,0,82,101,116,117,114,110,32,97,32,109,111, 100,117,108,101,32,115,112,101,99,32,98,97,115,101,100,32, 111,110,32,97,32,102,105,108,101,32,108,111,99,97,116,105, @@ -793,7 +793,7 @@ 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,23,115,112,101,99,95,102,114, 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 12,2,0,0,115,62,0,0,0,0,12,8,4,4,1,10, + 13,2,0,0,115,62,0,0,0,0,12,8,4,4,1,10, 2,2,1,14,1,14,1,8,2,10,8,16,1,6,3,8, 1,16,1,14,1,10,1,6,1,6,2,4,3,8,2,10, 1,2,1,14,1,14,1,6,2,4,1,8,2,6,1,12, @@ -819,27 +819,27 @@ 114,115,105,111,110,125,92,77,111,100,117,108,101,115,92,123, 102,117,108,108,110,97,109,101,125,92,68,101,98,117,103,70, 99,2,0,0,0,0,0,0,0,2,0,0,0,11,0,0, - 0,67,0,0,0,115,50,0,0,0,121,14,116,0,106,1, - 116,0,106,2,124,1,131,2,83,0,4,0,116,3,107,10, - 114,44,1,0,1,0,1,0,116,0,106,1,116,0,106,4, - 124,1,131,2,83,0,88,0,100,0,83,0,41,1,78,41, + 0,67,0,0,0,115,50,0,0,0,121,14,116,0,160,1, + 116,0,106,2,124,1,161,2,83,0,4,0,116,3,107,10, + 114,44,1,0,1,0,1,0,116,0,160,1,116,0,106,4, + 124,1,161,2,83,0,88,0,100,0,83,0,41,1,78,41, 5,218,7,95,119,105,110,114,101,103,90,7,79,112,101,110, 75,101,121,90,17,72,75,69,89,95,67,85,82,82,69,78, 84,95,85,83,69,82,114,42,0,0,0,90,18,72,75,69, 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, 2,218,3,99,108,115,114,5,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,92,2,0,0,115,8, + 110,95,114,101,103,105,115,116,114,121,93,2,0,0,115,8, 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, - 121,99,2,0,0,0,0,0,0,0,6,0,0,0,16,0, + 121,99,2,0,0,0,0,0,0,0,6,0,0,0,17,0, 0,0,67,0,0,0,115,112,0,0,0,124,0,106,0,114, 14,124,0,106,1,125,2,110,6,124,0,106,2,125,2,124, 2,106,3,124,1,100,1,116,4,106,5,100,0,100,2,133, - 2,25,0,22,0,100,3,141,2,125,3,121,38,124,0,106, - 6,124,3,131,1,143,18,125,4,116,7,106,8,124,4,100, - 4,131,2,125,5,87,0,100,0,81,0,82,0,88,0,87, + 2,25,0,22,0,100,3,141,2,125,3,121,38,124,0,160, + 6,124,3,161,1,143,18,125,4,116,7,160,8,124,4,100, + 4,161,2,125,5,87,0,100,0,81,0,82,0,88,0,87, 0,110,20,4,0,116,9,107,10,114,106,1,0,1,0,1, 0,100,0,83,0,88,0,124,5,83,0,41,5,78,122,5, 37,100,46,37,100,114,59,0,0,0,41,2,114,123,0,0, @@ -855,18 +855,18 @@ 121,114,5,0,0,0,90,4,104,107,101,121,218,8,102,105, 108,101,112,97,116,104,114,4,0,0,0,114,4,0,0,0, 114,6,0,0,0,218,16,95,115,101,97,114,99,104,95,114, - 101,103,105,115,116,114,121,99,2,0,0,115,22,0,0,0, + 101,103,105,115,116,114,121,100,2,0,0,115,22,0,0,0, 0,2,6,1,8,2,6,1,6,1,22,1,2,1,12,1, 26,1,14,1,6,1,122,38,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,95,115, 101,97,114,99,104,95,114,101,103,105,115,116,114,121,78,99, 4,0,0,0,0,0,0,0,8,0,0,0,14,0,0,0, - 67,0,0,0,115,120,0,0,0,124,0,106,0,124,1,131, + 67,0,0,0,115,120,0,0,0,124,0,160,0,124,1,161, 1,125,4,124,4,100,0,107,8,114,22,100,0,83,0,121, 12,116,1,124,4,131,1,1,0,87,0,110,20,4,0,116, 2,107,10,114,54,1,0,1,0,1,0,100,0,83,0,88, 0,120,58,116,3,131,0,68,0,93,48,92,2,125,5,125, - 6,124,4,106,4,116,5,124,6,131,1,131,1,114,64,116, + 6,124,4,160,4,116,5,124,6,131,1,161,1,114,64,116, 6,106,7,124,1,124,5,124,1,124,4,131,2,124,4,100, 1,141,3,125,7,124,7,83,0,113,64,87,0,100,0,83, 0,41,2,78,41,1,114,156,0,0,0,41,8,114,175,0, @@ -877,13 +877,13 @@ 0,0,0,218,6,116,97,114,103,101,116,114,174,0,0,0, 114,124,0,0,0,114,164,0,0,0,114,162,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,9, - 102,105,110,100,95,115,112,101,99,114,2,0,0,115,26,0, + 102,105,110,100,95,115,112,101,99,115,2,0,0,115,26,0, 0,0,0,2,10,1,8,1,4,1,2,1,12,1,14,1, 6,1,16,1,14,1,6,1,8,1,8,1,122,31,87,105, 110,100,111,119,115,82,101,103,105,115,116,114,121,70,105,110, 100,101,114,46,102,105,110,100,95,115,112,101,99,99,3,0, - 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, - 0,0,115,34,0,0,0,124,0,106,0,124,1,124,2,131, + 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, + 0,0,115,34,0,0,0,124,0,160,0,124,1,124,2,161, 2,125,3,124,3,100,1,107,9,114,26,124,3,106,1,83, 0,100,1,83,0,100,1,83,0,41,2,122,108,70,105,110, 100,32,109,111,100,117,108,101,32,110,97,109,101,100,32,105, @@ -896,7 +896,7 @@ 0,114,124,0,0,0,41,4,114,168,0,0,0,114,123,0, 0,0,114,37,0,0,0,114,162,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,6,0,0,0,218,11,102,105,110, - 100,95,109,111,100,117,108,101,130,2,0,0,115,8,0,0, + 100,95,109,111,100,117,108,101,131,2,0,0,115,8,0,0, 0,0,7,12,1,8,1,6,2,122,33,87,105,110,100,111, 119,115,82,101,103,105,115,116,114,121,70,105,110,100,101,114, 46,102,105,110,100,95,109,111,100,117,108,101,41,2,78,78, @@ -906,7 +906,7 @@ 101,116,104,111,100,114,169,0,0,0,114,175,0,0,0,114, 178,0,0,0,114,179,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,166,0, - 0,0,80,2,0,0,115,20,0,0,0,8,2,4,3,4, + 0,0,81,2,0,0,115,20,0,0,0,8,2,4,3,4, 3,4,2,4,2,12,7,12,15,2,1,12,15,2,1,114, 166,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, 0,2,0,0,0,64,0,0,0,115,48,0,0,0,101,0, @@ -920,10 +920,10 @@ 76,111,97,100,101,114,32,97,110,100,10,32,32,32,32,83, 111,117,114,99,101,108,101,115,115,70,105,108,101,76,111,97, 100,101,114,46,99,2,0,0,0,0,0,0,0,5,0,0, - 0,3,0,0,0,67,0,0,0,115,64,0,0,0,116,0, - 124,0,106,1,124,1,131,1,131,1,100,1,25,0,125,2, - 124,2,106,2,100,2,100,1,131,2,100,3,25,0,125,3, - 124,1,106,3,100,2,131,1,100,4,25,0,125,4,124,3, + 0,4,0,0,0,67,0,0,0,115,64,0,0,0,116,0, + 124,0,160,1,124,1,161,1,131,1,100,1,25,0,125,2, + 124,2,160,2,100,2,100,1,161,2,100,3,25,0,125,3, + 124,1,160,3,100,2,161,1,100,4,25,0,125,4,124,3, 100,5,107,2,111,62,124,4,100,5,107,3,83,0,41,6, 122,141,67,111,110,99,114,101,116,101,32,105,109,112,108,101, 109,101,110,116,97,116,105,111,110,32,111,102,32,73,110,115, @@ -941,7 +941,7 @@ 98,0,0,0,90,13,102,105,108,101,110,97,109,101,95,98, 97,115,101,90,9,116,97,105,108,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,157,0, - 0,0,149,2,0,0,115,8,0,0,0,0,3,18,1,16, + 0,0,150,2,0,0,115,8,0,0,0,0,3,18,1,16, 1,14,1,122,24,95,76,111,97,100,101,114,66,97,115,105, 99,115,46,105,115,95,112,97,99,107,97,103,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, @@ -951,14 +951,14 @@ 99,114,101,97,116,105,111,110,46,78,114,4,0,0,0,41, 2,114,104,0,0,0,114,162,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,6,0,0,0,218,13,99,114,101,97, - 116,101,95,109,111,100,117,108,101,157,2,0,0,115,0,0, + 116,101,95,109,111,100,117,108,101,158,2,0,0,115,0,0, 0,0,122,27,95,76,111,97,100,101,114,66,97,115,105,99, 115,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, - 2,0,0,0,0,0,0,0,3,0,0,0,4,0,0,0, - 67,0,0,0,115,56,0,0,0,124,0,106,0,124,1,106, - 1,131,1,125,2,124,2,100,1,107,8,114,36,116,2,100, - 2,106,3,124,1,106,1,131,1,131,1,130,1,116,4,106, - 5,116,6,124,2,124,1,106,7,131,3,1,0,100,1,83, + 2,0,0,0,0,0,0,0,3,0,0,0,5,0,0,0, + 67,0,0,0,115,56,0,0,0,124,0,160,0,124,1,106, + 1,161,1,125,2,124,2,100,1,107,8,114,36,116,2,100, + 2,160,3,124,1,106,1,161,1,131,1,130,1,116,4,160, + 5,116,6,124,2,124,1,106,7,161,3,1,0,100,1,83, 0,41,3,122,19,69,120,101,99,117,116,101,32,116,104,101, 32,109,111,100,117,108,101,46,78,122,52,99,97,110,110,111, 116,32,108,111,97,100,32,109,111,100,117,108,101,32,123,33, @@ -971,25 +971,25 @@ 114,115,0,0,0,41,3,114,104,0,0,0,218,6,109,111, 100,117,108,101,114,144,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,6,0,0,0,218,11,101,120,101,99,95,109, - 111,100,117,108,101,160,2,0,0,115,10,0,0,0,0,2, + 111,100,117,108,101,161,2,0,0,115,10,0,0,0,0,2, 12,1,8,1,6,1,10,1,122,25,95,76,111,97,100,101, 114,66,97,115,105,99,115,46,101,120,101,99,95,109,111,100, 117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,0, - 3,0,0,0,67,0,0,0,115,12,0,0,0,116,0,106, - 1,124,0,124,1,131,2,83,0,41,1,122,26,84,104,105, + 4,0,0,0,67,0,0,0,115,12,0,0,0,116,0,160, + 1,124,0,124,1,161,2,83,0,41,1,122,26,84,104,105, 115,32,109,111,100,117,108,101,32,105,115,32,100,101,112,114, 101,99,97,116,101,100,46,41,2,114,118,0,0,0,218,17, 95,108,111,97,100,95,109,111,100,117,108,101,95,115,104,105, 109,41,2,114,104,0,0,0,114,123,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,218,11,108,111, - 97,100,95,109,111,100,117,108,101,168,2,0,0,115,2,0, + 97,100,95,109,111,100,117,108,101,169,2,0,0,115,2,0, 0,0,0,2,122,25,95,76,111,97,100,101,114,66,97,115, 105,99,115,46,108,111,97,100,95,109,111,100,117,108,101,78, 41,8,114,109,0,0,0,114,108,0,0,0,114,110,0,0, 0,114,111,0,0,0,114,157,0,0,0,114,183,0,0,0, 114,188,0,0,0,114,190,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,181, - 0,0,0,144,2,0,0,115,10,0,0,0,8,3,4,2, + 0,0,0,145,2,0,0,115,10,0,0,0,8,3,4,2, 8,8,8,3,8,8,114,181,0,0,0,99,0,0,0,0, 0,0,0,0,0,0,0,0,3,0,0,0,64,0,0,0, 115,74,0,0,0,101,0,90,1,100,0,90,2,100,1,100, @@ -1014,12 +1014,12 @@ 32,32,32,32,32,32,32,78,41,1,218,7,73,79,69,114, 114,111,114,41,2,114,104,0,0,0,114,37,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,109,116,105,109,101,175,2,0,0,115,2, + 112,97,116,104,95,109,116,105,109,101,176,2,0,0,115,2, 0,0,0,0,6,122,23,83,111,117,114,99,101,76,111,97, 100,101,114,46,112,97,116,104,95,109,116,105,109,101,99,2, - 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, - 0,0,0,115,14,0,0,0,100,1,124,0,106,0,124,1, - 131,1,105,1,83,0,41,2,97,170,1,0,0,79,112,116, + 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, + 0,0,0,115,14,0,0,0,100,1,124,0,160,0,124,1, + 161,1,105,1,83,0,41,2,97,170,1,0,0,79,112,116, 105,111,110,97,108,32,109,101,116,104,111,100,32,114,101,116, 117,114,110,105,110,103,32,97,32,109,101,116,97,100,97,116, 97,32,100,105,99,116,32,102,111,114,32,116,104,101,32,115, @@ -1049,12 +1049,12 @@ 32,32,32,32,32,32,32,114,130,0,0,0,41,1,114,193, 0,0,0,41,2,114,104,0,0,0,114,37,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,10, - 112,97,116,104,95,115,116,97,116,115,183,2,0,0,115,2, + 112,97,116,104,95,115,116,97,116,115,184,2,0,0,115,2, 0,0,0,0,11,122,23,83,111,117,114,99,101,76,111,97, 100,101,114,46,112,97,116,104,95,115,116,97,116,115,99,4, - 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, - 0,0,0,115,12,0,0,0,124,0,106,0,124,2,124,3, - 131,2,83,0,41,1,122,228,79,112,116,105,111,110,97,108, + 0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67, + 0,0,0,115,12,0,0,0,124,0,160,0,124,2,124,3, + 161,2,83,0,41,1,122,228,79,112,116,105,111,110,97,108, 32,109,101,116,104,111,100,32,119,104,105,99,104,32,119,114, 105,116,101,115,32,100,97,116,97,32,40,98,121,116,101,115, 41,32,116,111,32,97,32,102,105,108,101,32,112,97,116,104, @@ -1073,7 +1073,7 @@ 94,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104, 114,56,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 6,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116, - 101,99,111,100,101,196,2,0,0,115,2,0,0,0,0,8, + 101,99,111,100,101,197,2,0,0,115,2,0,0,0,0,8, 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95, 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3, 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67, @@ -1090,11 +1090,11 @@ 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,104, 0,0,0,114,37,0,0,0,114,56,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,195,0,0, - 0,206,2,0,0,115,0,0,0,0,122,21,83,111,117,114, + 0,207,2,0,0,115,0,0,0,0,122,21,83,111,117,114, 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116, 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0, - 0,0,67,0,0,0,115,82,0,0,0,124,0,106,0,124, - 1,131,1,125,2,121,14,124,0,106,1,124,2,131,1,125, + 0,0,67,0,0,0,115,82,0,0,0,124,0,160,0,124, + 1,161,1,125,2,121,14,124,0,160,1,124,2,161,1,125, 3,87,0,110,48,4,0,116,2,107,10,114,72,1,0,125, 4,1,0,122,20,116,3,100,1,124,1,100,2,141,2,124, 4,130,2,87,0,89,0,100,3,100,3,125,4,126,4,88, @@ -1110,7 +1110,7 @@ 0,114,153,0,0,0,41,5,114,104,0,0,0,114,123,0, 0,0,114,37,0,0,0,114,151,0,0,0,218,3,101,120, 99,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,10,103,101,116,95,115,111,117,114,99,101,213,2,0,0, + 218,10,103,101,116,95,115,111,117,114,99,101,214,2,0,0, 115,14,0,0,0,0,2,10,1,2,1,14,1,16,1,4, 1,28,1,122,23,83,111,117,114,99,101,76,111,97,100,101, 114,46,103,101,116,95,115,111,117,114,99,101,114,31,0,0, @@ -1132,31 +1132,31 @@ 112,105,108,101,41,4,114,104,0,0,0,114,56,0,0,0, 114,37,0,0,0,114,200,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,6,0,0,0,218,14,115,111,117,114,99, - 101,95,116,111,95,99,111,100,101,223,2,0,0,115,4,0, + 101,95,116,111,95,99,111,100,101,224,2,0,0,115,4,0, 0,0,0,5,12,1,122,27,83,111,117,114,99,101,76,111, 97,100,101,114,46,115,111,117,114,99,101,95,116,111,95,99, 111,100,101,99,2,0,0,0,0,0,0,0,10,0,0,0, - 43,0,0,0,67,0,0,0,115,94,1,0,0,124,0,106, - 0,124,1,131,1,125,2,100,1,125,3,121,12,116,1,124, + 43,0,0,0,67,0,0,0,115,94,1,0,0,124,0,160, + 0,124,1,161,1,125,2,100,1,125,3,121,12,116,1,124, 2,131,1,125,4,87,0,110,24,4,0,116,2,107,10,114, 50,1,0,1,0,1,0,100,1,125,4,89,0,110,162,88, - 0,121,14,124,0,106,3,124,2,131,1,125,5,87,0,110, + 0,121,14,124,0,160,3,124,2,161,1,125,5,87,0,110, 20,4,0,116,4,107,10,114,86,1,0,1,0,1,0,89, 0,110,126,88,0,116,5,124,5,100,2,25,0,131,1,125, - 3,121,14,124,0,106,6,124,4,131,1,125,6,87,0,110, + 3,121,14,124,0,160,6,124,4,161,1,125,6,87,0,110, 20,4,0,116,7,107,10,114,134,1,0,1,0,1,0,89, 0,110,78,88,0,121,20,116,8,124,6,124,5,124,1,124, 4,100,3,141,4,125,7,87,0,110,24,4,0,116,9,116, 10,102,2,107,10,114,180,1,0,1,0,1,0,89,0,110, - 32,88,0,116,11,106,12,100,4,124,4,124,2,131,3,1, + 32,88,0,116,11,160,12,100,4,124,4,124,2,161,3,1, 0,116,13,124,7,124,1,124,4,124,2,100,5,141,4,83, - 0,124,0,106,6,124,2,131,1,125,8,124,0,106,14,124, - 8,124,2,131,2,125,9,116,11,106,12,100,6,124,2,131, + 0,124,0,160,6,124,2,161,1,125,8,124,0,160,14,124, + 8,124,2,161,2,125,9,116,11,160,12,100,6,124,2,161, 2,1,0,116,15,106,16,12,0,144,1,114,90,124,4,100, 1,107,9,144,1,114,90,124,3,100,1,107,9,144,1,114, 90,116,17,124,9,124,3,116,18,124,8,131,1,131,3,125, - 6,121,30,124,0,106,19,124,2,124,4,124,6,131,3,1, - 0,116,11,106,12,100,7,124,4,131,2,1,0,87,0,110, + 6,121,30,124,0,160,19,124,2,124,4,124,6,161,3,1, + 0,116,11,160,12,100,7,124,4,161,2,1,0,87,0,110, 22,4,0,116,2,107,10,144,1,114,88,1,0,1,0,1, 0,89,0,110,2,88,0,124,9,83,0,41,8,122,190,67, 111,110,99,114,101,116,101,32,105,109,112,108,101,109,101,110, @@ -1189,7 +1189,7 @@ 10,98,121,116,101,115,95,100,97,116,97,114,151,0,0,0, 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,184,0,0, - 0,231,2,0,0,115,78,0,0,0,0,7,10,1,4,1, + 0,232,2,0,0,115,78,0,0,0,0,7,10,1,4,1, 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, 12,1,2,1,14,1,14,1,6,2,2,1,4,1,4,1, 12,1,18,1,6,2,8,1,6,1,6,1,2,1,8,1, @@ -1201,7 +1201,7 @@ 114,196,0,0,0,114,195,0,0,0,114,199,0,0,0,114, 203,0,0,0,114,184,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,191,0, - 0,0,173,2,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,174,2,0,0,115,14,0,0,0,8,2,8,8,8, 13,8,10,8,7,8,10,14,8,114,191,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,115,80,0,0,0,101,0,90,1,100,0,90,2, @@ -1227,7 +1227,7 @@ 32,102,105,110,100,101,114,46,78,41,2,114,102,0,0,0, 114,37,0,0,0,41,3,114,104,0,0,0,114,123,0,0, 0,114,37,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,182,0,0,0,32,3,0,0,115,4, + 114,6,0,0,0,114,182,0,0,0,33,3,0,0,115,4, 0,0,0,0,3,6,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,95,95,105,110,105,116,95,95,99,2,0,0, 0,0,0,0,0,2,0,0,0,2,0,0,0,67,0,0, @@ -1236,7 +1236,7 @@ 78,41,2,218,9,95,95,99,108,97,115,115,95,95,114,115, 0,0,0,41,2,114,104,0,0,0,218,5,111,116,104,101, 114,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,6,95,95,101,113,95,95,38,3,0,0,115,4,0,0, + 218,6,95,95,101,113,95,95,39,3,0,0,115,4,0,0, 0,0,1,12,1,122,17,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, 0,1,0,0,0,3,0,0,0,67,0,0,0,115,20,0, @@ -1244,12 +1244,12 @@ 131,1,65,0,83,0,41,1,78,41,3,218,4,104,97,115, 104,114,102,0,0,0,114,37,0,0,0,41,1,114,104,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,8,95,95,104,97,115,104,95,95,42,3,0,0,115, + 0,218,8,95,95,104,97,115,104,95,95,43,3,0,0,115, 2,0,0,0,0,1,122,19,70,105,108,101,76,111,97,100, 101,114,46,95,95,104,97,115,104,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,3,0,0,0, - 115,16,0,0,0,116,0,116,1,124,0,131,2,106,2,124, - 1,131,1,83,0,41,1,122,100,76,111,97,100,32,97,32, + 115,16,0,0,0,116,0,116,1,124,0,131,2,160,2,124, + 1,161,1,83,0,41,1,122,100,76,111,97,100,32,97,32, 109,111,100,117,108,101,32,102,114,111,109,32,97,32,102,105, 108,101,46,10,10,32,32,32,32,32,32,32,32,84,104,105, 115,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114, @@ -1259,7 +1259,7 @@ 5,115,117,112,101,114,114,207,0,0,0,114,190,0,0,0, 41,2,114,104,0,0,0,114,123,0,0,0,41,1,114,208, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,190,0, - 0,0,45,3,0,0,115,2,0,0,0,0,10,122,22,70, + 0,0,46,3,0,0,115,2,0,0,0,0,10,122,22,70, 105,108,101,76,111,97,100,101,114,46,108,111,97,100,95,109, 111,100,117,108,101,99,2,0,0,0,0,0,0,0,2,0, 0,0,1,0,0,0,67,0,0,0,115,6,0,0,0,124, @@ -1269,19 +1269,19 @@ 111,117,110,100,32,98,121,32,116,104,101,32,102,105,110,100, 101,114,46,41,1,114,37,0,0,0,41,2,114,104,0,0, 0,114,123,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,155,0,0,0,57,3,0,0,115,2, + 114,6,0,0,0,114,155,0,0,0,58,3,0,0,115,2, 0,0,0,0,3,122,23,70,105,108,101,76,111,97,100,101, 114,46,103,101,116,95,102,105,108,101,110,97,109,101,99,2, 0,0,0,0,0,0,0,3,0,0,0,9,0,0,0,67, - 0,0,0,115,32,0,0,0,116,0,106,1,124,1,100,1, - 131,2,143,10,125,2,124,2,106,2,131,0,83,0,81,0, + 0,0,0,115,32,0,0,0,116,0,160,1,124,1,100,1, + 161,2,143,10,125,2,124,2,160,2,161,0,83,0,81,0, 82,0,88,0,100,2,83,0,41,3,122,39,82,101,116,117, 114,110,32,116,104,101,32,100,97,116,97,32,102,114,111,109, 32,112,97,116,104,32,97,115,32,114,97,119,32,98,121,116, 101,115,46,218,1,114,78,41,3,114,52,0,0,0,114,53, 0,0,0,90,4,114,101,97,100,41,3,114,104,0,0,0, 114,37,0,0,0,114,57,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,197,0,0,0,62,3, + 4,0,0,0,114,6,0,0,0,114,197,0,0,0,63,3, 0,0,115,4,0,0,0,0,2,14,1,122,19,70,105,108, 101,76,111,97,100,101,114,46,103,101,116,95,100,97,116,97, 41,12,114,109,0,0,0,114,108,0,0,0,114,110,0,0, @@ -1290,7 +1290,7 @@ 155,0,0,0,114,197,0,0,0,90,13,95,95,99,108,97, 115,115,99,101,108,108,95,95,114,4,0,0,0,114,4,0, 0,0,41,1,114,208,0,0,0,114,6,0,0,0,114,207, - 0,0,0,27,3,0,0,115,14,0,0,0,8,3,4,2, + 0,0,0,28,3,0,0,115,14,0,0,0,8,3,4,2, 8,6,8,4,8,3,16,12,12,5,114,207,0,0,0,99, 0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0, 64,0,0,0,115,46,0,0,0,101,0,90,1,100,0,90, @@ -1311,7 +1311,7 @@ 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, 116,95,115,105,122,101,41,3,114,104,0,0,0,114,37,0, 0,0,114,205,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,194,0,0,0,72,3,0,0,115, + 0,114,6,0,0,0,114,194,0,0,0,73,3,0,0,115, 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, @@ -1321,27 +1321,27 @@ 111,100,101,41,2,114,101,0,0,0,114,195,0,0,0,41, 5,114,104,0,0,0,114,94,0,0,0,114,93,0,0,0, 114,56,0,0,0,114,44,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,196,0,0,0,77,3, + 4,0,0,0,114,6,0,0,0,114,196,0,0,0,78,3, 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, 97,99,104,101,95,98,121,116,101,99,111,100,101,105,182,1, 0,0,41,1,114,217,0,0,0,99,3,0,0,0,1,0, - 0,0,9,0,0,0,17,0,0,0,67,0,0,0,115,250, + 0,0,9,0,0,0,18,0,0,0,67,0,0,0,115,250, 0,0,0,116,0,124,1,131,1,92,2,125,4,125,5,103, 0,125,6,120,40,124,4,114,56,116,1,124,4,131,1,12, 0,114,56,116,0,124,4,131,1,92,2,125,4,125,7,124, - 6,106,2,124,7,131,1,1,0,113,18,87,0,120,108,116, + 6,160,2,124,7,161,1,1,0,113,18,87,0,120,108,116, 3,124,6,131,1,68,0,93,96,125,7,116,4,124,4,124, - 7,131,2,125,4,121,14,116,5,106,6,124,4,131,1,1, + 7,131,2,125,4,121,14,116,5,160,6,124,4,161,1,1, 0,87,0,113,68,4,0,116,7,107,10,114,118,1,0,1, 0,1,0,119,68,89,0,113,68,4,0,116,8,107,10,114, - 162,1,0,125,8,1,0,122,18,116,9,106,10,100,1,124, - 4,124,8,131,3,1,0,100,2,83,0,100,2,125,8,126, + 162,1,0,125,8,1,0,122,18,116,9,160,10,100,1,124, + 4,124,8,161,3,1,0,100,2,83,0,100,2,125,8,126, 8,88,0,113,68,88,0,113,68,87,0,121,28,116,11,124, - 1,124,2,124,3,131,3,1,0,116,9,106,10,100,3,124, - 1,131,2,1,0,87,0,110,48,4,0,116,8,107,10,114, - 244,1,0,125,8,1,0,122,20,116,9,106,10,100,1,124, - 1,124,8,131,3,1,0,87,0,89,0,100,2,100,2,125, + 1,124,2,124,3,131,3,1,0,116,9,160,10,100,3,124, + 1,161,2,1,0,87,0,110,48,4,0,116,8,107,10,114, + 244,1,0,125,8,1,0,122,20,116,9,160,10,100,1,124, + 1,124,8,161,3,1,0,87,0,89,0,100,2,100,2,125, 8,126,8,88,0,110,2,88,0,100,2,83,0,41,4,122, 27,87,114,105,116,101,32,98,121,116,101,115,32,100,97,116, 97,32,116,111,32,97,32,102,105,108,101,46,122,27,99,111, @@ -1356,7 +1356,7 @@ 114,56,0,0,0,114,217,0,0,0,218,6,112,97,114,101, 110,116,114,98,0,0,0,114,29,0,0,0,114,25,0,0, 0,114,198,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,195,0,0,0,82,3,0,0,115,42, + 114,6,0,0,0,114,195,0,0,0,83,3,0,0,115,42, 0,0,0,0,2,12,1,4,2,16,1,12,1,14,2,14, 1,10,1,2,1,14,1,14,2,6,1,16,3,6,1,8, 1,20,1,2,1,12,1,16,1,16,2,8,1,122,25,83, @@ -1365,7 +1365,7 @@ 114,108,0,0,0,114,110,0,0,0,114,111,0,0,0,114, 194,0,0,0,114,196,0,0,0,114,195,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,215,0,0,0,68,3,0,0,115,8,0,0,0, + 0,0,114,215,0,0,0,69,3,0,0,115,8,0,0,0, 8,2,4,2,8,5,8,5,114,215,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,2,0,0,0,64,0, 0,0,115,32,0,0,0,101,0,90,1,100,0,90,2,100, @@ -1376,8 +1376,8 @@ 110,100,108,101,115,32,115,111,117,114,99,101,108,101,115,115, 32,102,105,108,101,32,105,109,112,111,114,116,115,46,99,2, 0,0,0,0,0,0,0,5,0,0,0,5,0,0,0,67, - 0,0,0,115,48,0,0,0,124,0,106,0,124,1,131,1, - 125,2,124,0,106,1,124,2,131,1,125,3,116,2,124,3, + 0,0,0,115,48,0,0,0,124,0,160,0,124,1,161,1, + 125,2,124,0,160,1,124,2,161,1,125,3,116,2,124,3, 124,1,124,2,100,1,141,3,125,4,116,3,124,4,124,1, 124,2,100,2,141,3,83,0,41,3,78,41,2,114,102,0, 0,0,114,37,0,0,0,41,2,114,102,0,0,0,114,93, @@ -1385,7 +1385,7 @@ 139,0,0,0,114,145,0,0,0,41,5,114,104,0,0,0, 114,123,0,0,0,114,37,0,0,0,114,56,0,0,0,114, 206,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,184,0,0,0,117,3,0,0,115,8,0,0, + 0,0,0,114,184,0,0,0,118,3,0,0,115,8,0,0, 0,0,1,10,1,10,1,14,1,122,29,83,111,117,114,99, 101,108,101,115,115,70,105,108,101,76,111,97,100,101,114,46, 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, @@ -1395,13 +1395,13 @@ 115,32,110,111,32,115,111,117,114,99,101,32,99,111,100,101, 46,78,114,4,0,0,0,41,2,114,104,0,0,0,114,123, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,199,0,0,0,123,3,0,0,115,2,0,0,0, + 0,0,114,199,0,0,0,124,3,0,0,115,2,0,0,0, 0,2,122,31,83,111,117,114,99,101,108,101,115,115,70,105, 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,78,41,6,114,109,0,0,0,114,108,0,0,0, 114,110,0,0,0,114,111,0,0,0,114,184,0,0,0,114, 199,0,0,0,114,4,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,220,0,0,0,113,3,0, + 0,0,0,114,6,0,0,0,114,220,0,0,0,114,3,0, 0,115,6,0,0,0,8,2,4,2,8,6,114,220,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,3,0, 0,0,64,0,0,0,115,92,0,0,0,101,0,90,1,100, @@ -1423,7 +1423,7 @@ 0,95,1,100,0,83,0,41,1,78,41,2,114,102,0,0, 0,114,37,0,0,0,41,3,114,104,0,0,0,114,102,0, 0,0,114,37,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,182,0,0,0,140,3,0,0,115, + 0,114,6,0,0,0,114,182,0,0,0,141,3,0,0,115, 4,0,0,0,0,1,6,1,122,28,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, 105,110,105,116,95,95,99,2,0,0,0,0,0,0,0,2, @@ -1432,7 +1432,7 @@ 124,1,106,1,107,2,83,0,41,1,78,41,2,114,208,0, 0,0,114,115,0,0,0,41,2,114,104,0,0,0,114,209, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,114,210,0,0,0,144,3,0,0,115,4,0,0,0, + 0,0,114,210,0,0,0,145,3,0,0,115,4,0,0,0, 0,1,12,1,122,26,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,95,95,101,113,95,95, 99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0, @@ -1440,13 +1440,13 @@ 131,1,116,0,124,0,106,2,131,1,65,0,83,0,41,1, 78,41,3,114,211,0,0,0,114,102,0,0,0,114,37,0, 0,0,41,1,114,104,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,6,0,0,0,114,212,0,0,0,148,3,0, + 0,0,0,114,6,0,0,0,114,212,0,0,0,149,3,0, 0,115,2,0,0,0,0,1,122,28,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,95,95, 104,97,115,104,95,95,99,2,0,0,0,0,0,0,0,3, - 0,0,0,4,0,0,0,67,0,0,0,115,36,0,0,0, - 116,0,106,1,116,2,106,3,124,1,131,2,125,2,116,0, - 106,4,100,1,124,1,106,5,124,0,106,6,131,3,1,0, + 0,0,0,5,0,0,0,67,0,0,0,115,36,0,0,0, + 116,0,160,1,116,2,106,3,124,1,161,2,125,2,116,0, + 160,4,100,1,124,1,106,5,124,0,106,6,161,3,1,0, 124,2,83,0,41,2,122,38,67,114,101,97,116,101,32,97, 110,32,117,110,105,116,105,97,108,105,122,101,100,32,101,120, 116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,38, @@ -1457,14 +1457,14 @@ 100,121,110,97,109,105,99,114,133,0,0,0,114,102,0,0, 0,114,37,0,0,0,41,3,114,104,0,0,0,114,162,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,183,0,0,0,151,3,0,0,115, + 0,114,6,0,0,0,114,183,0,0,0,152,3,0,0,115, 10,0,0,0,0,2,4,1,10,1,6,1,12,1,122,33, 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97, 100,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108, - 101,99,2,0,0,0,0,0,0,0,2,0,0,0,4,0, - 0,0,67,0,0,0,115,36,0,0,0,116,0,106,1,116, - 2,106,3,124,1,131,2,1,0,116,0,106,4,100,1,124, - 0,106,5,124,0,106,6,131,3,1,0,100,2,83,0,41, + 101,99,2,0,0,0,0,0,0,0,2,0,0,0,5,0, + 0,0,67,0,0,0,115,36,0,0,0,116,0,160,1,116, + 2,106,3,124,1,161,2,1,0,116,0,160,4,100,1,124, + 0,106,5,124,0,106,6,161,3,1,0,100,2,83,0,41, 3,122,30,73,110,105,116,105,97,108,105,122,101,32,97,110, 32,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, 101,122,40,101,120,116,101,110,115,105,111,110,32,109,111,100, @@ -1474,7 +1474,7 @@ 120,101,99,95,100,121,110,97,109,105,99,114,133,0,0,0, 114,102,0,0,0,114,37,0,0,0,41,2,114,104,0,0, 0,114,187,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,188,0,0,0,159,3,0,0,115,6, + 114,6,0,0,0,114,188,0,0,0,160,3,0,0,115,6, 0,0,0,0,2,14,1,6,1,122,31,69,120,116,101,110, 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,101, 120,101,99,95,109,111,100,117,108,101,99,2,0,0,0,0, @@ -1492,7 +1492,7 @@ 0,0,0,41,2,114,24,0,0,0,218,6,115,117,102,102, 105,120,41,1,218,9,102,105,108,101,95,110,97,109,101,114, 4,0,0,0,114,6,0,0,0,250,9,60,103,101,110,101, - 120,112,114,62,168,3,0,0,115,2,0,0,0,4,1,122, + 120,112,114,62,169,3,0,0,115,2,0,0,0,4,1,122, 49,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, 97,100,101,114,46,105,115,95,112,97,99,107,97,103,101,46, 60,108,111,99,97,108,115,62,46,60,103,101,110,101,120,112, @@ -1500,7 +1500,7 @@ 97,110,121,218,18,69,88,84,69,78,83,73,79,78,95,83, 85,70,70,73,88,69,83,41,2,114,104,0,0,0,114,123, 0,0,0,114,4,0,0,0,41,1,114,223,0,0,0,114, - 6,0,0,0,114,157,0,0,0,165,3,0,0,115,6,0, + 6,0,0,0,114,157,0,0,0,166,3,0,0,115,6,0, 0,0,0,2,14,1,12,1,122,30,69,120,116,101,110,115, 105,111,110,70,105,108,101,76,111,97,100,101,114,46,105,115, 95,112,97,99,107,97,103,101,99,2,0,0,0,0,0,0, @@ -1511,7 +1511,7 @@ 110,111,116,32,99,114,101,97,116,101,32,97,32,99,111,100, 101,32,111,98,106,101,99,116,46,78,114,4,0,0,0,41, 2,114,104,0,0,0,114,123,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,6,0,0,0,114,184,0,0,0,171, + 114,4,0,0,0,114,6,0,0,0,114,184,0,0,0,172, 3,0,0,115,2,0,0,0,0,2,122,28,69,120,116,101, 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, 103,101,116,95,99,111,100,101,99,2,0,0,0,0,0,0, @@ -1522,7 +1522,7 @@ 110,111,32,115,111,117,114,99,101,32,99,111,100,101,46,78, 114,4,0,0,0,41,2,114,104,0,0,0,114,123,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,199,0,0,0,175,3,0,0,115,2,0,0,0,0,2, + 114,199,0,0,0,176,3,0,0,115,2,0,0,0,0,2, 122,30,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, @@ -1533,7 +1533,7 @@ 98,121,32,116,104,101,32,102,105,110,100,101,114,46,41,1, 114,37,0,0,0,41,2,114,104,0,0,0,114,123,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,155,0,0,0,179,3,0,0,115,2,0,0,0,0,3, + 114,155,0,0,0,180,3,0,0,115,2,0,0,0,0,3, 122,32,69,120,116,101,110,115,105,111,110,70,105,108,101,76, 111,97,100,101,114,46,103,101,116,95,102,105,108,101,110,97, 109,101,78,41,14,114,109,0,0,0,114,108,0,0,0,114, @@ -1542,7 +1542,7 @@ 0,0,114,157,0,0,0,114,184,0,0,0,114,199,0,0, 0,114,120,0,0,0,114,155,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 221,0,0,0,132,3,0,0,115,20,0,0,0,8,6,4, + 221,0,0,0,133,3,0,0,115,20,0,0,0,8,6,4, 2,8,4,8,4,8,3,8,8,8,6,8,6,8,4,8, 4,114,221,0,0,0,99,0,0,0,0,0,0,0,0,0, 0,0,0,2,0,0,0,64,0,0,0,115,96,0,0,0, @@ -1572,9 +1572,9 @@ 101,115,44,32,116,104,101,32,112,97,114,101,110,116,32,109, 111,100,117,108,101,39,115,32,112,97,116,104,10,32,32,32, 32,105,115,32,115,121,115,46,112,97,116,104,46,99,4,0, - 0,0,0,0,0,0,4,0,0,0,2,0,0,0,67,0, + 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, 0,0,115,36,0,0,0,124,1,124,0,95,0,124,2,124, - 0,95,1,116,2,124,0,106,3,131,0,131,1,124,0,95, + 0,95,1,116,2,124,0,160,3,161,0,131,1,124,0,95, 4,124,3,124,0,95,5,100,0,83,0,41,1,78,41,6, 218,5,95,110,97,109,101,218,5,95,112,97,116,104,114,97, 0,0,0,218,16,95,103,101,116,95,112,97,114,101,110,116, @@ -1583,12 +1583,12 @@ 102,105,110,100,101,114,41,4,114,104,0,0,0,114,102,0, 0,0,114,37,0,0,0,218,11,112,97,116,104,95,102,105, 110,100,101,114,114,4,0,0,0,114,4,0,0,0,114,6, - 0,0,0,114,182,0,0,0,192,3,0,0,115,8,0,0, + 0,0,0,114,182,0,0,0,193,3,0,0,115,8,0,0, 0,0,1,6,1,6,1,14,1,122,23,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,95,105,110,105,116, 95,95,99,1,0,0,0,0,0,0,0,4,0,0,0,3, 0,0,0,67,0,0,0,115,38,0,0,0,124,0,106,0, - 106,1,100,1,131,1,92,3,125,1,125,2,125,3,124,2, + 160,1,100,1,161,1,92,3,125,1,125,2,125,3,124,2, 100,2,107,2,114,30,100,6,83,0,124,1,100,5,102,2, 83,0,41,7,122,62,82,101,116,117,114,110,115,32,97,32, 116,117,112,108,101,32,111,102,32,40,112,97,114,101,110,116, @@ -1601,12 +1601,12 @@ 0,114,219,0,0,0,218,3,100,111,116,90,2,109,101,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,23, 95,102,105,110,100,95,112,97,114,101,110,116,95,112,97,116, - 104,95,110,97,109,101,115,198,3,0,0,115,8,0,0,0, + 104,95,110,97,109,101,115,199,3,0,0,115,8,0,0,0, 0,2,18,1,8,2,4,3,122,38,95,78,97,109,101,115, 112,97,99,101,80,97,116,104,46,95,102,105,110,100,95,112, 97,114,101,110,116,95,112,97,116,104,95,110,97,109,101,115, 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, - 0,67,0,0,0,115,28,0,0,0,124,0,106,0,131,0, + 0,67,0,0,0,115,28,0,0,0,124,0,160,0,161,0, 92,2,125,1,125,2,116,1,116,2,106,3,124,1,25,0, 124,2,131,2,83,0,41,1,78,41,4,114,235,0,0,0, 114,114,0,0,0,114,8,0,0,0,218,7,109,111,100,117, @@ -1614,13 +1614,13 @@ 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14, 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,230,0, - 0,0,208,3,0,0,115,4,0,0,0,0,1,12,1,122, + 0,0,209,3,0,0,115,4,0,0,0,0,1,12,1,122, 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104, - 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, - 0,67,0,0,0,115,80,0,0,0,116,0,124,0,106,1, - 131,0,131,1,125,1,124,1,124,0,106,2,107,3,114,74, - 124,0,106,3,124,0,106,4,124,1,131,2,125,2,124,2, + 99,1,0,0,0,0,0,0,0,3,0,0,0,4,0,0, + 0,67,0,0,0,115,80,0,0,0,116,0,124,0,160,1, + 161,0,131,1,125,1,124,1,124,0,106,2,107,3,114,74, + 124,0,160,3,124,0,106,4,124,1,161,2,125,2,124,2, 100,0,107,9,114,68,124,2,106,5,100,0,107,8,114,68, 124,2,106,6,114,68,124,2,106,6,124,0,95,7,124,1, 124,0,95,2,124,0,106,7,83,0,41,1,78,41,8,114, @@ -1629,16 +1629,16 @@ 0,0,114,229,0,0,0,41,3,114,104,0,0,0,90,11, 112,97,114,101,110,116,95,112,97,116,104,114,162,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 12,95,114,101,99,97,108,99,117,108,97,116,101,212,3,0, + 12,95,114,101,99,97,108,99,117,108,97,116,101,213,3,0, 0,115,16,0,0,0,0,2,12,1,10,1,14,3,18,1, 6,1,8,1,6,1,122,27,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,114,101,99,97,108,99,117,108, 97,116,101,99,1,0,0,0,0,0,0,0,1,0,0,0, - 2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,124, - 0,106,1,131,0,131,1,83,0,41,1,78,41,2,218,4, + 3,0,0,0,67,0,0,0,115,12,0,0,0,116,0,124, + 0,160,1,161,0,131,1,83,0,41,1,78,41,2,218,4, 105,116,101,114,114,237,0,0,0,41,1,114,104,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,218, - 8,95,95,105,116,101,114,95,95,225,3,0,0,115,2,0, + 8,95,95,105,116,101,114,95,95,226,3,0,0,115,2,0, 0,0,0,1,122,23,95,78,97,109,101,115,112,97,99,101, 80,97,116,104,46,95,95,105,116,101,114,95,95,99,3,0, 0,0,0,0,0,0,3,0,0,0,3,0,0,0,67,0, @@ -1646,40 +1646,40 @@ 0,100,0,83,0,41,1,78,41,1,114,229,0,0,0,41, 3,114,104,0,0,0,218,5,105,110,100,101,120,114,37,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,218,11,95,95,115,101,116,105,116,101,109,95,95,228,3, + 0,218,11,95,95,115,101,116,105,116,101,109,95,95,229,3, 0,0,115,2,0,0,0,0,1,122,26,95,78,97,109,101, 115,112,97,99,101,80,97,116,104,46,95,95,115,101,116,105, 116,101,109,95,95,99,1,0,0,0,0,0,0,0,1,0, - 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116, - 0,124,0,106,1,131,0,131,1,83,0,41,1,78,41,2, + 0,0,3,0,0,0,67,0,0,0,115,12,0,0,0,116, + 0,124,0,160,1,161,0,131,1,83,0,41,1,78,41,2, 114,33,0,0,0,114,237,0,0,0,41,1,114,104,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 218,7,95,95,108,101,110,95,95,231,3,0,0,115,2,0, + 218,7,95,95,108,101,110,95,95,232,3,0,0,115,2,0, 0,0,0,1,122,22,95,78,97,109,101,115,112,97,99,101, 80,97,116,104,46,95,95,108,101,110,95,95,99,1,0,0, - 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, - 0,115,12,0,0,0,100,1,106,0,124,0,106,1,131,1, + 0,0,0,0,0,1,0,0,0,3,0,0,0,67,0,0, + 0,115,12,0,0,0,100,1,160,0,124,0,106,1,161,1, 83,0,41,2,78,122,20,95,78,97,109,101,115,112,97,99, 101,80,97,116,104,40,123,33,114,125,41,41,2,114,50,0, 0,0,114,229,0,0,0,41,1,114,104,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,95, - 95,114,101,112,114,95,95,234,3,0,0,115,2,0,0,0, + 95,114,101,112,114,95,95,235,3,0,0,115,2,0,0,0, 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, 116,104,46,95,95,114,101,112,114,95,95,99,2,0,0,0, - 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, - 115,12,0,0,0,124,1,124,0,106,0,131,0,107,6,83, + 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, + 115,12,0,0,0,124,1,124,0,160,0,161,0,107,6,83, 0,41,1,78,41,1,114,237,0,0,0,41,2,114,104,0, 0,0,218,4,105,116,101,109,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,12,95,95,99,111,110,116,97, - 105,110,115,95,95,237,3,0,0,115,2,0,0,0,0,1, + 105,110,115,95,95,238,3,0,0,115,2,0,0,0,0,1, 122,27,95,78,97,109,101,115,112,97,99,101,80,97,116,104, 46,95,95,99,111,110,116,97,105,110,115,95,95,99,2,0, - 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, - 0,0,115,16,0,0,0,124,0,106,0,106,1,124,1,131, + 0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,0, + 0,0,115,16,0,0,0,124,0,106,0,160,1,124,1,161, 1,1,0,100,0,83,0,41,1,78,41,2,114,229,0,0, 0,114,161,0,0,0,41,2,114,104,0,0,0,114,244,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,161,0,0,0,240,3,0,0,115,2,0,0,0,0, + 0,114,161,0,0,0,241,3,0,0,115,2,0,0,0,0, 1,122,21,95,78,97,109,101,115,112,97,99,101,80,97,116, 104,46,97,112,112,101,110,100,78,41,14,114,109,0,0,0, 114,108,0,0,0,114,110,0,0,0,114,111,0,0,0,114, @@ -1687,7 +1687,7 @@ 0,0,0,114,239,0,0,0,114,241,0,0,0,114,242,0, 0,0,114,243,0,0,0,114,245,0,0,0,114,161,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,227,0,0,0,185,3,0,0,115,22, + 114,6,0,0,0,114,227,0,0,0,186,3,0,0,115,22, 0,0,0,8,5,4,2,8,6,8,10,8,4,8,13,8, 3,8,3,8,3,8,3,8,3,114,227,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, @@ -1704,11 +1704,11 @@ 0,0,114,229,0,0,0,41,4,114,104,0,0,0,114,102, 0,0,0,114,37,0,0,0,114,233,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,182,0,0, - 0,246,3,0,0,115,2,0,0,0,0,1,122,25,95,78, + 0,247,3,0,0,115,2,0,0,0,0,1,122,25,95,78, 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,95, 95,105,110,105,116,95,95,99,2,0,0,0,0,0,0,0, - 2,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, - 0,100,1,106,0,124,1,106,1,131,1,83,0,41,2,122, + 2,0,0,0,3,0,0,0,67,0,0,0,115,12,0,0, + 0,100,1,160,0,124,1,106,1,161,1,83,0,41,2,122, 115,82,101,116,117,114,110,32,114,101,112,114,32,102,111,114, 32,116,104,101,32,109,111,100,117,108,101,46,10,10,32,32, 32,32,32,32,32,32,84,104,101,32,109,101,116,104,111,100, @@ -1721,21 +1721,21 @@ 2,114,50,0,0,0,114,109,0,0,0,41,2,114,168,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,6,0,0,0,218,11,109,111,100,117,108,101,95,114, - 101,112,114,249,3,0,0,115,2,0,0,0,0,7,122,28, + 101,112,114,250,3,0,0,115,2,0,0,0,0,7,122,28, 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, 46,109,111,100,117,108,101,95,114,101,112,114,99,2,0,0, 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, 0,115,4,0,0,0,100,1,83,0,41,2,78,84,114,4, 0,0,0,41,2,114,104,0,0,0,114,123,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,157, - 0,0,0,2,4,0,0,115,2,0,0,0,0,1,122,27, + 0,0,0,3,4,0,0,115,2,0,0,0,0,1,122,27, 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, 115,4,0,0,0,100,1,83,0,41,2,78,114,32,0,0, 0,114,4,0,0,0,41,2,114,104,0,0,0,114,123,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,199,0,0,0,5,4,0,0,115,2,0,0,0,0, + 0,114,199,0,0,0,6,4,0,0,115,2,0,0,0,0, 1,122,27,95,78,97,109,101,115,112,97,99,101,76,111,97, 100,101,114,46,103,101,116,95,115,111,117,114,99,101,99,2, 0,0,0,0,0,0,0,2,0,0,0,6,0,0,0,67, @@ -1744,7 +1744,7 @@ 122,8,60,115,116,114,105,110,103,62,114,186,0,0,0,84, 41,1,114,201,0,0,0,41,1,114,202,0,0,0,41,2, 114,104,0,0,0,114,123,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,184,0,0,0,8,4, + 4,0,0,0,114,6,0,0,0,114,184,0,0,0,9,4, 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1754,19 +1754,19 @@ 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46, 78,114,4,0,0,0,41,2,114,104,0,0,0,114,162,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,183,0,0,0,11,4,0,0,115,0,0,0,0,122, + 0,114,183,0,0,0,12,4,0,0,115,0,0,0,0,122, 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, 67,0,0,0,115,4,0,0,0,100,0,83,0,41,1,78, 114,4,0,0,0,41,2,114,104,0,0,0,114,187,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,188,0,0,0,14,4,0,0,115,2,0,0,0,0,1, + 114,188,0,0,0,15,4,0,0,115,2,0,0,0,0,1, 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2, - 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, - 0,0,0,115,26,0,0,0,116,0,106,1,100,1,124,0, - 106,2,131,2,1,0,116,0,106,3,124,0,124,1,131,2, + 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, + 0,0,0,115,26,0,0,0,116,0,160,1,100,1,124,0, + 106,2,161,2,1,0,116,0,160,3,124,0,124,1,161,2, 83,0,41,2,122,98,76,111,97,100,32,97,32,110,97,109, 101,115,112,97,99,101,32,109,111,100,117,108,101,46,10,10, 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116, @@ -1779,7 +1779,7 @@ 41,4,114,118,0,0,0,114,133,0,0,0,114,229,0,0, 0,114,189,0,0,0,41,2,114,104,0,0,0,114,123,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, - 0,114,190,0,0,0,17,4,0,0,115,6,0,0,0,0, + 0,114,190,0,0,0,18,4,0,0,115,6,0,0,0,0, 7,6,1,8,1,122,28,95,78,97,109,101,115,112,97,99, 101,76,111,97,100,101,114,46,108,111,97,100,95,109,111,100, 117,108,101,78,41,12,114,109,0,0,0,114,108,0,0,0, @@ -1787,7 +1787,7 @@ 247,0,0,0,114,157,0,0,0,114,199,0,0,0,114,184, 0,0,0,114,183,0,0,0,114,188,0,0,0,114,190,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,246,0,0,0,245,3,0,0,115, + 0,114,6,0,0,0,114,246,0,0,0,246,3,0,0,115, 16,0,0,0,8,1,8,3,12,9,8,3,8,3,8,3, 8,3,8,3,114,246,0,0,0,99,0,0,0,0,0,0, 0,0,0,0,0,0,4,0,0,0,64,0,0,0,115,106, @@ -1804,9 +1804,9 @@ 97,99,107,97,103,101,32,95,95,112,97,116,104,95,95,32, 97,116,116,114,105,98,117,116,101,115,46,99,1,0,0,0, 0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,0, - 115,42,0,0,0,120,36,116,0,106,1,106,2,131,0,68, + 115,42,0,0,0,120,36,116,0,106,1,160,2,161,0,68, 0,93,22,125,1,116,3,124,1,100,1,131,2,114,12,124, - 1,106,4,131,0,1,0,113,12,87,0,100,2,83,0,41, + 1,160,4,161,0,1,0,113,12,87,0,100,2,83,0,41, 3,122,125,67,97,108,108,32,116,104,101,32,105,110,118,97, 108,105,100,97,116,101,95,99,97,99,104,101,115,40,41,32, 109,101,116,104,111,100,32,111,110,32,97,108,108,32,112,97, @@ -1821,13 +1821,13 @@ 218,6,118,97,108,117,101,115,114,112,0,0,0,114,249,0, 0,0,41,2,114,168,0,0,0,218,6,102,105,110,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,6,0,0,0, - 114,249,0,0,0,35,4,0,0,115,6,0,0,0,0,4, + 114,249,0,0,0,36,4,0,0,115,6,0,0,0,0,4, 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, 0,0,0,67,0,0,0,115,86,0,0,0,116,0,106,1, 100,1,107,9,114,30,116,0,106,1,12,0,114,30,116,2, - 106,3,100,2,116,4,131,2,1,0,120,50,116,0,106,1, + 160,3,100,2,116,4,161,2,1,0,120,50,116,0,106,1, 68,0,93,36,125,2,121,8,124,2,124,1,131,1,83,0, 4,0,116,5,107,10,114,72,1,0,1,0,1,0,119,38, 89,0,113,38,88,0,113,38,87,0,100,1,83,0,100,1, @@ -1841,16 +1841,16 @@ 114,103,0,0,0,41,3,114,168,0,0,0,114,37,0,0, 0,90,4,104,111,111,107,114,4,0,0,0,114,4,0,0, 0,114,6,0,0,0,218,11,95,112,97,116,104,95,104,111, - 111,107,115,43,4,0,0,115,16,0,0,0,0,3,18,1, + 111,107,115,44,4,0,0,115,16,0,0,0,0,3,18,1, 12,1,12,1,2,1,8,1,14,1,12,2,122,22,80,97, 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,104, 111,111,107,115,99,2,0,0,0,0,0,0,0,3,0,0, 0,19,0,0,0,67,0,0,0,115,102,0,0,0,124,1, - 100,1,107,2,114,42,121,12,116,0,106,1,131,0,125,1, + 100,1,107,2,114,42,121,12,116,0,160,1,161,0,125,1, 87,0,110,20,4,0,116,2,107,10,114,40,1,0,1,0, 1,0,100,2,83,0,88,0,121,14,116,3,106,4,124,1, 25,0,125,2,87,0,110,40,4,0,116,5,107,10,114,96, - 1,0,1,0,1,0,124,0,106,6,124,1,131,1,125,2, + 1,0,1,0,1,0,124,0,160,6,124,1,161,1,125,2, 124,2,116,3,106,4,124,1,60,0,89,0,110,2,88,0, 124,2,83,0,41,3,122,210,71,101,116,32,116,104,101,32, 102,105,110,100,101,114,32,102,111,114,32,116,104,101,32,112, @@ -1872,17 +1872,17 @@ 0,0,0,41,3,114,168,0,0,0,114,37,0,0,0,114, 252,0,0,0,114,4,0,0,0,114,4,0,0,0,114,6, 0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114, - 116,101,114,95,99,97,99,104,101,56,4,0,0,115,22,0, + 116,101,114,95,99,97,99,104,101,57,4,0,0,115,22,0, 0,0,0,8,8,1,2,1,12,1,14,3,6,1,2,1, 14,1,14,1,10,1,16,1,122,31,80,97,116,104,70,105, 110,100,101,114,46,95,112,97,116,104,95,105,109,112,111,114, 116,101,114,95,99,97,99,104,101,99,3,0,0,0,0,0, - 0,0,6,0,0,0,3,0,0,0,67,0,0,0,115,82, - 0,0,0,116,0,124,2,100,1,131,2,114,26,124,2,106, - 1,124,1,131,1,92,2,125,3,125,4,110,14,124,2,106, - 2,124,1,131,1,125,3,103,0,125,4,124,3,100,0,107, - 9,114,60,116,3,106,4,124,1,124,3,131,2,83,0,116, - 3,106,5,124,1,100,0,131,2,125,5,124,4,124,5,95, + 0,0,6,0,0,0,4,0,0,0,67,0,0,0,115,82, + 0,0,0,116,0,124,2,100,1,131,2,114,26,124,2,160, + 1,124,1,161,1,92,2,125,3,125,4,110,14,124,2,160, + 2,124,1,161,1,125,3,103,0,125,4,124,3,100,0,107, + 9,114,60,116,3,160,4,124,1,124,3,161,2,83,0,116, + 3,160,5,124,1,100,0,161,2,125,5,124,4,124,5,95, 6,124,5,83,0,41,2,78,114,121,0,0,0,41,7,114, 112,0,0,0,114,121,0,0,0,114,179,0,0,0,114,118, 0,0,0,114,176,0,0,0,114,158,0,0,0,114,154,0, @@ -1890,21 +1890,21 @@ 0,0,0,114,124,0,0,0,114,125,0,0,0,114,162,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,6,0,0, 0,218,16,95,108,101,103,97,99,121,95,103,101,116,95,115, - 112,101,99,78,4,0,0,115,18,0,0,0,0,4,10,1, + 112,101,99,79,4,0,0,115,18,0,0,0,0,4,10,1, 16,2,10,1,4,1,8,1,12,1,12,1,6,1,122,27, 80,97,116,104,70,105,110,100,101,114,46,95,108,101,103,97, 99,121,95,103,101,116,95,115,112,101,99,78,99,4,0,0, 0,0,0,0,0,9,0,0,0,5,0,0,0,67,0,0, 0,115,170,0,0,0,103,0,125,4,120,160,124,2,68,0, 93,130,125,5,116,0,124,5,116,1,116,2,102,2,131,2, - 115,30,113,10,124,0,106,3,124,5,131,1,125,6,124,6, + 115,30,113,10,124,0,160,3,124,5,161,1,125,6,124,6, 100,1,107,9,114,10,116,4,124,6,100,2,131,2,114,72, - 124,6,106,5,124,1,124,3,131,2,125,7,110,12,124,0, - 106,6,124,1,124,6,131,2,125,7,124,7,100,1,107,8, + 124,6,160,5,124,1,124,3,161,2,125,7,110,12,124,0, + 160,6,124,1,124,6,161,2,125,7,124,7,100,1,107,8, 114,94,113,10,124,7,106,7,100,1,107,9,114,108,124,7, 83,0,124,7,106,8,125,8,124,8,100,1,107,8,114,130, - 116,9,100,3,131,1,130,1,124,4,106,10,124,8,131,1, - 1,0,113,10,87,0,116,11,106,12,124,1,100,1,131,2, + 116,9,100,3,131,1,130,1,124,4,160,10,124,8,161,1, + 1,0,113,10,87,0,116,11,160,12,124,1,100,1,161,2, 125,7,124,4,124,7,95,8,124,7,83,0,100,1,83,0, 41,4,122,63,70,105,110,100,32,116,104,101,32,108,111,97, 100,101,114,32,111,114,32,110,97,109,101,115,112,97,99,101, @@ -1921,15 +1921,15 @@ 112,97,99,101,95,112,97,116,104,90,5,101,110,116,114,121, 114,252,0,0,0,114,162,0,0,0,114,125,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,9, - 95,103,101,116,95,115,112,101,99,93,4,0,0,115,40,0, + 95,103,101,116,95,115,112,101,99,94,4,0,0,115,40,0, 0,0,0,5,4,1,10,1,14,1,2,1,10,1,8,1, 10,1,14,2,12,1,8,1,2,1,10,1,4,1,6,1, 8,1,8,5,14,2,12,1,6,1,122,20,80,97,116,104, 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, - 99,4,0,0,0,0,0,0,0,6,0,0,0,4,0,0, + 99,4,0,0,0,0,0,0,0,6,0,0,0,5,0,0, 0,67,0,0,0,115,100,0,0,0,124,2,100,1,107,8, - 114,14,116,0,106,1,125,2,124,0,106,2,124,1,124,2, - 124,3,131,3,125,4,124,4,100,1,107,8,114,40,100,1, + 114,14,116,0,106,1,125,2,124,0,160,2,124,1,124,2, + 124,3,161,3,125,4,124,4,100,1,107,8,114,40,100,1, 83,0,124,4,106,3,100,1,107,8,114,92,124,4,106,4, 125,5,124,5,114,86,100,2,124,4,95,5,116,6,124,1, 124,5,124,0,106,2,131,3,124,4,95,4,124,4,83,0, @@ -1949,12 +1949,12 @@ 41,6,114,168,0,0,0,114,123,0,0,0,114,37,0,0, 0,114,177,0,0,0,114,162,0,0,0,114,3,1,0,0, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 178,0,0,0,125,4,0,0,115,26,0,0,0,0,6,8, + 178,0,0,0,126,4,0,0,115,26,0,0,0,0,6,8, 1,6,1,14,1,8,1,4,1,10,1,6,1,4,3,6, 1,16,1,4,2,6,2,122,20,80,97,116,104,70,105,110, 100,101,114,46,102,105,110,100,95,115,112,101,99,99,3,0, - 0,0,0,0,0,0,4,0,0,0,3,0,0,0,67,0, - 0,0,115,30,0,0,0,124,0,106,0,124,1,124,2,131, + 0,0,0,0,0,0,4,0,0,0,4,0,0,0,67,0, + 0,0,115,30,0,0,0,124,0,160,0,124,1,124,2,161, 2,125,3,124,3,100,1,107,8,114,24,100,1,83,0,124, 3,106,1,83,0,41,2,122,170,102,105,110,100,32,116,104, 101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,46, @@ -1970,7 +1970,7 @@ 32,32,32,78,41,2,114,178,0,0,0,114,124,0,0,0, 41,4,114,168,0,0,0,114,123,0,0,0,114,37,0,0, 0,114,162,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,6,0,0,0,114,179,0,0,0,149,4,0,0,115,8, + 114,6,0,0,0,114,179,0,0,0,150,4,0,0,115,8, 0,0,0,0,8,12,1,8,1,4,1,122,22,80,97,116, 104,70,105,110,100,101,114,46,102,105,110,100,95,109,111,100, 117,108,101,41,1,78,41,2,78,78,41,1,78,41,12,114, @@ -1979,7 +1979,7 @@ 0,0,114,0,1,0,0,114,1,1,0,0,114,4,1,0, 0,114,178,0,0,0,114,179,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 248,0,0,0,31,4,0,0,115,22,0,0,0,8,2,4, + 248,0,0,0,32,4,0,0,115,22,0,0,0,8,2,4, 2,12,8,12,13,12,22,12,15,2,1,12,31,2,1,12, 23,2,1,114,248,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,3,0,0,0,64,0,0,0,115,90,0, @@ -2001,10 +2001,10 @@ 100,101,114,32,105,115,32,104,97,110,100,108,105,110,103,32, 104,97,115,32,98,101,101,110,32,109,111,100,105,102,105,101, 100,46,10,10,32,32,32,32,99,2,0,0,0,0,0,0, - 0,5,0,0,0,5,0,0,0,7,0,0,0,115,88,0, + 0,5,0,0,0,6,0,0,0,7,0,0,0,115,88,0, 0,0,103,0,125,3,120,40,124,2,68,0,93,32,92,2, - 137,0,125,4,124,3,106,0,135,0,102,1,100,1,100,2, - 132,8,124,4,68,0,131,1,131,1,1,0,113,10,87,0, + 137,0,125,4,124,3,160,0,135,0,102,1,100,1,100,2, + 132,8,124,4,68,0,131,1,161,1,1,0,113,10,87,0, 124,3,124,0,95,1,124,1,112,58,100,3,124,0,95,2, 100,6,124,0,95,3,116,4,131,0,124,0,95,5,116,4, 131,0,124,0,95,6,100,5,83,0,41,7,122,154,73,110, @@ -2023,7 +2023,7 @@ 1,0,113,2,100,0,83,0,41,1,78,114,4,0,0,0, 41,2,114,24,0,0,0,114,222,0,0,0,41,1,114,124, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,224,0, - 0,0,178,4,0,0,115,2,0,0,0,4,0,122,38,70, + 0,0,179,4,0,0,115,2,0,0,0,4,0,122,38,70, 105,108,101,70,105,110,100,101,114,46,95,95,105,110,105,116, 95,95,46,60,108,111,99,97,108,115,62,46,60,103,101,110, 101,120,112,114,62,114,61,0,0,0,114,31,0,0,0,78, @@ -2035,7 +2035,7 @@ 5,114,104,0,0,0,114,37,0,0,0,218,14,108,111,97, 100,101,114,95,100,101,116,97,105,108,115,90,7,108,111,97, 100,101,114,115,114,164,0,0,0,114,4,0,0,0,41,1, - 114,124,0,0,0,114,6,0,0,0,114,182,0,0,0,172, + 114,124,0,0,0,114,6,0,0,0,114,182,0,0,0,173, 4,0,0,115,16,0,0,0,0,4,4,1,14,1,28,1, 6,2,10,1,6,1,8,1,122,19,70,105,108,101,70,105, 110,100,101,114,46,95,95,105,110,105,116,95,95,99,1,0, @@ -2046,11 +2046,11 @@ 105,109,101,46,114,31,0,0,0,78,114,91,0,0,0,41, 1,114,7,1,0,0,41,1,114,104,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,6,0,0,0,114,249,0,0, - 0,186,4,0,0,115,2,0,0,0,0,2,122,28,70,105, + 0,187,4,0,0,115,2,0,0,0,0,2,122,28,70,105, 108,101,70,105,110,100,101,114,46,105,110,118,97,108,105,100, 97,116,101,95,99,97,99,104,101,115,99,2,0,0,0,0, - 0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115, - 42,0,0,0,124,0,106,0,124,1,131,1,125,2,124,2, + 0,0,0,3,0,0,0,3,0,0,0,67,0,0,0,115, + 42,0,0,0,124,0,160,0,124,1,161,1,125,2,124,2, 100,1,107,8,114,26,100,1,103,0,102,2,83,0,124,2, 106,1,124,2,106,2,112,38,103,0,102,2,83,0,41,2, 122,197,84,114,121,32,116,111,32,102,105,110,100,32,97,32, @@ -2068,7 +2068,7 @@ 32,32,32,32,32,32,32,78,41,3,114,178,0,0,0,114, 124,0,0,0,114,154,0,0,0,41,3,114,104,0,0,0, 114,123,0,0,0,114,162,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,121,0,0,0,192,4, + 4,0,0,0,114,6,0,0,0,114,121,0,0,0,193,4, 0,0,115,8,0,0,0,0,7,10,1,8,1,8,1,122, 22,70,105,108,101,70,105,110,100,101,114,46,102,105,110,100, 95,108,111,97,100,101,114,99,6,0,0,0,0,0,0,0, @@ -2079,32 +2079,32 @@ 0,41,7,114,104,0,0,0,114,163,0,0,0,114,123,0, 0,0,114,37,0,0,0,90,4,115,109,115,108,114,177,0, 0,0,114,124,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,4,1,0,0,204,4,0,0,115, + 0,114,6,0,0,0,114,4,1,0,0,205,4,0,0,115, 6,0,0,0,0,1,10,1,8,1,122,20,70,105,108,101, 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, - 78,99,3,0,0,0,0,0,0,0,14,0,0,0,15,0, + 78,99,3,0,0,0,0,0,0,0,14,0,0,0,16,0, 0,0,67,0,0,0,115,98,1,0,0,100,1,125,3,124, - 1,106,0,100,2,131,1,100,3,25,0,125,4,121,24,116, - 1,124,0,106,2,112,34,116,3,106,4,131,0,131,1,106, + 1,160,0,100,2,161,1,100,3,25,0,125,4,121,24,116, + 1,124,0,106,2,112,34,116,3,160,4,161,0,131,1,106, 5,125,5,87,0,110,24,4,0,116,6,107,10,114,66,1, 0,1,0,1,0,100,10,125,5,89,0,110,2,88,0,124, - 5,124,0,106,7,107,3,114,92,124,0,106,8,131,0,1, + 5,124,0,106,7,107,3,114,92,124,0,160,8,161,0,1, 0,124,5,124,0,95,7,116,9,131,0,114,114,124,0,106, - 10,125,6,124,4,106,11,131,0,125,7,110,10,124,0,106, + 10,125,6,124,4,160,11,161,0,125,7,110,10,124,0,106, 12,125,6,124,4,125,7,124,7,124,6,107,6,114,218,116, 13,124,0,106,2,124,4,131,2,125,8,120,72,124,0,106, 14,68,0,93,54,92,2,125,9,125,10,100,5,124,9,23, 0,125,11,116,13,124,8,124,11,131,2,125,12,116,15,124, - 12,131,1,114,152,124,0,106,16,124,10,124,1,124,12,124, - 8,103,1,124,2,131,5,83,0,113,152,87,0,116,17,124, + 12,131,1,114,152,124,0,160,16,124,10,124,1,124,12,124, + 8,103,1,124,2,161,5,83,0,113,152,87,0,116,17,124, 8,131,1,125,3,120,88,124,0,106,14,68,0,93,78,92, 2,125,9,125,10,116,13,124,0,106,2,124,4,124,9,23, 0,131,2,125,12,116,18,106,19,100,6,124,12,100,3,100, 7,141,3,1,0,124,7,124,9,23,0,124,6,107,6,114, - 226,116,15,124,12,131,1,114,226,124,0,106,16,124,10,124, - 1,124,12,100,8,124,2,131,5,83,0,113,226,87,0,124, - 3,144,1,114,94,116,18,106,19,100,9,124,8,131,2,1, - 0,116,18,106,20,124,1,100,8,131,2,125,13,124,8,103, + 226,116,15,124,12,131,1,114,226,124,0,160,16,124,10,124, + 1,124,12,100,8,124,2,161,5,83,0,113,226,87,0,124, + 3,144,1,114,94,116,18,160,19,100,9,124,8,161,2,1, + 0,116,18,160,20,124,1,100,8,161,2,125,13,124,8,103, 1,124,13,95,21,124,13,83,0,100,8,83,0,41,11,122, 111,84,114,121,32,116,111,32,102,105,110,100,32,97,32,115, 112,101,99,32,102,111,114,32,116,104,101,32,115,112,101,99, @@ -2134,25 +2134,25 @@ 0,90,13,105,110,105,116,95,102,105,108,101,110,97,109,101, 90,9,102,117,108,108,95,112,97,116,104,114,162,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,6,0,0,0,114, - 178,0,0,0,209,4,0,0,115,70,0,0,0,0,5,4, + 178,0,0,0,210,4,0,0,115,70,0,0,0,0,5,4, 1,14,1,2,1,24,1,14,1,10,1,10,1,8,1,6, 2,6,1,6,1,10,2,6,1,4,2,8,1,12,1,16, 1,8,1,10,1,8,1,24,4,8,2,16,1,16,1,16, 1,12,1,8,1,10,1,12,1,6,1,12,1,12,1,8, 1,4,1,122,20,70,105,108,101,70,105,110,100,101,114,46, 102,105,110,100,95,115,112,101,99,99,1,0,0,0,0,0, - 0,0,9,0,0,0,13,0,0,0,67,0,0,0,115,194, - 0,0,0,124,0,106,0,125,1,121,22,116,1,106,2,124, - 1,112,22,116,1,106,3,131,0,131,1,125,2,87,0,110, + 0,0,9,0,0,0,14,0,0,0,67,0,0,0,115,194, + 0,0,0,124,0,106,0,125,1,121,22,116,1,160,2,124, + 1,112,22,116,1,160,3,161,0,161,1,125,2,87,0,110, 30,4,0,116,4,116,5,116,6,102,3,107,10,114,58,1, 0,1,0,1,0,103,0,125,2,89,0,110,2,88,0,116, - 7,106,8,106,9,100,1,131,1,115,84,116,10,124,2,131, + 7,106,8,160,9,100,1,161,1,115,84,116,10,124,2,131, 1,124,0,95,11,110,78,116,10,131,0,125,3,120,64,124, - 2,68,0,93,56,125,4,124,4,106,12,100,2,131,1,92, - 3,125,5,125,6,125,7,124,6,114,138,100,3,106,13,124, - 5,124,7,106,14,131,0,131,2,125,8,110,4,124,5,125, - 8,124,3,106,15,124,8,131,1,1,0,113,96,87,0,124, - 3,124,0,95,11,116,7,106,8,106,9,116,16,131,1,114, + 2,68,0,93,56,125,4,124,4,160,12,100,2,161,1,92, + 3,125,5,125,6,125,7,124,6,114,138,100,3,160,13,124, + 5,124,7,160,14,161,0,161,2,125,8,110,4,124,5,125, + 8,124,3,160,15,124,8,161,1,1,0,113,96,87,0,124, + 3,124,0,95,11,116,7,106,8,160,9,116,16,161,1,114, 190,100,4,100,5,132,0,124,2,68,0,131,1,124,0,95, 17,100,6,83,0,41,7,122,68,70,105,108,108,32,116,104, 101,32,99,97,99,104,101,32,111,102,32,112,111,116,101,110, @@ -2160,12 +2160,12 @@ 32,112,97,99,107,97,103,101,115,32,102,111,114,32,116,104, 105,115,32,100,105,114,101,99,116,111,114,121,46,114,0,0, 0,0,114,61,0,0,0,122,5,123,125,46,123,125,99,1, - 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,83, + 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,83, 0,0,0,115,20,0,0,0,104,0,124,0,93,12,125,1, - 124,1,106,0,131,0,146,2,113,4,83,0,114,4,0,0, + 124,1,160,0,161,0,146,2,113,4,83,0,114,4,0,0, 0,41,1,114,92,0,0,0,41,2,114,24,0,0,0,90, 2,102,110,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,250,9,60,115,101,116,99,111,109,112,62,30,5,0, + 0,0,250,9,60,115,101,116,99,111,109,112,62,31,5,0, 0,115,2,0,0,0,6,0,122,41,70,105,108,101,70,105, 110,100,101,114,46,95,102,105,108,108,95,99,97,99,104,101, 46,60,108,111,99,97,108,115,62,46,60,115,101,116,99,111, @@ -2182,7 +2182,7 @@ 102,105,120,95,99,111,110,116,101,110,116,115,114,244,0,0, 0,114,102,0,0,0,114,234,0,0,0,114,222,0,0,0, 90,8,110,101,119,95,110,97,109,101,114,4,0,0,0,114, - 4,0,0,0,114,6,0,0,0,114,12,1,0,0,1,5, + 4,0,0,0,114,6,0,0,0,114,12,1,0,0,2,5, 0,0,115,34,0,0,0,0,2,6,1,2,1,22,1,20, 3,10,3,12,1,12,7,6,1,10,1,16,1,4,1,18, 2,4,1,14,1,6,1,12,1,122,22,70,105,108,101,70, @@ -2220,7 +2220,7 @@ 0,0,0,114,103,0,0,0,41,1,114,37,0,0,0,41, 2,114,168,0,0,0,114,11,1,0,0,114,4,0,0,0, 114,6,0,0,0,218,24,112,97,116,104,95,104,111,111,107, - 95,102,111,114,95,70,105,108,101,70,105,110,100,101,114,42, + 95,102,111,114,95,70,105,108,101,70,105,110,100,101,114,43, 5,0,0,115,6,0,0,0,0,2,8,1,12,1,122,54, 70,105,108,101,70,105,110,100,101,114,46,112,97,116,104,95, 104,111,111,107,46,60,108,111,99,97,108,115,62,46,112,97, @@ -2228,16 +2228,16 @@ 70,105,110,100,101,114,114,4,0,0,0,41,3,114,168,0, 0,0,114,11,1,0,0,114,17,1,0,0,114,4,0,0, 0,41,2,114,168,0,0,0,114,11,1,0,0,114,6,0, - 0,0,218,9,112,97,116,104,95,104,111,111,107,32,5,0, + 0,0,218,9,112,97,116,104,95,104,111,111,107,33,5,0, 0,115,4,0,0,0,0,10,14,6,122,20,70,105,108,101, 70,105,110,100,101,114,46,112,97,116,104,95,104,111,111,107, - 99,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0, - 0,67,0,0,0,115,12,0,0,0,100,1,106,0,124,0, - 106,1,131,1,83,0,41,2,78,122,16,70,105,108,101,70, + 99,1,0,0,0,0,0,0,0,1,0,0,0,3,0,0, + 0,67,0,0,0,115,12,0,0,0,100,1,160,0,124,0, + 106,1,161,1,83,0,41,2,78,122,16,70,105,108,101,70, 105,110,100,101,114,40,123,33,114,125,41,41,2,114,50,0, 0,0,114,37,0,0,0,41,1,114,104,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,6,0,0,0,114,243,0, - 0,0,50,5,0,0,115,2,0,0,0,0,1,122,19,70, + 0,0,51,5,0,0,115,2,0,0,0,0,1,122,19,70, 105,108,101,70,105,110,100,101,114,46,95,95,114,101,112,114, 95,95,41,1,78,41,15,114,109,0,0,0,114,108,0,0, 0,114,110,0,0,0,114,111,0,0,0,114,182,0,0,0, @@ -2245,12 +2245,12 @@ 121,0,0,0,114,4,1,0,0,114,178,0,0,0,114,12, 1,0,0,114,180,0,0,0,114,18,1,0,0,114,243,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,6,0,0,0,114,5,1,0,0,163,4,0,0,115, + 0,114,6,0,0,0,114,5,1,0,0,164,4,0,0,115, 20,0,0,0,8,7,4,2,8,14,8,4,4,2,8,12, 8,5,10,48,8,31,12,18,114,5,1,0,0,99,4,0, 0,0,0,0,0,0,6,0,0,0,11,0,0,0,67,0, - 0,0,115,146,0,0,0,124,0,106,0,100,1,131,1,125, - 4,124,0,106,0,100,2,131,1,125,5,124,4,115,66,124, + 0,0,115,146,0,0,0,124,0,160,0,100,1,161,1,125, + 4,124,0,160,0,100,2,161,1,125,5,124,4,115,66,124, 5,114,36,124,5,106,1,125,4,110,30,124,2,124,3,107, 2,114,56,116,2,124,1,124,2,131,2,125,4,110,10,116, 3,124,1,124,2,131,2,125,4,124,5,115,84,116,4,124, @@ -2268,12 +2268,12 @@ 90,8,112,97,116,104,110,97,109,101,90,9,99,112,97,116, 104,110,97,109,101,114,124,0,0,0,114,162,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,218,14, - 95,102,105,120,95,117,112,95,109,111,100,117,108,101,56,5, + 95,102,105,120,95,117,112,95,109,111,100,117,108,101,57,5, 0,0,115,34,0,0,0,0,2,10,1,10,1,4,1,4, 1,8,1,8,1,12,2,10,1,4,1,14,1,2,1,8, 1,8,1,8,1,12,1,14,2,114,23,1,0,0,99,0, 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, - 0,0,0,115,38,0,0,0,116,0,116,1,106,2,131,0, + 0,0,0,115,38,0,0,0,116,0,116,1,160,2,161,0, 102,2,125,0,116,3,116,4,102,2,125,1,116,5,116,6, 102,2,125,2,124,0,124,1,124,2,103,3,83,0,41,1, 122,95,82,101,116,117,114,110,115,32,97,32,108,105,115,116, @@ -2288,13 +2288,13 @@ 114,78,0,0,0,41,3,90,10,101,120,116,101,110,115,105, 111,110,115,90,6,115,111,117,114,99,101,90,8,98,121,116, 101,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114, - 6,0,0,0,114,159,0,0,0,79,5,0,0,115,8,0, + 6,0,0,0,114,159,0,0,0,80,5,0,0,115,8,0, 0,0,0,5,12,1,8,1,8,1,114,159,0,0,0,99, 1,0,0,0,0,0,0,0,12,0,0,0,12,0,0,0, 67,0,0,0,115,188,1,0,0,124,0,97,0,116,0,106, 1,97,1,116,0,106,2,97,2,116,1,106,3,116,4,25, 0,125,1,120,56,100,26,68,0,93,48,125,2,124,2,116, - 1,106,3,107,7,114,58,116,0,106,5,124,2,131,1,125, + 1,106,3,107,7,114,58,116,0,160,5,124,2,161,1,125, 3,110,10,116,1,106,3,124,2,25,0,125,3,116,6,124, 1,124,2,124,3,131,3,1,0,113,32,87,0,100,5,100, 6,103,1,102,2,100,7,100,8,100,6,103,2,102,2,102, @@ -2302,22 +2302,22 @@ 6,116,7,100,9,100,10,132,0,124,6,68,0,131,1,131, 1,115,142,116,8,130,1,124,6,100,11,25,0,125,7,124, 5,116,1,106,3,107,6,114,174,116,1,106,3,124,5,25, - 0,125,8,80,0,113,112,121,16,116,0,106,5,124,5,131, + 0,125,8,80,0,113,112,121,16,116,0,160,5,124,5,161, 1,125,8,80,0,87,0,113,112,4,0,116,9,107,10,114, 212,1,0,1,0,1,0,119,112,89,0,113,112,88,0,113, 112,87,0,116,9,100,12,131,1,130,1,116,6,124,1,100, 13,124,8,131,3,1,0,116,6,124,1,100,14,124,7,131, - 3,1,0,116,6,124,1,100,15,100,16,106,10,124,6,131, - 1,131,3,1,0,121,14,116,0,106,5,100,17,131,1,125, + 3,1,0,116,6,124,1,100,15,100,16,160,10,124,6,161, + 1,131,3,1,0,121,14,116,0,160,5,100,17,161,1,125, 9,87,0,110,26,4,0,116,9,107,10,144,1,114,52,1, 0,1,0,1,0,100,18,125,9,89,0,110,2,88,0,116, - 6,124,1,100,17,124,9,131,3,1,0,116,0,106,5,100, - 19,131,1,125,10,116,6,124,1,100,19,124,10,131,3,1, - 0,124,5,100,7,107,2,144,1,114,120,116,0,106,5,100, - 20,131,1,125,11,116,6,124,1,100,21,124,11,131,3,1, + 6,124,1,100,17,124,9,131,3,1,0,116,0,160,5,100, + 19,161,1,125,10,116,6,124,1,100,19,124,10,131,3,1, + 0,124,5,100,7,107,2,144,1,114,120,116,0,160,5,100, + 20,161,1,125,11,116,6,124,1,100,21,124,11,131,3,1, 0,116,6,124,1,100,22,116,11,131,0,131,3,1,0,116, - 12,106,13,116,2,106,14,131,0,131,1,1,0,124,5,100, - 7,107,2,144,1,114,184,116,15,106,16,100,23,131,1,1, + 12,160,13,116,2,160,14,161,0,161,1,1,0,124,5,100, + 7,107,2,144,1,114,184,116,15,160,16,100,23,161,1,1, 0,100,24,116,12,107,6,144,1,114,184,100,25,116,17,95, 18,100,18,83,0,41,27,122,205,83,101,116,117,112,32,116, 104,101,32,112,97,116,104,45,98,97,115,101,100,32,105,109, @@ -2341,7 +2341,7 @@ 100,1,83,0,41,2,114,31,0,0,0,78,41,1,114,33, 0,0,0,41,2,114,24,0,0,0,114,81,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,6,0,0,0,114,224, - 0,0,0,115,5,0,0,115,2,0,0,0,4,0,122,25, + 0,0,0,116,5,0,0,115,2,0,0,0,4,0,122,25, 95,115,101,116,117,112,46,60,108,111,99,97,108,115,62,46, 60,103,101,110,101,120,112,114,62,114,62,0,0,0,122,30, 105,109,112,111,114,116,108,105,98,32,114,101,113,117,105,114, @@ -2370,17 +2370,17 @@ 100,117,108,101,90,14,119,101,97,107,114,101,102,95,109,111, 100,117,108,101,90,13,119,105,110,114,101,103,95,109,111,100, 117,108,101,114,4,0,0,0,114,4,0,0,0,114,6,0, - 0,0,218,6,95,115,101,116,117,112,90,5,0,0,115,82, + 0,0,218,6,95,115,101,116,117,112,91,5,0,0,115,82, 0,0,0,0,8,4,1,6,1,6,3,10,1,10,1,10, 1,12,2,10,1,16,3,22,1,14,2,22,1,8,1,10, 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, 1,10,1,10,1,114,31,1,0,0,99,1,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, + 0,0,0,2,0,0,0,4,0,0,0,67,0,0,0,115, 50,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, - 125,1,116,2,106,3,106,4,116,5,106,6,124,1,142,0, - 103,1,131,1,1,0,116,2,106,7,106,8,116,9,131,1, + 125,1,116,2,106,3,160,4,116,5,106,6,124,1,142,0, + 103,1,161,1,1,0,116,2,106,7,160,8,116,9,161,1, 1,0,100,1,83,0,41,2,122,41,73,110,115,116,97,108, 108,32,116,104,101,32,112,97,116,104,45,98,97,115,101,100, 32,105,109,112,111,114,116,32,99,111,109,112,111,110,101,110, @@ -2391,7 +2391,7 @@ 114,30,1,0,0,90,17,115,117,112,112,111,114,116,101,100, 95,108,111,97,100,101,114,115,114,4,0,0,0,114,4,0, 0,0,114,6,0,0,0,218,8,95,105,110,115,116,97,108, - 108,158,5,0,0,115,8,0,0,0,0,2,8,1,6,1, + 108,159,5,0,0,115,8,0,0,0,0,2,8,1,6,1, 20,1,114,33,1,0,0,41,1,114,0,0,0,0,41,2, 114,1,0,0,0,114,2,0,0,0,41,1,114,49,0,0, 0,41,1,78,41,3,78,78,78,41,3,78,78,78,41,2, @@ -2424,7 +2424,7 @@ 0,0,0,114,4,0,0,0,114,6,0,0,0,218,8,60, 109,111,100,117,108,101,62,8,0,0,0,115,108,0,0,0, 4,16,4,1,4,1,2,1,6,3,8,17,8,5,8,5, - 8,6,8,12,8,10,8,9,8,5,8,7,10,22,10,123, + 8,6,8,12,8,10,8,9,8,5,8,7,10,22,10,124, 16,1,12,2,4,1,4,2,6,2,6,2,8,2,16,45, 8,34,8,19,8,12,8,12,8,28,8,17,10,55,10,12, 10,10,8,14,6,3,4,1,14,67,14,64,14,29,16,110, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -159,8 +159,8 @@ &&TARGET_BUILD_STRING, &&TARGET_BUILD_TUPLE_UNPACK_WITH_CALL, &&_unknown_opcode, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_LOAD_METHOD, + &&TARGET_CALL_METHOD, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 02:33:45 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 14 Dec 2016 07:33:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E13_release_branch?= Message-ID: <20161214073345.32736.60114.F527B39E@psf.io> https://hg.python.org/cpython/rev/58a5edf41144 changeset: 105615:58a5edf41144 branch: 2.7 parent: 105586:8359ee62dde3 parent: 105614:5315db3171b0 user: Benjamin Peterson date: Tue Dec 13 23:32:54 2016 -0800 summary: merge 2.7.13 release branch files: Lib/test/test_descr.py | 97 ------------------------------ Misc/NEWS | 10 +++ Objects/typeobject.c | 28 +-------- 3 files changed, 11 insertions(+), 124 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3,7 +3,6 @@ import sys import types import unittest -import warnings import weakref from copy import deepcopy @@ -1551,84 +1550,6 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) - def test_bad_new(self): - self.assertRaises(TypeError, object.__new__) - self.assertRaises(TypeError, object.__new__, '') - self.assertRaises(TypeError, list.__new__, object) - self.assertRaises(TypeError, object.__new__, list) - class C(object): - __new__ = list.__new__ - self.assertRaises(TypeError, C) - class C(list): - __new__ = object.__new__ - self.assertRaises(TypeError, C) - - def test_object_new(self): - class A(object): - pass - object.__new__(A) - self.assertRaises(TypeError, object.__new__, A, 5) - object.__init__(A()) - self.assertRaises(TypeError, object.__init__, A(), 5) - - class A(object): - def __init__(self, foo): - self.foo = foo - object.__new__(A) - object.__new__(A, 5) - object.__init__(A(3)) - self.assertRaises(TypeError, object.__init__, A(3), 5) - - class A(object): - def __new__(cls, foo): - return object.__new__(cls) - object.__new__(A) - self.assertRaises(TypeError, object.__new__, A, 5) - object.__init__(A(3)) - object.__init__(A(3), 5) - - class A(object): - def __new__(cls, foo): - return object.__new__(cls) - def __init__(self, foo): - self.foo = foo - object.__new__(A) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', DeprecationWarning) - a = object.__new__(A, 5) - self.assertEqual(type(a), A) - self.assertEqual(len(w), 1) - object.__init__(A(3)) - a = A(3) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', DeprecationWarning) - object.__init__(a, 5) - self.assertEqual(a.foo, 3) - self.assertEqual(len(w), 1) - - def test_restored_object_new(self): - class A(object): - def __new__(cls, *args, **kwargs): - raise AssertionError - self.assertRaises(AssertionError, A) - class B(A): - __new__ = object.__new__ - def __init__(self, foo): - self.foo = foo - with warnings.catch_warnings(): - warnings.simplefilter('error', DeprecationWarning) - b = B(3) - self.assertEqual(b.foo, 3) - self.assertEqual(b.__class__, B) - del B.__new__ - self.assertRaises(AssertionError, B) - del A.__new__ - with warnings.catch_warnings(): - warnings.simplefilter('error', DeprecationWarning) - b = B(3) - self.assertEqual(b.foo, 3) - self.assertEqual(b.__class__, B) - def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3835,24 +3756,6 @@ self.assertEqual(isinstance(d, D), True) self.assertEqual(d.foo, 1) - class C(object): - @staticmethod - def __new__(*args): - return args - self.assertEqual(C(1, 2), (C, 1, 2)) - class D(C): - pass - self.assertEqual(D(1, 2), (D, 1, 2)) - - class C(object): - @classmethod - def __new__(*args): - return args - self.assertEqual(C(1, 2), (C, C, 1, 2)) - class D(C): - pass - self.assertEqual(D(1, 2), (D, D, 1, 2)) - def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,16 @@ Library ------- +What's New in Python 2.7.13 +=========================== + +*Release date: 2016-12-XX* + +Core and Builtins +----------------- + +- Revert a37cc3d926ec (Issue #5322). + What's New in Python 2.7.13 release candidate 1? ================================================ diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6304,33 +6304,7 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - PyObject *self = PyCFunction_GET_SELF(descr); - if (!self || !PyType_Check(self)) { - /* This should never happen because - tp_new_wrapper expects a type for self. - Use slot_tp_new which will call - tp_new_wrapper which will raise an - exception. */ - specific = (void *)slot_tp_new; - } - else { - PyTypeObject *staticbase = type->tp_base; - specific = ((PyTypeObject *)self)->tp_new; - /* Check that the user does not do anything - silly and unsafe like object.__new__(dict). - To do this, we check that the most derived - base that's not a heap type is this type. */ - while (staticbase && - (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - if (staticbase && - staticbase->tp_new != specific) - /* Seems to be unsafe, better use - slot_tp_new which will call - tp_new_wrapper which will raise an - exception if it is unsafe. */ - specific = (void *)slot_tp_new; - } + specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 02:33:45 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 14 Dec 2016 07:33:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Backed_out_cha?= =?utf-8?q?ngeset_ea904d4b3634?= Message-ID: <20161214073345.117305.77709.2743E218@psf.io> https://hg.python.org/cpython/rev/0ed808d9e679 changeset: 105613:0ed808d9e679 branch: 2.7 parent: 105443:2b8df35c5990 user: Benjamin Peterson date: Tue Dec 13 23:27:56 2016 -0800 summary: Backed out changeset ea904d4b3634 files: Objects/typeobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6314,12 +6314,12 @@ specific = (void *)slot_tp_new; } else { - PyTypeObject *staticbase = type->tp_base; specific = ((PyTypeObject *)self)->tp_new; /* Check that the user does not do anything silly and unsafe like object.__new__(dict). To do this, we check that the most derived base that's not a heap type is this type. */ + PyTypeObject *staticbase = type->tp_base; while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) staticbase = staticbase->tp_base; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 02:33:45 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 14 Dec 2016 07:33:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_revert_a37cc3d?= =?utf-8?q?926ec_=28=235322=29?= Message-ID: <20161214073345.125432.85824.202D7339@psf.io> https://hg.python.org/cpython/rev/5315db3171b0 changeset: 105614:5315db3171b0 branch: 2.7 user: Benjamin Peterson date: Tue Dec 13 23:30:16 2016 -0800 summary: revert a37cc3d926ec (#5322) files: Lib/test/test_descr.py | 97 ------------------------------ Misc/NEWS | 14 +++- Objects/typeobject.c | 28 +-------- 3 files changed, 12 insertions(+), 127 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3,7 +3,6 @@ import sys import types import unittest -import warnings import weakref from copy import deepcopy @@ -1551,84 +1550,6 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) - def test_bad_new(self): - self.assertRaises(TypeError, object.__new__) - self.assertRaises(TypeError, object.__new__, '') - self.assertRaises(TypeError, list.__new__, object) - self.assertRaises(TypeError, object.__new__, list) - class C(object): - __new__ = list.__new__ - self.assertRaises(TypeError, C) - class C(list): - __new__ = object.__new__ - self.assertRaises(TypeError, C) - - def test_object_new(self): - class A(object): - pass - object.__new__(A) - self.assertRaises(TypeError, object.__new__, A, 5) - object.__init__(A()) - self.assertRaises(TypeError, object.__init__, A(), 5) - - class A(object): - def __init__(self, foo): - self.foo = foo - object.__new__(A) - object.__new__(A, 5) - object.__init__(A(3)) - self.assertRaises(TypeError, object.__init__, A(3), 5) - - class A(object): - def __new__(cls, foo): - return object.__new__(cls) - object.__new__(A) - self.assertRaises(TypeError, object.__new__, A, 5) - object.__init__(A(3)) - object.__init__(A(3), 5) - - class A(object): - def __new__(cls, foo): - return object.__new__(cls) - def __init__(self, foo): - self.foo = foo - object.__new__(A) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', DeprecationWarning) - a = object.__new__(A, 5) - self.assertEqual(type(a), A) - self.assertEqual(len(w), 1) - object.__init__(A(3)) - a = A(3) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', DeprecationWarning) - object.__init__(a, 5) - self.assertEqual(a.foo, 3) - self.assertEqual(len(w), 1) - - def test_restored_object_new(self): - class A(object): - def __new__(cls, *args, **kwargs): - raise AssertionError - self.assertRaises(AssertionError, A) - class B(A): - __new__ = object.__new__ - def __init__(self, foo): - self.foo = foo - with warnings.catch_warnings(): - warnings.simplefilter('error', DeprecationWarning) - b = B(3) - self.assertEqual(b.foo, 3) - self.assertEqual(b.__class__, B) - del B.__new__ - self.assertRaises(AssertionError, B) - del A.__new__ - with warnings.catch_warnings(): - warnings.simplefilter('error', DeprecationWarning) - b = B(3) - self.assertEqual(b.foo, 3) - self.assertEqual(b.__class__, B) - def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3835,24 +3756,6 @@ self.assertEqual(isinstance(d, D), True) self.assertEqual(d.foo, 1) - class C(object): - @staticmethod - def __new__(*args): - return args - self.assertEqual(C(1, 2), (C, 1, 2)) - class D(C): - pass - self.assertEqual(D(1, 2), (D, 1, 2)) - - class C(object): - @classmethod - def __new__(*args): - return args - self.assertEqual(C(1, 2), (C, C, 1, 2)) - class D(C): - pass - self.assertEqual(D(1, 2), (D, D, 1, 2)) - def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,17 @@ Python News +++++++++++ +What's New in Python 2.7.13 +=========================== + +*Release date: 2016-12-XX* + +Core and Builtins +----------------- + +- Revert a37cc3d926ec (Issue #5322). + + What's New in Python 2.7.13 release candidate 1? ================================================ @@ -10,9 +21,6 @@ Core and Builtins ----------------- -- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. - Original patch by Andreas St?hrk. - - Issue #28847: dumbdbm no longer writes the index file in when it is not changed and supports reading read-only files. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6304,33 +6304,7 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - PyObject *self = PyCFunction_GET_SELF(descr); - if (!self || !PyType_Check(self)) { - /* This should never happen because - tp_new_wrapper expects a type for self. - Use slot_tp_new which will call - tp_new_wrapper which will raise an - exception. */ - specific = (void *)slot_tp_new; - } - else { - specific = ((PyTypeObject *)self)->tp_new; - /* Check that the user does not do anything - silly and unsafe like object.__new__(dict). - To do this, we check that the most derived - base that's not a heap type is this type. */ - PyTypeObject *staticbase = type->tp_base; - while (staticbase && - (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - if (staticbase && - staticbase->tp_new != specific) - /* Seems to be unsafe, better use - slot_tp_new which will call - tp_new_wrapper which will raise an - exception if it is unsafe. */ - specific = (void *)slot_tp_new; - } + specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Dec 14 04:04:13 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 14 Dec 2016 09:04:13 +0000 Subject: [Python-checkins] Daily reference leaks (64afd5cab40a): sum=-3 Message-ID: <20161214090408.15383.40646.92094BEF@psf.io> results for 64afd5cab40a on branch "default" -------------------------------------------- test_collections leaked [0, 0, -7] 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/reflog7iue7B', '--timeout', '7200'] From python-checkins at python.org Wed Dec 14 05:16:39 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 14 Dec 2016 10:16:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzIwMjExOiBNZXJnZSAzLjYu?= Message-ID: <20161214101639.12861.46800.F625CE21@psf.io> https://hg.python.org/cpython/rev/fcc9f19fcc13 changeset: 105617:fcc9f19fcc13 parent: 105612:64afd5cab40a parent: 105616:d1b400943483 user: Xavier de Gaye date: Wed Dec 14 11:16:06 2016 +0100 summary: Issue #20211: Merge 3.6. files: Misc/NEWS | 4 ++++ setup.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -540,6 +540,10 @@ Build ----- +- Issue #20211: Do not add the directory for installing C header files and the + directory for installing object code libraries to the cross compilation + search paths. Original patch by Thomas Petazzoni. + - Issue #28849: Do not define sys.implementation._multiarch on Android. - Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -533,8 +533,9 @@ for directory in reversed(options.dirs): add_dir_to_list(dir_list, directory) - if os.path.normpath(sys.base_prefix) != '/usr' \ - and not sysconfig.get_config_var('PYTHONFRAMEWORK'): + if (not cross_compiling and + os.path.normpath(sys.base_prefix) != '/usr' and + not sysconfig.get_config_var('PYTHONFRAMEWORK')): # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework # (PYTHONFRAMEWORK is set) to avoid # linking problems when # building a framework with different architectures than -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 05:16:39 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 14 Dec 2016 10:16:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzIwMjEx?= =?utf-8?q?=3A_Do_not_add_the_directory_for_installing_C_header_files_and?= Message-ID: <20161214101639.99305.87791.18D912EC@psf.io> https://hg.python.org/cpython/rev/d1b400943483 changeset: 105616:d1b400943483 branch: 3.6 parent: 105610:0528a6743018 user: Xavier de Gaye date: Wed Dec 14 11:14:33 2016 +0100 summary: Issue #20211: Do not add the directory for installing C header files and the directory for installing object code libraries to the cross compilation search paths. files: Misc/NEWS | 4 ++++ setup.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -53,6 +53,10 @@ Build ----- +- Issue #20211: Do not add the directory for installing C header files and the + directory for installing object code libraries to the cross compilation + search paths. Original patch by Thomas Petazzoni. + - Issue #28849: Do not define sys.implementation._multiarch on Android. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -532,8 +532,9 @@ for directory in reversed(options.dirs): add_dir_to_list(dir_list, directory) - if os.path.normpath(sys.base_prefix) != '/usr' \ - and not sysconfig.get_config_var('PYTHONFRAMEWORK'): + if (not cross_compiling and + os.path.normpath(sys.base_prefix) != '/usr' and + not sysconfig.get_config_var('PYTHONFRAMEWORK')): # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework # (PYTHONFRAMEWORK is set) to avoid # linking problems when # building a framework with different architectures than -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 05:55:22 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 14 Dec 2016 10:55:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4NjgzOiBNZXJnZSAzLjYu?= Message-ID: <20161214105521.23109.1613.948C65CA@psf.io> https://hg.python.org/cpython/rev/0350e0634a4b changeset: 105619:0350e0634a4b parent: 105617:fcc9f19fcc13 parent: 105618:b65ae19bc42a user: Xavier de Gaye date: Wed Dec 14 11:54:49 2016 +0100 summary: Issue #28683: Merge 3.6. files: Lib/test/support/__init__.py | 10 ++++++++++ Lib/test/test_asyncore.py | 4 +++- Lib/test/test_pathlib.py | 3 ++- Lib/test/test_socket.py | 21 +++++++++++++++------ Misc/NEWS | 3 +++ 5 files changed, 33 insertions(+), 8 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 @@ -96,6 +96,7 @@ "setswitchinterval", "android_not_root", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", + "bind_unix_socket", # processes 'temp_umask', "reap_children", # logging @@ -708,6 +709,15 @@ port = sock.getsockname()[1] return port +def bind_unix_socket(sock, addr): + """Bind a unix socket, raising SkipTest if PermissionError is raised.""" + assert sock.family == socket.AF_UNIX + try: + sock.bind(addr) + except PermissionError: + sock.close() + raise unittest.SkipTest('cannot bind AF_UNIX sockets') + def _is_ipv6_enabled(): """Check whether IPv6 is enabled on this host.""" if socket.has_ipv6: diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -95,7 +95,9 @@ if HAS_UNIX_SOCKETS and sock.family == socket.AF_UNIX: # Make sure the path doesn't exist. support.unlink(addr) - sock.bind(addr) + support.bind_unix_socket(sock, addr) + else: + sock.bind(addr) class HelperFunctionTests(unittest.TestCase): 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 @@ -1888,7 +1888,8 @@ try: sock.bind(str(P)) except OSError as e: - if "AF_UNIX path too long" in str(e): + if (isinstance(e, PermissionError) or + "AF_UNIX path too long" in str(e)): self.skipTest("cannot bind Unix socket: " + str(e)) self.assertTrue(P.is_socket()) self.assertFalse(P.is_fifo()) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -278,8 +278,14 @@ def clientRun(self, test_func): self.server_ready.wait() - self.clientSetUp() - self.client_ready.set() + try: + self.clientSetUp() + except BaseException as e: + self.queue.put(e) + self.clientTearDown() + return + finally: + self.client_ready.set() if self.server_crashed: self.clientTearDown() return @@ -520,8 +526,11 @@ self.serv_conn = self.cli def clientTearDown(self): - self.serv_conn.close() - self.serv_conn = None + try: + self.serv_conn.close() + self.serv_conn = None + except AttributeError: + pass super().clientTearDown() @@ -540,7 +549,7 @@ def bindSock(self, sock): path = tempfile.mktemp(dir=self.dir_path) - sock.bind(path) + support.bind_unix_socket(sock, path) self.addCleanup(support.unlink, path) class UnixStreamBase(UnixSocketTestBase): @@ -4649,7 +4658,7 @@ def bind(self, sock, path): # Bind the socket try: - sock.bind(path) + support.bind_unix_socket(sock, path) except OSError as e: if str(e) == "AF_UNIX path too long": self.skipTest( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -598,6 +598,9 @@ Tests ----- +- Issue #28683: Fix the tests that bind() a unix socket and raise + PermissionError on Android for a non-root user. + - Issue #26936: Fix the test_socket failures on Android - getservbyname(), getservbyport() and getaddrinfo() are broken on some Android API levels. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 05:55:22 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 14 Dec 2016 10:55:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4Njgz?= =?utf-8?q?=3A_Fix_the_tests_that_bind=28=29_a_unix_socket_and_raise_Permi?= =?utf-8?q?ssionError?= Message-ID: <20161214105521.117653.72775.1512AD3C@psf.io> https://hg.python.org/cpython/rev/b65ae19bc42a changeset: 105618:b65ae19bc42a branch: 3.6 parent: 105616:d1b400943483 user: Xavier de Gaye date: Wed Dec 14 11:52:28 2016 +0100 summary: Issue #28683: Fix the tests that bind() a unix socket and raise PermissionError on Android for a non-root user. files: Lib/test/support/__init__.py | 10 ++++++++++ Lib/test/test_asyncore.py | 4 +++- Lib/test/test_pathlib.py | 3 ++- Lib/test/test_socket.py | 21 +++++++++++++++------ Misc/NEWS | 3 +++ 5 files changed, 33 insertions(+), 8 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 @@ -96,6 +96,7 @@ "setswitchinterval", "android_not_root", # network "HOST", "IPV6_ENABLED", "find_unused_port", "bind_port", "open_urlresource", + "bind_unix_socket", # processes 'temp_umask', "reap_children", # logging @@ -708,6 +709,15 @@ port = sock.getsockname()[1] return port +def bind_unix_socket(sock, addr): + """Bind a unix socket, raising SkipTest if PermissionError is raised.""" + assert sock.family == socket.AF_UNIX + try: + sock.bind(addr) + except PermissionError: + sock.close() + raise unittest.SkipTest('cannot bind AF_UNIX sockets') + def _is_ipv6_enabled(): """Check whether IPv6 is enabled on this host.""" if socket.has_ipv6: diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -95,7 +95,9 @@ if HAS_UNIX_SOCKETS and sock.family == socket.AF_UNIX: # Make sure the path doesn't exist. support.unlink(addr) - sock.bind(addr) + support.bind_unix_socket(sock, addr) + else: + sock.bind(addr) class HelperFunctionTests(unittest.TestCase): 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 @@ -1888,7 +1888,8 @@ try: sock.bind(str(P)) except OSError as e: - if "AF_UNIX path too long" in str(e): + if (isinstance(e, PermissionError) or + "AF_UNIX path too long" in str(e)): self.skipTest("cannot bind Unix socket: " + str(e)) self.assertTrue(P.is_socket()) self.assertFalse(P.is_fifo()) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -278,8 +278,14 @@ def clientRun(self, test_func): self.server_ready.wait() - self.clientSetUp() - self.client_ready.set() + try: + self.clientSetUp() + except BaseException as e: + self.queue.put(e) + self.clientTearDown() + return + finally: + self.client_ready.set() if self.server_crashed: self.clientTearDown() return @@ -520,8 +526,11 @@ self.serv_conn = self.cli def clientTearDown(self): - self.serv_conn.close() - self.serv_conn = None + try: + self.serv_conn.close() + self.serv_conn = None + except AttributeError: + pass super().clientTearDown() @@ -540,7 +549,7 @@ def bindSock(self, sock): path = tempfile.mktemp(dir=self.dir_path) - sock.bind(path) + support.bind_unix_socket(sock, path) self.addCleanup(support.unlink, path) class UnixStreamBase(UnixSocketTestBase): @@ -4631,7 +4640,7 @@ def bind(self, sock, path): # Bind the socket try: - sock.bind(path) + support.bind_unix_socket(sock, path) except OSError as e: if str(e) == "AF_UNIX path too long": self.skipTest( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,9 @@ Tests ----- +- Issue #28683: Fix the tests that bind() a unix socket and raise + PermissionError on Android for a non-root user. + - Issue #26939: Add the support.setswitchinterval() function to fix test_functools hanging on the Android armv7 qemu emulator. -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Dec 14 10:06:29 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 14 Dec 2016 15:06:29 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-12-14 Message-ID: <494918cf-e074-4338-8671-b428da3787c9@irsmsx101.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-12-14 03:47:32 +0000 commit: 8359ee62dde3 previous commit: e414fb1640e0 revision date: 2016-12-11 03:51:44 +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.50% 3.47% 6.68% 5.34% :-) pybench 0.13% -0.10% 8.01% 3.82% :-| regex_v8 0.55% 0.09% 0.20% 10.23% :-) nbody 0.14% 0.06% 14.03% 2.34% :-| json_dump_v2 0.32% 0.02% 0.05% 8.88% :-| normal_startup 1.85% -0.20% -1.54% 2.40% :-| ssbench 0.12% 0.18% -0.03% 1.66% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-12-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 Wed Dec 14 10:07:17 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 14 Dec 2016 15:07:17 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-12-14 Message-ID: Results for project Python default, build date 2016-12-14 03:03:12 +0000 commit: 64afd5cab40a previous commit: 0d209cc7ffdc revision date: 2016-12-14 00:03:51 +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.16% 0.97% 1.65% 13.89% :-| pybench 0.13% 0.73% 1.38% 5.50% :-( regex_v8 3.82% -2.23% -1.38% 4.90% :-) nbody 0.17% 4.48% -0.75% 7.29% :-) json_dump_v2 0.28% 0.02% 8.48% 11.94% :-| normal_startup 0.88% -0.25% 0.37% 6.65% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-12-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 python-checkins at python.org Wed Dec 14 12:57:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 14 Dec 2016 17:57:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzUzMjI6?= =?utf-8?q?_Restored_tests_for_=5F=5Fnew=5F=5F=2E?= Message-ID: <20161214175714.125645.53474.922FBD07@psf.io> https://hg.python.org/cpython/rev/f89ef18f9824 changeset: 105620:f89ef18f9824 branch: 2.7 parent: 105615:58a5edf41144 user: Serhiy Storchaka date: Wed Dec 14 19:48:38 2016 +0200 summary: Issue #5322: Restored tests for __new__. files: Lib/test/test_descr.py | 99 ++++++++++++++++++++++++++++++ 1 files changed, 99 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3,6 +3,7 @@ import sys import types import unittest +import warnings import weakref from copy import deepcopy @@ -1550,6 +1551,86 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + @unittest.expectedFailure + def test_bad_new(self): + self.assertRaises(TypeError, object.__new__) + self.assertRaises(TypeError, object.__new__, '') + self.assertRaises(TypeError, list.__new__, object) + self.assertRaises(TypeError, object.__new__, list) + class C(object): + __new__ = list.__new__ + self.assertRaises(TypeError, C) + class C(list): + __new__ = object.__new__ + self.assertRaises(TypeError, C) + + def test_object_new(self): + class A(object): + pass + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A()) + self.assertRaises(TypeError, object.__init__, A(), 5) + + class A(object): + def __init__(self, foo): + self.foo = foo + object.__new__(A) + object.__new__(A, 5) + object.__init__(A(3)) + self.assertRaises(TypeError, object.__init__, A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + object.__new__(A) + self.assertRaises(TypeError, object.__new__, A, 5) + object.__init__(A(3)) + object.__init__(A(3), 5) + + class A(object): + def __new__(cls, foo): + return object.__new__(cls) + def __init__(self, foo): + self.foo = foo + object.__new__(A) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always', DeprecationWarning) + a = object.__new__(A, 5) + self.assertEqual(type(a), A) + self.assertEqual(len(w), 1) + object.__init__(A(3)) + a = A(3) + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always', DeprecationWarning) + object.__init__(a, 5) + self.assertEqual(a.foo, 3) + self.assertEqual(len(w), 1) + + @unittest.expectedFailure + def test_restored_object_new(self): + class A(object): + def __new__(cls, *args, **kwargs): + raise AssertionError + self.assertRaises(AssertionError, A) + class B(A): + __new__ = object.__new__ + def __init__(self, foo): + self.foo = foo + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + del B.__new__ + self.assertRaises(AssertionError, B) + del A.__new__ + with warnings.catch_warnings(): + warnings.simplefilter('error', DeprecationWarning) + b = B(3) + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, B) + def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3756,6 +3837,24 @@ self.assertEqual(isinstance(d, D), True) self.assertEqual(d.foo, 1) + class C(object): + @staticmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, 1, 2)) + + class C(object): + @classmethod + def __new__(*args): + return args + self.assertEqual(C(1, 2), (C, C, 1, 2)) + class D(C): + pass + self.assertEqual(D(1, 2), (D, D, 1, 2)) + def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 12:57:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 14 Dec 2016 17:57:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Revert_changes?= =?utf-8?q?et_1f31bf3f76f5_=28issue5322=29_except_tests=2E?= Message-ID: <20161214175714.9585.87026.9C5DDA9C@psf.io> https://hg.python.org/cpython/rev/06e4b9f2e4b0 changeset: 105621:06e4b9f2e4b0 branch: 3.5 parent: 105609:c3da1ee47e6b user: Serhiy Storchaka date: Wed Dec 14 19:52:17 2016 +0200 summary: Revert changeset 1f31bf3f76f5 (issue5322) except tests. files: Lib/test/test_descr.py | 2 ++ Misc/NEWS | 3 --- Objects/typeobject.c | 29 +---------------------------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1662,6 +1662,7 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + @unittest.expectedFailure def test_bad_new(self): self.assertRaises(TypeError, object.__new__) self.assertRaises(TypeError, object.__new__, '') @@ -1708,6 +1709,7 @@ object.__init__(A(3)) self.assertRaises(TypeError, object.__init__, A(3), 5) + @unittest.expectedFailure def test_restored_object_new(self): class A(object): def __new__(cls, *args, **kwargs): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,9 +13,6 @@ - Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). -- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. - Original patch by Andreas St?hrk. - - Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode astral characters. Patch by Xiang Zhang. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6798,34 +6798,7 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - PyObject *self = PyCFunction_GET_SELF(descr); - if (!self || !PyType_Check(self)) { - /* This should never happen because - tp_new_wrapper expects a type for self. - Use slot_tp_new which will call - tp_new_wrapper which will raise an - exception. */ - specific = (void *)slot_tp_new; - } - else { - PyTypeObject *staticbase; - specific = ((PyTypeObject *)self)->tp_new; - /* Check that the user does not do anything - silly and unsafe like object.__new__(dict). - To do this, we check that the most derived - base that's not a heap type is this type. */ - staticbase = type->tp_base; - while (staticbase && - (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - if (staticbase && - staticbase->tp_new != specific) - /* Seems to be unsafe, better use - slot_tp_new which will call - tp_new_wrapper which will raise an - exception if it is unsafe. */ - specific = (void *)slot_tp_new; - } + specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 12:57:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 14 Dec 2016 17:57:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgZnJvbSAzLjYu?= Message-ID: <20161214175715.117653.8084.114E56A2@psf.io> https://hg.python.org/cpython/rev/09a8ee0f7585 changeset: 105623:09a8ee0f7585 parent: 105619:0350e0634a4b parent: 105622:0ce789eae627 user: Serhiy Storchaka date: Wed Dec 14 19:56:53 2016 +0200 summary: Merge from 3.6. files: Lib/test/test_descr.py | 2 ++ Misc/NEWS | 3 --- Objects/typeobject.c | 29 +---------------------------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1662,6 +1662,7 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + @unittest.expectedFailure def test_bad_new(self): self.assertRaises(TypeError, object.__new__) self.assertRaises(TypeError, object.__new__, '') @@ -1708,6 +1709,7 @@ object.__init__(A(3)) self.assertRaises(TypeError, object.__init__, A(3), 5) + @unittest.expectedFailure def test_restored_object_new(self): class A(object): def __new__(cls, *args, **kwargs): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,9 +19,6 @@ - Issue #28918: Fix the cross compilation of xxlimited when Python has been built with Py_DEBUG defined. -- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. - Original patch by Andreas St?hrk. - - Issue #23722: Rather than silently producing a class that doesn't support zero-argument ``super()`` in methods, failing to pass the new ``__classcell__`` namespace entry up to ``type.__new__`` now results in a diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6847,34 +6847,7 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - PyObject *self = PyCFunction_GET_SELF(descr); - if (!self || !PyType_Check(self)) { - /* This should never happen because - tp_new_wrapper expects a type for self. - Use slot_tp_new which will call - tp_new_wrapper which will raise an - exception. */ - specific = (void *)slot_tp_new; - } - else { - PyTypeObject *staticbase; - specific = ((PyTypeObject *)self)->tp_new; - /* Check that the user does not do anything - silly and unsafe like object.__new__(dict). - To do this, we check that the most derived - base that's not a heap type is this type. */ - staticbase = type->tp_base; - while (staticbase && - (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - if (staticbase && - staticbase->tp_new != specific) - /* Seems to be unsafe, better use - slot_tp_new which will call - tp_new_wrapper which will raise an - exception if it is unsafe. */ - specific = (void *)slot_tp_new; - } + specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 12:57:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 14 Dec 2016 17:57:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_from_3=2E6=2E?= Message-ID: <20161214175714.125113.2799.6561320E@psf.io> https://hg.python.org/cpython/rev/0ce789eae627 changeset: 105622:0ce789eae627 branch: 3.6 parent: 105618:b65ae19bc42a parent: 105621:06e4b9f2e4b0 user: Serhiy Storchaka date: Wed Dec 14 19:54:38 2016 +0200 summary: Merge from 3.6. files: Lib/test/test_descr.py | 2 ++ Misc/NEWS | 3 --- Objects/typeobject.c | 29 +---------------------------- 3 files changed, 3 insertions(+), 31 deletions(-) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1662,6 +1662,7 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) + @unittest.expectedFailure def test_bad_new(self): self.assertRaises(TypeError, object.__new__) self.assertRaises(TypeError, object.__new__, '') @@ -1708,6 +1709,7 @@ object.__init__(A(3)) self.assertRaises(TypeError, object.__init__, A(3), 5) + @unittest.expectedFailure def test_restored_object_new(self): class A(object): def __new__(cls, *args, **kwargs): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,9 +22,6 @@ - Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. Improve speed of dict literal with constant keys up to 30%. -- Issue #5322: Fixed setting __new__ to a PyCFunction inside Python code. - Original patch by Andreas St?hrk. - Library ------- diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6878,34 +6878,7 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - PyObject *self = PyCFunction_GET_SELF(descr); - if (!self || !PyType_Check(self)) { - /* This should never happen because - tp_new_wrapper expects a type for self. - Use slot_tp_new which will call - tp_new_wrapper which will raise an - exception. */ - specific = (void *)slot_tp_new; - } - else { - PyTypeObject *staticbase; - specific = ((PyTypeObject *)self)->tp_new; - /* Check that the user does not do anything - silly and unsafe like object.__new__(dict). - To do this, we check that the most derived - base that's not a heap type is this type. */ - staticbase = type->tp_base; - while (staticbase && - (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - if (staticbase && - staticbase->tp_new != specific) - /* Seems to be unsafe, better use - slot_tp_new which will call - tp_new_wrapper which will raise an - exception if it is unsafe. */ - specific = (void *)slot_tp_new; - } + specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 14:22:32 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 14 Dec 2016 19:22:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Fixes_maximum_?= =?utf-8?q?usable_length_of_buffer_for_formatting_time_zone_in_localtime?= =?utf-8?b?KCku?= Message-ID: <20161214192232.12525.18457.61EB14F6@psf.io> https://hg.python.org/cpython/rev/70ae89898398 changeset: 105624:70ae89898398 branch: 3.6 parent: 105622:0ce789eae627 user: Steve Dower date: Wed Dec 14 11:22:05 2016 -0800 summary: Fixes maximum usable length of buffer for formatting time zone in localtime(). files: Modules/timemodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -398,7 +398,7 @@ struct tm local = buf; char zone[100]; int gmtoff; - strftime(zone, sizeof(buf), "%Z", &buf); + strftime(zone, sizeof(zone), "%Z", &buf); gmtoff = timegm(&buf) - when; return tmtotuple(&local, zone, gmtoff); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 14:22:32 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 14 Dec 2016 19:22:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Fixes_maximum_usable_length_of_buffer_for_formatting_tim?= =?utf-8?q?e_zone_in_localtime=28=29=2E?= Message-ID: <20161214192232.30448.96307.01A1CCDD@psf.io> https://hg.python.org/cpython/rev/5a61c1bc3df9 changeset: 105625:5a61c1bc3df9 parent: 105623:09a8ee0f7585 parent: 105624:70ae89898398 user: Steve Dower date: Wed Dec 14 11:22:14 2016 -0800 summary: Fixes maximum usable length of buffer for formatting time zone in localtime(). files: Modules/timemodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/timemodule.c b/Modules/timemodule.c --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -398,7 +398,7 @@ struct tm local = buf; char zone[100]; int gmtoff; - strftime(zone, sizeof(buf), "%Z", &buf); + strftime(zone, sizeof(zone), "%Z", &buf); gmtoff = timegm(&buf) - when; return tmtotuple(&local, zone, gmtoff); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 14:38:31 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 14 Dec 2016 19:38:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODQ5?= =?utf-8?q?=3A_Skip_test=5Fsysconfig=2Etest=5Ftriplet=5Fin=5Fext=5Fsuffix_?= =?utf-8?q?on_non_linux?= Message-ID: <20161214193830.39793.80011.553BE239@psf.io> https://hg.python.org/cpython/rev/ab3d870aa3bc changeset: 105626:ab3d870aa3bc branch: 3.6 parent: 105624:70ae89898398 user: Xavier de Gaye date: Wed Dec 14 20:37:10 2016 +0100 summary: Issue #28849: Skip test_sysconfig.test_triplet_in_ext_suffix on non linux platforms. files: Lib/test/test_sysconfig.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -385,7 +385,8 @@ self.assertIsNotNone(vars['SO']) self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) - @unittest.skipUnless(hasattr(sys.implementation, '_multiarch'), + @unittest.skipUnless(sys.platform == 'linux' and + hasattr(sys.implementation, '_multiarch'), 'multiarch-specific test') def test_triplet_in_ext_suffix(self): import ctypes, platform, re -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 14:38:31 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 14 Dec 2016 19:38:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4ODQ5OiBNZXJnZSAzLjYu?= Message-ID: <20161214193830.80503.64188.326A950D@psf.io> https://hg.python.org/cpython/rev/0ff181ca7558 changeset: 105627:0ff181ca7558 parent: 105625:5a61c1bc3df9 parent: 105626:ab3d870aa3bc user: Xavier de Gaye date: Wed Dec 14 20:37:53 2016 +0100 summary: Issue #28849: Merge 3.6. files: Lib/test/test_sysconfig.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -385,7 +385,8 @@ self.assertIsNotNone(vars['SO']) self.assertEqual(vars['SO'], vars['EXT_SUFFIX']) - @unittest.skipUnless(hasattr(sys.implementation, '_multiarch'), + @unittest.skipUnless(sys.platform == 'linux' and + hasattr(sys.implementation, '_multiarch'), 'multiarch-specific test') def test_triplet_in_ext_suffix(self): ctypes = import_module('ctypes') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 21:20:51 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 15 Dec 2016 02:20:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328919=3A_Simplify?= =?utf-8?q?_=5Fcopy=5Ffunc=5Fdetails=28=29_in_unittest=2Emock?= Message-ID: <20161215022051.24879.1641.193BD9C9@psf.io> https://hg.python.org/cpython/rev/bbdfde7958a8 changeset: 105628:bbdfde7958a8 user: Berker Peksag date: Thu Dec 15 05:21:44 2016 +0300 summary: Issue #28919: Simplify _copy_func_details() in unittest.mock Patch by Jiajun Huang. files: Lib/unittest/mock.py | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -104,26 +104,16 @@ def _copy_func_details(func, funcopy): - funcopy.__name__ = func.__name__ - funcopy.__doc__ = func.__doc__ - try: - funcopy.__text_signature__ = func.__text_signature__ - except AttributeError: - pass # we explicitly don't copy func.__dict__ into this copy as it would # expose original attributes that should be mocked - try: - funcopy.__module__ = func.__module__ - except AttributeError: - pass - try: - funcopy.__defaults__ = func.__defaults__ - except AttributeError: - pass - try: - funcopy.__kwdefaults__ = func.__kwdefaults__ - except AttributeError: - pass + for attribute in ( + '__name__', '__doc__', '__text_signature__', + '__module__', '__defaults__', '__kwdefaults__', + ): + try: + setattr(funcopy, attribute, getattr(func, attribute)) + except AttributeError: + pass def _callable(obj): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 21:37:54 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 15 Dec 2016 02:37:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328944=3A_Merge_from_3=2E6?= Message-ID: <20161215023754.1070.41948.DFB1B60E@psf.io> https://hg.python.org/cpython/rev/13b600dc4ee5 changeset: 105631:13b600dc4ee5 parent: 105628:bbdfde7958a8 parent: 105630:502f5d53fb4a user: Berker Peksag date: Thu Dec 15 05:38:46 2016 +0300 summary: Issue #28944: Merge from 3.6 files: Doc/library/stdtypes.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2160,7 +2160,7 @@ +------------+-----------------------------------------------------+-------+ | ``'o'`` | Signed octal value. | \(1) | +------------+-----------------------------------------------------+-------+ -| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(7) | +| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(6) | +------------+-----------------------------------------------------+-------+ | ``'x'`` | Signed hexadecimal (lowercase). | \(2) | +------------+-----------------------------------------------------+-------+ @@ -2225,8 +2225,7 @@ (5) If precision is ``N``, the output is truncated to ``N`` characters. - -(7) +(6) See :pep:`237`. Since Python strings have an explicit length, ``%s`` conversions do not assume -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 21:37:54 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 15 Dec 2016 02:37:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328944=3A_Merge_from_3=2E5?= Message-ID: <20161215023754.26597.76743.2EAA5E6B@psf.io> https://hg.python.org/cpython/rev/502f5d53fb4a changeset: 105630:502f5d53fb4a branch: 3.6 parent: 105626:ab3d870aa3bc parent: 105629:a89469328b78 user: Berker Peksag date: Thu Dec 15 05:38:25 2016 +0300 summary: Issue #28944: Merge from 3.5 files: Doc/library/stdtypes.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2160,7 +2160,7 @@ +------------+-----------------------------------------------------+-------+ | ``'o'`` | Signed octal value. | \(1) | +------------+-----------------------------------------------------+-------+ -| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(7) | +| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(6) | +------------+-----------------------------------------------------+-------+ | ``'x'`` | Signed hexadecimal (lowercase). | \(2) | +------------+-----------------------------------------------------+-------+ @@ -2225,8 +2225,7 @@ (5) If precision is ``N``, the output is truncated to ``N`` characters. - -(7) +(6) See :pep:`237`. Since Python strings have an explicit length, ``%s`` conversions do not assume -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 14 21:37:54 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 15 Dec 2016 02:37:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTQ0?= =?utf-8?q?=3A_Fix_footnote_numbering?= Message-ID: <20161215023753.18323.70815.01B70D67@psf.io> https://hg.python.org/cpython/rev/a89469328b78 changeset: 105629:a89469328b78 branch: 3.5 parent: 105621:06e4b9f2e4b0 user: Berker Peksag date: Thu Dec 15 05:37:56 2016 +0300 summary: Issue #28944: Fix footnote numbering files: Doc/library/stdtypes.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2154,7 +2154,7 @@ +------------+-----------------------------------------------------+-------+ | ``'o'`` | Signed octal value. | \(1) | +------------+-----------------------------------------------------+-------+ -| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(7) | +| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(6) | +------------+-----------------------------------------------------+-------+ | ``'x'`` | Signed hexadecimal (lowercase). | \(2) | +------------+-----------------------------------------------------+-------+ @@ -2219,8 +2219,7 @@ (5) If precision is ``N``, the output is truncated to ``N`` characters. - -(7) +(6) See :pep:`237`. Since Python strings have an explicit length, ``%s`` conversions do not assume -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 03:09:36 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 08:09:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogX2FzeW5jaW8gdXNl?= =?utf-8?q?s_=5FPyObject=5FCallMethodIdObjArgs=28=29?= Message-ID: <20161215080936.1325.50984.2CD8BC10@psf.io> https://hg.python.org/cpython/rev/f2745b64d8b7 changeset: 105632:f2745b64d8b7 branch: 3.6 parent: 105630:502f5d53fb4a user: Victor Stinner date: Thu Dec 15 09:05:11 2016 +0100 summary: _asyncio uses _PyObject_CallMethodIdObjArgs() Issue #28920: Replace _PyObject_CallMethodId(obj, meth, "O", arg) with _PyObject_CallMethodIdObjArgs(obj, meth, arg, NULL) to avoid _PyObject_CallMethodId() special case when arg is a tuple. If arg is a tuple, _PyObject_CallMethodId() unpacks the tuple: obj.meth(*arg). files: Modules/_asynciomodule.c | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1327,7 +1327,7 @@ return -1; } - res = _PyObject_CallMethodId(all_tasks, &PyId_add, "O", self, NULL); + res = _PyObject_CallMethodIdObjArgs(all_tasks, &PyId_add, self, NULL); if (res == NULL) { return -1; } @@ -1838,8 +1838,8 @@ } else { /* `task` is a subclass of Task */ - return _PyObject_CallMethodId( - (PyObject*)task, &PyId__wakeup, "O", fut, NULL); + return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__wakeup, + fut, NULL); } } @@ -1854,8 +1854,8 @@ if (arg == NULL) { arg = Py_None; } - return _PyObject_CallMethodId( - (PyObject*)task, &PyId__step, "O", arg, NULL); + return _PyObject_CallMethodIdObjArgs((PyObject*)task, &PyId__step, + arg, NULL); } } @@ -1869,8 +1869,8 @@ return -1; } - handle = _PyObject_CallMethodId( - task->task_loop, &PyId_call_soon, "O", cb, NULL); + handle = _PyObject_CallMethodIdObjArgs(task->task_loop, &PyId_call_soon, + cb, NULL); Py_DECREF(cb); if (handle == NULL) { return -1; @@ -2135,8 +2135,9 @@ if (wrapper == NULL) { goto fail; } - res = _PyObject_CallMethodId( - result, &PyId_add_done_callback, "O", wrapper, NULL); + res = _PyObject_CallMethodIdObjArgs(result, + &PyId_add_done_callback, + wrapper, NULL); Py_DECREF(wrapper); if (res == NULL) { goto fail; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 03:09:36 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 08:09:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_3=2E6?= Message-ID: <20161215080936.5206.46652.EB7EA015@psf.io> https://hg.python.org/cpython/rev/7eaf1fe31d2f changeset: 105633:7eaf1fe31d2f parent: 105631:13b600dc4ee5 parent: 105632:f2745b64d8b7 user: Victor Stinner date: Thu Dec 15 09:06:45 2016 +0100 summary: Null merge 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 03:15:26 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 08:15:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328838=3A_Cleanup_?= =?utf-8?q?abstract=2Eh?= Message-ID: <20161215081525.63556.7765.D12A212F@psf.io> https://hg.python.org/cpython/rev/654ec6ed3225 changeset: 105634:654ec6ed3225 user: Victor Stinner date: Thu Dec 15 09:14:25 2016 +0100 summary: Issue #28838: Cleanup abstract.h Rewrite all comments to use the same style than other Python header files: comment functions *before* their declaration, no newline between the comment and the declaration. Reformat some comments, add newlines, to make them easier to read. Quote argument like 'arg' to mention an argument in a comment. files: Include/abstract.h | 1046 ++++++++++++------------------- 1 files changed, 424 insertions(+), 622 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -4,14 +4,6 @@ extern "C" { #endif -#ifdef PY_SSIZE_T_CLEAN -# define PyObject_CallFunction _PyObject_CallFunction_SizeT -# define PyObject_CallMethod _PyObject_CallMethod_SizeT -# ifndef Py_LIMITED_API -# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT -# endif /* !Py_LIMITED_API */ -#endif - /* Abstract Object Interface (many thanks to Jim Fulton) */ /* @@ -134,136 +126,139 @@ /* Implemented elsewhere: -int PyObject_Print(PyObject *o, FILE *fp, int flags); + int PyObject_Print(PyObject *o, FILE *fp, int flags); -Print an object, o, on file, fp. Returns -1 on -error. The flags argument is used to enable certain printing -options. The only option currently supported is Py_Print_RAW. + Print an object 'o' on file 'fp'. Returns -1 on error. The flags argument + is used to enable certain printing options. The only option currently + supported is Py_Print_RAW. -(What should be said about Py_Print_RAW?) + (What should be said about Py_Print_RAW?). */ - */ /* Implemented elsewhere: -int PyObject_HasAttrString(PyObject *o, const char *attr_name); + int PyObject_HasAttrString(PyObject *o, const char *attr_name); -Returns 1 if o has the attribute attr_name, and 0 otherwise. -This is equivalent to the Python expression: -hasattr(o,attr_name). + Returns 1 if object 'o' has the attribute attr_name, and 0 otherwise. -This function always succeeds. + This is equivalent to the Python expression: hasattr(o,attr_name). - */ + This function always succeeds. */ + /* Implemented elsewhere: -PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); + PyObject* PyObject_GetAttrString(PyObject *o, const char *attr_name); -Retrieve an attributed named attr_name form object o. -Returns the attribute value on success, or NULL on failure. -This is the equivalent of the Python expression: o.attr_name. + Retrieve an attributed named attr_name form object o. + Returns the attribute value on success, or NULL on failure. - */ + This is the equivalent of the Python expression: o.attr_name. */ + /* Implemented elsewhere: -int PyObject_HasAttr(PyObject *o, PyObject *attr_name); + int PyObject_HasAttr(PyObject *o, PyObject *attr_name); -Returns 1 if o has the attribute attr_name, and 0 otherwise. -This is equivalent to the Python expression: -hasattr(o,attr_name). + Returns 1 if o has the attribute attr_name, and 0 otherwise. -This function always succeeds. + This is equivalent to the Python expression: hasattr(o,attr_name). - */ + This function always succeeds. */ /* Implemented elsewhere: -PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); + PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); -Retrieve an attributed named attr_name form object o. -Returns the attribute value on success, or NULL on failure. -This is the equivalent of the Python expression: o.attr_name. + Retrieve an attributed named 'attr_name' form object 'o'. + Returns the attribute value on success, or NULL on failure. - */ + This is the equivalent of the Python expression: o.attr_name. */ /* Implemented elsewhere: -int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); + int PyObject_SetAttrString(PyObject *o, const char *attr_name, PyObject *v); -Set the value of the attribute named attr_name, for object o, -to the value v. Raise an exception and return -1 on failure; return 0 on -success. This is the equivalent of the Python statement o.attr_name=v. + Set the value of the attribute named attr_name, for object 'o', + to the value 'v'. Raise an exception and return -1 on failure; return 0 on + success. - */ + This is the equivalent of the Python statement o.attr_name=v. */ + /* Implemented elsewhere: -int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); + int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); -Set the value of the attribute named attr_name, for object o, -to the value v. Raise an exception and return -1 on failure; return 0 on -success. This is the equivalent of the Python statement o.attr_name=v. + Set the value of the attribute named attr_name, for object 'o', to the value + 'v'. an exception and return -1 on failure; return 0 on success. - */ + This is the equivalent of the Python statement o.attr_name=v. */ -/* implemented as a macro: +/* Implemented as a macro: -int PyObject_DelAttrString(PyObject *o, const char *attr_name); + int PyObject_DelAttrString(PyObject *o, const char *attr_name); -Delete attribute named attr_name, for object o. Returns --1 on failure. This is the equivalent of the Python -statement: del o.attr_name. + Delete attribute named attr_name, for object o. Returns + -1 on failure. - */ -#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL) + This is the equivalent of the Python statement: del o.attr_name. */ +#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A), NULL) -/* implemented as a macro: -int PyObject_DelAttr(PyObject *o, PyObject *attr_name); +/* Implemented as a macro: -Delete attribute named attr_name, for object o. Returns -1 -on failure. This is the equivalent of the Python -statement: del o.attr_name. + int PyObject_DelAttr(PyObject *o, PyObject *attr_name); - */ -#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) + Delete attribute named attr_name, for object o. Returns -1 + on failure. This is the equivalent of the Python + statement: del o.attr_name. */ +#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A), NULL) + /* Implemented elsewhere: -PyObject *PyObject_Repr(PyObject *o); + PyObject *PyObject_Repr(PyObject *o); -Compute the string representation of object, o. Returns the -string representation on success, NULL on failure. This is -the equivalent of the Python expression: repr(o). + Compute the string representation of object 'o'. Returns the + string representation on success, NULL on failure. -Called by the repr() built-in function. + This is the equivalent of the Python expression: repr(o). - */ + Called by the repr() built-in function. */ + /* Implemented elsewhere: -PyObject *PyObject_Str(PyObject *o); + PyObject *PyObject_Str(PyObject *o); -Compute the string representation of object, o. Returns the -string representation on success, NULL on failure. This is -the equivalent of the Python expression: str(o).) + Compute the string representation of object, o. Returns the + string representation on success, NULL on failure. -Called by the str() and print() built-in functions. + This is the equivalent of the Python expression: str(o). - */ + Called by the str() and print() built-in functions. */ - /* Declared elsewhere -PyAPI_FUNC(int) PyCallable_Check(PyObject *o); +/* Declared elsewhere -Determine if the object, o, is callable. Return 1 if the -object is callable and 0 otherwise. + PyAPI_FUNC(int) PyCallable_Check(PyObject *o); -This function always succeeds. - */ + Determine if the object, o, is callable. Return 1 if the object is callable + and 0 otherwise. + + This function always succeeds. */ + + +#ifdef PY_SSIZE_T_CLEAN +# define PyObject_CallFunction _PyObject_CallFunction_SizeT +# define PyObject_CallMethod _PyObject_CallMethod_SizeT +# ifndef Py_LIMITED_API +# define _PyObject_CallMethodId _PyObject_CallMethodId_SizeT +# endif /* !Py_LIMITED_API */ +#endif + /* Call a callable Python object 'callable' with arguments given by the tuple 'args' and keywords arguments given by the dictionary 'kwargs'. @@ -276,7 +271,6 @@ PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs); - #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject*) _PyStack_AsTuple( PyObject **stack, @@ -285,9 +279,9 @@ /* Convert keyword arguments from the (stack, kwnames) format to a Python dictionary. - kwnames must only contains str strings, no subclass, and all keys must - be unique. kwnames is not checked, usually these checks are done before or later - calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an + kwnames must only contains str strings, no subclass, and all keys must be + unique. kwnames is not checked, usually these checks are done before or + later calling _PyStack_AsDict(). For example, _PyArg_ParseStack() raises an error if a key is not a string. */ PyAPI_FUNC(PyObject *) _PyStack_AsDict( PyObject **values, @@ -369,7 +363,7 @@ Returns the result of the call on success, or *NULL* on failure. This is the equivalent of the Python expression: - callable(*args) */ + callable(*args). */ PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable, PyObject *args); @@ -382,7 +376,7 @@ Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: - callable(arg1, arg2, ...) */ + callable(arg1, arg2, ...). */ PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable, const char *format, ...); @@ -394,20 +388,17 @@ Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: - obj.name(arg1, arg2, ...) */ + obj.name(arg1, arg2, ...). */ PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...); #ifndef Py_LIMITED_API +/* Like PyObject_CallMethod(), but expect a _Py_Identifier* + as the method name. */ PyAPI_FUNC(PyObject *) _PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, const char *format, ...); - -/* - Like PyObject_CallMethod, but expect a _Py_Identifier* as the - method name. -*/ #endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, @@ -433,23 +424,25 @@ Returns the result of the call on success, or NULL on failure. This is the equivalent of the Python expression: - callable(arg1, arg2, ...) */ + callable(arg1, arg2, ...). */ PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, ...); #ifndef Py_LIMITED_API +/* Similar PyObject_CallFunctionObjArgs(), but pass positional arguments + as a va_list: list of PyObject* object. */ PyAPI_FUNC(PyObject *) _PyObject_VaCallFunctionObjArgs( PyObject *callable, va_list vargs); #endif - /* -Call the method named 'name' of object 'obj' with a variable number of -C arguments. The C arguments are provided as PyObject * -values, terminated by NULL. Returns the result of the call -on success, or NULL on failure. This is the equivalent of -the Python expression: obj.name(args). - */ +/* Call the method named 'name' of object 'obj' with a variable number of + C arguments. The C arguments are provided as PyObject* values, terminated + by NULL. + + Returns the result of the call on success, or NULL on failure. + + This is the equivalent of the Python expression: obj.name(*args). */ PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs( PyObject *obj, @@ -466,190 +459,166 @@ /* Implemented elsewhere: -long PyObject_Hash(PyObject *o); + long PyObject_Hash(PyObject *o); -Compute and return the hash, hash_value, of an object, o. On -failure, return -1. This is the equivalent of the Python -expression: hash(o). - */ + Compute and return the hash, hash_value, of an object, o. On + failure, return -1. + + This is the equivalent of the Python expression: hash(o). */ /* Implemented elsewhere: -int PyObject_IsTrue(PyObject *o); + int PyObject_IsTrue(PyObject *o); -Returns 1 if the object, o, is considered to be true, 0 if o is -considered to be false and -1 on failure. This is equivalent to the -Python expression: not not o - */ + Returns 1 if the object, o, is considered to be true, 0 if o is + considered to be false and -1 on failure. + + This is equivalent to the Python expression: not not o. */ + /* Implemented elsewhere: -int PyObject_Not(PyObject *o); + int PyObject_Not(PyObject *o); -Returns 0 if the object, o, is considered to be true, 1 if o is -considered to be false and -1 on failure. This is equivalent to the -Python expression: not o - */ + Returns 0 if the object, o, is considered to be true, 1 if o is + considered to be false and -1 on failure. + This is equivalent to the Python expression: not o. */ + + +/* Get the type of an object. + + On success, returns a type object corresponding to the object type of object + 'o'. On failure, returns NULL. + + This is equivalent to the Python expression: type(o) */ PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); - /* -On success, returns a type object corresponding to the object -type of object o. On failure, returns NULL. This is -equivalent to the Python expression: type(o). - */ +/* Return the size of object 'o'. If the object 'o' provides both sequence and + mapping protocols, the sequence size is returned. + + On error, -1 is returned. + + This is the equivalent to the Python expression: len(o) */ PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); - /* -Return the size of object o. If the object, o, provides -both sequence and mapping protocols, the sequence size is -returned. On error, -1 is returned. This is the equivalent -to the Python expression: len(o). - */ /* For DLL compatibility */ #undef PyObject_Length PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); #define PyObject_Length PyObject_Size + #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyObject_HasLen(PyObject *o); + +/* Guess the size of object 'o' using len(o) or o.__length_hint__(). + If neither of those return a non-negative value, then return the default + value. If one of the calls fails, this function returns -1. */ PyAPI_FUNC(Py_ssize_t) PyObject_LengthHint(PyObject *o, Py_ssize_t); #endif - /* -Guess the size of object o using len(o) or o.__length_hint__(). -If neither of those return a non-negative value, then return the -default value. If one of the calls fails, this function returns -1. - */ +/* Return element of 'o' corresponding to the object 'key'. Return NULL + on failure. + This is the equivalent of the Python expression: o[key] */ PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); - /* -Return element of o corresponding to the object, key, or NULL -on failure. This is the equivalent of the Python expression: -o[key]. - */ +/* Map the object 'key' to the value 'v' into 'o'. + + Raise an exception and return -1 on failure; return 0 on success. + + This is the equivalent of the Python statement: o[key]=v. */ PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); - /* -Map the object key to the value v. Raise an exception and return -1 -on failure; return 0 on success. This is the equivalent of the Python -statement o[key]=v. - */ +/* Remove the mapping for object, key, from the object 'o'. + Returns -1 on failure. + This is equivalent to the Python statement: del o[key]. */ PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, const char *key); - /* -Remove the mapping for object, key, from the object *o. -Returns -1 on failure. This is equivalent to -the Python statement: del o[key]. - */ +/* Delete the mapping for key from object 'o'. Returns -1 on failure. + This is the equivalent of the Python statement: del o[key]. */ PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); - /* -Delete the mapping for key from *o. Returns -1 on failure. -This is the equivalent of the Python statement: del o[key]. - */ -/* old buffer API - FIXME: usage of these should all be replaced in Python itself +/* === Old Buffer API ============================================ */ + +/* FIXME: usage of these should all be replaced in Python itself but for backwards compatibility we will implement them. Their usage without a corresponding "unlock" mechanism may create issues (but they would already be there). */ +/* Takes an arbitrary object which must support the (character, single segment) + buffer interface and returns a pointer to a read-only memory location + useable as character based input for subsequent processing. + + Return 0 on success. buffer and buffer_len are only set in case no error + occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, const char **buffer, Py_ssize_t *buffer_len) Py_DEPRECATED(3.0); - /* -Takes an arbitrary object which must support the (character, -single segment) buffer interface and returns a pointer to a -read-only memory location useable as character based input -for subsequent processing. +/* Checks whether an arbitrary object supports the (character, single segment) + buffer interface. -0 is returned on success. buffer and buffer_len are only -set in case no error occurs. Otherwise, -1 is returned and -an exception set. - */ - + Returns 1 on success, 0 on failure. */ PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj) Py_DEPRECATED(3.0); -/* -Checks whether an arbitrary object supports the (character, -single segment) buffer interface. Returns 1 on success, 0 -on failure. -*/ +/* Same as PyObject_AsCharBuffer() except that this API expects (readable, + single segment) buffer interface and returns a pointer to a read-only memory + location which can contain arbitrary data. + 0 is returned on success. buffer and buffer_len are only set in case no + error occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, const void **buffer, Py_ssize_t *buffer_len) Py_DEPRECATED(3.0); - /* -Same as PyObject_AsCharBuffer() except that this API expects -(readable, single segment) buffer interface and returns a -pointer to a read-only memory location which can contain -arbitrary data. +/* Takes an arbitrary object which must support the (writable, single segment) + buffer interface and returns a pointer to a writable memory location in + buffer of size 'buffer_len'. -0 is returned on success. buffer and buffer_len are only -set in case no error occurs. Otherwise, -1 is returned and -an exception set. - */ - + Return 0 on success. buffer and buffer_len are only set in case no error + occurs. Otherwise, -1 is returned and an exception set. */ PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len) Py_DEPRECATED(3.0); - /* -Takes an arbitrary object which must support the (writable, -single segment) buffer interface and returns a pointer to a -writable memory location in buffer of size buffer_len. -0 is returned on success. buffer and buffer_len are only -set in case no error occurs. Otherwise, -1 is returned and -an exception set. - */ - -/* new buffer API */ +/* === New Buffer API ============================================ */ #ifndef Py_LIMITED_API + +/* Return 1 if the getbuffer function is available, otherwise return 0. */ #define PyObject_CheckBuffer(obj) \ (((obj)->ob_type->tp_as_buffer != NULL) && \ ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) -/* Return 1 if the getbuffer function is available, otherwise - return 0 */ +/* This is a C-API version of the getbuffer function call. It checks + to make sure object has the required function pointer and issues the + call. + Returns -1 and raises an error on failure and returns 0 on success. */ PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -/* This is a C-API version of the getbuffer function call. It checks - to make sure object has the required function pointer and issues the - call. Returns -1 and raises an error on failure and returns 0 on - success -*/ - +/* Get the memory area pointed to by the indices for the buffer given. + Note that view->ndim is the assumed size of indices. */ PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); -/* Get the memory area pointed to by the indices for the buffer given. - Note that view->ndim is the assumed size of indices -*/ - +/* Return the implied itemsize of the data-format area from a + struct-style description. */ PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); -/* Return the implied itemsize of the data-format area from a - struct-style description */ - - - /* Implementation in memoryobject.c */ PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char order); @@ -657,7 +626,6 @@ PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char order); - /* Copy len bytes of data from the contiguous chunk of memory pointed to by buf into the buffer exported by obj. Return 0 on success and return -1 and raise a PyBuffer_Error on @@ -670,703 +638,537 @@ fort is 'C', then the data will be copied into the array in C-style (last dimension varies the fastest). If fort is 'A', then it does not matter and the copy will be made - in whatever way is more efficient. - -*/ - + in whatever way is more efficient. */ PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); -/* Copy the data from the src buffer to the buffer of destination - */ - +/* Copy the data from the src buffer to the buffer of destination. */ PyAPI_FUNC(int) PyBuffer_IsContiguous(const Py_buffer *view, char fort); - +/*Fill the strides array with byte-strides of a contiguous + (Fortran-style if fort is 'F' or C-style otherwise) + array of the given shape with the given number of bytes + per element. */ PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char fort); -/* Fill the strides array with byte-strides of a contiguous - (Fortran-style if fort is 'F' or C-style otherwise) - array of the given shape with the given number of bytes - per element. -*/ +/* Fills in a buffer-info structure correctly for an exporter + that can only share a contiguous chunk of memory of + "unsigned bytes" of the given length. + Returns 0 on success and -1 (with raising an error) on error. */ PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, Py_ssize_t len, int readonly, int flags); -/* Fills in a buffer-info structure correctly for an exporter - that can only share a contiguous chunk of memory of - "unsigned bytes" of the given length. Returns 0 on success - and -1 (with raising an error) on error. - */ - +/* Releases a Py_buffer obtained from getbuffer ParseTuple's "s*". */ PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); -/* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. - */ #endif /* Py_LIMITED_API */ -PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, +/* Takes an arbitrary object and returns the result of calling + obj.__format__(format_spec). */ +PyAPI_FUNC(PyObject *) PyObject_Format(PyObject *obj, PyObject *format_spec); - /* -Takes an arbitrary object and returns the result of -calling obj.__format__(format_spec). - */ -/* Iterators */ +/* ==== Iterators ================================================ */ + +/* Takes an object and returns an iterator for it. + This is typically a new iterator but if the argument is an iterator, this + returns itself. */ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); - /* Takes an object and returns an iterator for it. -This is typically a new iterator but if the argument -is an iterator, this returns itself. */ #define PyIter_Check(obj) \ ((obj)->ob_type->tp_iternext != NULL && \ (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) +/* Takes an iterator object and calls its tp_iternext slot, + returning the next value. + + If the iterator is exhausted, this returns NULL without setting an + exception. + + NULL with an exception means an error occurred. */ PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); - /* Takes an iterator object and calls its tp_iternext slot, -returning the next value. If the iterator is exhausted, -this returns NULL without setting an exception. -NULL with an exception means an error occurred. */ /* === Number Protocol ================================================== */ +/* Returns 1 if the object 'o' provides numeric protocols, and 0 otherwise. + + This function always succeeds. */ PyAPI_FUNC(int) PyNumber_Check(PyObject *o); - /* -Returns 1 if the object, o, provides numeric protocols, and -false otherwise. +/* Returns the result of adding o1 and o2, or NULL on failure. -This function always succeeds. - */ - + This is the equivalent of the Python expression: o1 + o2. */ PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); - /* -Returns the result of adding o1 and o2, or null on failure. -This is the equivalent of the Python expression: o1+o2. - */ +/* Returns the result of subtracting o2 from o1, or NULL on failure. + This is the equivalent of the Python expression: o1 - o2. */ PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); - /* -Returns the result of subtracting o2 from o1, or null on -failure. This is the equivalent of the Python expression: -o1-o2. - */ +/* Returns the result of multiplying o1 and o2, or NULL on failure. + This is the equivalent of the Python expression: o1 * o2. */ PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); - /* -Returns the result of multiplying o1 and o2, or null on -failure. This is the equivalent of the Python expression: -o1*o2. - */ - +/* This is the equivalent of the Python expression: o1 @ o2. */ PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); - /* -This is the equivalent of the Python expression: o1 @ o2. - */ +/* Returns the result of dividing o1 by o2 giving an integral result, + or NULL on failure. + This is the equivalent of the Python expression: o1 // o2. */ PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); - /* -Returns the result of dividing o1 by o2 giving an integral result, -or null on failure. -This is the equivalent of the Python expression: o1//o2. - */ +/* Returns the result of dividing o1 by o2 giving a float result, or NULL on + failure. + This is the equivalent of the Python expression: o1 / o2. */ PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); - /* -Returns the result of dividing o1 by o2 giving a float result, -or null on failure. -This is the equivalent of the Python expression: o1/o2. - */ +/* Returns the remainder of dividing o1 by o2, or NULL on failure. + This is the equivalent of the Python expression: o1 % o2. */ PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); - /* -Returns the remainder of dividing o1 by o2, or null on -failure. This is the equivalent of the Python expression: -o1%o2. - */ +/* See the built-in function divmod. + Returns NULL on failure. + + This is the equivalent of the Python expression: divmod(o1, o2). */ PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); - /* -See the built-in function divmod. Returns NULL on failure. -This is the equivalent of the Python expression: -divmod(o1,o2). - */ +/* See the built-in function pow. Returns NULL on failure. + This is the equivalent of the Python expression: pow(o1, o2, o3), + where o3 is optional. */ PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, PyObject *o3); - /* -See the built-in function pow. Returns NULL on failure. -This is the equivalent of the Python expression: -pow(o1,o2,o3), where o3 is optional. - */ +/* Returns the negation of o on success, or NULL on failure. + This is the equivalent of the Python expression: -o. */ PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); - /* -Returns the negation of o on success, or null on failure. -This is the equivalent of the Python expression: -o. - */ +/* Returns the positive of o on success, or NULL on failure. + This is the equivalent of the Python expression: +o. */ PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); - /* -Returns the (what?) of o on success, or NULL on failure. -This is the equivalent of the Python expression: +o. - */ +/* Returns the absolute value of 'o', or NULL on failure. + This is the equivalent of the Python expression: abs(o). */ PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); - /* -Returns the absolute value of o, or null on failure. This is -the equivalent of the Python expression: abs(o). - */ +/* Returns the bitwise negation of 'o' on success, or NULL on failure. + This is the equivalent of the Python expression: ~o. */ PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); - /* -Returns the bitwise negation of o on success, or NULL on -failure. This is the equivalent of the Python expression: -~o. - */ +/* Returns the result of left shifting o1 by o2 on success, or NULL on failure. + This is the equivalent of the Python expression: o1 << o2. */ PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); - /* -Returns the result of left shifting o1 by o2 on success, or -NULL on failure. This is the equivalent of the Python -expression: o1 << o2. - */ +/* Returns the result of right shifting o1 by o2 on success, or NULL on + failure. + This is the equivalent of the Python expression: o1 >> o2. */ PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); - /* -Returns the result of right shifting o1 by o2 on success, or -NULL on failure. This is the equivalent of the Python -expression: o1 >> o2. - */ +/* Returns the result of bitwise and of o1 and o2 on success, or NULL on + failure. + This is the equivalent of the Python expression: o1 & o2. */ PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); - /* -Returns the result of bitwise and of o1 and o2 on success, or -NULL on failure. This is the equivalent of the Python -expression: o1&o2. +/* Returns the bitwise exclusive or of o1 by o2 on success, or NULL on failure. - */ - + This is the equivalent of the Python expression: o1 ^ o2. */ PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); - /* -Returns the bitwise exclusive or of o1 by o2 on success, or -NULL on failure. This is the equivalent of the Python -expression: o1^o2. - */ +/* Returns the result of bitwise or on o1 and o2 on success, or NULL on + failure. + This is the equivalent of the Python expression: o1 | o2. */ PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); - /* -Returns the result of bitwise or on o1 and o2 on success, or -NULL on failure. This is the equivalent of the Python -expression: o1|o2. - */ +#define PyIndex_Check(obj) \ + ((obj)->ob_type->tp_as_number != NULL && \ + (obj)->ob_type->tp_as_number->nb_index != NULL) -#define PyIndex_Check(obj) \ - ((obj)->ob_type->tp_as_number != NULL && \ - (obj)->ob_type->tp_as_number->nb_index != NULL) - +/* Returns the object 'o' converted to a Python int, or NULL with an exception + raised on failure. */ PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); - /* -Returns the object converted to a Python int -or NULL with an error raised on failure. - */ +/* Returns the object 'o' converted to Py_ssize_t by going through + PyNumber_Index() first. + If an overflow error occurs while converting the int to Py_ssize_t, then the + second argument 'exc' is the error-type to return. If it is NULL, then the + overflow error is cleared and the value is clipped. */ PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); - /* -Returns the object converted to Py_ssize_t by going through -PyNumber_Index first. If an overflow error occurs while -converting the int to Py_ssize_t, then the second argument -is the error-type to return. If it is NULL, then the overflow error -is cleared and the value is clipped. - */ +/* Returns the object 'o' converted to an integer object on success, or NULL + on failure. + This is the equivalent of the Python expression: int(o). */ PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); - /* -Returns the o converted to an integer object on success, or -NULL on failure. This is the equivalent of the Python -expression: int(o). - */ +/* Returns the object 'o' converted to a float object on success, or NULL + on failure. + This is the equivalent of the Python expression: float(o). */ PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); - /* -Returns the o converted to a float object on success, or NULL -on failure. This is the equivalent of the Python expression: -float(o). - */ +/* --- In-place variants of (some of) the above number protocol functions -- */ -/* In-place variants of (some of) the above number protocol functions */ +/* Returns the result of adding o2 to o1, possibly in-place, or NULL + on failure. + This is the equivalent of the Python expression: o1 += o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); - /* -Returns the result of adding o2 to o1, possibly in-place, or null -on failure. This is the equivalent of the Python expression: -o1 += o2. - */ +/* Returns the result of subtracting o2 from o1, possibly in-place or + NULL on failure. + This is the equivalent of the Python expression: o1 -= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); - /* -Returns the result of subtracting o2 from o1, possibly in-place or -null on failure. This is the equivalent of the Python expression: -o1 -= o2. - */ +/* Returns the result of multiplying o1 by o2, possibly in-place, or NULL on + failure. + This is the equivalent of the Python expression: o1 *= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); - /* -Returns the result of multiplying o1 by o2, possibly in-place, or -null on failure. This is the equivalent of the Python expression: -o1 *= o2. - */ - +/* This is the equivalent of the Python expression: o1 @= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); - /* -This is the equivalent of the Python expression: o1 @= o2. - */ +/* Returns the result of dividing o1 by o2 giving an integral result, possibly + in-place, or NULL on failure. + This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2); - /* -Returns the result of dividing o1 by o2 giving an integral result, -possibly in-place, or null on failure. -This is the equivalent of the Python expression: -o1 /= o2. - */ +/* Returns the result of dividing o1 by o2 giving a float result, possibly + in-place, or null on failure. + This is the equivalent of the Python expression: o1 /= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, PyObject *o2); - /* -Returns the result of dividing o1 by o2 giving a float result, -possibly in-place, or null on failure. -This is the equivalent of the Python expression: -o1 /= o2. - */ +/* Returns the remainder of dividing o1 by o2, possibly in-place, or NULL on + failure. + This is the equivalent of the Python expression: o1 %= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); - /* -Returns the remainder of dividing o1 by o2, possibly in-place, or -null on failure. This is the equivalent of the Python expression: -o1 %= o2. - */ +/* Returns the result of raising o1 to the power of o2, possibly in-place, + or NULL on failure. + This is the equivalent of the Python expression: o1 **= o2, + or o1 = pow(o1, o2, o3) if o3 is present. */ PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject *o3); - /* -Returns the result of raising o1 to the power of o2, possibly -in-place, or null on failure. This is the equivalent of the Python -expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. - */ +/* Returns the result of left shifting o1 by o2, possibly in-place, or NULL + on failure. + This is the equivalent of the Python expression: o1 <<= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); - /* -Returns the result of left shifting o1 by o2, possibly in-place, or -null on failure. This is the equivalent of the Python expression: -o1 <<= o2. - */ +/* Returns the result of right shifting o1 by o2, possibly in-place or NULL + on failure. + This is the equivalent of the Python expression: o1 >>= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); - /* -Returns the result of right shifting o1 by o2, possibly in-place or -null on failure. This is the equivalent of the Python expression: -o1 >>= o2. - */ +/* Returns the result of bitwise and of o1 and o2, possibly in-place, or NULL + on failure. + This is the equivalent of the Python expression: o1 &= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); - /* -Returns the result of bitwise and of o1 and o2, possibly in-place, -or null on failure. This is the equivalent of the Python -expression: o1 &= o2. - */ +/* Returns the bitwise exclusive or of o1 by o2, possibly in-place, or NULL + on failure. + This is the equivalent of the Python expression: o1 ^= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); - /* -Returns the bitwise exclusive or of o1 by o2, possibly in-place, or -null on failure. This is the equivalent of the Python expression: -o1 ^= o2. - */ +/* Returns the result of bitwise or of o1 and o2, possibly in-place, + or NULL on failure. + This is the equivalent of the Python expression: o1 |= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); - /* -Returns the result of bitwise or of o1 and o2, possibly in-place, -or null on failure. This is the equivalent of the Python -expression: o1 |= o2. - */ +/* Returns the integer n converted to a string with a base, with a base + marker of 0b, 0o or 0x prefixed if applicable. + If n is not an int object, it is converted with PyNumber_Index first. */ PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); - /* -Returns the integer n converted to a string with a base, with a base -marker of 0b, 0o or 0x prefixed if applicable. -If n is not an int object, it is converted with PyNumber_Index first. - */ - /* === Sequence protocol ================================================ */ +/* Return 1 if the object provides sequence protocol, and zero + otherwise. + + This function always succeeds. */ PyAPI_FUNC(int) PySequence_Check(PyObject *o); - /* -Return 1 if the object provides sequence protocol, and zero -otherwise. - -This function always succeeds. - */ - +/* Return the size of sequence object o, or -1 on failure. */ PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); - /* -Return the size of sequence object o, or -1 on failure. - */ - /* For DLL compatibility */ #undef PySequence_Length - PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); +PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); #define PySequence_Length PySequence_Size +/* Return the concatenation of o1 and o2 on success, and NULL on failure. + + This is the equivalent of the Python expression: o1 + o2. */ PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); - /* -Return the concatenation of o1 and o2 on success, and NULL on -failure. This is the equivalent of the Python -expression: o1+o2. - */ +/* Return the result of repeating sequence object 'o' 'count' times, + or NULL on failure. + This is the equivalent of the Python expression: o * count. */ PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); - /* -Return the result of repeating sequence object o count times, -or NULL on failure. This is the equivalent of the Python -expression: o1*count. - */ +/* Return the ith element of o, or NULL on failure. + This is the equivalent of the Python expression: o[i]. */ PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); - /* -Return the ith element of o, or NULL on failure. This is the -equivalent of the Python expression: o[i]. - */ +/* Return the slice of sequence object o between i1 and i2, or NULL on failure. + This is the equivalent of the Python expression: o[i1:i2]. */ PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); - /* -Return the slice of sequence object o between i1 and i2, or -NULL on failure. This is the equivalent of the Python -expression: o[i1:i2]. - */ +/* Assign object 'v' to the ith element of the sequence 'o'. Raise an exception + and return -1 on failure; return 0 on success. + This is the equivalent of the Python statement o[i] = v. */ PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); - /* -Assign object v to the ith element of o. Raise an exception and return --1 on failure; return 0 on success. This is the equivalent of the -Python statement o[i]=v. - */ +/* Delete the 'i'-th element of the sequence 'v'. Returns -1 on failure. + This is the equivalent of the Python statement: del o[i]. */ PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); - /* -Delete the ith element of object v. Returns --1 on failure. This is the equivalent of the Python -statement: del o[i]. - */ +/* Assign the sequence object 'v' to the slice in sequence object 'o', + from 'i1' to 'i2'. Returns -1 on failure. + This is the equivalent of the Python statement: o[i1:i2] = v. */ PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, PyObject *v); - /* -Assign the sequence object, v, to the slice in sequence -object, o, from i1 to i2. Returns -1 on failure. This is the -equivalent of the Python statement: o[i1:i2]=v. - */ +/* Delete the slice in sequence object 'o' from 'i1' to 'i2'. + Returns -1 on failure. + This is the equivalent of the Python statement: del o[i1:i2]. */ PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); - /* -Delete the slice in sequence object, o, from i1 to i2. -Returns -1 on failure. This is the equivalent of the Python -statement: del o[i1:i2]. - */ +/* Returns the sequence 'o' as a tuple on success, and NULL on failure. + This is equivalent to the Python expression: tuple(o). */ PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); - /* -Returns the sequence, o, as a tuple on success, and NULL on failure. -This is equivalent to the Python expression: tuple(o) - */ +/* Returns the sequence 'o' as a list on success, and NULL on failure. + This is equivalent to the Python expression: list(o) */ +PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); +/* Return the sequence 'o' as a list, unless it's already a tuple or list. -PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); - /* -Returns the sequence, o, as a list on success, and NULL on failure. -This is equivalent to the Python expression: list(o) - */ + Use PySequence_Fast_GET_ITEM to access the members of this list, and + PySequence_Fast_GET_SIZE to get its length. + Returns NULL on failure. If the object does not support iteration, raises a + TypeError exception with 'm' as the message text. */ PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); - /* -Return the sequence, o, as a list, unless it's already a -tuple or list. Use PySequence_Fast_GET_ITEM to access the -members of this list, and PySequence_Fast_GET_SIZE to get its length. -Returns NULL on failure. If the object does not support iteration, -raises a TypeError exception with m as the message text. - */ - +/* Return the size of the sequence 'o', assuming that 'o' was returned by + PySequence_Fast and is not NULL. */ #define PySequence_Fast_GET_SIZE(o) \ (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) - /* - Return the size of o, assuming that o was returned by - PySequence_Fast and is not NULL. - */ +/* Return the 'i'-th element of the sequence 'o', assuming that o was returned + by PySequence_Fast, and that i is within bounds. */ #define PySequence_Fast_GET_ITEM(o, i)\ (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) - /* - Return the ith element of o, assuming that o was returned by - PySequence_Fast, and that i is within bounds. - */ +/* Assume tp_as_sequence and sq_item exist and that 'i' does not + need to be corrected for a negative index. */ #define PySequence_ITEM(o, i)\ ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) - /* Assume tp_as_sequence and sq_item exist and that i does not - need to be corrected for a negative index - */ +/* Return a pointer to the underlying item array for + an object retured by PySequence_Fast */ #define PySequence_Fast_ITEMS(sf) \ (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ : ((PyTupleObject *)(sf))->ob_item) -/* Return a pointer to the underlying item array for - an object retured by PySequence_Fast */ +/* Return the number of occurrences on value on 'o', that is, return + the number of keys for which o[key] == value. + + On failure, return -1. This is equivalent to the Python expression: + o.count(value). */ PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); - /* -Return the number of occurrences on value on o, that is, -return the number of keys for which o[key]==value. On -failure, return -1. This is equivalent to the Python -expression: o.count(value). - */ +/* Return 1 if 'ob' is in the sequence 'seq'; 0 if 'ob' is not in the sequence + 'seq'; -1 on error. + Use __contains__ if possible, else _PySequence_IterSearch(). */ PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); - /* -Return -1 if error; 1 if ob in seq; 0 if ob not in seq. -Use __contains__ if possible, else _PySequence_IterSearch(). - */ #ifndef Py_LIMITED_API #define PY_ITERSEARCH_COUNT 1 #define PY_ITERSEARCH_INDEX 2 #define PY_ITERSEARCH_CONTAINS 3 + +/* Iterate over seq. + + Result depends on the operation: + + PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if + error. + PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of + obj in seq; set ValueError and return -1 if none found; + also return -1 on error. + PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on + error. */ PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation); #endif -/* - Iterate over seq. Result depends on the operation: - PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if - error. - PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of - obj in seq; set ValueError and return -1 if none found; - also return -1 on error. - PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on - error. -*/ + /* For DLL-level backwards compatibility */ #undef PySequence_In +/* Determine if the sequence 'o' contains 'value'. If an item in 'o' is equal + to 'value', return 1, otherwise return 0. On error, return -1. + + This is equivalent to the Python expression: value in o. */ PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); /* For source-level backwards compatibility */ #define PySequence_In PySequence_Contains - /* -Determine if o contains value. If an item in o is equal to -X, return 1, otherwise return 0. On error, return -1. This -is equivalent to the Python expression: value in o. - */ +/* Return the first index for which o[i] == value. + On error, return -1. + + This is equivalent to the Python expression: o.index(value). */ PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); - /* -Return the first index for which o[i]=value. On error, -return -1. This is equivalent to the Python -expression: o.index(value). - */ +/* --- In-place versions of some of the above Sequence functions --- */ -/* In-place versions of some of the above Sequence functions. */ +/* Append sequence 'o2' to sequence 'o1', in-place when possible. Return the + resulting object, which could be 'o1', or NULL on failure. + This is the equivalent of the Python expression: o1 += o2. */ PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); - /* -Append o2 to o1, in-place when possible. Return the resulting -object, which could be o1, or NULL on failure. This is the -equivalent of the Python expression: o1 += o2. +/* Repeat sequence 'o' by 'count', in-place when possible. Return the resulting + object, which could be 'o', or NULL on failure. - */ - + This is the equivalent of the Python expression: o1 *= count. */ PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); - /* -Repeat o1 by count, in-place when possible. Return the resulting -object, which could be o1, or NULL on failure. This is the -equivalent of the Python expression: o1 *= count. - */ +/* === Mapping protocol ================================================= */ -/* Mapping protocol:*/ +/* Return 1 if the object provides mapping protocol, and 0 otherwise. + This function always succeeds. */ PyAPI_FUNC(int) PyMapping_Check(PyObject *o); - /* -Return 1 if the object provides mapping protocol, and zero -otherwise. - -This function always succeeds. - */ - +/* Returns the number of keys in mapping object 'o' on success, and -1 on + failure. For objects that do not provide sequence protocol, this is + equivalent to the Python expression: len(o). */ PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); - /* -Returns the number of keys in object o on success, and -1 on -failure. For objects that do not provide sequence protocol, -this is equivalent to the Python expression: len(o). - */ - /* For DLL compatibility */ #undef PyMapping_Length PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); #define PyMapping_Length PyMapping_Size -/* implemented as a macro: +/* Implemented as a macro: -int PyMapping_DelItemString(PyObject *o, const char *key); + int PyMapping_DelItemString(PyObject *o, const char *key); -Remove the mapping for object, key, from the object *o. -Returns -1 on failure. This is equivalent to -the Python statement: del o[key]. - */ + Remove the mapping for object 'key' from the mapping 'o'. Returns -1 on + failure. + + This is equivalent to the Python statement: del o[key]. */ #define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) -/* implemented as a macro: +/* Implemented as a macro: -int PyMapping_DelItem(PyObject *o, PyObject *key); + int PyMapping_DelItem(PyObject *o, PyObject *key); -Remove the mapping for object, key, from the object *o. -Returns -1 on failure. This is equivalent to -the Python statement: del o[key]. - */ + Remove the mapping for object 'key' from the mapping object 'o'. + Returns -1 on failure. + + This is equivalent to the Python statement: del o[key]. */ #define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) +/* On success, return 1 if the mapping object 'o' has the key 'key', + and 0 otherwise. + + This is equivalent to the Python expression: key in o. + + This function always succeeds. */ PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, const char *key); - /* -On success, return 1 if the mapping object has the key, key, -and 0 otherwise. This is equivalent to the Python expression: -key in o. +/* Return 1 if the mapping object has the key 'key', and 0 otherwise. -This function always succeeds. - */ + This is equivalent to the Python expression: key in o. + This function always succeeds. */ PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); - /* -Return 1 if the mapping object has the key, key, -and 0 otherwise. This is equivalent to the Python expression: -key in o. - -This function always succeeds. - - */ - +/* On success, return a list or tuple of the keys in mapping object 'o'. + On failure, return NULL. */ PyAPI_FUNC(PyObject *) PyMapping_Keys(PyObject *o); - /* -On success, return a list or tuple of the keys in object o. -On failure, return NULL. - */ - +/* On success, return a list or tuple of the values in mapping object 'o'. + On failure, return NULL. */ PyAPI_FUNC(PyObject *) PyMapping_Values(PyObject *o); - /* -On success, return a list or tuple of the values in object o. -On failure, return NULL. - */ - +/* On success, return a list or tuple of the items in mapping object 'o', + where each item is a tuple containing a key-value pair. On failure, return + NULL. */ PyAPI_FUNC(PyObject *) PyMapping_Items(PyObject *o); - /* -On success, return a list or tuple of the items in object o, -where each item is a tuple containing a key-value pair. -On failure, return NULL. +/* Return element of o corresponding to the object, key, or NULL on failure. - */ - + This is the equivalent of the Python expression: o[key]. */ PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, const char *key); - /* -Return element of o corresponding to the object, key, or NULL -on failure. This is the equivalent of the Python expression: -o[key]. - */ +/* Map the object 'key' to the value 'v' in the mapping 'o'. + Returns -1 on failure. + This is the equivalent of the Python statement: o[key]=v. */ PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, const char *key, PyObject *value); - /* -Map the object, key, to the value, v. Returns --1 on failure. This is the equivalent of the Python -statement: o[key]=v. - */ +/* isinstance(object, typeorclass) */ +PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); - -PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); - /* isinstance(object, typeorclass) */ - +/* issubclass(object, typeorclass) */ PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); - /* issubclass(object, typeorclass) */ #ifndef Py_LIMITED_API -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Dec 15 04:06:04 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 15 Dec 2016 09:06:04 +0000 Subject: [Python-checkins] Daily reference leaks (13b600dc4ee5): sum=-3 Message-ID: <20161215090603.24252.72861.E37D96FE@psf.io> results for 13b600dc4ee5 on branch "default" -------------------------------------------- test_collections leaked [0, 0, -7] 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/reflogXG07ZO', '--timeout', '7200'] From python-checkins at python.org Thu Dec 15 04:15:45 2016 From: python-checkins at python.org (xiang.zhang) Date: Thu, 15 Dec 2016 09:15:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328930=3A_Merge_from_3=2E6=2E?= Message-ID: <20161215091544.5181.40438.D9F43901@psf.io> https://hg.python.org/cpython/rev/c4bcca326c0a changeset: 105636:c4bcca326c0a parent: 105634:654ec6ed3225 parent: 105635:56a7eb5a0679 user: Xiang Zhang date: Thu Dec 15 17:05:04 2016 +0800 summary: Issue #28930: Merge from 3.6. files: Makefile.pre.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -858,8 +858,8 @@ $(srcdir)/Objects/stringlib/unicode_format.h \ $(srcdir)/Objects/stringlib/unicodedefs.h +Objects/bytes_methods.o: $(srcdir)/Objects/bytes_methods.c $(BYTESTR_DEPS) Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS) - Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS) Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 04:15:44 2016 From: python-checkins at python.org (xiang.zhang) Date: Thu, 15 Dec 2016 09:15:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTMw?= =?utf-8?q?=3A_Add_a_Makefile_rule_for_bytes=5Fmethods=2Ec=2E?= Message-ID: <20161215091544.26452.44484.93C035B3@psf.io> https://hg.python.org/cpython/rev/56a7eb5a0679 changeset: 105635:56a7eb5a0679 branch: 3.6 parent: 105632:f2745b64d8b7 user: Xiang Zhang date: Thu Dec 15 16:41:12 2016 +0800 summary: Issue #28930: Add a Makefile rule for bytes_methods.c. Add a dependency to stringlib to make sure that bytes_methods.c is recompiled if stringlib is modified. files: Makefile.pre.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -858,8 +858,8 @@ $(srcdir)/Objects/stringlib/unicode_format.h \ $(srcdir)/Objects/stringlib/unicodedefs.h +Objects/bytes_methods.o: $(srcdir)/Objects/bytes_methods.c $(BYTESTR_DEPS) Objects/bytesobject.o: $(srcdir)/Objects/bytesobject.c $(BYTESTR_DEPS) - Objects/bytearrayobject.o: $(srcdir)/Objects/bytearrayobject.c $(BYTESTR_DEPS) Objects/unicodeobject.o: $(srcdir)/Objects/unicodeobject.c $(UNICODE_DEPS) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 05:55:58 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 15 Dec 2016 10:55:58 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4OTI1?= =?utf-8?q?=3A_cPickle_now_correctly_propagates_errors_when_unpickle_insta?= =?utf-8?q?nces?= Message-ID: <20161215105557.3548.8091.C9FCC1BB@psf.io> https://hg.python.org/cpython/rev/eb830f1511ef changeset: 105637:eb830f1511ef branch: 2.7 parent: 105620:f89ef18f9824 user: Serhiy Storchaka date: Thu Dec 15 12:51:34 2016 +0200 summary: Issue #28925: cPickle now correctly propagates errors when unpickle instances of old-style classes. files: Lib/test/pickletester.py | 43 +++++++++++++++++++++++++++ Misc/NEWS | 4 ++ Modules/cPickle.c | 44 ++++----------------------- 3 files changed, 54 insertions(+), 37 deletions(-) diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py --- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -147,6 +147,17 @@ class H(object): pass +class MyErr(Exception): + def __init__(self): + pass + +class I: + def __init__(self, *args, **kwargs): + raise MyErr() + + def __getinitargs__(self): + return () + # Hashable mutable key class K(object): def __init__(self, value): @@ -165,6 +176,8 @@ E.__module__ = "__main__" __main__.H = H H.__module__ = "__main__" +__main__.I = I +I.__module__ = "__main__" __main__.K = K K.__module__ = "__main__" @@ -623,6 +636,36 @@ 'q\x00oq\x01}q\x02b.').replace('X', xname) self.assert_is_copy(X(*args), self.loads(pickle2)) + def test_load_classic_instance_error(self): + # Issue #28925. + # Protocol 0 (text mode pickle): + """ + 0: ( MARK + 1: i INST '__main__ I' (MARK at 0) + 13: ( MARK + 14: d DICT (MARK at 13) + 15: b BUILD + 16: . STOP + """ + pickle0 = ('(i__main__\n' + 'I\n' + '(db.') + self.assertRaises(MyErr, self.loads, pickle0) + + # Protocol 1 (binary mode pickle) + """ + 0: ( MARK + 1: c GLOBAL '__main__ I' + 13: o OBJ (MARK at 0) + 14: } EMPTY_DICT + 15: b BUILD + 16: . STOP + """ + pickle1 = ('(c__main__\n' + 'I\n' + 'o}b.') + self.assertRaises(MyErr, self.loads, pickle1) + def test_load_str(self): # From Python 2: pickle.dumps('a\x00\xa0', protocol=0) self.assertEqual(self.loads("S'a\\x00\\xa0'\n."), 'a\x00\xa0') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #28925: cPickle now correctly propagates errors when unpickle instances + of old-style classes. + + What's New in Python 2.7.13 =========================== diff --git a/Modules/cPickle.c b/Modules/cPickle.c --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -3875,52 +3875,22 @@ static PyObject * Instance_New(PyObject *cls, PyObject *args) { - PyObject *r = 0; - if (PyClass_Check(cls)) { int l; - if ((l=PyObject_Size(args)) < 0) goto err; + if ((l=PyObject_Size(args)) < 0) return NULL; if (!( l )) { - PyObject *__getinitargs__; - - __getinitargs__ = PyObject_GetAttr(cls, - __getinitargs___str); - if (!__getinitargs__) { + if (!PyObject_HasAttr(cls, __getinitargs___str)) { /* We have a class with no __getinitargs__, so bypass usual construction */ - PyObject *inst; - - PyErr_Clear(); - if (!( inst=PyInstance_NewRaw(cls, NULL))) - goto err; - return inst; + return PyInstance_NewRaw(cls, NULL); } - Py_DECREF(__getinitargs__); } - if ((r=PyInstance_New(cls, args, NULL))) return r; - else goto err; - } - - if ((r=PyObject_CallObject(cls, args))) return r; - - err: - { - PyObject *tp, *v, *tb, *tmp_value; - - PyErr_Fetch(&tp, &v, &tb); - tmp_value = v; - /* NULL occurs when there was a KeyboardInterrupt */ - if (tmp_value == NULL) - tmp_value = Py_None; - if ((r = PyTuple_Pack(3, tmp_value, cls, args))) { - Py_XDECREF(v); - v=r; - } - PyErr_Restore(tp,v,tb); - } - return NULL; + return PyInstance_New(cls, args, NULL); + } + + return PyObject_CallObject(cls, args); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 06:55:07 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 11:55:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_=5FPyObject=5FCallFunc?= =?utf-8?q?tionVa=28=29=2C_use_the_small_stack?= Message-ID: <20161215115507.17983.23257.CBAC70FA@psf.io> https://hg.python.org/cpython/rev/bec846dd92e8 changeset: 105638:bec846dd92e8 parent: 105636:c4bcca326c0a user: Victor Stinner date: Thu Dec 15 12:36:50 2016 +0100 summary: Fix _PyObject_CallFunctionVa(), use the small stack Issue #28915. Oops, I disabled the small stack to test both code paths. It's now fixed. files: Objects/abstract.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2524,8 +2524,7 @@ va_list va, int is_size_t) { PyObject* small_stack[5]; - /*const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack);*/ - const Py_ssize_t small_stack_len = 0; + const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack); PyObject **stack; Py_ssize_t nargs, i; PyObject *result; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 06:55:07 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 11:55:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_=5FPY=5FFASTCALL=5FSMA?= =?utf-8?q?LL=5FSTACK_constant?= Message-ID: <20161215115507.17870.14887.B6E98E59@psf.io> https://hg.python.org/cpython/rev/71876e4abce4 changeset: 105639:71876e4abce4 user: Victor Stinner date: Thu Dec 15 12:40:53 2016 +0100 summary: Add _PY_FASTCALL_SMALL_STACK constant Issue #28870: Add a new _PY_FASTCALL_SMALL_STACK constant, size of "small stacks" allocated on the C stack to pass positional arguments to _PyObject_FastCall(). _PyObject_Call_Prepend() now uses a small stack of 5 arguments (40 bytes) instead of 8 (64 bytes), since it is modified to use _PY_FASTCALL_SMALL_STACK. files: Include/abstract.h | 11 +++++++++++ Objects/abstract.c | 6 +++--- Python/bltinmodule.c | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -303,6 +303,17 @@ PyObject **kwnames, PyObject *func); +/* Suggested size (number of positional arguments) for arrays of PyObject* + allocated on a C stack to avoid allocating memory on the heap memory. Such + array is used to pass positional arguments to call functions of the + _PyObject_FastCall() family. + + The size is chosen to not abuse the C stack and so limit the risk of stack + overflow. The size is also chosen to allow using the small stack for most + function calls of the Python standard library. On 64-bit CPU, it allocates + 40 bytes on the stack. */ +#define _PY_FASTCALL_SMALL_STACK 5 + /* Call the callable object 'callable' with the "fast call" calling convention: args is a C array for positional arguments (nargs is the number of positional arguments), kwargs is a dictionary for keyword arguments. diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2337,7 +2337,7 @@ _PyObject_Call_Prepend(PyObject *callable, PyObject *obj, PyObject *args, PyObject *kwargs) { - PyObject *small_stack[8]; + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; PyObject **stack; Py_ssize_t argcount; PyObject *result; @@ -2523,7 +2523,7 @@ _PyObject_CallFunctionVa(PyObject *callable, const char *format, va_list va, int is_size_t) { - PyObject* small_stack[5]; + 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; @@ -2704,7 +2704,7 @@ PyObject * _PyObject_VaCallFunctionObjArgs(PyObject *callable, va_list vargs) { - PyObject *small_stack[5]; + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; PyObject **stack; Py_ssize_t nargs; PyObject *result; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1186,7 +1186,7 @@ static PyObject * map_next(mapobject *lz) { - PyObject *small_stack[5]; + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; PyObject **stack; Py_ssize_t niters, nargs, i; PyObject *result = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 10:22:24 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 15:22:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161215152224.64064.93546.3871CC45@psf.io> https://hg.python.org/cpython/rev/ff588872867d changeset: 105641:ff588872867d parent: 105639:71876e4abce4 parent: 105640:181453f9a0c4 user: Victor Stinner date: Thu Dec 15 16:22:19 2016 +0100 summary: Merge 3.6 files: Doc/whatsnew/3.6.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -77,7 +77,7 @@ CPython implementation improvements: * The :ref:`dict ` type has been reimplemented to use - a :ref:`faster, more compact representation ` + a :ref:`more compact representation ` similar to the `PyPy dict implementation`_. This resulted in dictionaries using 20% to 25% less memory when compared to Python 3.5. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 10:22:24 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 15:22:24 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTc5?= =?utf-8?q?=3A_Fix_What=27s_New_in_Python_3=2E6=2C_dict?= Message-ID: <20161215152224.63685.97961.C36B8700@psf.io> https://hg.python.org/cpython/rev/181453f9a0c4 changeset: 105640:181453f9a0c4 branch: 3.6 parent: 105635:56a7eb5a0679 user: Victor Stinner date: Thu Dec 15 16:20:53 2016 +0100 summary: Issue #28979: Fix What's New in Python 3.6, dict The new dict implementation is not faster, but more compact. Patch written by Brendan Donegan. files: Doc/whatsnew/3.6.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -77,7 +77,7 @@ CPython implementation improvements: * The :ref:`dict ` type has been reimplemented to use - a :ref:`faster, more compact representation ` + a :ref:`more compact representation ` similar to the `PyPy dict implementation`_. This resulted in dictionaries using 20% to 25% less memory when compared to Python 3.5. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 11:02:19 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 16:02:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_=5FPyDict=5FNewPresize?= =?utf-8?b?ZCgpIGluIF9QeVN0YWNrX0FzRGljdCgp?= Message-ID: <20161215160215.64423.83713.2C32C8F5@psf.io> https://hg.python.org/cpython/rev/ecd218c41cd4 changeset: 105642:ecd218c41cd4 user: Victor Stinner date: Thu Dec 15 16:59:40 2016 +0100 summary: Use _PyDict_NewPresized() in _PyStack_AsDict() Issue #27810. files: Objects/abstract.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2378,7 +2378,7 @@ PyObject *kwdict; Py_ssize_t i; - kwdict = PyDict_New(); + kwdict = _PyDict_NewPresized(nkwargs); if (kwdict == NULL) { return NULL; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 11:23:47 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 16:23:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Fix_a_memory_l?= =?utf-8?q?eak_in_split-table_dictionaries?= Message-ID: <20161215162347.5132.23640.D41A49FE@psf.io> https://hg.python.org/cpython/rev/85be9dcc16a8 changeset: 105643:85be9dcc16a8 branch: 3.6 parent: 105640:181453f9a0c4 user: Victor Stinner date: Thu Dec 15 17:21:23 2016 +0100 summary: Fix a memory leak in split-table dictionaries Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. files: Lib/test/test_dict.py | 30 +++++++++++++++++++++++++++ Misc/NEWS | 4 +++ Modules/_testcapimodule.c | 14 ++++++++++++ Objects/dictobject.c | 27 +++++++++++++++++++---- 4 files changed, 70 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -933,6 +933,36 @@ self.assertEqual(list(a), ['x', 'y']) self.assertEqual(list(b), ['x', 'y', 'z']) + @support.cpython_only + def test_splittable_setattr_after_pop(self): + """setattr() must not convert combined table into split table.""" + # Issue 28147 + import _testcapi + + class C: + pass + a = C() + + a.a = 1 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + + # dict.pop() convert it to combined table + a.__dict__.pop('a') + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + + # But C should not convert a.__dict__ to split table again. + a.a = 1 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + + # Same for popitem() + a = C() + a.a = 2 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + a.__dict__.popitem() + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + a.a = 3 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + def test_iterator_pickling(self): for proto in range(pickle.HIGHEST_PROTOCOL + 1): data = {1:"a", 2:"b", 3:"c"} diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() + must not convert combined table into split table. Patch written by INADA + Naoki. + - Issue #28739: f-string expressions no longer accepted as docstrings and by ast.literal_eval() even if they do not include expressions. diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -259,6 +259,19 @@ return result; } +static PyObject* +dict_hassplittable(PyObject *self, PyObject *arg) +{ + if (!PyDict_Check(arg)) { + PyErr_Format(PyExc_TypeError, + "dict_hassplittable() argument must be dict, not '%s'", + arg->ob_type->tp_name); + return NULL; + } + + return PyBool_FromLong(_PyDict_HasSplitTable((PyDictObject*)arg)); +} + /* Issue #4701: Check that PyObject_Hash implicitly calls * PyType_Ready if it hasn't already been called */ @@ -4024,6 +4037,7 @@ {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, {"dict_getitem_knownhash", dict_getitem_knownhash, METH_VARARGS}, + {"dict_hassplittable", dict_hassplittable, METH_O}, {"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS}, {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, {"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS}, diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1245,7 +1245,7 @@ but can be resplit by make_keys_shared(). */ static int -dictresize(PyDictObject *mp, Py_ssize_t minused) +dictresize(PyDictObject *mp, Py_ssize_t minsize) { Py_ssize_t i, newsize; PyDictKeysObject *oldkeys; @@ -1254,7 +1254,7 @@ /* Find the smallest table size > minused. */ for (newsize = PyDict_MINSIZE; - newsize <= minused && newsize > 0; + newsize < minsize && newsize > 0; newsize <<= 1) ; if (newsize <= 0) { @@ -1269,6 +1269,8 @@ mp->ma_keys = oldkeys; return -1; } + // New table must be large enough. + assert(mp->ma_keys->dk_usable >= mp->ma_used); if (oldkeys->dk_lookup == lookdict) mp->ma_keys->dk_lookup = lookdict; mp->ma_values = NULL; @@ -4306,10 +4308,25 @@ CACHED_KEYS(tp) = NULL; DK_DECREF(cached); } - } else { + } + else { + int was_shared = cached == ((PyDictObject *)dict)->ma_keys; res = PyDict_SetItem(dict, key, value); - if (cached != ((PyDictObject *)dict)->ma_keys) { - /* Either update tp->ht_cached_keys or delete it */ + if (was_shared && cached != ((PyDictObject *)dict)->ma_keys) { + /* PyDict_SetItem() may call dictresize and convert split table + * into combined table. In such case, convert it to split + * table again and update type's shared key only when this is + * the only dict sharing key with the type. + * + * This is to allow using shared key in class like this: + * + * class C: + * def __init__(self): + * # one dict resize happens + * self.a, self.b, self.c = 1, 2, 3 + * self.d, self.e, self.f = 4, 5, 6 + * a = C() + */ if (cached->dk_refcnt == 1) { CACHED_KEYS(tp) = make_keys_shared(dict); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 11:23:50 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 15 Dec 2016 16:23:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161215162350.15473.28334.03EA9689@psf.io> https://hg.python.org/cpython/rev/940ffd51608c changeset: 105644:940ffd51608c parent: 105642:ecd218c41cd4 parent: 105643:85be9dcc16a8 user: Victor Stinner date: Thu Dec 15 17:23:24 2016 +0100 summary: Merge 3.6 files: Lib/test/test_dict.py | 30 +++++++++++++++++++++++++++ Misc/NEWS | 4 +++ Modules/_testcapimodule.c | 14 ++++++++++++ Objects/dictobject.c | 27 +++++++++++++++++++---- 4 files changed, 70 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -933,6 +933,36 @@ self.assertEqual(list(a), ['x', 'y']) self.assertEqual(list(b), ['x', 'y', 'z']) + @support.cpython_only + def test_splittable_setattr_after_pop(self): + """setattr() must not convert combined table into split table.""" + # Issue 28147 + import _testcapi + + class C: + pass + a = C() + + a.a = 1 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + + # dict.pop() convert it to combined table + a.__dict__.pop('a') + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + + # But C should not convert a.__dict__ to split table again. + a.a = 1 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + + # Same for popitem() + a = C() + a.a = 2 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + a.__dict__.popitem() + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + a.a = 3 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + def test_iterator_pickling(self): for proto in range(pickle.HIGHEST_PROTOCOL + 1): data = {1:"a", 2:"b", 3:"c"} diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() + must not convert combined table into split table. Patch written by INADA + Naoki. + - Issue #28739: f-string expressions no longer accepted as docstrings and by ast.literal_eval() even if they do not include expressions. diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -259,6 +259,19 @@ return result; } +static PyObject* +dict_hassplittable(PyObject *self, PyObject *arg) +{ + if (!PyDict_Check(arg)) { + PyErr_Format(PyExc_TypeError, + "dict_hassplittable() argument must be dict, not '%s'", + arg->ob_type->tp_name); + return NULL; + } + + return PyBool_FromLong(_PyDict_HasSplitTable((PyDictObject*)arg)); +} + /* Issue #4701: Check that PyObject_Hash implicitly calls * PyType_Ready if it hasn't already been called */ @@ -4016,6 +4029,7 @@ {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, {"dict_getitem_knownhash", dict_getitem_knownhash, METH_VARARGS}, + {"dict_hassplittable", dict_hassplittable, METH_O}, {"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS}, {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, {"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS}, diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1214,7 +1214,7 @@ but can be resplit by make_keys_shared(). */ static int -dictresize(PyDictObject *mp, Py_ssize_t minused) +dictresize(PyDictObject *mp, Py_ssize_t minsize) { Py_ssize_t newsize, numentries; PyDictKeysObject *oldkeys; @@ -1223,7 +1223,7 @@ /* Find the smallest table size > minused. */ for (newsize = PyDict_MINSIZE; - newsize <= minused && newsize > 0; + newsize < minsize && newsize > 0; newsize <<= 1) ; if (newsize <= 0) { @@ -1244,6 +1244,8 @@ mp->ma_keys = oldkeys; return -1; } + // New table must be large enough. + assert(mp->ma_keys->dk_usable >= mp->ma_used); if (oldkeys->dk_lookup == lookdict) mp->ma_keys->dk_lookup = lookdict; @@ -4270,10 +4272,25 @@ CACHED_KEYS(tp) = NULL; DK_DECREF(cached); } - } else { + } + else { + int was_shared = cached == ((PyDictObject *)dict)->ma_keys; res = PyDict_SetItem(dict, key, value); - if (cached != ((PyDictObject *)dict)->ma_keys) { - /* Either update tp->ht_cached_keys or delete it */ + if (was_shared && cached != ((PyDictObject *)dict)->ma_keys) { + /* PyDict_SetItem() may call dictresize and convert split table + * into combined table. In such case, convert it to split + * table again and update type's shared key only when this is + * the only dict sharing key with the type. + * + * This is to allow using shared key in class like this: + * + * class C: + * def __init__(self): + * # one dict resize happens + * self.a, self.b, self.c = 1, 2, 3 + * self.d, self.e, self.f = 4, 5, 6 + * a = C() + */ if (cached->dk_refcnt == 1) { CACHED_KEYS(tp) = make_keys_shared(dict); } -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Thu Dec 15 11:24:53 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 15 Dec 2016 16:24:53 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-12-15 Message-ID: <5acfc0dc-b128-490a-bba9-1ff9a5e5664a@irsmsx105.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-15 11:47:21 +0000 commit: f89ef18f9824 previous commit: 8359ee62dde3 revision date: 2016-12-14 17:48:38 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.14% -1.31% 5.46% 5.91% :-) pybench 0.14% 0.00% 8.01% 3.59% :-| regex_v8 0.60% 0.00% 0.20% 10.24% :-) nbody 0.11% -0.88% 13.27% 3.02% :-| json_dump_v2 0.17% -0.30% -0.24% 10.91% :-| normal_startup 1.69% -0.17% -1.71% 2.00% :-| ssbench 0.15% 0.41% 0.39% 1.99% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-12-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 lp_benchmark_robot at intel.com Thu Dec 15 11:26:09 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 15 Dec 2016 16:26:09 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-12-15 Message-ID: <1436c983-3a7f-4b3d-90aa-944205179075@irsmsx105.ger.corp.intel.com> Results for project Python default, build date 2016-12-15 11:03:06 +0000 commit: 13b600dc4ee5 previous commit: 64afd5cab40a revision date: 2016-12-15 02:38:46 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.25% -1.10% 0.57% 12.38% :-| pybench 0.14% -0.48% 0.91% 5.40% :-| regex_v8 3.78% 0.96% -0.41% 3.95% :-| nbody 0.29% 0.23% -0.52% 3.71% :-) json_dump_v2 0.29% -0.84% 7.70% 12.10% :-| normal_startup 1.16% -0.06% -0.53% 6.34% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-12-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 python-checkins at python.org Thu Dec 15 15:02:31 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 15 Dec 2016 20:02:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI2OTE5?= =?utf-8?q?=3A_On_Android=2C_operating_system_data_is_now_always_encoded/d?= =?utf-8?q?ecoded?= Message-ID: <20161215200231.68295.41007.99BA5BF5@psf.io> https://hg.python.org/cpython/rev/e5360d413ce4 changeset: 105645:e5360d413ce4 branch: 3.6 parent: 105643:85be9dcc16a8 user: Xavier de Gaye date: Thu Dec 15 20:59:58 2016 +0100 summary: Issue #26919: On Android, operating system data is now always encoded/decoded to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. files: Lib/test/test_cmd_line.py | 9 +++++---- Misc/NEWS | 4 ++++ Objects/unicodeobject.c | 6 +++--- Python/fileutils.c | 10 +++++----- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -8,7 +8,7 @@ import sys import subprocess import tempfile -from test.support import script_helper +from test.support import script_helper, is_android from test.support.script_helper import (spawn_python, kill_python, assert_python_ok, assert_python_failure) @@ -178,15 +178,16 @@ if not stdout.startswith(pattern): raise AssertionError("%a doesn't start with %a" % (stdout, pattern)) - @unittest.skipUnless(sys.platform == 'darwin', 'test specific to Mac OS X') - def test_osx_utf8(self): + @unittest.skipUnless((sys.platform == 'darwin' or + is_android), 'test specific to Mac OS X and Android') + def test_osx_android_utf8(self): def check_output(text): decoded = text.decode('utf-8', 'surrogateescape') expected = ascii(decoded).encode('ascii') + b'\n' env = os.environ.copy() # C locale gives ASCII locale encoding, but Python uses UTF-8 - # to parse the command line arguments on Mac OS X + # to parse the command line arguments on Mac OS X and Android. env['LC_ALL'] = 'C' p = subprocess.Popen( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #26919: On Android, operating system data is now always encoded/decoded + to/from UTF-8, instead of the locale encoding to avoid inconsistencies with + os.fsencode() and os.fsdecode() which are already using UTF-8. + - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -5083,10 +5083,10 @@ return NULL; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) /* Simplified UTF-8 decoder using surrogateescape error handler, - used to decode the command line arguments on Mac OS X. + used to decode the command line arguments on Mac OS X and Android. Return a pointer to a newly allocated wide character string (use PyMem_RawFree() to free the memory), or NULL on memory allocation error. */ @@ -5137,7 +5137,7 @@ return unicode; } -#endif /* __APPLE__ */ +#endif /* __APPLE__ or __ANDROID__ */ /* Primary internal function which creates utf8 encoded bytes objects. diff --git a/Python/fileutils.c b/Python/fileutils.c --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -20,7 +20,7 @@ #include #endif /* HAVE_FCNTL_H */ -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size); #endif @@ -273,7 +273,7 @@ wchar_t* Py_DecodeLocale(const char* arg, size_t *size) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) wchar_t *wstr; wstr = _Py_DecodeUTF8_surrogateescape(arg, strlen(arg)); if (size != NULL) { @@ -406,7 +406,7 @@ if (size != NULL) *size = (size_t)-1; return NULL; -#endif /* __APPLE__ */ +#endif /* __APPLE__ or __ANDROID__ */ } /* Encode a wide character string to the locale encoding with the @@ -424,7 +424,7 @@ char* Py_EncodeLocale(const wchar_t *text, size_t *error_pos) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) Py_ssize_t len; PyObject *unicode, *bytes = NULL; char *cpath; @@ -522,7 +522,7 @@ bytes = result; } return result; -#endif /* __APPLE__ */ +#endif /* __APPLE__ or __ANDROID__ */ } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 15:02:31 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 15 Dec 2016 20:02:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42Lg==?= Message-ID: <20161215200231.28582.85555.E1202DB3@psf.io> https://hg.python.org/cpython/rev/80a041d39c20 changeset: 105646:80a041d39c20 parent: 105644:940ffd51608c parent: 105645:e5360d413ce4 user: Xavier de Gaye date: Thu Dec 15 21:01:52 2016 +0100 summary: Merge 3.6. files: Lib/test/test_cmd_line.py | 9 +++++---- Misc/NEWS | 4 ++++ Objects/unicodeobject.c | 6 +++--- Python/fileutils.c | 10 +++++----- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -8,7 +8,7 @@ import sys import subprocess import tempfile -from test.support import script_helper +from test.support import script_helper, is_android from test.support.script_helper import (spawn_python, kill_python, assert_python_ok, assert_python_failure) @@ -178,15 +178,16 @@ if not stdout.startswith(pattern): raise AssertionError("%a doesn't start with %a" % (stdout, pattern)) - @unittest.skipUnless(sys.platform == 'darwin', 'test specific to Mac OS X') - def test_osx_utf8(self): + @unittest.skipUnless((sys.platform == 'darwin' or + is_android), 'test specific to Mac OS X and Android') + def test_osx_android_utf8(self): def check_output(text): decoded = text.decode('utf-8', 'surrogateescape') expected = ascii(decoded).encode('ascii') + b'\n' env = os.environ.copy() # C locale gives ASCII locale encoding, but Python uses UTF-8 - # to parse the command line arguments on Mac OS X + # to parse the command line arguments on Mac OS X and Android. env['LC_ALL'] = 'C' p = subprocess.Popen( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #26919: On Android, operating system data is now always encoded/decoded + to/from UTF-8, instead of the locale encoding to avoid inconsistencies with + os.fsencode() and os.fsdecode() which are already using UTF-8. + - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -5067,10 +5067,10 @@ return NULL; } -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) /* Simplified UTF-8 decoder using surrogateescape error handler, - used to decode the command line arguments on Mac OS X. + used to decode the command line arguments on Mac OS X and Android. Return a pointer to a newly allocated wide character string (use PyMem_RawFree() to free the memory), or NULL on memory allocation error. */ @@ -5121,7 +5121,7 @@ return unicode; } -#endif /* __APPLE__ */ +#endif /* __APPLE__ or __ANDROID__ */ /* Primary internal function which creates utf8 encoded bytes objects. diff --git a/Python/fileutils.c b/Python/fileutils.c --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -20,7 +20,7 @@ #include #endif /* HAVE_FCNTL_H */ -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size); #endif @@ -273,7 +273,7 @@ wchar_t* Py_DecodeLocale(const char* arg, size_t *size) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) wchar_t *wstr; wstr = _Py_DecodeUTF8_surrogateescape(arg, strlen(arg)); if (size != NULL) { @@ -406,7 +406,7 @@ if (size != NULL) *size = (size_t)-1; return NULL; -#endif /* __APPLE__ */ +#endif /* __APPLE__ or __ANDROID__ */ } /* Encode a wide character string to the locale encoding with the @@ -424,7 +424,7 @@ char* Py_EncodeLocale(const wchar_t *text, size_t *error_pos) { -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__ANDROID__) Py_ssize_t len; PyObject *unicode, *bytes = NULL; char *cpath; @@ -522,7 +522,7 @@ bytes = result; } return result; -#endif /* __APPLE__ */ +#endif /* __APPLE__ or __ANDROID__ */ } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 17:36:43 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 15 Dec 2016 22:36:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42IChpc3N1ZSAjMjgwOTEp?= Message-ID: <20161215223643.13331.89719.6EB9E58D@psf.io> https://hg.python.org/cpython/rev/6bf84e661e69 changeset: 105648:6bf84e661e69 parent: 105646:80a041d39c20 parent: 105647:78c8f450b84c user: Yury Selivanov date: Thu Dec 15 17:36:37 2016 -0500 summary: Merge 3.6 (issue #28091) files: Doc/glossary.rst | 28 +++ Doc/library/asyncio-eventloop.rst | 18 + Doc/library/inspect.rst | 21 ++ Doc/library/sys.rst | 36 +++ Doc/library/types.rst | 8 + Doc/reference/compound_stmts.rst | 2 +- Doc/reference/datamodel.rst | 19 ++ Doc/reference/expressions.rst | 166 +++++++++++++++++- Doc/reference/simple_stmts.rst | 4 + 9 files changed, 298 insertions(+), 4 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -74,6 +74,34 @@ :keyword:`async with` statement by defining :meth:`__aenter__` and :meth:`__aexit__` methods. Introduced by :pep:`492`. + asynchronous generator + A function which returns an :term:`asynchronous generator iterator`. It + looks like a coroutine function defined with :keyword:`async def` except + that it contains :keyword:`yield` expressions for producing a series of + values usable in an :keyword:`async for` loop. + + Usually refers to a asynchronous generator function, but may refer to an + *asynchronous generator iterator* in some contexts. In cases where the + intended meaning isn't clear, using the full terms avoids ambiguity. + + An asynchronous generator function may contain :keyword:`await` + expressions as well as :keyword:`async for`, and :keyword:`async with` + statements. + + asynchronous generator iterator + An object created by a :term:`asynchronous generator` function. + + This is an :term:`asynchronous iterator` which when called using the + :meth:`__anext__` method returns an awaitable object which will execute + that the body of the asynchronous generator function until the + next :keyword:`yield` expression. + + Each :keyword:`yield` temporarily suspends processing, remembering the + location execution state (including local variables and pending + try-statements). When the *asynchronous generator iterator* effectively + resumes with another awaitable returned by :meth:`__anext__`, it + picks-up where it left-off. See :pep:`492` and :pep:`525`. + asynchronous iterable An object, that can be used in an :keyword:`async for` statement. Must return an :term:`asynchronous iterator` from its diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -88,6 +88,24 @@ This is idempotent and irreversible. No other methods should be called after this one. + +.. coroutinemethod:: AbstractEventLoop.shutdown_asyncgens() + + Schedule all currently open :term:`asynchronous generator` objects to + close with an :meth:`~agen.aclose()` call. After calling this method, + the event loop will issue a warning whenever a new asynchronous generator + is iterated. Should be used to finalize all scheduled asynchronous + generators reliably. Example:: + + try: + loop.run_forever() + finally: + loop.run_until_complete(loop.shutdown_asyncgens()) + loop.close() + + .. versionadded:: 3.6 + + .. _asyncio-pass-keywords: Calls diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -318,6 +318,27 @@ .. versionadded:: 3.5 +.. function:: isasyncgenfunction(object) + + Return true if the object is an :term:`asynchronous generator` function, + for example:: + + >>> async def agen(): + ... yield 1 + ... + >>> inspect.isasyncgenfunction(agen) + True + + .. versionadded:: 3.6 + + +.. function:: isasyncgen(object) + + Return true if the object is an :term:`asynchronous generator iterator` + created by an :term:`asynchronous generator` function. + + .. versionadded:: 3.6 + .. function:: istraceback(object) Return true if the object is a traceback. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -603,6 +603,24 @@ .. versionchanged:: 3.6 Added *platform_version* + +.. function:: get_asyncgen_hooks() + + Returns an *asyncgen_hooks* object, which is similar to a + :class:`~collections.namedtuple` of the form `(firstiter, finalizer)`, + where *firstiter* and *finalizer* are expected to be either ``None`` or + functions which take an :term:`asynchronous generator iterator` as an + argument, and are used to schedule finalization of an asychronous + generator by an event loop. + + .. versionadded:: 3.6 + See :pep:`525` for more details. + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + + .. function:: get_coroutine_wrapper() Returns ``None``, or a wrapper set by :func:`set_coroutine_wrapper`. @@ -1107,6 +1125,24 @@ implementation platform, rather than part of the language definition, and thus may not be available in all Python implementations. +.. function:: set_asyncgen_hooks(firstiter, finalizer) + + Accepts two optional keyword arguments which are callables that accept an + :term:`asynchronous generator iterator` as an argument. The *firstiter* + callable will be called when an asynchronous generator is iterated for the + first time. The *finalizer* will be called when an asynchronous generator + is about to be garbage collected. + + .. versionadded:: 3.6 + See :pep:`525` for more details, and for a reference example of a + *finalizer* method see the implementation of + ``asyncio.Loop.shutdown_asyncgens`` in + :source:`Lib/asyncio/base_events.py` + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + .. function:: set_coroutine_wrapper(wrapper) diff --git a/Doc/library/types.rst b/Doc/library/types.rst --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -104,6 +104,14 @@ .. versionadded:: 3.5 +.. data:: AsyncGeneratorType + + The type of :term:`asynchronous generator`-iterator objects, created by + asynchronous generator functions. + + .. versionadded:: 3.6 + + .. data:: CodeType .. index:: builtin: compile diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -697,7 +697,7 @@ Functions defined with ``async def`` syntax are always coroutine functions, even if they do not contain ``await`` or ``async`` keywords. -It is a :exc:`SyntaxError` to use :keyword:`yield` expressions in +It is a :exc:`SyntaxError` to use ``yield from`` expressions in ``async def`` coroutines. An example of a coroutine function:: diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -627,6 +627,25 @@ as well as :keyword:`async with` and :keyword:`async for` statements. See also the :ref:`coroutine-objects` section. + Asynchronous generator functions + .. index:: + single: asynchronous generator; function + single: asynchronous generator; asynchronous iterator + + A function or method which is defined using :keyword:`async def` and + which uses the :keyword:`yield` statement is called a + :dfn:`asynchronous generator function`. Such a function, when called, + returns an asynchronous iterator object which can be used in an + :keyword:`async for` statement to execute the body of the function. + + Calling the asynchronous iterator's :meth:`aiterator.__anext__` method + will return an :term:`awaitable` which when awaited + will execute until it provides a value using the :keyword:`yield` + expression. When the function executes an empty :keyword:`return` + statement or falls off the end, a :exc:`StopAsyncIteration` exception + is raised and the asynchronous iterator will have reached the end of + the set of values to be yielded. + Built-in functions .. index:: object: built-in function diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -172,7 +172,7 @@ .. productionlist:: comprehension: `expression` `comp_for` - comp_for: "for" `target_list` "in" `or_test` [`comp_iter`] + comp_for: [ASYNC] "for" `target_list` "in" `or_test` [`comp_iter`] comp_iter: `comp_for` | `comp_if` comp_if: "if" `expression_nocond` [`comp_iter`] @@ -186,6 +186,17 @@ Note that the comprehension is executed in a separate scope, so names assigned to in the target list don't "leak" into the enclosing scope. +Since Python 3.6, in an :keyword:`async def` function, an :keyword:`async for` +clause may be used to iterate over a :term:`asynchronous iterator`. +A comprehension in an :keyword:`async def` function may consist of either a +:keyword:`for` or :keyword:`async for` clause following the leading +expression, may contan additonal :keyword:`for` or :keyword:`async for` +clauses, and may also use :keyword:`await` expressions. +If a comprehension contains either :keyword:`async for` clauses +or :keyword:`await` expressions it is called an +:dfn:`asynchronous comprehension`. An asynchronous comprehension may +suspend the execution of the coroutine function in which it appears. +See also :pep:`530`. .. _lists: @@ -315,6 +326,14 @@ The parentheses can be omitted on calls with only one argument. See section :ref:`calls` for details. +Since Python 3.6, if the generator appears in an :keyword:`async def` function, +then :keyword:`async for` clauses and :keyword:`await` expressions are permitted +as with an asynchronous comprehension. If a generator expression +contains either :keyword:`async for` clauses or :keyword:`await` expressions +it is called an :dfn:`asynchronous generator expression`. +An asynchronous generator expression yields a new asynchronous +generator object, which is an asynchronous iterator +(see :ref:`async-iterators`). .. _yieldexpr: @@ -330,9 +349,22 @@ yield_atom: "(" `yield_expression` ")" yield_expression: "yield" [`expression_list` | "from" `expression`] -The yield expression is only used when defining a :term:`generator` function and +The yield expression is used when defining a :term:`generator` function +or an :term:`asynchronous generator` function and thus can only be used in the body of a function definition. Using a yield -expression in a function's body causes that function to be a generator. +expression in a function's body causes that function to be a generator, +and using it in an :keyword:`async def` function's body causes that +coroutine function to be an asynchronous generator. For example:: + + def gen(): # defines a generator function + yield 123 + + async def agen(): # defines an asynchronous generator function (PEP 525) + yield 123 + +Generator functions are described below, while asynchronous generator +functions are described separately in section +:ref:`asynchronous-generator-functions`. When a generator function is called, it returns an iterator known as a generator. That generator then controls the execution of the generator function. @@ -496,6 +528,134 @@ For examples using ``yield from``, see :ref:`pep-380` in "What's New in Python." +.. _asynchronous-generator-functions: + +Asynchronous generator functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The presence of a yield expression in a function or method defined using +:keyword:`async def` further defines the function as a +:term:`asynchronous generator` function. + +When an asynchronous generator function is called, it returns an +asynchronous iterator known as an asynchronous generator object. +That object then controls the execution of the generator function. +An asynchronous generator object is typically used in an +:keyword:`async for` statement in a coroutine function analogously to +how a generator object would be used in a :keyword:`for` statement. + +Calling one of the asynchronous generator's methods returns an +:term:`awaitable` object, and the execution starts when this object +is awaited on. At that time, the execution proceeds to the first yield +expression, where it is suspended again, returning the value of +:token:`expression_list` to the awaiting coroutine. As with a generator, +suspension means that all local state is retained, including the +current bindings of local variables, the instruction pointer, the internal +evaluation stack, and the state of any exception handling. When the execution +is resumed by awaiting on the next object returned by the asynchronous +generator's methods, the function can proceed exactly as if the yield +expression were just another external call. The value of the yield expression +after resuming depends on the method which resumed the execution. If +:meth:`~agen.__anext__` is used then the result is :const:`None`. Otherwise, if +:meth:`~agen.asend` is used, then the result will be the value passed in to +that method. + +In an asynchronous generator function, yield expressions are allowed anywhere +in a :keyword:`try` construct. However, if an asynchronous generator is not +resumed before it is finalized (by reaching a zero reference count or by +being garbage collected), then a yield expression within a :keyword:`try` +construct could result in a failure to execute pending :keyword:`finally` +clauses. In this case, it is the responsibility of the event loop or +scheduler running the asynchronous generator to call the asynchronous +generator-iterator's :meth:`~agen.aclose` method and run the resulting +coroutine object, thus allowing any pending :keyword:`finally` clauses +to execute. + +To take care of finalization, an event loop should define +a *finalizer* function which takes an asynchronous generator-iterator +and presumably calls :meth:`~agen.aclose` and executes the coroutine. +This *finalizer* may be registered by calling :func:`sys.set_asyncgen_hooks`. +When first iterated over, an asynchronous generator-iterator will store the +registered *finalizer* to be called upon finalization. For a reference example +of a *finalizer* method see the implementation of +``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`. + +The expression ``yield from `` is a syntax error when used in an +asynchronous generator function. + +.. index:: object: asynchronous-generator +.. _asynchronous-generator-methods: + +Asynchronous generator-iterator methods +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This subsection describes the methods of an asynchronous generator iterator, +which are used to control the execution of a generator function. + + +.. index:: exception: StopAsyncIteration + +.. coroutinemethod:: agen.__anext__() + + Returns an awaitable which when run starts to execute the asynchronous + generator or resumes it at the last executed yield expression. When an + asynchronous generator function is resumed with a :meth:`~agen.__anext__` + method, the current yield expression always evaluates to :const:`None` in + the returned awaitable, which when run will continue to the next yield + expression. The value of the :token:`expression_list` of the yield + expression is the value of the :exc:`StopIteration` exception raised by + the completing coroutine. If the asynchronous generator exits without + yielding another value, the awaitable instead raises an + :exc:`StopAsyncIteration` exception, signalling that the asynchronous + iteration has completed. + + This method is normally called implicitly by a :keyword:`async for` loop. + + +.. coroutinemethod:: agen.asend(value) + + Returns an awaitable which when run resumes the execution of the + asynchronous generator. As with the :meth:`~generator.send()` method for a + generator, this "sends" a value into the asynchronous generator function, + and the *value* argument becomes the result of the current yield expression. + The awaitable returned by the :meth:`asend` method will return the next + value yielded by the generator as the value of the raised + :exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the + asynchronous generator exits without yielding another value. When + :meth:`asend` is called to start the asynchronous + generator, it must be called with :const:`None` as the argument, + because there is no yield expression that could receive the value. + + +.. coroutinemethod:: agen.athrow(type[, value[, traceback]]) + + Returns an awaitable that raises an exception of type ``type`` at the point + where the asynchronous generator was paused, and returns the next value + yielded by the generator function as the value of the raised + :exc:`StopIteration` exception. If the asynchronous generator exits + without yielding another value, an :exc:`StopAsyncIteration` exception is + raised by the awaitable. + If the generator function does not catch the passed-in exception, or + raises a different exception, then when the awaitalbe is run that exception + propagates to the caller of the awaitable. + +.. index:: exception: GeneratorExit + + +.. coroutinemethod:: agen.aclose() + + Returns an awaitable that when run will throw a :exc:`GeneratorExit` into + the asynchronous generator function at the point where it was paused. + If the asynchronous generator function then exits gracefully, is already + closed, or raises :exc:`GeneratorExit` (by not catching the exception), + then the returned awaitable will raise a :exc:`StopIteration` exception. + Any further awaitables returned by subsequent calls to the asynchronous + generator will raise a :exc:`StopAsyncIteration` exception. If the + asynchronous generator yields a value, a :exc:`RuntimeError` is raised + by the awaitable. If the asynchronous generator raises any other exception, + it is propagated to the caller of the awaitable. If the asynchronous + generator has already exited due to an exception or normal exit, then + further calls to :meth:`aclose` will return an awaitable that does nothing. .. _primaries: diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -492,6 +492,10 @@ value (if any) is used as an argument to construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` attribute. +In an asynchronous generator function, an empty :keyword:`return` statement +indicates that the asynchronous generator is done and will cause +:exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`return` +statement is a syntax error in an asynchronous generator function. .. _yield: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 17:36:43 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 15 Dec 2016 22:36:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MDkx?= =?utf-8?q?=3A_Document_PEP_525_=26_PEP_530=2E?= Message-ID: <20161215223643.32515.32651.D57A4D33@psf.io> https://hg.python.org/cpython/rev/78c8f450b84c changeset: 105647:78c8f450b84c branch: 3.6 parent: 105645:e5360d413ce4 user: Yury Selivanov date: Thu Dec 15 17:36:05 2016 -0500 summary: Issue #28091: Document PEP 525 & PEP 530. Patch by Eric Appelt. files: Doc/glossary.rst | 28 +++ Doc/library/asyncio-eventloop.rst | 18 + Doc/library/inspect.rst | 21 ++ Doc/library/sys.rst | 36 +++ Doc/library/types.rst | 8 + Doc/reference/compound_stmts.rst | 2 +- Doc/reference/datamodel.rst | 19 ++ Doc/reference/expressions.rst | 166 +++++++++++++++++- Doc/reference/simple_stmts.rst | 4 + 9 files changed, 298 insertions(+), 4 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -74,6 +74,34 @@ :keyword:`async with` statement by defining :meth:`__aenter__` and :meth:`__aexit__` methods. Introduced by :pep:`492`. + asynchronous generator + A function which returns an :term:`asynchronous generator iterator`. It + looks like a coroutine function defined with :keyword:`async def` except + that it contains :keyword:`yield` expressions for producing a series of + values usable in an :keyword:`async for` loop. + + Usually refers to a asynchronous generator function, but may refer to an + *asynchronous generator iterator* in some contexts. In cases where the + intended meaning isn't clear, using the full terms avoids ambiguity. + + An asynchronous generator function may contain :keyword:`await` + expressions as well as :keyword:`async for`, and :keyword:`async with` + statements. + + asynchronous generator iterator + An object created by a :term:`asynchronous generator` function. + + This is an :term:`asynchronous iterator` which when called using the + :meth:`__anext__` method returns an awaitable object which will execute + that the body of the asynchronous generator function until the + next :keyword:`yield` expression. + + Each :keyword:`yield` temporarily suspends processing, remembering the + location execution state (including local variables and pending + try-statements). When the *asynchronous generator iterator* effectively + resumes with another awaitable returned by :meth:`__anext__`, it + picks-up where it left-off. See :pep:`492` and :pep:`525`. + asynchronous iterable An object, that can be used in an :keyword:`async for` statement. Must return an :term:`asynchronous iterator` from its diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -88,6 +88,24 @@ This is idempotent and irreversible. No other methods should be called after this one. + +.. coroutinemethod:: AbstractEventLoop.shutdown_asyncgens() + + Schedule all currently open :term:`asynchronous generator` objects to + close with an :meth:`~agen.aclose()` call. After calling this method, + the event loop will issue a warning whenever a new asynchronous generator + is iterated. Should be used to finalize all scheduled asynchronous + generators reliably. Example:: + + try: + loop.run_forever() + finally: + loop.run_until_complete(loop.shutdown_asyncgens()) + loop.close() + + .. versionadded:: 3.6 + + .. _asyncio-pass-keywords: Calls diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -318,6 +318,27 @@ .. versionadded:: 3.5 +.. function:: isasyncgenfunction(object) + + Return true if the object is an :term:`asynchronous generator` function, + for example:: + + >>> async def agen(): + ... yield 1 + ... + >>> inspect.isasyncgenfunction(agen) + True + + .. versionadded:: 3.6 + + +.. function:: isasyncgen(object) + + Return true if the object is an :term:`asynchronous generator iterator` + created by an :term:`asynchronous generator` function. + + .. versionadded:: 3.6 + .. function:: istraceback(object) Return true if the object is a traceback. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -594,6 +594,24 @@ .. versionchanged:: 3.6 Added *platform_version* + +.. function:: get_asyncgen_hooks() + + Returns an *asyncgen_hooks* object, which is similar to a + :class:`~collections.namedtuple` of the form `(firstiter, finalizer)`, + where *firstiter* and *finalizer* are expected to be either ``None`` or + functions which take an :term:`asynchronous generator iterator` as an + argument, and are used to schedule finalization of an asychronous + generator by an event loop. + + .. versionadded:: 3.6 + See :pep:`525` for more details. + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + + .. function:: get_coroutine_wrapper() Returns ``None``, or a wrapper set by :func:`set_coroutine_wrapper`. @@ -1098,6 +1116,24 @@ implementation platform, rather than part of the language definition, and thus may not be available in all Python implementations. +.. function:: set_asyncgen_hooks(firstiter, finalizer) + + Accepts two optional keyword arguments which are callables that accept an + :term:`asynchronous generator iterator` as an argument. The *firstiter* + callable will be called when an asynchronous generator is iterated for the + first time. The *finalizer* will be called when an asynchronous generator + is about to be garbage collected. + + .. versionadded:: 3.6 + See :pep:`525` for more details, and for a reference example of a + *finalizer* method see the implementation of + ``asyncio.Loop.shutdown_asyncgens`` in + :source:`Lib/asyncio/base_events.py` + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + .. function:: set_coroutine_wrapper(wrapper) diff --git a/Doc/library/types.rst b/Doc/library/types.rst --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -104,6 +104,14 @@ .. versionadded:: 3.5 +.. data:: AsyncGeneratorType + + The type of :term:`asynchronous generator`-iterator objects, created by + asynchronous generator functions. + + .. versionadded:: 3.6 + + .. data:: CodeType .. index:: builtin: compile diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -697,7 +697,7 @@ Functions defined with ``async def`` syntax are always coroutine functions, even if they do not contain ``await`` or ``async`` keywords. -It is a :exc:`SyntaxError` to use :keyword:`yield` expressions in +It is a :exc:`SyntaxError` to use ``yield from`` expressions in ``async def`` coroutines. An example of a coroutine function:: diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -627,6 +627,25 @@ as well as :keyword:`async with` and :keyword:`async for` statements. See also the :ref:`coroutine-objects` section. + Asynchronous generator functions + .. index:: + single: asynchronous generator; function + single: asynchronous generator; asynchronous iterator + + A function or method which is defined using :keyword:`async def` and + which uses the :keyword:`yield` statement is called a + :dfn:`asynchronous generator function`. Such a function, when called, + returns an asynchronous iterator object which can be used in an + :keyword:`async for` statement to execute the body of the function. + + Calling the asynchronous iterator's :meth:`aiterator.__anext__` method + will return an :term:`awaitable` which when awaited + will execute until it provides a value using the :keyword:`yield` + expression. When the function executes an empty :keyword:`return` + statement or falls off the end, a :exc:`StopAsyncIteration` exception + is raised and the asynchronous iterator will have reached the end of + the set of values to be yielded. + Built-in functions .. index:: object: built-in function diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -172,7 +172,7 @@ .. productionlist:: comprehension: `expression` `comp_for` - comp_for: "for" `target_list` "in" `or_test` [`comp_iter`] + comp_for: [ASYNC] "for" `target_list` "in" `or_test` [`comp_iter`] comp_iter: `comp_for` | `comp_if` comp_if: "if" `expression_nocond` [`comp_iter`] @@ -186,6 +186,17 @@ Note that the comprehension is executed in a separate scope, so names assigned to in the target list don't "leak" into the enclosing scope. +Since Python 3.6, in an :keyword:`async def` function, an :keyword:`async for` +clause may be used to iterate over a :term:`asynchronous iterator`. +A comprehension in an :keyword:`async def` function may consist of either a +:keyword:`for` or :keyword:`async for` clause following the leading +expression, may contan additonal :keyword:`for` or :keyword:`async for` +clauses, and may also use :keyword:`await` expressions. +If a comprehension contains either :keyword:`async for` clauses +or :keyword:`await` expressions it is called an +:dfn:`asynchronous comprehension`. An asynchronous comprehension may +suspend the execution of the coroutine function in which it appears. +See also :pep:`530`. .. _lists: @@ -315,6 +326,14 @@ The parentheses can be omitted on calls with only one argument. See section :ref:`calls` for details. +Since Python 3.6, if the generator appears in an :keyword:`async def` function, +then :keyword:`async for` clauses and :keyword:`await` expressions are permitted +as with an asynchronous comprehension. If a generator expression +contains either :keyword:`async for` clauses or :keyword:`await` expressions +it is called an :dfn:`asynchronous generator expression`. +An asynchronous generator expression yields a new asynchronous +generator object, which is an asynchronous iterator +(see :ref:`async-iterators`). .. _yieldexpr: @@ -330,9 +349,22 @@ yield_atom: "(" `yield_expression` ")" yield_expression: "yield" [`expression_list` | "from" `expression`] -The yield expression is only used when defining a :term:`generator` function and +The yield expression is used when defining a :term:`generator` function +or an :term:`asynchronous generator` function and thus can only be used in the body of a function definition. Using a yield -expression in a function's body causes that function to be a generator. +expression in a function's body causes that function to be a generator, +and using it in an :keyword:`async def` function's body causes that +coroutine function to be an asynchronous generator. For example:: + + def gen(): # defines a generator function + yield 123 + + async def agen(): # defines an asynchronous generator function (PEP 525) + yield 123 + +Generator functions are described below, while asynchronous generator +functions are described separately in section +:ref:`asynchronous-generator-functions`. When a generator function is called, it returns an iterator known as a generator. That generator then controls the execution of the generator function. @@ -496,6 +528,134 @@ For examples using ``yield from``, see :ref:`pep-380` in "What's New in Python." +.. _asynchronous-generator-functions: + +Asynchronous generator functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The presence of a yield expression in a function or method defined using +:keyword:`async def` further defines the function as a +:term:`asynchronous generator` function. + +When an asynchronous generator function is called, it returns an +asynchronous iterator known as an asynchronous generator object. +That object then controls the execution of the generator function. +An asynchronous generator object is typically used in an +:keyword:`async for` statement in a coroutine function analogously to +how a generator object would be used in a :keyword:`for` statement. + +Calling one of the asynchronous generator's methods returns an +:term:`awaitable` object, and the execution starts when this object +is awaited on. At that time, the execution proceeds to the first yield +expression, where it is suspended again, returning the value of +:token:`expression_list` to the awaiting coroutine. As with a generator, +suspension means that all local state is retained, including the +current bindings of local variables, the instruction pointer, the internal +evaluation stack, and the state of any exception handling. When the execution +is resumed by awaiting on the next object returned by the asynchronous +generator's methods, the function can proceed exactly as if the yield +expression were just another external call. The value of the yield expression +after resuming depends on the method which resumed the execution. If +:meth:`~agen.__anext__` is used then the result is :const:`None`. Otherwise, if +:meth:`~agen.asend` is used, then the result will be the value passed in to +that method. + +In an asynchronous generator function, yield expressions are allowed anywhere +in a :keyword:`try` construct. However, if an asynchronous generator is not +resumed before it is finalized (by reaching a zero reference count or by +being garbage collected), then a yield expression within a :keyword:`try` +construct could result in a failure to execute pending :keyword:`finally` +clauses. In this case, it is the responsibility of the event loop or +scheduler running the asynchronous generator to call the asynchronous +generator-iterator's :meth:`~agen.aclose` method and run the resulting +coroutine object, thus allowing any pending :keyword:`finally` clauses +to execute. + +To take care of finalization, an event loop should define +a *finalizer* function which takes an asynchronous generator-iterator +and presumably calls :meth:`~agen.aclose` and executes the coroutine. +This *finalizer* may be registered by calling :func:`sys.set_asyncgen_hooks`. +When first iterated over, an asynchronous generator-iterator will store the +registered *finalizer* to be called upon finalization. For a reference example +of a *finalizer* method see the implementation of +``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`. + +The expression ``yield from `` is a syntax error when used in an +asynchronous generator function. + +.. index:: object: asynchronous-generator +.. _asynchronous-generator-methods: + +Asynchronous generator-iterator methods +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This subsection describes the methods of an asynchronous generator iterator, +which are used to control the execution of a generator function. + + +.. index:: exception: StopAsyncIteration + +.. coroutinemethod:: agen.__anext__() + + Returns an awaitable which when run starts to execute the asynchronous + generator or resumes it at the last executed yield expression. When an + asynchronous generator function is resumed with a :meth:`~agen.__anext__` + method, the current yield expression always evaluates to :const:`None` in + the returned awaitable, which when run will continue to the next yield + expression. The value of the :token:`expression_list` of the yield + expression is the value of the :exc:`StopIteration` exception raised by + the completing coroutine. If the asynchronous generator exits without + yielding another value, the awaitable instead raises an + :exc:`StopAsyncIteration` exception, signalling that the asynchronous + iteration has completed. + + This method is normally called implicitly by a :keyword:`async for` loop. + + +.. coroutinemethod:: agen.asend(value) + + Returns an awaitable which when run resumes the execution of the + asynchronous generator. As with the :meth:`~generator.send()` method for a + generator, this "sends" a value into the asynchronous generator function, + and the *value* argument becomes the result of the current yield expression. + The awaitable returned by the :meth:`asend` method will return the next + value yielded by the generator as the value of the raised + :exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the + asynchronous generator exits without yielding another value. When + :meth:`asend` is called to start the asynchronous + generator, it must be called with :const:`None` as the argument, + because there is no yield expression that could receive the value. + + +.. coroutinemethod:: agen.athrow(type[, value[, traceback]]) + + Returns an awaitable that raises an exception of type ``type`` at the point + where the asynchronous generator was paused, and returns the next value + yielded by the generator function as the value of the raised + :exc:`StopIteration` exception. If the asynchronous generator exits + without yielding another value, an :exc:`StopAsyncIteration` exception is + raised by the awaitable. + If the generator function does not catch the passed-in exception, or + raises a different exception, then when the awaitalbe is run that exception + propagates to the caller of the awaitable. + +.. index:: exception: GeneratorExit + + +.. coroutinemethod:: agen.aclose() + + Returns an awaitable that when run will throw a :exc:`GeneratorExit` into + the asynchronous generator function at the point where it was paused. + If the asynchronous generator function then exits gracefully, is already + closed, or raises :exc:`GeneratorExit` (by not catching the exception), + then the returned awaitable will raise a :exc:`StopIteration` exception. + Any further awaitables returned by subsequent calls to the asynchronous + generator will raise a :exc:`StopAsyncIteration` exception. If the + asynchronous generator yields a value, a :exc:`RuntimeError` is raised + by the awaitable. If the asynchronous generator raises any other exception, + it is propagated to the caller of the awaitable. If the asynchronous + generator has already exited due to an exception or normal exit, then + further calls to :meth:`aclose` will return an awaitable that does nothing. .. _primaries: diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -492,6 +492,10 @@ value (if any) is used as an argument to construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` attribute. +In an asynchronous generator function, an empty :keyword:`return` statement +indicates that the asynchronous generator is done and will cause +:exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`return` +statement is a syntax error in an asynchronous generator function. .. _yield: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 17:57:59 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 15 Dec 2016 22:57:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42IChpc3N1ZSAjMjg2MzUp?= Message-ID: <20161215225759.2559.8036.1A092B1F@psf.io> https://hg.python.org/cpython/rev/83eb8053a4e1 changeset: 105650:83eb8053a4e1 parent: 105648:6bf84e661e69 parent: 105649:418ba3a0f090 user: Yury Selivanov date: Thu Dec 15 17:57:55 2016 -0500 summary: Merge 3.6 (issue #28635) files: Doc/whatsnew/3.6.rst | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -859,7 +859,7 @@ function if the address is already resolved. (Contributed by A. Jesse Jiryu Davis.) -* The :meth:`BaseEventLoop.stop() ` +* The :meth:`loop.stop() ` method has been changed to stop the loop immediately after the current iteration. Any new callbacks scheduled as a result of the last iteration will be discarded. @@ -870,7 +870,7 @@ the :exc:`StopIteration` exception. (Contributed by Chris Angelico in :issue:`26221`.) -* New :meth:`Loop.connect_accepted_socket() ` +* New :meth:`loop.connect_accepted_socket() ` method to be used by servers that accept connections outside of asyncio, but that use asyncio to handle them. (Contributed by Jim Fulton in :issue:`27392`.) @@ -878,6 +878,17 @@ * ``TCP_NODELAY`` flag is now set for all TCP transports by default. (Contributed by Yury Selivanov in :issue:`27456`.) +* New :meth:`loop.shutdown_asyncgens() ` + to properly close pending asynchronous generators before closing the + loop. + (Contributed by Yury Selivanov in :issue:`28003`.) + +* :class:`Future ` and :class:`Task ` + classes now have an optimized C implementation which makes asyncio + code up to 30% faster. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081` + and :issue:`28544`.) + binascii -------- @@ -1714,11 +1725,10 @@ (Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:`26647` and :issue:`28050`.) -* The :class:`Future ` class now has an optimized - C implementation. - (Contributed by Yury Selivanov and INADA Naoki in :issue:`26801`.) - -* The :class:`Task ` class now has an optimized +* The :class:`asyncio.Future` class now has an optimized C implementation. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081`.) + +* The :class:`asyncio.Task` class now has an optimized C implementation. (Contributed by Yury Selivanov in :issue:`28544`.) * Various implementation improvements in the :mod:`typing` module -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 17:57:59 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 15 Dec 2016 22:57:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NjM1?= =?utf-8?q?=3A_asyncio-related_fixes_and_additions=2E?= Message-ID: <20161215225759.98159.70359.ECCAAB3B@psf.io> https://hg.python.org/cpython/rev/418ba3a0f090 changeset: 105649:418ba3a0f090 branch: 3.6 parent: 105647:78c8f450b84c user: Yury Selivanov date: Thu Dec 15 17:56:43 2016 -0500 summary: Issue #28635: asyncio-related fixes and additions. files: Doc/whatsnew/3.6.rst | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -859,7 +859,7 @@ function if the address is already resolved. (Contributed by A. Jesse Jiryu Davis.) -* The :meth:`BaseEventLoop.stop() ` +* The :meth:`loop.stop() ` method has been changed to stop the loop immediately after the current iteration. Any new callbacks scheduled as a result of the last iteration will be discarded. @@ -870,7 +870,7 @@ the :exc:`StopIteration` exception. (Contributed by Chris Angelico in :issue:`26221`.) -* New :meth:`Loop.connect_accepted_socket() ` +* New :meth:`loop.connect_accepted_socket() ` method to be used by servers that accept connections outside of asyncio, but that use asyncio to handle them. (Contributed by Jim Fulton in :issue:`27392`.) @@ -878,6 +878,17 @@ * ``TCP_NODELAY`` flag is now set for all TCP transports by default. (Contributed by Yury Selivanov in :issue:`27456`.) +* New :meth:`loop.shutdown_asyncgens() ` + to properly close pending asynchronous generators before closing the + loop. + (Contributed by Yury Selivanov in :issue:`28003`.) + +* :class:`Future ` and :class:`Task ` + classes now have an optimized C implementation which makes asyncio + code up to 30% faster. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081` + and :issue:`28544`.) + binascii -------- @@ -1714,11 +1725,10 @@ (Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:`26647` and :issue:`28050`.) -* The :class:`Future ` class now has an optimized - C implementation. - (Contributed by Yury Selivanov and INADA Naoki in :issue:`26801`.) - -* The :class:`Task ` class now has an optimized +* The :class:`asyncio.Future` class now has an optimized C implementation. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081`.) + +* The :class:`asyncio.Task` class now has an optimized C implementation. (Contributed by Yury Selivanov in :issue:`28544`.) * Various implementation improvements in the :mod:`typing` module -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 18:58:39 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 15 Dec 2016 23:58:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogZG9jczogYXN5bmNp?= =?utf-8?q?o_is_no_longer_provisional?= Message-ID: <20161215235839.31595.92662.D1B89764@psf.io> https://hg.python.org/cpython/rev/4cb3ea76ce68 changeset: 105651:4cb3ea76ce68 branch: 3.6 parent: 105649:418ba3a0f090 user: Yury Selivanov date: Thu Dec 15 18:58:19 2016 -0500 summary: docs: asyncio is no longer provisional files: Doc/library/asyncio.rst | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -8,13 +8,6 @@ **Source code:** :source:`Lib/asyncio/` -.. note:: - - The asyncio package has been included in the standard library on a - :term:`provisional basis `. Backwards incompatible - changes (up to and including removal of the module) may occur if deemed - necessary by the core developers. - -------------- This module provides infrastructure for writing single-threaded concurrent -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 15 18:58:39 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 15 Dec 2016 23:58:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161215235839.16235.12305.CCD5E7D0@psf.io> https://hg.python.org/cpython/rev/0b78a8c35357 changeset: 105652:0b78a8c35357 parent: 105650:83eb8053a4e1 parent: 105651:4cb3ea76ce68 user: Yury Selivanov date: Thu Dec 15 18:58:35 2016 -0500 summary: Merge 3.6 files: Doc/library/asyncio.rst | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -8,13 +8,6 @@ **Source code:** :source:`Lib/asyncio/` -.. note:: - - The asyncio package has been included in the standard library on a - :term:`provisional basis `. Backwards incompatible - changes (up to and including removal of the module) may occur if deemed - necessary by the core developers. - -------------- This module provides infrastructure for writing single-threaded concurrent -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTAw?= =?utf-8?q?=3A_Update_documentation_sidebar_for_3=2E6=2E0rc=2E?= Message-ID: <20161216074440.77820.78100.7F73C3C1@psf.io> https://hg.python.org/cpython/rev/257a1c7f9507 changeset: 105654:257a1c7f9507 branch: 3.6 user: Ned Deily date: Wed Dec 07 23:37:12 2016 -0500 summary: Issue #28900: Update documentation sidebar for 3.6.0rc. files: Doc/tools/templates/indexsidebar.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -3,7 +3,8 @@

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MDg5?= =?utf-8?q?=3A_Document_TCP=5FNODELAY_in_asyncio?= Message-ID: <20161216074440.12134.61220.510FB26D@psf.io> https://hg.python.org/cpython/rev/dfd1019f75f9 changeset: 105658:dfd1019f75f9 branch: 3.6 user: Yury Selivanov date: Mon Dec 12 16:44:58 2016 -0500 summary: Issue #28089: Document TCP_NODELAY in asyncio Initial patch by Mariatta Wijaya. (grafted from 853e3f4d6cd98ac4590238bc1c60e40fd8ed3895) files: Doc/library/asyncio-protocol.rst | 3 +++ Doc/whatsnew/3.6.rst | 3 +++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst --- a/Doc/library/asyncio-protocol.rst +++ b/Doc/library/asyncio-protocol.rst @@ -25,6 +25,9 @@ The transport classes are :ref:`not thread safe `. +.. versionchanged:: 3.6 + The socket option ``TCP_NODELAY`` is now set by default. + BaseTransport ------------- diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -875,6 +875,9 @@ but that use asyncio to handle them. (Contributed by Jim Fulton in :issue:`27392`.) +* ``TCP_NODELAY`` flag is now set for all TCP transports by default. + (Contributed by Yury Selivanov in :issue:`27456`.) + binascii -------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODk2?= =?utf-8?q?=3A_Deprecate_WindowsRegistryFinder?= Message-ID: <20161216074440.40319.47661.1A652C0F@psf.io> https://hg.python.org/cpython/rev/6249350e654a changeset: 105656:6249350e654a branch: 3.6 user: Steve Dower date: Wed Dec 07 13:02:27 2016 -0800 summary: Issue #28896: Deprecate WindowsRegistryFinder (grafted from 25df9671663b5f8b1560d58d8842f9676f6dffc2) files: Doc/library/importlib.rst | 4 ++++ Doc/using/windows.rst | 8 ++++++++ Doc/whatsnew/3.6.rst | 4 ++++ Misc/NEWS | 11 +++++++++++ 4 files changed, 27 insertions(+), 0 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -806,6 +806,10 @@ .. versionadded:: 3.3 + .. deprecated:: 3.6 + Use :mod:`site` configuration instead. Future versions of Python may + not enable this finder by default. + .. class:: PathFinder diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -823,6 +823,14 @@ * Adds ``pythonXX.zip`` as a potential landmark when directly adjacent to the executable. +.. deprecated:: + 3.6 + + Modules specified in the registry under ``Modules`` (not ``PythonPath``) + may be imported by :class:`importlib.machinery.WindowsRegistryFinder`. + This finder is enabled on Windows in 3.6.0 and earlier, but may need to + be explicitly added to :attr:`sys.meta_path` in the future. + Additional modules ================== diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -1938,6 +1938,10 @@ been deprecated in previous versions of Python in favour of :meth:`importlib.abc.Loader.exec_module`. +The :class:`importlib.machinery.WindowsRegistryFinder` class is now +deprecated. As of 3.6.0, it is still added to :attr:`sys.meta_path` by +default (on Windows), but this may change in future releases. + os ~~ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,17 @@ Python News +++++++++++ +What's New in Python 3.6.0 release candidate 2 +============================================== + +*Release date: XXXX-XX-XX* + +Windows +------- + +- Issue #28896: Deprecate WindowsRegistryFinder + + What's New in Python 3.6.0 release candidate 1 ============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4Nzgz?= =?utf-8?q?=3A_Replaces_bdist=5Fwininst_in_nuget_packages_with_stub?= Message-ID: <20161216074440.78148.52758.19D666EB@psf.io> https://hg.python.org/cpython/rev/1f69fb337288 changeset: 105657:1f69fb337288 branch: 3.6 user: Steve Dower date: Sun Dec 11 14:48:32 2016 -0800 summary: Issue #28783: Replaces bdist_wininst in nuget packages with stub files: Tools/msi/distutils.command.bdist_wininst.py | 48 +++------ Tools/msi/make_zip.py | 8 +- 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/Tools/msi/distutils.command.__init__.py b/Tools/msi/distutils.command.bdist_wininst.py rename from Tools/msi/distutils.command.__init__.py rename to Tools/msi/distutils.command.bdist_wininst.py --- a/Tools/msi/distutils.command.__init__.py +++ b/Tools/msi/distutils.command.bdist_wininst.py @@ -1,32 +1,20 @@ -"""distutils.command +"""distutils.command.bdist_wininst -Package containing implementation of all the standard Distutils -commands.""" +Suppresses the 'bdist_wininst' command, while still allowing +setuptools to import it without breaking.""" -__all__ = ['build', - 'build_py', - 'build_ext', - 'build_clib', - 'build_scripts', - 'clean', - 'install', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data', - 'sdist', - 'register', - 'bdist', - 'bdist_dumb', - 'bdist_rpm', - # This command is not included in this package - #'bdist_wininst', - 'check', - 'upload', - # These two are reserved for future use: - #'bdist_sdux', - #'bdist_pkgtool', - # Note: - # bdist_packager is not included because it only provides - # an abstract base class - ] +from distutils.core import Command +from distutils.errors import DistutilsPlatformError + +class bdist_wininst(Command): + description = "create an executable installer for MS Windows" + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + raise DistutilsPlatformError("bdist_wininst is not supported " + "in this Python distribution") 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 @@ -79,10 +79,6 @@ if name in EXCLUDE_FILE_FROM_LIBRARY: return False - # Special code is included below to patch this file back in - if [d.lower() for d in p.parts[-3:]] == ['distutils', 'command', '__init__.py']: - return False - suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} @@ -218,8 +214,8 @@ extra_files = [] if s == 'Lib' and p == '**/*': extra_files.append(( - source / 'tools' / 'msi' / 'distutils.command.__init__.py', - Path('distutils') / 'command' / '__init__.py' + source / 'tools' / 'msi' / 'distutils.command.bdist_wininst.py', + Path('distutils') / 'command' / 'bdist_wininst.py' )) copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files)) print('Copied {} files'.format(copied)) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTc5?= =?utf-8?q?=3A_Fix_What=27s_New_in_Python_3=2E6=2C_dict?= Message-ID: <20161216074440.40739.11819.708D32D3@psf.io> https://hg.python.org/cpython/rev/911cc601089d changeset: 105659:911cc601089d branch: 3.6 user: Victor Stinner date: Thu Dec 15 16:20:53 2016 +0100 summary: Issue #28979: Fix What's New in Python 3.6, dict The new dict implementation is not faster, but more compact. Patch written by Brendan Donegan. (grafted from 181453f9a0c424212f0f6ddca2b9065c15689d7c) files: Doc/whatsnew/3.6.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -77,7 +77,7 @@ CPython implementation improvements: * The :ref:`dict ` type has been reimplemented to use - a :ref:`faster, more compact representation ` + a :ref:`more compact representation ` similar to the `PyPy dict implementation`_. This resulted in dictionaries using 20% to 25% less memory when compared to Python 3.5. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NjM1?= =?utf-8?q?=3A_asyncio-related_fixes_and_additions=2E?= Message-ID: <20161216074440.11902.22954.5413C187@psf.io> https://hg.python.org/cpython/rev/c4d6ef15bb7c changeset: 105662:c4d6ef15bb7c branch: 3.6 user: Yury Selivanov date: Thu Dec 15 17:56:43 2016 -0500 summary: Issue #28635: asyncio-related fixes and additions. (grafted from 418ba3a0f090ac0e17a935b7cd5a63ea8263a914) files: Doc/whatsnew/3.6.rst | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -859,7 +859,7 @@ function if the address is already resolved. (Contributed by A. Jesse Jiryu Davis.) -* The :meth:`BaseEventLoop.stop() ` +* The :meth:`loop.stop() ` method has been changed to stop the loop immediately after the current iteration. Any new callbacks scheduled as a result of the last iteration will be discarded. @@ -870,7 +870,7 @@ the :exc:`StopIteration` exception. (Contributed by Chris Angelico in :issue:`26221`.) -* New :meth:`Loop.connect_accepted_socket() ` +* New :meth:`loop.connect_accepted_socket() ` method to be used by servers that accept connections outside of asyncio, but that use asyncio to handle them. (Contributed by Jim Fulton in :issue:`27392`.) @@ -878,6 +878,17 @@ * ``TCP_NODELAY`` flag is now set for all TCP transports by default. (Contributed by Yury Selivanov in :issue:`27456`.) +* New :meth:`loop.shutdown_asyncgens() ` + to properly close pending asynchronous generators before closing the + loop. + (Contributed by Yury Selivanov in :issue:`28003`.) + +* :class:`Future ` and :class:`Task ` + classes now have an optimized C implementation which makes asyncio + code up to 30% faster. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081` + and :issue:`28544`.) + binascii -------- @@ -1714,11 +1725,10 @@ (Contributed by Demur Rumed with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:`26647` and :issue:`28050`.) -* The :class:`Future ` class now has an optimized - C implementation. - (Contributed by Yury Selivanov and INADA Naoki in :issue:`26801`.) - -* The :class:`Task ` class now has an optimized +* The :class:`asyncio.Future` class now has an optimized C implementation. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26081`.) + +* The :class:`asyncio.Task` class now has an optimized C implementation. (Contributed by Yury Selivanov in :issue:`28544`.) * Various implementation improvements in the :mod:`typing` module -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogZG9jczogYXN5bmNp?= =?utf-8?q?o_is_no_longer_provisional?= Message-ID: <20161216074440.78738.81147.F1F0623E@psf.io> https://hg.python.org/cpython/rev/f5ae27928a5f changeset: 105663:f5ae27928a5f branch: 3.6 user: Yury Selivanov date: Thu Dec 15 18:58:19 2016 -0500 summary: docs: asyncio is no longer provisional (grafted from 4cb3ea76ce68efd52271e499647abbf0f8a2941f) files: Doc/library/asyncio.rst | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -8,13 +8,6 @@ **Source code:** :source:`Lib/asyncio/` -.. note:: - - The asyncio package has been included in the standard library on a - :term:`provisional basis `. Backwards incompatible - changes (up to and including removal of the module) may occur if deemed - necessary by the core developers. - -------------- This module provides infrastructure for writing single-threaded concurrent -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:41 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy42IC0+IDMuNik6?= =?utf-8?q?_null_merge_3=2E6=2E0rc1+_head?= Message-ID: <20161216074441.40444.503.3875321C@psf.io> https://hg.python.org/cpython/rev/8d294c52df39 changeset: 105666:8d294c52df39 branch: 3.6 parent: 105651:4cb3ea76ce68 parent: 105665:c9a058c78457 user: Ned Deily date: Fri Dec 16 01:02:17 2016 -0500 summary: null merge 3.6.0rc1+ head files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:41 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_bump_version_t?= =?utf-8?q?o_3=2E6=2E0rc1+?= Message-ID: <20161216074440.40600.30768.4C3FCFE0@psf.io> https://hg.python.org/cpython/rev/c9a058c78457 changeset: 105665:c9a058c78457 branch: 3.6 user: Ned Deily date: Fri Dec 16 00:13:46 2016 -0500 summary: bump version to 3.6.0rc1+ files: Include/patchlevel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.6.0rc1" +#define PY_VERSION "3.6.0rc1+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MDkx?= =?utf-8?q?=3A_Document_PEP_525_=26_PEP_530=2E?= Message-ID: <20161216074440.40396.54813.202BBD92@psf.io> https://hg.python.org/cpython/rev/5a11263bb612 changeset: 105661:5a11263bb612 branch: 3.6 user: Yury Selivanov date: Thu Dec 15 17:36:05 2016 -0500 summary: Issue #28091: Document PEP 525 & PEP 530. Patch by Eric Appelt. (grafted from 78c8f450b84ca1864123ec487d363eb151f61a4a) files: Doc/glossary.rst | 28 +++ Doc/library/asyncio-eventloop.rst | 18 + Doc/library/inspect.rst | 21 ++ Doc/library/sys.rst | 36 +++ Doc/library/types.rst | 8 + Doc/reference/compound_stmts.rst | 2 +- Doc/reference/datamodel.rst | 19 ++ Doc/reference/expressions.rst | 166 +++++++++++++++++- Doc/reference/simple_stmts.rst | 4 + 9 files changed, 298 insertions(+), 4 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -74,6 +74,34 @@ :keyword:`async with` statement by defining :meth:`__aenter__` and :meth:`__aexit__` methods. Introduced by :pep:`492`. + asynchronous generator + A function which returns an :term:`asynchronous generator iterator`. It + looks like a coroutine function defined with :keyword:`async def` except + that it contains :keyword:`yield` expressions for producing a series of + values usable in an :keyword:`async for` loop. + + Usually refers to a asynchronous generator function, but may refer to an + *asynchronous generator iterator* in some contexts. In cases where the + intended meaning isn't clear, using the full terms avoids ambiguity. + + An asynchronous generator function may contain :keyword:`await` + expressions as well as :keyword:`async for`, and :keyword:`async with` + statements. + + asynchronous generator iterator + An object created by a :term:`asynchronous generator` function. + + This is an :term:`asynchronous iterator` which when called using the + :meth:`__anext__` method returns an awaitable object which will execute + that the body of the asynchronous generator function until the + next :keyword:`yield` expression. + + Each :keyword:`yield` temporarily suspends processing, remembering the + location execution state (including local variables and pending + try-statements). When the *asynchronous generator iterator* effectively + resumes with another awaitable returned by :meth:`__anext__`, it + picks-up where it left-off. See :pep:`492` and :pep:`525`. + asynchronous iterable An object, that can be used in an :keyword:`async for` statement. Must return an :term:`asynchronous iterator` from its diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -88,6 +88,24 @@ This is idempotent and irreversible. No other methods should be called after this one. + +.. coroutinemethod:: AbstractEventLoop.shutdown_asyncgens() + + Schedule all currently open :term:`asynchronous generator` objects to + close with an :meth:`~agen.aclose()` call. After calling this method, + the event loop will issue a warning whenever a new asynchronous generator + is iterated. Should be used to finalize all scheduled asynchronous + generators reliably. Example:: + + try: + loop.run_forever() + finally: + loop.run_until_complete(loop.shutdown_asyncgens()) + loop.close() + + .. versionadded:: 3.6 + + .. _asyncio-pass-keywords: Calls diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -318,6 +318,27 @@ .. versionadded:: 3.5 +.. function:: isasyncgenfunction(object) + + Return true if the object is an :term:`asynchronous generator` function, + for example:: + + >>> async def agen(): + ... yield 1 + ... + >>> inspect.isasyncgenfunction(agen) + True + + .. versionadded:: 3.6 + + +.. function:: isasyncgen(object) + + Return true if the object is an :term:`asynchronous generator iterator` + created by an :term:`asynchronous generator` function. + + .. versionadded:: 3.6 + .. function:: istraceback(object) Return true if the object is a traceback. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -594,6 +594,24 @@ .. versionchanged:: 3.6 Added *platform_version* + +.. function:: get_asyncgen_hooks() + + Returns an *asyncgen_hooks* object, which is similar to a + :class:`~collections.namedtuple` of the form `(firstiter, finalizer)`, + where *firstiter* and *finalizer* are expected to be either ``None`` or + functions which take an :term:`asynchronous generator iterator` as an + argument, and are used to schedule finalization of an asychronous + generator by an event loop. + + .. versionadded:: 3.6 + See :pep:`525` for more details. + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + + .. function:: get_coroutine_wrapper() Returns ``None``, or a wrapper set by :func:`set_coroutine_wrapper`. @@ -1098,6 +1116,24 @@ implementation platform, rather than part of the language definition, and thus may not be available in all Python implementations. +.. function:: set_asyncgen_hooks(firstiter, finalizer) + + Accepts two optional keyword arguments which are callables that accept an + :term:`asynchronous generator iterator` as an argument. The *firstiter* + callable will be called when an asynchronous generator is iterated for the + first time. The *finalizer* will be called when an asynchronous generator + is about to be garbage collected. + + .. versionadded:: 3.6 + See :pep:`525` for more details, and for a reference example of a + *finalizer* method see the implementation of + ``asyncio.Loop.shutdown_asyncgens`` in + :source:`Lib/asyncio/base_events.py` + + .. note:: + This function has been added on a provisional basis (see :pep:`411` + for details.) + .. function:: set_coroutine_wrapper(wrapper) diff --git a/Doc/library/types.rst b/Doc/library/types.rst --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -104,6 +104,14 @@ .. versionadded:: 3.5 +.. data:: AsyncGeneratorType + + The type of :term:`asynchronous generator`-iterator objects, created by + asynchronous generator functions. + + .. versionadded:: 3.6 + + .. data:: CodeType .. index:: builtin: compile diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -697,7 +697,7 @@ Functions defined with ``async def`` syntax are always coroutine functions, even if they do not contain ``await`` or ``async`` keywords. -It is a :exc:`SyntaxError` to use :keyword:`yield` expressions in +It is a :exc:`SyntaxError` to use ``yield from`` expressions in ``async def`` coroutines. An example of a coroutine function:: diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -627,6 +627,25 @@ as well as :keyword:`async with` and :keyword:`async for` statements. See also the :ref:`coroutine-objects` section. + Asynchronous generator functions + .. index:: + single: asynchronous generator; function + single: asynchronous generator; asynchronous iterator + + A function or method which is defined using :keyword:`async def` and + which uses the :keyword:`yield` statement is called a + :dfn:`asynchronous generator function`. Such a function, when called, + returns an asynchronous iterator object which can be used in an + :keyword:`async for` statement to execute the body of the function. + + Calling the asynchronous iterator's :meth:`aiterator.__anext__` method + will return an :term:`awaitable` which when awaited + will execute until it provides a value using the :keyword:`yield` + expression. When the function executes an empty :keyword:`return` + statement or falls off the end, a :exc:`StopAsyncIteration` exception + is raised and the asynchronous iterator will have reached the end of + the set of values to be yielded. + Built-in functions .. index:: object: built-in function diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -172,7 +172,7 @@ .. productionlist:: comprehension: `expression` `comp_for` - comp_for: "for" `target_list` "in" `or_test` [`comp_iter`] + comp_for: [ASYNC] "for" `target_list` "in" `or_test` [`comp_iter`] comp_iter: `comp_for` | `comp_if` comp_if: "if" `expression_nocond` [`comp_iter`] @@ -186,6 +186,17 @@ Note that the comprehension is executed in a separate scope, so names assigned to in the target list don't "leak" into the enclosing scope. +Since Python 3.6, in an :keyword:`async def` function, an :keyword:`async for` +clause may be used to iterate over a :term:`asynchronous iterator`. +A comprehension in an :keyword:`async def` function may consist of either a +:keyword:`for` or :keyword:`async for` clause following the leading +expression, may contan additonal :keyword:`for` or :keyword:`async for` +clauses, and may also use :keyword:`await` expressions. +If a comprehension contains either :keyword:`async for` clauses +or :keyword:`await` expressions it is called an +:dfn:`asynchronous comprehension`. An asynchronous comprehension may +suspend the execution of the coroutine function in which it appears. +See also :pep:`530`. .. _lists: @@ -315,6 +326,14 @@ The parentheses can be omitted on calls with only one argument. See section :ref:`calls` for details. +Since Python 3.6, if the generator appears in an :keyword:`async def` function, +then :keyword:`async for` clauses and :keyword:`await` expressions are permitted +as with an asynchronous comprehension. If a generator expression +contains either :keyword:`async for` clauses or :keyword:`await` expressions +it is called an :dfn:`asynchronous generator expression`. +An asynchronous generator expression yields a new asynchronous +generator object, which is an asynchronous iterator +(see :ref:`async-iterators`). .. _yieldexpr: @@ -330,9 +349,22 @@ yield_atom: "(" `yield_expression` ")" yield_expression: "yield" [`expression_list` | "from" `expression`] -The yield expression is only used when defining a :term:`generator` function and +The yield expression is used when defining a :term:`generator` function +or an :term:`asynchronous generator` function and thus can only be used in the body of a function definition. Using a yield -expression in a function's body causes that function to be a generator. +expression in a function's body causes that function to be a generator, +and using it in an :keyword:`async def` function's body causes that +coroutine function to be an asynchronous generator. For example:: + + def gen(): # defines a generator function + yield 123 + + async def agen(): # defines an asynchronous generator function (PEP 525) + yield 123 + +Generator functions are described below, while asynchronous generator +functions are described separately in section +:ref:`asynchronous-generator-functions`. When a generator function is called, it returns an iterator known as a generator. That generator then controls the execution of the generator function. @@ -496,6 +528,134 @@ For examples using ``yield from``, see :ref:`pep-380` in "What's New in Python." +.. _asynchronous-generator-functions: + +Asynchronous generator functions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The presence of a yield expression in a function or method defined using +:keyword:`async def` further defines the function as a +:term:`asynchronous generator` function. + +When an asynchronous generator function is called, it returns an +asynchronous iterator known as an asynchronous generator object. +That object then controls the execution of the generator function. +An asynchronous generator object is typically used in an +:keyword:`async for` statement in a coroutine function analogously to +how a generator object would be used in a :keyword:`for` statement. + +Calling one of the asynchronous generator's methods returns an +:term:`awaitable` object, and the execution starts when this object +is awaited on. At that time, the execution proceeds to the first yield +expression, where it is suspended again, returning the value of +:token:`expression_list` to the awaiting coroutine. As with a generator, +suspension means that all local state is retained, including the +current bindings of local variables, the instruction pointer, the internal +evaluation stack, and the state of any exception handling. When the execution +is resumed by awaiting on the next object returned by the asynchronous +generator's methods, the function can proceed exactly as if the yield +expression were just another external call. The value of the yield expression +after resuming depends on the method which resumed the execution. If +:meth:`~agen.__anext__` is used then the result is :const:`None`. Otherwise, if +:meth:`~agen.asend` is used, then the result will be the value passed in to +that method. + +In an asynchronous generator function, yield expressions are allowed anywhere +in a :keyword:`try` construct. However, if an asynchronous generator is not +resumed before it is finalized (by reaching a zero reference count or by +being garbage collected), then a yield expression within a :keyword:`try` +construct could result in a failure to execute pending :keyword:`finally` +clauses. In this case, it is the responsibility of the event loop or +scheduler running the asynchronous generator to call the asynchronous +generator-iterator's :meth:`~agen.aclose` method and run the resulting +coroutine object, thus allowing any pending :keyword:`finally` clauses +to execute. + +To take care of finalization, an event loop should define +a *finalizer* function which takes an asynchronous generator-iterator +and presumably calls :meth:`~agen.aclose` and executes the coroutine. +This *finalizer* may be registered by calling :func:`sys.set_asyncgen_hooks`. +When first iterated over, an asynchronous generator-iterator will store the +registered *finalizer* to be called upon finalization. For a reference example +of a *finalizer* method see the implementation of +``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`. + +The expression ``yield from `` is a syntax error when used in an +asynchronous generator function. + +.. index:: object: asynchronous-generator +.. _asynchronous-generator-methods: + +Asynchronous generator-iterator methods +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This subsection describes the methods of an asynchronous generator iterator, +which are used to control the execution of a generator function. + + +.. index:: exception: StopAsyncIteration + +.. coroutinemethod:: agen.__anext__() + + Returns an awaitable which when run starts to execute the asynchronous + generator or resumes it at the last executed yield expression. When an + asynchronous generator function is resumed with a :meth:`~agen.__anext__` + method, the current yield expression always evaluates to :const:`None` in + the returned awaitable, which when run will continue to the next yield + expression. The value of the :token:`expression_list` of the yield + expression is the value of the :exc:`StopIteration` exception raised by + the completing coroutine. If the asynchronous generator exits without + yielding another value, the awaitable instead raises an + :exc:`StopAsyncIteration` exception, signalling that the asynchronous + iteration has completed. + + This method is normally called implicitly by a :keyword:`async for` loop. + + +.. coroutinemethod:: agen.asend(value) + + Returns an awaitable which when run resumes the execution of the + asynchronous generator. As with the :meth:`~generator.send()` method for a + generator, this "sends" a value into the asynchronous generator function, + and the *value* argument becomes the result of the current yield expression. + The awaitable returned by the :meth:`asend` method will return the next + value yielded by the generator as the value of the raised + :exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the + asynchronous generator exits without yielding another value. When + :meth:`asend` is called to start the asynchronous + generator, it must be called with :const:`None` as the argument, + because there is no yield expression that could receive the value. + + +.. coroutinemethod:: agen.athrow(type[, value[, traceback]]) + + Returns an awaitable that raises an exception of type ``type`` at the point + where the asynchronous generator was paused, and returns the next value + yielded by the generator function as the value of the raised + :exc:`StopIteration` exception. If the asynchronous generator exits + without yielding another value, an :exc:`StopAsyncIteration` exception is + raised by the awaitable. + If the generator function does not catch the passed-in exception, or + raises a different exception, then when the awaitalbe is run that exception + propagates to the caller of the awaitable. + +.. index:: exception: GeneratorExit + + +.. coroutinemethod:: agen.aclose() + + Returns an awaitable that when run will throw a :exc:`GeneratorExit` into + the asynchronous generator function at the point where it was paused. + If the asynchronous generator function then exits gracefully, is already + closed, or raises :exc:`GeneratorExit` (by not catching the exception), + then the returned awaitable will raise a :exc:`StopIteration` exception. + Any further awaitables returned by subsequent calls to the asynchronous + generator will raise a :exc:`StopAsyncIteration` exception. If the + asynchronous generator yields a value, a :exc:`RuntimeError` is raised + by the awaitable. If the asynchronous generator raises any other exception, + it is propagated to the caller of the awaitable. If the asynchronous + generator has already exited due to an exception or normal exit, then + further calls to :meth:`aclose` will return an awaitable that does nothing. .. _primaries: diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -492,6 +492,10 @@ value (if any) is used as an argument to construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` attribute. +In an asynchronous generator function, an empty :keyword:`return` statement +indicates that the asynchronous generator is done and will cause +:exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`return` +statement is a syntax error in an asynchronous generator function. .. _yield: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:42 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NjM1?= =?utf-8?q?=3A_Drop_the_note_that_whatsnew_is_incomplete?= Message-ID: <20161216074439.1363.21000.0735AF13@psf.io> https://hg.python.org/cpython/rev/cb4ad88fdc91 changeset: 105653:cb4ad88fdc91 branch: 3.6 parent: 105497:27a35996becd user: Yury Selivanov date: Wed Dec 07 16:19:56 2016 -0800 summary: Issue #28635: Drop the note that whatsnew is incomplete (grafted from d12bc674b74eee73365e38fad1f170ed3349bd59) files: Doc/whatsnew/3.6.rst | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -46,12 +46,6 @@ This saves the maintainer the effort of going through the Mercurial log when researching a change. -.. note:: - - Prerelease users should be aware that this document is currently in draft - form. It will be updated substantially as Python 3.6 moves towards release, - so it's worth checking back even after reading earlier versions. - This article explains the new features in Python 3.6, compared to 3.5. .. seealso:: @@ -62,9 +56,6 @@ Summary -- Release highlights ============================= -.. This section singles out the most important changes in Python 3.6. - Brevity is key. - New syntax features: * :ref:`PEP 498 `, formatted string literals. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:42 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogZ3VhcmQgSEFWRV9M?= =?utf-8?q?ONG=5FLONG_definition_to_prevent_redefinition_=28=2328898=29?= Message-ID: <20161216074440.12418.62535.E8E60EB1@psf.io> https://hg.python.org/cpython/rev/d6c8803c55b4 changeset: 105655:d6c8803c55b4 branch: 3.6 user: Benjamin Peterson date: Wed Dec 07 23:54:28 2016 -0800 summary: guard HAVE_LONG_LONG definition to prevent redefinition (#28898) (grafted from 4745d801cae2d57e3432313acd0b76b8b4cc9c75) files: Include/pyport.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/pyport.h b/Include/pyport.h --- a/Include/pyport.h +++ b/Include/pyport.h @@ -37,9 +37,10 @@ * integral synonyms. Only define the ones we actually need. */ -// long long is required now. Define HAVE_LONG_LONG unconditionally for -// compatibility. +// long long is required. Ensure HAVE_LONG_LONG is defined for compatibility. +#ifndef HAVE_LONG_LONG #define HAVE_LONG_LONG +#endif #ifndef PY_LONG_LONG #define PY_LONG_LONG long long /* If LLONG_MAX is defined in limits.h, use that. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:42 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4ODk4?= =?utf-8?q?=3A_add_Misc/NEWS_entry?= Message-ID: <20161216074440.12655.70226.E14EE302@psf.io> https://hg.python.org/cpython/rev/9d0765c22bed changeset: 105664:9d0765c22bed branch: 3.6 user: Ned Deily date: Thu Dec 15 23:20:48 2016 -0500 summary: Issue #28898: add Misc/NEWS entry files: Misc/NEWS | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,11 @@ - Issue #28896: Deprecate WindowsRegistryFinder +Build +----- + +- Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. + What's New in Python 3.6.0 release candidate 1 ============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 02:44:42 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 16 Dec 2016 07:44:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Fix_a_memory_l?= =?utf-8?q?eak_in_split-table_dictionaries?= Message-ID: <20161216074440.1688.60550.1A9A534C@psf.io> https://hg.python.org/cpython/rev/b70b2d3f3167 changeset: 105660:b70b2d3f3167 branch: 3.6 user: Victor Stinner date: Thu Dec 15 17:21:23 2016 +0100 summary: Fix a memory leak in split-table dictionaries Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. (grafted from 85be9dcc16a81d3ccd1f67b056255a7f206edd47) files: Lib/test/test_dict.py | 30 +++++++++++++++++++++++++++ Misc/NEWS | 7 ++++++ Modules/_testcapimodule.c | 14 ++++++++++++ Objects/dictobject.c | 27 +++++++++++++++++++---- 4 files changed, 73 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -933,6 +933,36 @@ self.assertEqual(list(a), ['x', 'y']) self.assertEqual(list(b), ['x', 'y', 'z']) + @support.cpython_only + def test_splittable_setattr_after_pop(self): + """setattr() must not convert combined table into split table.""" + # Issue 28147 + import _testcapi + + class C: + pass + a = C() + + a.a = 1 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + + # dict.pop() convert it to combined table + a.__dict__.pop('a') + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + + # But C should not convert a.__dict__ to split table again. + a.a = 1 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + + # Same for popitem() + a = C() + a.a = 2 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + a.__dict__.popitem() + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + a.a = 3 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + def test_iterator_pickling(self): for proto in range(pickle.HIGHEST_PROTOCOL + 1): data = {1:"a", 2:"b", 3:"c"} diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7,6 +7,13 @@ *Release date: XXXX-XX-XX* +Core and Builtins +----------------- + +- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() + must not convert combined table into split table. Patch written by INADA + Naoki. + Windows ------- diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -259,6 +259,19 @@ return result; } +static PyObject* +dict_hassplittable(PyObject *self, PyObject *arg) +{ + if (!PyDict_Check(arg)) { + PyErr_Format(PyExc_TypeError, + "dict_hassplittable() argument must be dict, not '%s'", + arg->ob_type->tp_name); + return NULL; + } + + return PyBool_FromLong(_PyDict_HasSplitTable((PyDictObject*)arg)); +} + /* Issue #4701: Check that PyObject_Hash implicitly calls * PyType_Ready if it hasn't already been called */ @@ -4024,6 +4037,7 @@ {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, {"dict_getitem_knownhash", dict_getitem_knownhash, METH_VARARGS}, + {"dict_hassplittable", dict_hassplittable, METH_O}, {"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS}, {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, {"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS}, diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1245,7 +1245,7 @@ but can be resplit by make_keys_shared(). */ static int -dictresize(PyDictObject *mp, Py_ssize_t minused) +dictresize(PyDictObject *mp, Py_ssize_t minsize) { Py_ssize_t i, newsize; PyDictKeysObject *oldkeys; @@ -1254,7 +1254,7 @@ /* Find the smallest table size > minused. */ for (newsize = PyDict_MINSIZE; - newsize <= minused && newsize > 0; + newsize < minsize && newsize > 0; newsize <<= 1) ; if (newsize <= 0) { @@ -1269,6 +1269,8 @@ mp->ma_keys = oldkeys; return -1; } + // New table must be large enough. + assert(mp->ma_keys->dk_usable >= mp->ma_used); if (oldkeys->dk_lookup == lookdict) mp->ma_keys->dk_lookup = lookdict; mp->ma_values = NULL; @@ -4292,10 +4294,25 @@ CACHED_KEYS(tp) = NULL; DK_DECREF(cached); } - } else { + } + else { + int was_shared = cached == ((PyDictObject *)dict)->ma_keys; res = PyDict_SetItem(dict, key, value); - if (cached != ((PyDictObject *)dict)->ma_keys) { - /* Either update tp->ht_cached_keys or delete it */ + if (was_shared && cached != ((PyDictObject *)dict)->ma_keys) { + /* PyDict_SetItem() may call dictresize and convert split table + * into combined table. In such case, convert it to split + * table again and update type's shared key only when this is + * the only dict sharing key with the type. + * + * This is to allow using shared key in class like this: + * + * class C: + * def __init__(self): + * # one dict resize happens + * self.a, self.b, self.c = 1, 2, 3 + * self.d, self.e, self.f = 4, 5, 6 + * a = C() + */ if (cached->dk_refcnt == 1) { CACHED_KEYS(tp) = make_keys_shared(dict); } -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Dec 16 04:06:06 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 16 Dec 2016 09:06:06 +0000 Subject: [Python-checkins] Daily reference leaks (0b78a8c35357): sum=0 Message-ID: <20161216090605.12869.12602.84B79FAE@psf.io> results for 0b78a8c35357 on branch "default" -------------------------------------------- test_collections leaked [-7, 8, -7] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [2, 0, 0] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogvFfuMQ', '--timeout', '7200'] From python-checkins at python.org Fri Dec 16 04:07:20 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 16 Dec 2016 09:07:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5?= Message-ID: <20161216090720.12461.63794.5BB647B7@psf.io> https://hg.python.org/cpython/rev/598a00a4540a changeset: 105668:598a00a4540a branch: 3.6 parent: 105666:8d294c52df39 parent: 105667:092d4d83c50a user: Victor Stinner date: Fri Dec 16 10:00:53 2016 +0100 summary: Merge 3.5 files: Tools/gdb/libpython.py | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1570,7 +1570,11 @@ def get_selected_python_frame(cls): '''Try to obtain the Frame for the python-related code in the selected frame, or None''' - frame = cls.get_selected_frame() + try: + frame = cls.get_selected_frame() + except gdb.error: + # No frame: Python didn't start yet + return None while frame: if frame.is_python_frame(): @@ -1711,6 +1715,10 @@ def move_in_stack(move_up): '''Move up or down the stack (for the py-up/py-down command)''' frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + while frame: if move_up: iter_frame = frame.older() @@ -1773,6 +1781,10 @@ def invoke(self, args, from_tty): frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + while frame: if frame.is_python_frame(): frame.print_summary() @@ -1790,8 +1802,12 @@ def invoke(self, args, from_tty): + frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + sys.stdout.write('Traceback (most recent call first):\n') - frame = Frame.get_selected_python_frame() while frame: if frame.is_python_frame(): frame.print_traceback() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 04:07:20 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 16 Dec 2016 09:07:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161216090720.31595.48615.8C2B2576@psf.io> https://hg.python.org/cpython/rev/63792c2509a7 changeset: 105669:63792c2509a7 parent: 105652:0b78a8c35357 parent: 105668:598a00a4540a user: Victor Stinner date: Fri Dec 16 10:03:10 2016 +0100 summary: Merge 3.6 files: Tools/gdb/libpython.py | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1570,7 +1570,11 @@ def get_selected_python_frame(cls): '''Try to obtain the Frame for the python-related code in the selected frame, or None''' - frame = cls.get_selected_frame() + try: + frame = cls.get_selected_frame() + except gdb.error: + # No frame: Python didn't start yet + return None while frame: if frame.is_python_frame(): @@ -1711,6 +1715,10 @@ def move_in_stack(move_up): '''Move up or down the stack (for the py-up/py-down command)''' frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + while frame: if move_up: iter_frame = frame.older() @@ -1773,6 +1781,10 @@ def invoke(self, args, from_tty): frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + while frame: if frame.is_python_frame(): frame.print_summary() @@ -1790,8 +1802,12 @@ def invoke(self, args, from_tty): + frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + sys.stdout.write('Traceback (most recent call first):\n') - frame = Frame.get_selected_python_frame() while frame: if frame.is_python_frame(): frame.print_traceback() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 04:07:20 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 16 Dec 2016 09:07:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogcHl0aG9uLWdkYi5w?= =?utf-8?q?y=3A_catch_gdb=2Eerror_on_gdb=2Eselected=5Fframe=28=29?= Message-ID: <20161216090720.1166.45038.DBE2E294@psf.io> https://hg.python.org/cpython/rev/092d4d83c50a changeset: 105667:092d4d83c50a branch: 3.5 parent: 105629:a89469328b78 user: Victor Stinner date: Fri Dec 16 10:00:39 2016 +0100 summary: python-gdb.py: catch gdb.error on gdb.selected_frame() files: Tools/gdb/libpython.py | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1527,7 +1527,11 @@ def get_selected_python_frame(cls): '''Try to obtain the Frame for the python-related code in the selected frame, or None''' - frame = cls.get_selected_frame() + try: + frame = cls.get_selected_frame() + except gdb.error: + # No frame: Python didn't start yet + return None while frame: if frame.is_python_frame(): @@ -1668,6 +1672,10 @@ def move_in_stack(move_up): '''Move up or down the stack (for the py-up/py-down command)''' frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + while frame: if move_up: iter_frame = frame.older() @@ -1730,6 +1738,10 @@ def invoke(self, args, from_tty): frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + while frame: if frame.is_python_frame(): frame.print_summary() @@ -1747,8 +1759,12 @@ def invoke(self, args, from_tty): + frame = Frame.get_selected_python_frame() + if not frame: + print('Unable to locate python frame') + return + sys.stdout.write('Traceback (most recent call first):\n') - frame = Frame.get_selected_python_frame() while frame: if frame.is_python_frame(): frame.print_traceback() -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Dec 16 09:18:27 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 16 Dec 2016 14:18:27 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-12-16 Message-ID: Results for project Python 2.7, build date 2016-12-16 11:47:27 +0000 commit: eb830f1511ef previous commit: f89ef18f9824 revision date: 2016-12-15 10:51:34 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% 0.39% 5.83% 6.70% :-) pybench 0.20% -0.04% 7.97% 3.36% :-| regex_v8 0.57% -0.11% 0.08% 10.69% :-) nbody 0.12% 0.00% 13.27% 0.66% :-| json_dump_v2 0.16% -0.14% -0.39% 9.61% :-( normal_startup 1.84% -0.60% -2.32% 2.83% :-| ssbench 0.16% -0.13% 0.26% 2.09% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-12-16/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Fri Dec 16 09:19:14 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 14:19:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328959=3A_Added_pr?= =?utf-8?q?ivate_macro_PyDict=5FGET=5FSIZE_for_retrieving_the_size_of?= Message-ID: <20161216141914.40739.8363.D478C647@psf.io> https://hg.python.org/cpython/rev/dbf72357cb4a changeset: 105670:dbf72357cb4a user: Serhiy Storchaka date: Fri Dec 16 16:18:57 2016 +0200 summary: Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. files: Include/dictobject.h | 2 + Include/odictobject.h | 2 +- Modules/_ctypes/_ctypes.c | 2 +- Modules/_datetimemodule.c | 2 +- Modules/_decimal/_decimal.c | 2 +- Modules/_elementtree.c | 2 +- Modules/_functoolsmodule.c | 10 ++++---- Modules/_operator.c | 13 +---------- Modules/_pickle.c | 15 +++++-------- Modules/_sqlite/cache.c | 2 +- Modules/_struct.c | 2 +- Modules/itertoolsmodule.c | 6 ++-- Modules/selectmodule.c | 2 +- Objects/abstract.c | 3 +- Objects/descrobject.c | 2 +- Objects/funcobject.c | 2 +- Objects/methodobject.c | 9 ++++--- Objects/object.c | 4 +- Objects/odictobject.c | 3 +- Objects/setobject.c | 2 +- Objects/sliceobject.c | 2 +- Objects/typeobject.c | 16 +++++++------- Python/ceval.c | 4 +- Python/compile.c | 26 ++++++++---------------- Python/getargs.c | 6 ++-- 25 files changed, 61 insertions(+), 80 deletions(-) diff --git a/Include/dictobject.h b/Include/dictobject.h --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -106,6 +106,8 @@ PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); #ifndef Py_LIMITED_API +/* Get the number of items of a dictionary. */ +#define PyDict_GET_SIZE(mp) (assert(PyDict_Check(mp)),((PyDictObject *)mp)->ma_used) PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); diff --git a/Include/odictobject.h b/Include/odictobject.h --- a/Include/odictobject.h +++ b/Include/odictobject.h @@ -21,7 +21,7 @@ #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) -#define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used +#define PyODict_SIZE(op) PyDict_GET_SIZE((op)) #define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key) PyAPI_FUNC(PyObject *) PyODict_New(void); diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -3684,7 +3684,7 @@ must be the same as len(inargs) + len(kwds), otherwise we have either too much or not enough arguments. */ - actual_args = PyTuple_GET_SIZE(inargs) + (kwds ? PyDict_Size(kwds) : 0); + actual_args = PyTuple_GET_SIZE(inargs) + (kwds ? PyDict_GET_SIZE(kwds) : 0); if (actual_args != inargs_index) { /* When we have default values or named parameters, this error message is misleading. See unittests/test_paramflags.py diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -3169,7 +3169,7 @@ PyErr_Clear(); state = Py_None; dictptr = _PyObject_GetDictPtr(self); - if (dictptr && *dictptr && PyDict_Size(*dictptr)) { + if (dictptr && *dictptr && PyDict_GET_SIZE(*dictptr)) { state = *dictptr; } Py_INCREF(state); diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -428,7 +428,7 @@ return DEC_INVALID_SIGNALS; } - if (PyDict_Size(val) != SIGNAL_MAP_LEN) { + if (PyDict_GET_SIZE(val) != SIGNAL_MAP_LEN) { PyErr_SetString(PyExc_KeyError, "invalid signal dict"); return DEC_INVALID_SIGNALS; diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -150,7 +150,7 @@ static int is_empty_dict(PyObject *obj) { - return PyDict_CheckExact(obj) && PyDict_Size(obj) == 0; + return PyDict_CheckExact(obj) && PyDict_GET_SIZE(obj) == 0; } diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -84,7 +84,7 @@ } Py_DECREF(nargs); - if (pkw == NULL || PyDict_Size(pkw) == 0) { + if (pkw == NULL || PyDict_GET_SIZE(pkw) == 0) { if (kw == NULL) { pto->kw = PyDict_New(); } @@ -155,7 +155,7 @@ assert(PyTuple_Check(argappl)); } - if (PyDict_Size(pto->kw) == 0) { + if (PyDict_GET_SIZE(pto->kw) == 0) { kwappl = kw; Py_XINCREF(kwappl); } @@ -713,7 +713,7 @@ return args; } - if (kwds && PyDict_Size(kwds) > 0) { + if (kwds && PyDict_GET_SIZE(kwds) > 0) { sorted_items = PyDict_Items(kwds); if (!sorted_items) return NULL; @@ -933,7 +933,7 @@ } lru_cache_append_link(self, link); Py_INCREF(result); /* for return */ - self->full = (PyDict_Size(self->cache) >= self->maxsize); + self->full = (PyDict_GET_SIZE(self->cache) >= self->maxsize); } self->misses++; return result; @@ -1062,7 +1062,7 @@ { return PyObject_CallFunction(self->cache_info_type, "nnOn", self->hits, self->misses, self->maxsize_O, - PyDict_Size(self->cache)); + PyDict_GET_SIZE(self->cache)); } static PyObject * diff --git a/Modules/_operator.c b/Modules/_operator.c --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -1016,16 +1016,7 @@ return PyUnicode_FromFormat("%s(...)", Py_TYPE(mc)->tp_name); } - if (mc->kwds != NULL) { - numkwdargs = PyDict_Size(mc->kwds); - if (numkwdargs < 0) { - Py_ReprLeave((PyObject *)mc); - return NULL; - } - } else { - numkwdargs = 0; - } - + numkwdargs = mc->kwds != NULL ? PyDict_GET_SIZE(mc->kwds) : 0; numposargs = PyTuple_GET_SIZE(mc->args); numtotalargs = numposargs + numkwdargs; @@ -1092,7 +1083,7 @@ methodcaller_reduce(methodcallerobject *mc) { PyObject *newargs; - if (!mc->kwds || PyDict_Size(mc->kwds) == 0) { + if (!mc->kwds || PyDict_GET_SIZE(mc->kwds) == 0) { Py_ssize_t i; Py_ssize_t callargcount = PyTuple_GET_SIZE(mc->args); newargs = PyTuple_New(1 + callargcount); diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -2787,10 +2787,10 @@ const char setitem_op = SETITEM; const char setitems_op = SETITEMS; - assert(obj != NULL); + assert(obj != NULL && PyDict_CheckExact(obj)); assert(self->proto > 0); - dict_size = PyDict_Size(obj); + dict_size = PyDict_GET_SIZE(obj); /* Special-case len(d) == 1 to save space. */ if (dict_size == 1) { @@ -2819,7 +2819,7 @@ } if (_Pickler_Write(self, &setitems_op, 1) < 0) return -1; - if (PyDict_Size(obj) != dict_size) { + if (PyDict_GET_SIZE(obj) != dict_size) { PyErr_Format( PyExc_RuntimeError, "dictionary changed size during iteration"); @@ -2837,6 +2837,7 @@ char header[3]; Py_ssize_t len; int status = 0; + assert(PyDict_Check(obj)); if (self->fast && !fast_save_enter(self, obj)) goto error; @@ -2855,14 +2856,10 @@ if (_Pickler_Write(self, header, len) < 0) goto error; - /* Get dict size, and bow out early if empty. */ - if ((len = PyDict_Size(obj)) < 0) - goto error; - if (memo_put(self, obj) < 0) goto error; - if (len != 0) { + if (PyDict_GET_SIZE(obj)) { /* Save the dict items. */ if (PyDict_CheckExact(obj) && self->proto > 0) { /* We can take certain shortcuts if we know this is a dict and @@ -6878,7 +6875,7 @@ Py_ssize_t i = 0; PyObject *key, *value; - new_memo_size = PyDict_Size(obj); + new_memo_size = PyDict_GET_SIZE(obj); new_memo = _Unpickler_NewMemo(new_memo_size); if (new_memo == NULL) return -1; diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c --- a/Modules/_sqlite/cache.c +++ b/Modules/_sqlite/cache.c @@ -162,7 +162,7 @@ * entry in the cache, and make space if necessary by throwing the * least used item out of the cache. */ - if (PyDict_Size(self->mapping) == self->size) { + if (PyDict_GET_SIZE(self->mapping) == self->size) { if (self->last) { node = self->last; diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2048,7 +2048,7 @@ s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); if (s_object != NULL) { - if (PyDict_Size(cache) >= MAXCACHE) + if (PyDict_GET_SIZE(cache) >= MAXCACHE) PyDict_Clear(cache); /* Attempt to cache the result */ if (PyDict_SetItem(cache, fmt, s_object) == -1) diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -4180,7 +4180,7 @@ return NULL; if (kwds != NULL) - n_kwds = PyDict_Size(kwds); + n_kwds = PyDict_GET_SIZE(kwds); /* Does user supply times argument? */ if ((PyTuple_Size(args) + n_kwds == 2) && cnt < 0) cnt = 0; @@ -4331,9 +4331,9 @@ PyObject *fillvalue = Py_None; Py_ssize_t tuplesize = PySequence_Length(args); - if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_Size(kwds) > 0) { + if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_GET_SIZE(kwds) > 0) { fillvalue = PyDict_GetItemString(kwds, "fillvalue"); - if (fillvalue == NULL || PyDict_Size(kwds) > 1) { + if (fillvalue == NULL || PyDict_GET_SIZE(kwds) > 1) { PyErr_SetString(PyExc_TypeError, "zip_longest() got an unexpected keyword argument"); return NULL; diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -353,7 +353,7 @@ PyObject *key, *value; struct pollfd *old_ufds = self->ufds; - self->ufd_len = PyDict_Size(self->dict); + self->ufd_len = PyDict_GET_SIZE(self->dict); PyMem_RESIZE(self->ufds, struct pollfd, self->ufd_len); if (self->ufds == NULL) { self->ufds = old_ufds; diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2409,8 +2409,7 @@ assert(nargs >= 0); assert(kwargs == NULL || PyDict_CheckExact(kwargs)); - nkwargs = (kwargs != NULL) ? PyDict_Size(kwargs) : 0; - if (!nkwargs) { + if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) { *p_kwnames = NULL; return args; } diff --git a/Objects/descrobject.c b/Objects/descrobject.c --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -1173,7 +1173,7 @@ return (*wk)(self, args, wp->descr->d_wrapped, kwds); } - if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_Size(kwds) != 0)) { + if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_GET_SIZE(kwds) != 0)) { PyErr_Format(PyExc_TypeError, "wrapper %s doesn't take keyword arguments", wp->descr->d_base->name); diff --git a/Objects/funcobject.c b/Objects/funcobject.c --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -583,7 +583,7 @@ if (kw != NULL && PyDict_Check(kw)) { Py_ssize_t pos, i; - nk = PyDict_Size(kw); + nk = PyDict_GET_SIZE(kw); kwtuple = PyTuple_New(2*nk); if (kwtuple == NULL) return NULL; diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -87,6 +87,7 @@ Py_ssize_t size; int flags; + assert(kwds == NULL || PyDict_Check(kwds)); /* PyCFunction_Call() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ @@ -103,7 +104,7 @@ res = _PyCFunction_FastCallDict(func, stack, nargs, kwds); } else { - if (kwds != NULL && PyDict_Size(kwds) != 0) { + if (kwds != NULL && PyDict_GET_SIZE(kwds) != 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); return NULL; @@ -176,7 +177,7 @@ switch (flags) { case METH_NOARGS: - if (kwargs != NULL && PyDict_Size(kwargs) != 0) { + if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", func->m_ml->ml_name); return NULL; @@ -193,7 +194,7 @@ break; case METH_O: - if (kwargs != NULL && PyDict_Size(kwargs) != 0) { + if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", func->m_ml->ml_name); return NULL; @@ -215,7 +216,7 @@ /* Slow-path: create a temporary tuple */ PyObject *tuple; - if (!(flags & METH_KEYWORDS) && kwargs != NULL && PyDict_Size(kwargs) != 0) { + if (!(flags & METH_KEYWORDS) && kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", func->m_ml->ml_name); diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -1454,7 +1454,7 @@ static PyObject * none_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_Size(kwargs))) { + if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_GET_SIZE(kwargs))) { PyErr_SetString(PyExc_TypeError, "NoneType takes no arguments"); return NULL; } @@ -1573,7 +1573,7 @@ static PyObject * notimplemented_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_Size(kwargs))) { + if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_GET_SIZE(kwargs))) { PyErr_SetString(PyExc_TypeError, "NotImplementedType takes no arguments"); return NULL; } diff --git a/Objects/odictobject.c b/Objects/odictobject.c --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -2423,8 +2423,7 @@ /* now handle kwargs */ assert(kwargs == NULL || PyDict_Check(kwargs)); - len = (kwargs != NULL) ? PyDict_Size(kwargs) : 0; - if (len > 0) { + if (kwargs != NULL && PyDict_GET_SIZE(kwargs)) { PyObject *items = PyDict_Items(kwargs); if (items == NULL) return NULL; diff --git a/Objects/setobject.c b/Objects/setobject.c --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -981,7 +981,7 @@ PyObject *value; Py_ssize_t pos = 0; Py_hash_t hash; - Py_ssize_t dictsize = PyDict_Size(other); + Py_ssize_t dictsize = PyDict_GET_SIZE(other); /* Do one big resize at the start, rather than * incrementally resizing as we insert new keys. Expect diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c --- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -19,7 +19,7 @@ static PyObject * ellipsis_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) { - if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_Size(kwargs))) { + if (PyTuple_GET_SIZE(args) || (kwargs && PyDict_GET_SIZE(kwargs))) { PyErr_SetString(PyExc_TypeError, "EllipsisType takes no arguments"); return NULL; } diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -902,7 +902,7 @@ if (type == &PyType_Type && PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 && (kwds == NULL || - (PyDict_Check(kwds) && PyDict_Size(kwds) == 0))) + (PyDict_Check(kwds) && PyDict_GET_SIZE(kwds) == 0))) return obj; /* If the returned object is not an instance of type, @@ -1585,7 +1585,7 @@ } } } - n = PyDict_Size(set); + n = PyDict_GET_SIZE(set); off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \ consistent method resolution\norder (MRO) for bases"); @@ -2187,7 +2187,7 @@ assert(kwds == NULL || PyDict_Check(kwds)); if (kwds != NULL && PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 && - PyDict_Check(kwds) && PyDict_Size(kwds) != 0) { + PyDict_Check(kwds) && PyDict_GET_SIZE(kwds) != 0) { PyErr_SetString(PyExc_TypeError, "type.__init__() takes no keyword arguments"); return -1; @@ -2272,7 +2272,7 @@ Note: We don't call PyType_CheckExact as that also allows subclasses */ if (metatype == &PyType_Type) { const Py_ssize_t nargs = PyTuple_GET_SIZE(args); - const Py_ssize_t nkwds = kwds == NULL ? 0 : PyDict_Size(kwds); + const Py_ssize_t nkwds = kwds == NULL ? 0 : PyDict_GET_SIZE(kwds); if (nargs == 1 && nkwds == 0) { PyObject *x = PyTuple_GET_ITEM(args, 0); @@ -3416,7 +3416,7 @@ excess_args(PyObject *args, PyObject *kwds) { return PyTuple_GET_SIZE(args) || - (kwds && PyDict_Check(kwds) && PyDict_Size(kwds)); + (kwds && PyDict_Check(kwds) && PyDict_GET_SIZE(kwds)); } static int @@ -3894,7 +3894,7 @@ We also return None if the dict is empty to make the behavior consistent regardless whether the dict was initialized or not. This make unit testing easier. */ - if (dict != NULL && *dict != NULL && PyDict_Size(*dict) > 0) { + if (dict != NULL && *dict != NULL && PyDict_GET_SIZE(*dict)) { state = *dict; } else { @@ -3983,7 +3983,7 @@ /* If we found some slot attributes, pack them in a tuple along the original attribute dictionary. */ - if (PyDict_Size(slots) > 0) { + if (PyDict_GET_SIZE(slots) > 0) { PyObject *state2; state2 = PyTuple_Pack(2, state, slots); @@ -4175,7 +4175,7 @@ return NULL; } hasargs = (args != NULL); - if (kwargs == NULL || PyDict_Size(kwargs) == 0) { + if (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) { _Py_IDENTIFIER(__newobj__); PyObject *cls; Py_ssize_t i, n; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5010,7 +5010,7 @@ assert(kwargs == NULL || PyDict_Check(kwargs)); if (co->co_kwonlyargcount == 0 && - (kwargs == NULL || PyDict_Size(kwargs) == 0) && + (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { /* Fast paths */ @@ -5028,7 +5028,7 @@ if (kwargs != NULL) { Py_ssize_t pos, i; - nk = PyDict_Size(kwargs); + nk = PyDict_GET_SIZE(kwargs); kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -564,7 +564,7 @@ PyObject *tuple, *name, *zero; int res; assert(u->u_scope_type == COMPILER_SCOPE_CLASS); - assert(PyDict_Size(u->u_cellvars) == 0); + assert(PyDict_GET_SIZE(u->u_cellvars) == 0); name = _PyUnicode_FromId(&PyId___class__); if (!name) { compiler_unit_free(u); @@ -591,7 +591,7 @@ } u->u_freevars = dictbytype(u->u_ste->ste_symbols, FREE, DEF_FREE_CLASS, - PyDict_Size(u->u_cellvars)); + PyDict_GET_SIZE(u->u_cellvars)); if (!u->u_freevars) { compiler_unit_free(u); return 0; @@ -1128,7 +1128,7 @@ Py_DECREF(t); return -1; } - arg = PyDict_Size(dict); + arg = PyDict_GET_SIZE(dict); v = PyLong_FromSsize_t(arg); if (!v) { Py_DECREF(t); @@ -1999,7 +1999,7 @@ } else { /* No methods referenced __class__, so just return None */ - assert(PyDict_Size(c->u->u_cellvars) == 0); + assert(PyDict_GET_SIZE(c->u->u_cellvars) == 0); ADDOP_O(c, LOAD_CONST, Py_None, consts); } ADDOP_IN_SCOPE(c, RETURN_VALUE); @@ -5179,7 +5179,7 @@ dict_keys_inorder(PyObject *dict, Py_ssize_t offset) { PyObject *tuple, *k, *v; - Py_ssize_t i, pos = 0, size = PyDict_Size(dict); + Py_ssize_t i, pos = 0, size = PyDict_GET_SIZE(dict); tuple = PyTuple_New(size); if (tuple == NULL) @@ -5203,7 +5203,6 @@ { PySTEntryObject *ste = c->u->u_ste; int flags = 0; - Py_ssize_t n; if (ste->ste_type == FunctionBlock) { flags |= CO_NEWLOCALS | CO_OPTIMIZED; if (ste->ste_nested) @@ -5223,16 +5222,9 @@ /* (Only) inherit compilerflags in PyCF_MASK */ flags |= (c->c_flags->cf_flags & PyCF_MASK); - n = PyDict_Size(c->u->u_freevars); - if (n < 0) - return -1; - if (n == 0) { - n = PyDict_Size(c->u->u_cellvars); - if (n < 0) - return -1; - if (n == 0) { - flags |= CO_NOFREE; - } + if (!PyDict_GET_SIZE(c->u->u_freevars) && + !PyDict_GET_SIZE(c->u->u_cellvars)) { + flags |= CO_NOFREE; } return flags; @@ -5273,7 +5265,7 @@ if (!freevars) goto error; - nlocals = PyDict_Size(c->u->u_varnames); + nlocals = PyDict_GET_SIZE(c->u->u_varnames); assert(nlocals < INT_MAX); nlocals_int = Py_SAFE_DOWNCAST(nlocals, Py_ssize_t, int); diff --git a/Python/getargs.c b/Python/getargs.c --- a/Python/getargs.c +++ b/Python/getargs.c @@ -1650,7 +1650,7 @@ } nargs = PyTuple_GET_SIZE(args); - nkeywords = (keywords == NULL) ? 0 : PyDict_Size(keywords); + nkeywords = (keywords == NULL) ? 0 : PyDict_GET_SIZE(keywords); if (nargs + nkeywords > len) { PyErr_Format(PyExc_TypeError, "%s%s takes at most %d argument%s (%zd given)", @@ -2034,7 +2034,7 @@ } if (keywords != NULL) { - nkeywords = PyDict_Size(keywords); + nkeywords = PyDict_GET_SIZE(keywords); } else if (kwnames != NULL) { nkeywords = PyTuple_GET_SIZE(kwnames); @@ -2421,7 +2421,7 @@ PyErr_BadInternalCall(); return 0; } - if (PyDict_Size(kw) == 0) + if (PyDict_GET_SIZE(kw) == 0) return 1; PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments", -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Dec 16 09:19:16 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 16 Dec 2016 14:19:16 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-12-16 Message-ID: <1ea153ae-af75-4e20-afc5-5f805574c3f0@irsmsx105.ger.corp.intel.com> Results for project Python default, build date 2016-12-16 11:03:08 +0000 commit: 0b78a8c35357 previous commit: 13b600dc4ee5 revision date: 2016-12-15 23:58:35 +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.41% 0.16% 16.28% :-| pybench 0.18% -0.05% 0.86% 5.71% :-| regex_v8 3.85% 1.28% 0.88% 1.28% :-| nbody 0.18% -0.05% -0.56% 3.83% :-) json_dump_v2 0.32% 0.45% 8.12% 11.66% :-| normal_startup 0.94% 0.01% -0.57% 6.65% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-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 python-checkins at python.org Fri Dec 16 11:53:17 2016 From: python-checkins at python.org (yury.selivanov) Date: Fri, 16 Dec 2016 16:53:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTkw?= =?utf-8?q?=3A_Fix_SSL_hanging_if_connection_is_closed_before_handshake?= Message-ID: <20161216165317.40232.68613.333E9C22@psf.io> https://hg.python.org/cpython/rev/fcba55d649ea changeset: 105671:fcba55d649ea branch: 3.5 parent: 105667:092d4d83c50a user: Yury Selivanov date: Fri Dec 16 11:50:41 2016 -0500 summary: Issue #28990: Fix SSL hanging if connection is closed before handshake completed. files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -479,6 +479,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -485,6 +485,10 @@ - Issue #24142: Reading a corrupt config file left the parser in an invalid state. Original patch by Florian H?ch. +- Issue #28990: Fix SSL hanging if connection is closed before handshake + completed. + (Patch by HoHo-Ho) + IDLE ---- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 11:53:17 2016 From: python-checkins at python.org (yury.selivanov) Date: Fri, 16 Dec 2016 16:53:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5_=28issue_=2328990=29?= Message-ID: <20161216165317.40232.56784.72E16A62@psf.io> https://hg.python.org/cpython/rev/fcc642bf88c1 changeset: 105672:fcc642bf88c1 branch: 3.6 parent: 105668:598a00a4540a parent: 105671:fcba55d649ea user: Yury Selivanov date: Fri Dec 16 11:51:57 2016 -0500 summary: Merge 3.5 (issue #28990) files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -480,6 +480,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,6 +44,10 @@ now when the grp module cannot be imported, as for example on Android platforms. +- Issue #28990: Fix SSL hanging if connection is closed before handshake + completed. + (Patch by HoHo-Ho) + Windows ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 11:53:33 2016 From: python-checkins at python.org (yury.selivanov) Date: Fri, 16 Dec 2016 16:53:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42IChpc3N1ZSAjMjg5OTAp?= Message-ID: <20161216165333.12508.43854.5BCD5455@psf.io> https://hg.python.org/cpython/rev/59eea8122df6 changeset: 105673:59eea8122df6 parent: 105670:dbf72357cb4a parent: 105672:fcc642bf88c1 user: Yury Selivanov date: Fri Dec 16 11:52:36 2016 -0500 summary: Merge 3.6 (issue #28990) files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -480,6 +480,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:07:37 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:07:37 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE0MDYx?= =?utf-8?q?=3A_Misc_fixes_and_cleanups_in_archiving_code_in_shutil=2E?= Message-ID: <20161216170737.1262.63017.530A2662@psf.io> https://hg.python.org/cpython/rev/929c2d076a85 changeset: 105674:929c2d076a85 branch: 3.5 parent: 105667:092d4d83c50a user: Serhiy Storchaka date: Fri Dec 16 18:58:33 2016 +0200 summary: Issue #14061: Misc fixes and cleanups in archiving code in shutil. Imporoved the documentation and tests for make_archive() and unpack_archive(). Improved error handling when corresponding compress module is not available. Brake circular dependency between shutil and tarfile modules. files: Doc/library/shutil.rst | 44 +++++++------ Lib/shutil.py | 82 ++++++++++++++------------ Lib/test/test_shutil.py | 91 +++++++++++++--------------- 3 files changed, 110 insertions(+), 107 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -458,6 +458,10 @@ .. versionadded:: 3.2 +.. versionchanged:: 3.5 + Added support for the *xztar* format. + + High-level utilities to create and read compressed and archived files are also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules. @@ -467,8 +471,9 @@ *base_name* is the name of the file to create, including the path, minus any format-specific extension. *format* is the archive format: one of - "zip", "tar", "bztar" (if the :mod:`bz2` module is available), "xztar" - (if the :mod:`lzma` module is available) or "gztar". + "zip" (if the :mod:`zlib` module is available), "tar", "gztar" (if the + :mod:`zlib` module is available), "bztar" (if the :mod:`bz2` module is + available), or "xztar" (if the :mod:`lzma` module is available). *root_dir* is a directory that will be the root directory of the archive; for example, we typically chdir into *root_dir* before creating the @@ -491,9 +496,6 @@ The *verbose* argument is unused and deprecated. - .. versionchanged:: 3.5 - Added support for the *xztar* format. - .. function:: get_archive_formats() @@ -502,11 +504,11 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.) - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (if the :mod:`zlib` module is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). + - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). You can register new formats or provide your own archiver for any existing formats, by using :func:`register_archive_format`. @@ -541,11 +543,12 @@ *extract_dir* is the name of the target directory where the archive is unpacked. If not provided, the current working directory is used. - *format* is the archive format: one of "zip", "tar", or "gztar". Or any - other format registered with :func:`register_unpack_format`. If not - provided, :func:`unpack_archive` will use the archive file name extension - and see if an unpacker was registered for that extension. In case none is - found, a :exc:`ValueError` is raised. + *format* is the archive format: one of "zip", "tar", "gztar", "bztar", or + "xztar". Or any other format registered with + :func:`register_unpack_format`. If not provided, :func:`unpack_archive` + will use the archive file name extension and see if an unpacker was + registered for that extension. In case none is found, + a :exc:`ValueError` is raised. .. function:: register_unpack_format(name, extensions, function[, extra_args[, description]]) @@ -578,11 +581,12 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.) - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (unpacking compressed files works only if corresponding + module is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). + - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). You can register new formats or provide your own unpacker for any existing formats, by using :func:`register_unpack_format`. diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -10,7 +10,13 @@ import fnmatch import collections import errno -import tarfile + +try: + import zlib + del zlib + _ZLIB_SUPPORTED = True +except ImportError: + _ZLIB_SUPPORTED = False try: import bz2 @@ -602,23 +608,22 @@ Returns the output filename. """ - tar_compression = {'gzip': 'gz', None: ''} - compress_ext = {'gzip': '.gz'} - - if _BZ2_SUPPORTED: - tar_compression['bzip2'] = 'bz2' - compress_ext['bzip2'] = '.bz2' - - if _LZMA_SUPPORTED: - tar_compression['xz'] = 'xz' - compress_ext['xz'] = '.xz' - - # flags for compression program, each element of list will be an argument - if compress is not None and compress not in compress_ext: + if compress is None: + tar_compression = '' + elif _ZLIB_SUPPORTED and compress == 'gzip': + tar_compression = 'gz' + elif _BZ2_SUPPORTED and compress == 'bzip2': + tar_compression = 'bz2' + elif _LZMA_SUPPORTED and compress == 'xz': + tar_compression = 'xz' + else: raise ValueError("bad value for 'compress', or compression format not " "supported : {0}".format(compress)) - archive_name = base_name + '.tar' + compress_ext.get(compress, '') + import tarfile # late import for breaking circular dependency + + compress_ext = '.' + tar_compression if compress else '' + archive_name = base_name + '.tar' + compress_ext archive_dir = os.path.dirname(archive_name) if archive_dir and not os.path.exists(archive_dir): @@ -644,7 +649,7 @@ return tarinfo if not dry_run: - tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) + tar = tarfile.open(archive_name, 'w|%s' % tar_compression) try: tar.add(base_dir, filter=_set_uid_gid) finally: @@ -655,13 +660,10 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. - The output zip file will be named 'base_name' + ".zip". Uses either the - "zipfile" Python module (if available) or the InfoZIP "zip" utility - (if installed and found on the default search path). If neither tool is - available, raises ExecError. Returns the name of the output zip - file. + The output zip file will be named 'base_name' + ".zip". Returns the + name of the output zip file. """ - import zipfile + import zipfile # late import for breaking circular dependency zip_filename = base_name + ".zip" archive_dir = os.path.dirname(base_name) @@ -700,10 +702,13 @@ return zip_filename _ARCHIVE_FORMATS = { - 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [], "ZIP file") - } +} + +if _ZLIB_SUPPORTED: + _ARCHIVE_FORMATS['gztar'] = (_make_tarball, [('compress', 'gzip')], + "gzip'ed tar-file") + _ARCHIVE_FORMATS['zip'] = (_make_zipfile, [], "ZIP file") if _BZ2_SUPPORTED: _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], @@ -752,8 +757,8 @@ """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific - extension; 'format' is the archive format: one of "zip", "tar", "bztar" - or "gztar". + extension; 'format' is the archive format: one of "zip", "tar", "gztar", + "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the @@ -866,10 +871,7 @@ def _unpack_zipfile(filename, extract_dir): """Unpack zip `filename` to `extract_dir` """ - try: - import zipfile - except ImportError: - raise ReadError('zlib not supported, cannot unpack this archive.') + import zipfile # late import for breaking circular dependency if not zipfile.is_zipfile(filename): raise ReadError("%s is not a zip file" % filename) @@ -903,6 +905,7 @@ def _unpack_tarfile(filename, extract_dir): """Unpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` """ + import tarfile # late import for breaking circular dependency try: tarobj = tarfile.open(filename) except tarfile.TarError: @@ -914,10 +917,13 @@ tarobj.close() _UNPACK_FORMATS = { - 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), - 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file") - } + 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file"), +} + +if _ZLIB_SUPPORTED: + _UNPACK_FORMATS['gztar'] = (['.tar.gz', '.tgz'], _unpack_tarfile, [], + "gzip'ed tar-file") if _BZ2_SUPPORTED: _UNPACK_FORMATS['bztar'] = (['.tar.bz2', '.tbz2'], _unpack_tarfile, [], @@ -942,10 +948,10 @@ `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. - `format` is the archive format: one of "zip", "tar", or "gztar". Or any - other registered format. If not provided, unpack_archive will use the - filename extension and see if an unpacker was registered for that - extension. + `format` is the archive format: one of "zip", "tar", "gztar", "bztar", + or "xztar". Or any other registered format. If not provided, + unpack_archive will use the filename extension and see if an unpacker + was registered for that extension. In case none is found, a ValueError is raised. """ diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -19,22 +19,11 @@ unregister_unpack_format, get_unpack_formats, SameFileError) import tarfile +import zipfile import warnings from test import support -from test.support import TESTFN, check_warnings, captured_stdout, requires_zlib - -try: - import bz2 - BZ2_SUPPORTED = True -except ImportError: - BZ2_SUPPORTED = False - -try: - import lzma - LZMA_SUPPORTED = True -except ImportError: - LZMA_SUPPORTED = False +from test.support import TESTFN, check_warnings, captured_stdout TESTFN2 = TESTFN + "2" @@ -45,12 +34,6 @@ except ImportError: UID_GID_SUPPORT = False -try: - import zipfile - ZIP_SUPPORT = True -except ImportError: - ZIP_SUPPORT = shutil.which('zip') - def _fake_rename(*args, **kwargs): # Pretend the destination path is on a different filesystem. raise OSError(getattr(errno, 'EXDEV', 18), "Invalid cross-device link") @@ -964,7 +947,7 @@ self.assertEqual(getattr(file1_stat, 'st_flags'), getattr(file2_stat, 'st_flags')) - @requires_zlib + @support.requires_zlib def test_make_tarball(self): # creating something to tar root_dir, base_dir = self._create_files('') @@ -1020,7 +1003,7 @@ write_file((root_dir, 'outer'), 'xxx') return root_dir, base_dir - @requires_zlib + @support.requires_zlib @unittest.skipUnless(shutil.which('tar'), 'Need the tar command to run') def test_tarfile_vs_tar(self): @@ -1053,8 +1036,7 @@ self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib def test_make_zipfile(self): # creating something to zip root_dir, base_dir = self._create_files() @@ -1091,8 +1073,7 @@ ['dist/', 'dist/sub/', 'dist/sub2/', 'dist/file1', 'dist/file2', 'dist/sub/file3']) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib @unittest.skipUnless(shutil.which('zip'), 'Need the zip command to run') def test_zipfile_vs_zip(self): @@ -1118,8 +1099,7 @@ names2 = zf.namelist() self.assertEqual(sorted(names), sorted(names2)) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib @unittest.skipUnless(shutil.which('unzip'), 'Need the unzip command to run') def test_unzip_zipfile(self): @@ -1146,7 +1126,7 @@ base_name = os.path.join(tmpdir, 'archive') self.assertRaises(ValueError, make_archive, base_name, 'xxx') - @requires_zlib + @support.requires_zlib def test_make_archive_owner_group(self): # testing make_archive with owner and group, with various combinations # this works even if there's not gid/uid support @@ -1174,7 +1154,7 @@ self.assertTrue(os.path.isfile(res)) - @requires_zlib + @support.requires_zlib @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support") def test_tarfile_root_owner(self): root_dir, base_dir = self._create_files() @@ -1219,7 +1199,7 @@ self.assertEqual(make_archive('test', 'tar'), 'test.tar') self.assertTrue(os.path.isfile('test.tar')) - @requires_zlib + @support.requires_zlib def test_make_zipfile_in_curdir(self): # Issue #21280 root_dir = self.mkdtemp() @@ -1243,33 +1223,46 @@ formats = [name for name, params in get_archive_formats()] self.assertNotIn('xxx', formats) - @requires_zlib - def test_unpack_archive(self): - formats = ['tar', 'gztar', 'zip'] - if BZ2_SUPPORTED: - formats.append('bztar') - if LZMA_SUPPORTED: - formats.append('xztar') - + def check_unpack_archive(self, format): root_dir, base_dir = self._create_files() expected = rlistdir(root_dir) expected.remove('outer') - for format in formats: - base_name = os.path.join(self.mkdtemp(), 'archive') - filename = make_archive(base_name, format, root_dir, base_dir) - # let's try to unpack it now - tmpdir2 = self.mkdtemp() - unpack_archive(filename, tmpdir2) - self.assertEqual(rlistdir(tmpdir2), expected) + base_name = os.path.join(self.mkdtemp(), 'archive') + filename = make_archive(base_name, format, root_dir, base_dir) - # and again, this time with the format specified - tmpdir3 = self.mkdtemp() - unpack_archive(filename, tmpdir3, format=format) - self.assertEqual(rlistdir(tmpdir3), expected) + # let's try to unpack it now + tmpdir2 = self.mkdtemp() + unpack_archive(filename, tmpdir2) + self.assertEqual(rlistdir(tmpdir2), expected) + + # and again, this time with the format specified + tmpdir3 = self.mkdtemp() + unpack_archive(filename, tmpdir3, format=format) + self.assertEqual(rlistdir(tmpdir3), expected) + self.assertRaises(shutil.ReadError, unpack_archive, TESTFN) self.assertRaises(ValueError, unpack_archive, TESTFN, format='xxx') + def test_unpack_archive_tar(self): + self.check_unpack_archive('tar') + + @support.requires_zlib + def test_unpack_archive_gztar(self): + self.check_unpack_archive('gztar') + + @support.requires_bz2 + def test_unpack_archive_bztar(self): + self.check_unpack_archive('bztar') + + @support.requires_lzma + def test_unpack_archive_xztar(self): + self.check_unpack_archive('xztar') + + @support.requires_zlib + def test_unpack_archive_zip(self): + self.check_unpack_archive('zip') + def test_unpack_registry(self): formats = get_unpack_formats() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:10 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2314061=3A_Misc_fixes_and_cleanups_in_archiving_code_in?= =?utf-8?q?_shutil=2E?= Message-ID: <20161216170809.12508.86389.2AA65EAD@psf.io> https://hg.python.org/cpython/rev/268d3763bb07 changeset: 105675:268d3763bb07 branch: 3.6 parent: 105668:598a00a4540a parent: 105674:929c2d076a85 user: Serhiy Storchaka date: Fri Dec 16 19:00:55 2016 +0200 summary: Issue #14061: Misc fixes and cleanups in archiving code in shutil. Imporoved the documentation and tests for make_archive() and unpack_archive(). Improved error handling when corresponding compress module is not available. Brake circular dependency between shutil and tarfile modules. files: Doc/library/shutil.rst | 44 +++++++------ Lib/shutil.py | 82 ++++++++++++++------------ Lib/test/test_shutil.py | 91 +++++++++++++--------------- 3 files changed, 110 insertions(+), 107 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -458,6 +458,10 @@ .. versionadded:: 3.2 +.. versionchanged:: 3.5 + Added support for the *xztar* format. + + High-level utilities to create and read compressed and archived files are also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules. @@ -467,8 +471,9 @@ *base_name* is the name of the file to create, including the path, minus any format-specific extension. *format* is the archive format: one of - "zip", "tar", "bztar" (if the :mod:`bz2` module is available), "xztar" - (if the :mod:`lzma` module is available) or "gztar". + "zip" (if the :mod:`zlib` module is available), "tar", "gztar" (if the + :mod:`zlib` module is available), "bztar" (if the :mod:`bz2` module is + available), or "xztar" (if the :mod:`lzma` module is available). *root_dir* is a directory that will be the root directory of the archive; for example, we typically chdir into *root_dir* before creating the @@ -491,9 +496,6 @@ The *verbose* argument is unused and deprecated. - .. versionchanged:: 3.5 - Added support for the *xztar* format. - .. function:: get_archive_formats() @@ -502,11 +504,11 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.) - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (if the :mod:`zlib` module is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). + - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). You can register new formats or provide your own archiver for any existing formats, by using :func:`register_archive_format`. @@ -541,11 +543,12 @@ *extract_dir* is the name of the target directory where the archive is unpacked. If not provided, the current working directory is used. - *format* is the archive format: one of "zip", "tar", or "gztar". Or any - other format registered with :func:`register_unpack_format`. If not - provided, :func:`unpack_archive` will use the archive file name extension - and see if an unpacker was registered for that extension. In case none is - found, a :exc:`ValueError` is raised. + *format* is the archive format: one of "zip", "tar", "gztar", "bztar", or + "xztar". Or any other format registered with + :func:`register_unpack_format`. If not provided, :func:`unpack_archive` + will use the archive file name extension and see if an unpacker was + registered for that extension. In case none is found, + a :exc:`ValueError` is raised. .. function:: register_unpack_format(name, extensions, function[, extra_args[, description]]) @@ -578,11 +581,12 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.) - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (unpacking compressed files works only if corresponding + module is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). + - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). You can register new formats or provide your own unpacker for any existing formats, by using :func:`register_unpack_format`. diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -10,7 +10,13 @@ import fnmatch import collections import errno -import tarfile + +try: + import zlib + del zlib + _ZLIB_SUPPORTED = True +except ImportError: + _ZLIB_SUPPORTED = False try: import bz2 @@ -602,23 +608,22 @@ Returns the output filename. """ - tar_compression = {'gzip': 'gz', None: ''} - compress_ext = {'gzip': '.gz'} - - if _BZ2_SUPPORTED: - tar_compression['bzip2'] = 'bz2' - compress_ext['bzip2'] = '.bz2' - - if _LZMA_SUPPORTED: - tar_compression['xz'] = 'xz' - compress_ext['xz'] = '.xz' - - # flags for compression program, each element of list will be an argument - if compress is not None and compress not in compress_ext: + if compress is None: + tar_compression = '' + elif _ZLIB_SUPPORTED and compress == 'gzip': + tar_compression = 'gz' + elif _BZ2_SUPPORTED and compress == 'bzip2': + tar_compression = 'bz2' + elif _LZMA_SUPPORTED and compress == 'xz': + tar_compression = 'xz' + else: raise ValueError("bad value for 'compress', or compression format not " "supported : {0}".format(compress)) - archive_name = base_name + '.tar' + compress_ext.get(compress, '') + import tarfile # late import for breaking circular dependency + + compress_ext = '.' + tar_compression if compress else '' + archive_name = base_name + '.tar' + compress_ext archive_dir = os.path.dirname(archive_name) if archive_dir and not os.path.exists(archive_dir): @@ -644,7 +649,7 @@ return tarinfo if not dry_run: - tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) + tar = tarfile.open(archive_name, 'w|%s' % tar_compression) try: tar.add(base_dir, filter=_set_uid_gid) finally: @@ -655,13 +660,10 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. - The output zip file will be named 'base_name' + ".zip". Uses either the - "zipfile" Python module (if available) or the InfoZIP "zip" utility - (if installed and found on the default search path). If neither tool is - available, raises ExecError. Returns the name of the output zip - file. + The output zip file will be named 'base_name' + ".zip". Returns the + name of the output zip file. """ - import zipfile + import zipfile # late import for breaking circular dependency zip_filename = base_name + ".zip" archive_dir = os.path.dirname(base_name) @@ -700,10 +702,13 @@ return zip_filename _ARCHIVE_FORMATS = { - 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [], "ZIP file") - } +} + +if _ZLIB_SUPPORTED: + _ARCHIVE_FORMATS['gztar'] = (_make_tarball, [('compress', 'gzip')], + "gzip'ed tar-file") + _ARCHIVE_FORMATS['zip'] = (_make_zipfile, [], "ZIP file") if _BZ2_SUPPORTED: _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], @@ -752,8 +757,8 @@ """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific - extension; 'format' is the archive format: one of "zip", "tar", "bztar" - or "gztar". + extension; 'format' is the archive format: one of "zip", "tar", "gztar", + "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the @@ -866,10 +871,7 @@ def _unpack_zipfile(filename, extract_dir): """Unpack zip `filename` to `extract_dir` """ - try: - import zipfile - except ImportError: - raise ReadError('zlib not supported, cannot unpack this archive.') + import zipfile # late import for breaking circular dependency if not zipfile.is_zipfile(filename): raise ReadError("%s is not a zip file" % filename) @@ -903,6 +905,7 @@ def _unpack_tarfile(filename, extract_dir): """Unpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` """ + import tarfile # late import for breaking circular dependency try: tarobj = tarfile.open(filename) except tarfile.TarError: @@ -914,10 +917,13 @@ tarobj.close() _UNPACK_FORMATS = { - 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), - 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file") - } + 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file"), +} + +if _ZLIB_SUPPORTED: + _UNPACK_FORMATS['gztar'] = (['.tar.gz', '.tgz'], _unpack_tarfile, [], + "gzip'ed tar-file") if _BZ2_SUPPORTED: _UNPACK_FORMATS['bztar'] = (['.tar.bz2', '.tbz2'], _unpack_tarfile, [], @@ -942,10 +948,10 @@ `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. - `format` is the archive format: one of "zip", "tar", or "gztar". Or any - other registered format. If not provided, unpack_archive will use the - filename extension and see if an unpacker was registered for that - extension. + `format` is the archive format: one of "zip", "tar", "gztar", "bztar", + or "xztar". Or any other registered format. If not provided, + unpack_archive will use the filename extension and see if an unpacker + was registered for that extension. In case none is found, a ValueError is raised. """ diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -19,23 +19,12 @@ unregister_unpack_format, get_unpack_formats, SameFileError) import tarfile +import zipfile import warnings from test import support from test.support import (TESTFN, check_warnings, captured_stdout, - requires_zlib, android_not_root) - -try: - import bz2 - BZ2_SUPPORTED = True -except ImportError: - BZ2_SUPPORTED = False - -try: - import lzma - LZMA_SUPPORTED = True -except ImportError: - LZMA_SUPPORTED = False + android_not_root) TESTFN2 = TESTFN + "2" @@ -46,12 +35,6 @@ except ImportError: UID_GID_SUPPORT = False -try: - import zipfile - ZIP_SUPPORT = True -except ImportError: - ZIP_SUPPORT = shutil.which('zip') - def _fake_rename(*args, **kwargs): # Pretend the destination path is on a different filesystem. raise OSError(getattr(errno, 'EXDEV', 18), "Invalid cross-device link") @@ -966,7 +949,7 @@ self.assertEqual(getattr(file1_stat, 'st_flags'), getattr(file2_stat, 'st_flags')) - @requires_zlib + @support.requires_zlib def test_make_tarball(self): # creating something to tar root_dir, base_dir = self._create_files('') @@ -1022,7 +1005,7 @@ write_file((root_dir, 'outer'), 'xxx') return root_dir, base_dir - @requires_zlib + @support.requires_zlib @unittest.skipUnless(shutil.which('tar'), 'Need the tar command to run') def test_tarfile_vs_tar(self): @@ -1055,8 +1038,7 @@ self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib def test_make_zipfile(self): # creating something to zip root_dir, base_dir = self._create_files() @@ -1093,8 +1075,7 @@ ['dist/', 'dist/sub/', 'dist/sub2/', 'dist/file1', 'dist/file2', 'dist/sub/file3']) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib @unittest.skipUnless(shutil.which('zip'), 'Need the zip command to run') def test_zipfile_vs_zip(self): @@ -1120,8 +1101,7 @@ names2 = zf.namelist() self.assertEqual(sorted(names), sorted(names2)) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib @unittest.skipUnless(shutil.which('unzip'), 'Need the unzip command to run') def test_unzip_zipfile(self): @@ -1148,7 +1128,7 @@ base_name = os.path.join(tmpdir, 'archive') self.assertRaises(ValueError, make_archive, base_name, 'xxx') - @requires_zlib + @support.requires_zlib def test_make_archive_owner_group(self): # testing make_archive with owner and group, with various combinations # this works even if there's not gid/uid support @@ -1176,7 +1156,7 @@ self.assertTrue(os.path.isfile(res)) - @requires_zlib + @support.requires_zlib @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support") def test_tarfile_root_owner(self): root_dir, base_dir = self._create_files() @@ -1221,7 +1201,7 @@ self.assertEqual(make_archive('test', 'tar'), 'test.tar') self.assertTrue(os.path.isfile('test.tar')) - @requires_zlib + @support.requires_zlib def test_make_zipfile_in_curdir(self): # Issue #21280 root_dir = self.mkdtemp() @@ -1245,33 +1225,46 @@ formats = [name for name, params in get_archive_formats()] self.assertNotIn('xxx', formats) - @requires_zlib - def test_unpack_archive(self): - formats = ['tar', 'gztar', 'zip'] - if BZ2_SUPPORTED: - formats.append('bztar') - if LZMA_SUPPORTED: - formats.append('xztar') - + def check_unpack_archive(self, format): root_dir, base_dir = self._create_files() expected = rlistdir(root_dir) expected.remove('outer') - for format in formats: - base_name = os.path.join(self.mkdtemp(), 'archive') - filename = make_archive(base_name, format, root_dir, base_dir) - # let's try to unpack it now - tmpdir2 = self.mkdtemp() - unpack_archive(filename, tmpdir2) - self.assertEqual(rlistdir(tmpdir2), expected) + base_name = os.path.join(self.mkdtemp(), 'archive') + filename = make_archive(base_name, format, root_dir, base_dir) - # and again, this time with the format specified - tmpdir3 = self.mkdtemp() - unpack_archive(filename, tmpdir3, format=format) - self.assertEqual(rlistdir(tmpdir3), expected) + # let's try to unpack it now + tmpdir2 = self.mkdtemp() + unpack_archive(filename, tmpdir2) + self.assertEqual(rlistdir(tmpdir2), expected) + + # and again, this time with the format specified + tmpdir3 = self.mkdtemp() + unpack_archive(filename, tmpdir3, format=format) + self.assertEqual(rlistdir(tmpdir3), expected) + self.assertRaises(shutil.ReadError, unpack_archive, TESTFN) self.assertRaises(ValueError, unpack_archive, TESTFN, format='xxx') + def test_unpack_archive_tar(self): + self.check_unpack_archive('tar') + + @support.requires_zlib + def test_unpack_archive_gztar(self): + self.check_unpack_archive('gztar') + + @support.requires_bz2 + def test_unpack_archive_bztar(self): + self.check_unpack_archive('bztar') + + @support.requires_lzma + def test_unpack_archive_xztar(self): + self.check_unpack_archive('xztar') + + @support.requires_zlib + def test_unpack_archive_zip(self): + self.check_unpack_archive('zip') + def test_unpack_registry(self): formats = get_unpack_formats() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:13 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE0MDYx?= =?utf-8?q?=3A_Misc_fixes_and_cleanups_in_archiving_code_in_shutil=2E?= Message-ID: <20161216170812.77773.80008.496E71EF@psf.io> https://hg.python.org/cpython/rev/eb02db65e148 changeset: 105677:eb02db65e148 branch: 2.7 parent: 105637:eb830f1511ef user: Serhiy Storchaka date: Fri Dec 16 19:04:17 2016 +0200 summary: Issue #14061: Misc fixes and cleanups in archiving code in shutil. Improved the documentation and tests for make_archive(). Improved error handling when corresponding compress module is not available. External zip executable is now used if the zlib module is not available. files: Doc/library/shutil.rst | 13 ++++-- Lib/shutil.py | 54 ++++++++++++++++++++-------- Lib/test/test_shutil.py | 5 +- 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -267,7 +267,9 @@ *base_name* is the name of the file to create, including the path, minus any format-specific extension. *format* is the archive format: one of - "zip", "tar", "bztar" or "gztar". + "zip" (if the :mod:`zlib` module or external ``zip`` executable is + available), "tar", "gztar" (if the :mod:`zlib` module is available), or + "bztar" (if the :mod:`bz2` module is available). *root_dir* is a directory that will be the root directory of the archive; ie. we typically chdir into *root_dir* before creating the @@ -295,10 +297,11 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (if the :mod:`zlib` module or external ``zip`` + executable is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). You can register new formats or provide your own archiver for any existing formats, by using :func:`register_archive_format`. diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -13,6 +13,20 @@ import errno try: + import zlib + del zlib + _ZLIB_SUPPORTED = True +except ImportError: + _ZLIB_SUPPORTED = False + +try: + import bz2 + del bz2 + _BZ2_SUPPORTED = True +except ImportError: + _BZ2_SUPPORTED = False + +try: from pwd import getpwnam except ImportError: getpwnam = None @@ -351,15 +365,18 @@ Returns the output filename. """ - tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: ''} - compress_ext = {'gzip': '.gz', 'bzip2': '.bz2'} + if compress is None: + tar_compression = '' + elif _ZLIB_SUPPORTED and compress == 'gzip': + tar_compression = 'gz' + elif _BZ2_SUPPORTED and compress == 'bzip2': + tar_compression = 'bz2' + else: + raise ValueError("bad value for 'compress', or compression format not " + "supported : {0}".format(compress)) - # flags for compression program, each element of list will be an argument - if compress is not None and compress not in compress_ext.keys(): - raise ValueError, \ - ("bad value for 'compress': must be None, 'gzip' or 'bzip2'") - - archive_name = base_name + '.tar' + compress_ext.get(compress, '') + compress_ext = '.' + tar_compression if compress else '' + archive_name = base_name + '.tar' + compress_ext archive_dir = os.path.dirname(archive_name) if archive_dir and not os.path.exists(archive_dir): @@ -388,7 +405,7 @@ return tarinfo if not dry_run: - tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) + tar = tarfile.open(archive_name, 'w|%s' % tar_compression) try: tar.add(base_dir, filter=_set_uid_gid) finally: @@ -435,6 +452,7 @@ # If zipfile module is not available, try spawning an external 'zip' # command. try: + import zlib import zipfile except ImportError: zipfile = None @@ -470,11 +488,17 @@ return zip_filename _ARCHIVE_FORMATS = { - 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), - 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [],"ZIP file") - } + 'zip': (_make_zipfile, [], "ZIP file") +} + +if _ZLIB_SUPPORTED: + _ARCHIVE_FORMATS['gztar'] = (_make_tarball, [('compress', 'gzip')], + "gzip'ed tar-file") + +if _BZ2_SUPPORTED: + _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], + "bzip2'ed tar-file") def get_archive_formats(): """Returns a list of supported formats for archiving and unarchiving. @@ -515,8 +539,8 @@ """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific - extension; 'format' is the archive format: one of "zip", "tar", "bztar" - or "gztar". + extension; 'format' is the archive format: one of "zip", "tar", "gztar", + or "bztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -35,6 +35,7 @@ try: import zipfile + import zlib ZIP_SUPPORT = True except ImportError: ZIP_SUPPORT = find_executable('zip') @@ -460,7 +461,6 @@ self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) - @unittest.skipUnless(zlib, "Requires zlib") @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') def test_make_zipfile(self): # creating something to zip @@ -485,6 +485,7 @@ ['dist/', 'dist/file1', 'dist/file2', 'dist/sub/', 'dist/sub/file3', 'dist/sub2/', 'outer']) + support.unlink(res) with support.change_cwd(work_dir): base_name = os.path.abspath(rel_base_name) @@ -498,7 +499,6 @@ ['dist/', 'dist/file1', 'dist/file2', 'dist/sub/', 'dist/sub/file3', 'dist/sub2/']) - @unittest.skipUnless(zlib, "Requires zlib") @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') @unittest.skipUnless(find_executable('zip'), 'Need the zip command to run') @@ -524,7 +524,6 @@ names2 = zf.namelist() self.assertEqual(sorted(names), sorted(names2)) - @unittest.skipUnless(zlib, "Requires zlib") @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') @unittest.skipUnless(find_executable('unzip'), 'Need the unzip command to run') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2314061=3A_Misc_fixes_and_cleanups_in_archiving_c?= =?utf-8?q?ode_in_shutil=2E?= Message-ID: <20161216170812.77860.82257.E58D0B0E@psf.io> https://hg.python.org/cpython/rev/5fd772a20f25 changeset: 105676:5fd772a20f25 parent: 105670:dbf72357cb4a parent: 105675:268d3763bb07 user: Serhiy Storchaka date: Fri Dec 16 19:01:34 2016 +0200 summary: Issue #14061: Misc fixes and cleanups in archiving code in shutil. Imporoved the documentation and tests for make_archive() and unpack_archive(). Improved error handling when corresponding compress module is not available. Brake circular dependency between shutil and tarfile modules. files: Doc/library/shutil.rst | 44 +++++++------ Lib/shutil.py | 82 ++++++++++++++------------ Lib/test/test_shutil.py | 91 +++++++++++++--------------- 3 files changed, 110 insertions(+), 107 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -458,6 +458,10 @@ .. versionadded:: 3.2 +.. versionchanged:: 3.5 + Added support for the *xztar* format. + + High-level utilities to create and read compressed and archived files are also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules. @@ -467,8 +471,9 @@ *base_name* is the name of the file to create, including the path, minus any format-specific extension. *format* is the archive format: one of - "zip", "tar", "bztar" (if the :mod:`bz2` module is available), "xztar" - (if the :mod:`lzma` module is available) or "gztar". + "zip" (if the :mod:`zlib` module is available), "tar", "gztar" (if the + :mod:`zlib` module is available), "bztar" (if the :mod:`bz2` module is + available), or "xztar" (if the :mod:`lzma` module is available). *root_dir* is a directory that will be the root directory of the archive; for example, we typically chdir into *root_dir* before creating the @@ -491,9 +496,6 @@ The *verbose* argument is unused and deprecated. - .. versionchanged:: 3.5 - Added support for the *xztar* format. - .. function:: get_archive_formats() @@ -502,11 +504,11 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.) - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (if the :mod:`zlib` module is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). + - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). You can register new formats or provide your own archiver for any existing formats, by using :func:`register_archive_format`. @@ -541,11 +543,12 @@ *extract_dir* is the name of the target directory where the archive is unpacked. If not provided, the current working directory is used. - *format* is the archive format: one of "zip", "tar", or "gztar". Or any - other format registered with :func:`register_unpack_format`. If not - provided, :func:`unpack_archive` will use the archive file name extension - and see if an unpacker was registered for that extension. In case none is - found, a :exc:`ValueError` is raised. + *format* is the archive format: one of "zip", "tar", "gztar", "bztar", or + "xztar". Or any other format registered with + :func:`register_unpack_format`. If not provided, :func:`unpack_archive` + will use the archive file name extension and see if an unpacker was + registered for that extension. In case none is found, + a :exc:`ValueError` is raised. .. function:: register_unpack_format(name, extensions, function[, extra_args[, description]]) @@ -578,11 +581,12 @@ By default :mod:`shutil` provides these formats: - - *gztar*: gzip'ed tar-file - - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available.) - - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available.) - - *tar*: uncompressed tar file - - *zip*: ZIP file + - *zip*: ZIP file (unpacking compressed files works only if corresponding + module is available). + - *tar*: uncompressed tar file. + - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). + - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). + - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). You can register new formats or provide your own unpacker for any existing formats, by using :func:`register_unpack_format`. diff --git a/Lib/shutil.py b/Lib/shutil.py --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -10,7 +10,13 @@ import fnmatch import collections import errno -import tarfile + +try: + import zlib + del zlib + _ZLIB_SUPPORTED = True +except ImportError: + _ZLIB_SUPPORTED = False try: import bz2 @@ -602,23 +608,22 @@ Returns the output filename. """ - tar_compression = {'gzip': 'gz', None: ''} - compress_ext = {'gzip': '.gz'} - - if _BZ2_SUPPORTED: - tar_compression['bzip2'] = 'bz2' - compress_ext['bzip2'] = '.bz2' - - if _LZMA_SUPPORTED: - tar_compression['xz'] = 'xz' - compress_ext['xz'] = '.xz' - - # flags for compression program, each element of list will be an argument - if compress is not None and compress not in compress_ext: + if compress is None: + tar_compression = '' + elif _ZLIB_SUPPORTED and compress == 'gzip': + tar_compression = 'gz' + elif _BZ2_SUPPORTED and compress == 'bzip2': + tar_compression = 'bz2' + elif _LZMA_SUPPORTED and compress == 'xz': + tar_compression = 'xz' + else: raise ValueError("bad value for 'compress', or compression format not " "supported : {0}".format(compress)) - archive_name = base_name + '.tar' + compress_ext.get(compress, '') + import tarfile # late import for breaking circular dependency + + compress_ext = '.' + tar_compression if compress else '' + archive_name = base_name + '.tar' + compress_ext archive_dir = os.path.dirname(archive_name) if archive_dir and not os.path.exists(archive_dir): @@ -644,7 +649,7 @@ return tarinfo if not dry_run: - tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) + tar = tarfile.open(archive_name, 'w|%s' % tar_compression) try: tar.add(base_dir, filter=_set_uid_gid) finally: @@ -655,13 +660,10 @@ def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. - The output zip file will be named 'base_name' + ".zip". Uses either the - "zipfile" Python module (if available) or the InfoZIP "zip" utility - (if installed and found on the default search path). If neither tool is - available, raises ExecError. Returns the name of the output zip - file. + The output zip file will be named 'base_name' + ".zip". Returns the + name of the output zip file. """ - import zipfile + import zipfile # late import for breaking circular dependency zip_filename = base_name + ".zip" archive_dir = os.path.dirname(base_name) @@ -700,10 +702,13 @@ return zip_filename _ARCHIVE_FORMATS = { - 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [], "ZIP file") - } +} + +if _ZLIB_SUPPORTED: + _ARCHIVE_FORMATS['gztar'] = (_make_tarball, [('compress', 'gzip')], + "gzip'ed tar-file") + _ARCHIVE_FORMATS['zip'] = (_make_zipfile, [], "ZIP file") if _BZ2_SUPPORTED: _ARCHIVE_FORMATS['bztar'] = (_make_tarball, [('compress', 'bzip2')], @@ -752,8 +757,8 @@ """Create an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific - extension; 'format' is the archive format: one of "zip", "tar", "bztar" - or "gztar". + extension; 'format' is the archive format: one of "zip", "tar", "gztar", + "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the @@ -866,10 +871,7 @@ def _unpack_zipfile(filename, extract_dir): """Unpack zip `filename` to `extract_dir` """ - try: - import zipfile - except ImportError: - raise ReadError('zlib not supported, cannot unpack this archive.') + import zipfile # late import for breaking circular dependency if not zipfile.is_zipfile(filename): raise ReadError("%s is not a zip file" % filename) @@ -903,6 +905,7 @@ def _unpack_tarfile(filename, extract_dir): """Unpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` """ + import tarfile # late import for breaking circular dependency try: tarobj = tarfile.open(filename) except tarfile.TarError: @@ -914,10 +917,13 @@ tarobj.close() _UNPACK_FORMATS = { - 'gztar': (['.tar.gz', '.tgz'], _unpack_tarfile, [], "gzip'ed tar-file"), 'tar': (['.tar'], _unpack_tarfile, [], "uncompressed tar file"), - 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file") - } + 'zip': (['.zip'], _unpack_zipfile, [], "ZIP file"), +} + +if _ZLIB_SUPPORTED: + _UNPACK_FORMATS['gztar'] = (['.tar.gz', '.tgz'], _unpack_tarfile, [], + "gzip'ed tar-file") if _BZ2_SUPPORTED: _UNPACK_FORMATS['bztar'] = (['.tar.bz2', '.tbz2'], _unpack_tarfile, [], @@ -942,10 +948,10 @@ `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. - `format` is the archive format: one of "zip", "tar", or "gztar". Or any - other registered format. If not provided, unpack_archive will use the - filename extension and see if an unpacker was registered for that - extension. + `format` is the archive format: one of "zip", "tar", "gztar", "bztar", + or "xztar". Or any other registered format. If not provided, + unpack_archive will use the filename extension and see if an unpacker + was registered for that extension. In case none is found, a ValueError is raised. """ diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -19,23 +19,12 @@ unregister_unpack_format, get_unpack_formats, SameFileError) import tarfile +import zipfile import warnings from test import support from test.support import (TESTFN, check_warnings, captured_stdout, - requires_zlib, android_not_root) - -try: - import bz2 - BZ2_SUPPORTED = True -except ImportError: - BZ2_SUPPORTED = False - -try: - import lzma - LZMA_SUPPORTED = True -except ImportError: - LZMA_SUPPORTED = False + android_not_root) TESTFN2 = TESTFN + "2" @@ -46,12 +35,6 @@ except ImportError: UID_GID_SUPPORT = False -try: - import zipfile - ZIP_SUPPORT = True -except ImportError: - ZIP_SUPPORT = shutil.which('zip') - def _fake_rename(*args, **kwargs): # Pretend the destination path is on a different filesystem. raise OSError(getattr(errno, 'EXDEV', 18), "Invalid cross-device link") @@ -966,7 +949,7 @@ self.assertEqual(getattr(file1_stat, 'st_flags'), getattr(file2_stat, 'st_flags')) - @requires_zlib + @support.requires_zlib def test_make_tarball(self): # creating something to tar root_dir, base_dir = self._create_files('') @@ -1022,7 +1005,7 @@ write_file((root_dir, 'outer'), 'xxx') return root_dir, base_dir - @requires_zlib + @support.requires_zlib @unittest.skipUnless(shutil.which('tar'), 'Need the tar command to run') def test_tarfile_vs_tar(self): @@ -1055,8 +1038,7 @@ self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib def test_make_zipfile(self): # creating something to zip root_dir, base_dir = self._create_files() @@ -1093,8 +1075,7 @@ ['dist/', 'dist/sub/', 'dist/sub2/', 'dist/file1', 'dist/file2', 'dist/sub/file3']) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib @unittest.skipUnless(shutil.which('zip'), 'Need the zip command to run') def test_zipfile_vs_zip(self): @@ -1120,8 +1101,7 @@ names2 = zf.namelist() self.assertEqual(sorted(names), sorted(names2)) - @requires_zlib - @unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run') + @support.requires_zlib @unittest.skipUnless(shutil.which('unzip'), 'Need the unzip command to run') def test_unzip_zipfile(self): @@ -1148,7 +1128,7 @@ base_name = os.path.join(tmpdir, 'archive') self.assertRaises(ValueError, make_archive, base_name, 'xxx') - @requires_zlib + @support.requires_zlib def test_make_archive_owner_group(self): # testing make_archive with owner and group, with various combinations # this works even if there's not gid/uid support @@ -1176,7 +1156,7 @@ self.assertTrue(os.path.isfile(res)) - @requires_zlib + @support.requires_zlib @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support") def test_tarfile_root_owner(self): root_dir, base_dir = self._create_files() @@ -1221,7 +1201,7 @@ self.assertEqual(make_archive('test', 'tar'), 'test.tar') self.assertTrue(os.path.isfile('test.tar')) - @requires_zlib + @support.requires_zlib def test_make_zipfile_in_curdir(self): # Issue #21280 root_dir = self.mkdtemp() @@ -1245,33 +1225,46 @@ formats = [name for name, params in get_archive_formats()] self.assertNotIn('xxx', formats) - @requires_zlib - def test_unpack_archive(self): - formats = ['tar', 'gztar', 'zip'] - if BZ2_SUPPORTED: - formats.append('bztar') - if LZMA_SUPPORTED: - formats.append('xztar') - + def check_unpack_archive(self, format): root_dir, base_dir = self._create_files() expected = rlistdir(root_dir) expected.remove('outer') - for format in formats: - base_name = os.path.join(self.mkdtemp(), 'archive') - filename = make_archive(base_name, format, root_dir, base_dir) - # let's try to unpack it now - tmpdir2 = self.mkdtemp() - unpack_archive(filename, tmpdir2) - self.assertEqual(rlistdir(tmpdir2), expected) + base_name = os.path.join(self.mkdtemp(), 'archive') + filename = make_archive(base_name, format, root_dir, base_dir) - # and again, this time with the format specified - tmpdir3 = self.mkdtemp() - unpack_archive(filename, tmpdir3, format=format) - self.assertEqual(rlistdir(tmpdir3), expected) + # let's try to unpack it now + tmpdir2 = self.mkdtemp() + unpack_archive(filename, tmpdir2) + self.assertEqual(rlistdir(tmpdir2), expected) + + # and again, this time with the format specified + tmpdir3 = self.mkdtemp() + unpack_archive(filename, tmpdir3, format=format) + self.assertEqual(rlistdir(tmpdir3), expected) + self.assertRaises(shutil.ReadError, unpack_archive, TESTFN) self.assertRaises(ValueError, unpack_archive, TESTFN, format='xxx') + def test_unpack_archive_tar(self): + self.check_unpack_archive('tar') + + @support.requires_zlib + def test_unpack_archive_gztar(self): + self.check_unpack_archive('gztar') + + @support.requires_bz2 + def test_unpack_archive_bztar(self): + self.check_unpack_archive('bztar') + + @support.requires_lzma + def test_unpack_archive_xztar(self): + self.check_unpack_archive('xztar') + + @support.requires_zlib + def test_unpack_archive_zip(self): + self.check_unpack_archive('zip') + def test_unpack_registry(self): formats = get_unpack_formats() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20161216170845.1363.35321.42654070@psf.io> https://hg.python.org/cpython/rev/7f11020b64ef changeset: 105678:7f11020b64ef branch: 3.5 parent: 105674:929c2d076a85 parent: 105671:fcba55d649ea user: Serhiy Storchaka date: Fri Dec 16 19:05:33 2016 +0200 summary: Merge heads files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -479,6 +479,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -485,6 +485,10 @@ - Issue #24142: Reading a corrupt config file left the parser in an invalid state. Original patch by Florian H?ch. +- Issue #28990: Fix SSL hanging if connection is closed before handshake + completed. + (Patch by HoHo-Ho) + IDLE ---- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Null_merge?= Message-ID: <20161216170847.40444.6483.B922F64A@psf.io> https://hg.python.org/cpython/rev/8d5b0f8c672d changeset: 105681:8d5b0f8c672d branch: 3.6 parent: 105679:1254dce790ce parent: 105678:7f11020b64ef user: Serhiy Storchaka date: Fri Dec 16 19:06:34 2016 +0200 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_heads?= Message-ID: <20161216170847.78688.29437.5356268E@psf.io> https://hg.python.org/cpython/rev/7e9d71fefc80 changeset: 105680:7e9d71fefc80 parent: 105676:5fd772a20f25 parent: 105673:59eea8122df6 user: Serhiy Storchaka date: Fri Dec 16 19:06:17 2016 +0200 summary: Merge heads files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -480,6 +480,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy42IC0+IDMuNik6?= =?utf-8?q?_Merge_heads?= Message-ID: <20161216170846.41090.71144.C01F6377@psf.io> https://hg.python.org/cpython/rev/1254dce790ce changeset: 105679:1254dce790ce branch: 3.6 parent: 105675:268d3763bb07 parent: 105672:fcc642bf88c1 user: Serhiy Storchaka date: Fri Dec 16 19:05:57 2016 +0200 summary: Merge heads files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -480,6 +480,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,6 +44,10 @@ now when the grp module cannot be imported, as for example on Android platforms. +- Issue #28990: Fix SSL hanging if connection is closed before handshake + completed. + (Patch by HoHo-Ho) + Windows ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:08:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:08:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20161216170847.40396.94749.CA83A321@psf.io> https://hg.python.org/cpython/rev/79d52e7d472d changeset: 105682:79d52e7d472d parent: 105680:7e9d71fefc80 parent: 105681:8d5b0f8c672d user: Serhiy Storchaka date: Fri Dec 16 19:06:51 2016 +0200 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 12:19:19 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 17:19:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2318896=3A_Python_f?= =?utf-8?q?unction_can_now_have_more_than_255_parameters=2E?= Message-ID: <20161216171918.12058.84514.CB58BD86@psf.io> https://hg.python.org/cpython/rev/7454ca88aacb changeset: 105683:7454ca88aacb user: Serhiy Storchaka date: Fri Dec 16 19:19:02 2016 +0200 summary: Issue #18896: Python function can now have more than 255 parameters. collections.namedtuple() now supports tuples with more than 255 elements. files: Doc/whatsnew/3.7.rst | 5 ++- Include/code.h | 7 ++--- Lib/test/test_collections.py | 3 +- Lib/test/test_compile.py | 11 +------- Lib/test/test_keywordonlyarg.py | 24 +++++--------------- Lib/test/test_sys.py | 2 +- Misc/NEWS | 3 ++ Objects/codeobject.c | 20 +++++++++++------ Python/ast.c | 5 ---- Python/ceval.c | 2 +- 10 files changed, 33 insertions(+), 49 deletions(-) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -75,8 +75,9 @@ Other Language Changes ====================== -* More than 255 arguments can now be passed to a function. - (Contributed by Serhiy Storchaka in :issue:`12844`.) +* More than 255 arguments can now be passed to a function, and a function can + now have more than 255 parameters. + (Contributed by Serhiy Storchaka in :issue:`12844` and :issue:`18896`.) New Modules diff --git a/Include/code.h b/Include/code.h --- a/Include/code.h +++ b/Include/code.h @@ -37,7 +37,7 @@ for tracebacks and debuggers; otherwise, constant de-duplication would collapse identical functions/lambdas defined on different lines. */ - unsigned char *co_cell2arg; /* Maps cell vars which are arguments. */ + Py_ssize_t *co_cell2arg; /* Maps cell vars which are arguments. */ PyObject *co_filename; /* unicode (where it was loaded from) */ PyObject *co_name; /* unicode (name, for reference) */ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See @@ -84,9 +84,8 @@ #define CO_FUTURE_GENERATOR_STOP 0x80000 /* This value is found in the co_cell2arg array when the associated cell - variable does not correspond to an argument. The maximum number of - arguments is 255 (indexed up to 254), so 255 work as a special flag.*/ -#define CO_CELL_NOT_AN_ARG 255 + variable does not correspond to an argument. */ +#define CO_CELL_NOT_AN_ARG (-1) /* This should be defined if a future statement modifies the syntax. For example, when a keyword is added. diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -319,8 +319,7 @@ self.assertEqual(Dot(1)._replace(d=999), (999,)) self.assertEqual(Dot(1)._fields, ('d',)) - # n = 5000 - n = 254 # SyntaxError: more than 255 arguments: + n = 5000 names = list(set(''.join([choice(string.ascii_letters) for j in range(10)]) for i in range(n))) n = len(names) diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py --- a/Lib/test/test_compile.py +++ b/Lib/test/test_compile.py @@ -401,16 +401,9 @@ self.assertNotIn((Ellipsis, Ellipsis), d) def test_annotation_limit(self): - # 16 bits are available for # of annotations, but only 8 bits are - # available for the parameter count, hence 255 - # is the max. Ensure the result of too many annotations is a - # SyntaxError. + # more than 255 annotations, should compile ok s = "def f(%s): pass" - s %= ', '.join('a%d:%d' % (i,i) for i in range(256)) - self.assertRaises(SyntaxError, compile, s, '?', 'exec') - # Test that the max # of annotations compiles. - s = "def f(%s): pass" - s %= ', '.join('a%d:%d' % (i,i) for i in range(255)) + s %= ', '.join('a%d:%d' % (i,i) for i in range(300)) compile(s, '?', 'exec') def test_mangling(self): diff --git a/Lib/test/test_keywordonlyarg.py b/Lib/test/test_keywordonlyarg.py --- a/Lib/test/test_keywordonlyarg.py +++ b/Lib/test/test_keywordonlyarg.py @@ -51,24 +51,12 @@ self.assertRaisesSyntaxError("def f(p, *, (k1, k2), **kw):\n pass\n") def testSyntaxForManyArguments(self): - fundef = "def f(" - for i in range(255): - fundef += "i%d, "%i - fundef += "*, key=100):\n pass\n" - self.assertRaisesSyntaxError(fundef) - - fundef2 = "def foo(i,*," - for i in range(255): - fundef2 += "i%d, "%i - fundef2 += "lastarg):\n pass\n" - self.assertRaisesSyntaxError(fundef2) - - # exactly 255 arguments, should compile ok - fundef3 = "def f(i,*," - for i in range(253): - fundef3 += "i%d, "%i - fundef3 += "lastarg):\n pass\n" - compile(fundef3, "", "single") + # more than 255 positional arguments, should compile ok + fundef = "def f(%s):\n pass\n" % ', '.join('i%d' % i for i in range(300)) + compile(fundef, "", "single") + # more than 255 keyword-only arguments, should compile ok + fundef = "def f(*, %s):\n pass\n" % ', '.join('i%d' % i for i in range(300)) + compile(fundef, "", "single") def testTooManyPositionalErrorMessage(self): def f(a, b=None, *, c=None): 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 @@ -926,7 +926,7 @@ def inner(): return x return inner - check(get_cell2.__code__, size('6i13P') + 1) + check(get_cell2.__code__, size('6i13P') + calcsize('n')) # complex check(complex(0,1), size('2d')) # method_descriptor (descriptor object) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #18896: Python function can now have more than 255 parameters. + collections.namedtuple() now supports tuples with more than 255 elements. + - Issue #26919: On Android, operating system data is now always encoded/decoded to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. diff --git a/Objects/codeobject.c b/Objects/codeobject.c --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -110,7 +110,7 @@ PyObject *lnotab) { PyCodeObject *co; - unsigned char *cell2arg = NULL; + Py_ssize_t *cell2arg = NULL; Py_ssize_t i, n_cellvars; /* Check argument types */ @@ -142,19 +142,25 @@ if (n_cellvars) { Py_ssize_t total_args = argcount + kwonlyargcount + ((flags & CO_VARARGS) != 0) + ((flags & CO_VARKEYWORDS) != 0); - Py_ssize_t alloc_size = sizeof(unsigned char) * n_cellvars; bool used_cell2arg = false; - cell2arg = PyMem_MALLOC(alloc_size); - if (cell2arg == NULL) + cell2arg = PyMem_NEW(Py_ssize_t, n_cellvars); + if (cell2arg == NULL) { + PyErr_NoMemory(); return NULL; - memset(cell2arg, CO_CELL_NOT_AN_ARG, alloc_size); + } /* Find cells which are also arguments. */ for (i = 0; i < n_cellvars; i++) { Py_ssize_t j; PyObject *cell = PyTuple_GET_ITEM(cellvars, i); + cell2arg[i] = CO_CELL_NOT_AN_ARG; for (j = 0; j < total_args; j++) { PyObject *arg = PyTuple_GET_ITEM(varnames, j); - if (!PyUnicode_Compare(cell, arg)) { + int cmp = PyUnicode_Compare(cell, arg); + if (cmp == -1 && PyErr_Occurred()) { + PyMem_FREE(cell2arg); + return NULL; + } + if (cmp == 0) { cell2arg[i] = j; used_cell2arg = true; break; @@ -449,7 +455,7 @@ res = _PyObject_SIZE(Py_TYPE(co)); if (co->co_cell2arg != NULL && co->co_cellvars != NULL) - res += PyTuple_GET_SIZE(co->co_cellvars) * sizeof(unsigned char); + res += PyTuple_GET_SIZE(co->co_cellvars) * sizeof(Py_ssize_t); return PyLong_FromSsize_t(res); } diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -1411,11 +1411,6 @@ if (!kwdefaults && nkwonlyargs) return NULL; - if (nposargs + nkwonlyargs > 255) { - ast_error(c, n, "more than 255 arguments"); - return NULL; - } - /* tfpdef: NAME [':' test] vfpdef: NAME */ diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4100,7 +4100,7 @@ vars into frame. */ for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { PyObject *c; - int arg; + Py_ssize_t arg; /* Possibly account for the cell variable being an argument. */ if (co->co_cell2arg != NULL && (arg = co->co_cell2arg[i]) != CO_CELL_NOT_AN_ARG) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 13:00:34 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 16 Dec 2016 18:00:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Remove_unused_imports=2E?= Message-ID: <20161216180034.66185.53301.4854B68D@psf.io> https://hg.python.org/cpython/rev/25b8b5cf8e2f changeset: 105684:25b8b5cf8e2f user: Serhiy Storchaka date: Fri Dec 16 20:00:15 2016 +0200 summary: Remove unused imports. files: Lib/asyncio/base_events.py | 1 - Lib/http/client.py | 1 - Lib/idlelib/idle_test/test_macosx.py | 1 - Lib/idlelib/idle_test/test_tree.py | 1 - Lib/idlelib/macosx.py | 1 - Lib/idlelib/stackviewer.py | 1 - Lib/lib2to3/pytree.py | 1 - Lib/lib2to3/tests/__init__.py | 1 - Lib/modulefinder.py | 1 - Lib/socketserver.py | 1 - Lib/test/support/script_helper.py | 3 --- Lib/test/test_asyncgen.py | 1 - Lib/test/test_asyncio/test_tasks.py | 1 - Lib/test/test_asyncio/test_unix_events.py | 1 - Lib/test/test_bz2.py | 1 - Lib/test/test_cmd.py | 1 - Lib/test/test_cmd_line.py | 1 - Lib/test/test_configparser.py | 1 - Lib/test/test_dbm_dumb.py | 1 - Lib/test/test_decimal.py | 2 -- Lib/test/test_dis.py | 1 - Lib/test/test_faulthandler.py | 1 - Lib/test/test_frame.py | 2 -- Lib/test/test_import/__init__.py | 1 - Lib/test/test_importlib/abc.py | 1 - Lib/test/test_importlib/test_abc.py | 2 -- Lib/test/test_inspect.py | 3 --- Lib/test/test_os.py | 1 - Lib/test/test_peepholer.py | 3 --- Lib/test/test_raise.py | 1 - Lib/test/test_re.py | 3 --- Lib/test/test_set.py | 1 - Lib/test/test_shutil.py | 1 - Lib/test/test_signal.py | 4 ---- Lib/test/test_ssl.py | 1 - Lib/test/test_subclassinit.py | 1 - Lib/test/test_super.py | 1 - Lib/test/test_timeit.py | 1 - Lib/test/test_unicode_identifiers.py | 1 - Lib/test/test_winsound.py | 2 -- Lib/test/test_yield_from.py | 3 --- Lib/urllib/request.py | 1 - Lib/zipfile.py | 1 - 43 files changed, 0 insertions(+), 60 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -16,7 +16,6 @@ import collections import concurrent.futures import heapq -import inspect import itertools import logging import os diff --git a/Lib/http/client.py b/Lib/http/client.py --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -72,7 +72,6 @@ import email.message import http import io -import os import re import socket import collections diff --git a/Lib/idlelib/idle_test/test_macosx.py b/Lib/idlelib/idle_test/test_macosx.py --- a/Lib/idlelib/idle_test/test_macosx.py +++ b/Lib/idlelib/idle_test/test_macosx.py @@ -4,7 +4,6 @@ ''' from idlelib import macosx from test.support import requires -import sys import tkinter as tk import unittest import unittest.mock as mock diff --git a/Lib/idlelib/idle_test/test_tree.py b/Lib/idlelib/idle_test/test_tree.py --- a/Lib/idlelib/idle_test/test_tree.py +++ b/Lib/idlelib/idle_test/test_tree.py @@ -5,7 +5,6 @@ from idlelib import tree from test.support import requires requires('gui') -import os import unittest from tkinter import Tk diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -2,7 +2,6 @@ A number of functions that enhance IDLE on Mac OSX. """ from sys import platform # Used in _init_tk_type, changed by test. -import warnings import tkinter diff --git a/Lib/idlelib/stackviewer.py b/Lib/idlelib/stackviewer.py --- a/Lib/idlelib/stackviewer.py +++ b/Lib/idlelib/stackviewer.py @@ -1,6 +1,5 @@ import linecache import os -import re import sys import tkinter as tk diff --git a/Lib/lib2to3/pytree.py b/Lib/lib2to3/pytree.py --- a/Lib/lib2to3/pytree.py +++ b/Lib/lib2to3/pytree.py @@ -13,7 +13,6 @@ __author__ = "Guido van Rossum " import sys -import warnings from io import StringIO HUGE = 0x7FFFFFFF # maximum repeat count, default max diff --git a/Lib/lib2to3/tests/__init__.py b/Lib/lib2to3/tests/__init__.py --- a/Lib/lib2to3/tests/__init__.py +++ b/Lib/lib2to3/tests/__init__.py @@ -1,7 +1,6 @@ # Author: Collin Winter import os -import unittest from test.support import load_package_tests diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py --- a/Lib/modulefinder.py +++ b/Lib/modulefinder.py @@ -7,7 +7,6 @@ import os import sys import types -import struct import warnings with warnings.catch_warnings(): warnings.simplefilter('ignore', DeprecationWarning) diff --git a/Lib/socketserver.py b/Lib/socketserver.py --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -126,7 +126,6 @@ import socket import selectors import os -import errno import sys try: import threading diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -6,11 +6,8 @@ import sys import os import os.path -import tempfile import subprocess import py_compile -import contextlib -import shutil import zipfile from importlib.util import source_from_cache diff --git a/Lib/test/test_asyncgen.py b/Lib/test/test_asyncgen.py --- a/Lib/test/test_asyncgen.py +++ b/Lib/test/test_asyncgen.py @@ -1,5 +1,4 @@ import inspect -import sys import types import unittest diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -7,7 +7,6 @@ import os import re import sys -import time import types import unittest import weakref diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py --- a/Lib/test/test_asyncio/test_unix_events.py +++ b/Lib/test/test_asyncio/test_unix_events.py @@ -12,7 +12,6 @@ import tempfile import threading import unittest -import warnings from unittest import mock if sys.platform == 'win32': diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py --- a/Lib/test/test_bz2.py +++ b/Lib/test/test_bz2.py @@ -10,7 +10,6 @@ import random import shutil import subprocess -import sys from test.support import unlink import _compression diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py --- a/Lib/test/test_cmd.py +++ b/Lib/test/test_cmd.py @@ -6,7 +6,6 @@ import cmd import sys -import re import unittest import io from test import support diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -4,7 +4,6 @@ import test.support, unittest import os -import shutil import sys import subprocess import tempfile diff --git a/Lib/test/test_configparser.py b/Lib/test/test_configparser.py --- a/Lib/test/test_configparser.py +++ b/Lib/test/test_configparser.py @@ -2,7 +2,6 @@ import configparser import io import os -import sys import textwrap import unittest import warnings diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -7,7 +7,6 @@ import os import stat import unittest -import warnings import dbm.dumb as dumbdbm from test import support from functools import partial diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -37,8 +37,6 @@ from test.support import (check_warnings, import_fresh_module, TestFailed, run_with_locale, cpython_only) import random -import time -import warnings import inspect try: import threading diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -2,7 +2,6 @@ from test.support import captured_stdout from test.bytecode_helper import BytecodeTestCase -import difflib import unittest import sys import dis diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -2,7 +2,6 @@ import datetime import faulthandler import os -import re import signal import subprocess import sys diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py --- a/Lib/test/test_frame.py +++ b/Lib/test/test_frame.py @@ -1,5 +1,3 @@ -import gc -import sys import types import unittest import weakref diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -14,7 +14,6 @@ import unittest.mock as mock import textwrap import errno -import shutil import contextlib import test.support diff --git a/Lib/test/test_importlib/abc.py b/Lib/test/test_importlib/abc.py --- a/Lib/test/test_importlib/abc.py +++ b/Lib/test/test_importlib/abc.py @@ -1,5 +1,4 @@ import abc -import unittest class FinderTests(metaclass=abc.ABCMeta): diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py --- a/Lib/test/test_importlib/test_abc.py +++ b/Lib/test/test_importlib/test_abc.py @@ -1,5 +1,3 @@ -import contextlib -import inspect import io import marshal import os 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 @@ -10,7 +10,6 @@ from os.path import normcase import _pickle import pickle -import re import shutil import sys import types @@ -56,8 +55,6 @@ def revise(filename, *args): return (normcase(filename),) + args -import builtins - git = mod.StupidGit() class IsTestBase(unittest.TestCase): diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -15,7 +15,6 @@ import mmap import os import pickle -import re import shutil import signal import socket diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -1,7 +1,4 @@ import dis -import re -import sys -import textwrap import unittest from test.bytecode_helper import BytecodeTestCase diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -4,7 +4,6 @@ """Tests for the raise statement.""" from test import support -import re import sys import types import unittest 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 @@ -1,12 +1,9 @@ from test.support import verbose, run_unittest, gc_collect, bigmemtest, _2G, \ cpython_only, captured_stdout -import io import locale import re import sre_compile import string -import sys -import traceback import unittest import warnings from re import Scanner diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py --- a/Lib/test/test_set.py +++ b/Lib/test/test_set.py @@ -10,7 +10,6 @@ import collections import collections.abc import itertools -import string class PassThru(Exception): pass diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -20,7 +20,6 @@ SameFileError) import tarfile import zipfile -import warnings from test import support from test.support import (TESTFN, check_warnings, captured_stdout, diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1,15 +1,11 @@ import unittest from test import support from contextlib import closing -import enum -import gc -import pickle import select import signal import socket import struct import subprocess -import traceback import sys, os, time, errno from test.support.script_helper import assert_python_ok, spawn_python try: diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -11,7 +11,6 @@ import os import errno import pprint -import tempfile import urllib.request import traceback import asyncore diff --git a/Lib/test/test_subclassinit.py b/Lib/test/test_subclassinit.py --- a/Lib/test/test_subclassinit.py +++ b/Lib/test/test_subclassinit.py @@ -1,4 +1,3 @@ -import sys import types import unittest diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -1,6 +1,5 @@ """Unit tests for zero-argument super() & related machinery.""" -import sys import unittest import warnings from test.support import check_warnings diff --git a/Lib/test/test_timeit.py b/Lib/test/test_timeit.py --- a/Lib/test/test_timeit.py +++ b/Lib/test/test_timeit.py @@ -2,7 +2,6 @@ import unittest import sys import io -import time from textwrap import dedent from test.support import captured_stdout diff --git a/Lib/test/test_unicode_identifiers.py b/Lib/test/test_unicode_identifiers.py --- a/Lib/test/test_unicode_identifiers.py +++ b/Lib/test/test_unicode_identifiers.py @@ -1,5 +1,4 @@ import unittest -import sys class PEP3131Test(unittest.TestCase): diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py --- a/Lib/test/test_winsound.py +++ b/Lib/test/test_winsound.py @@ -1,8 +1,6 @@ # Ridiculously simple test of the winsound module for Windows. import functools -import os -import subprocess import time import unittest diff --git a/Lib/test/test_yield_from.py b/Lib/test/test_yield_from.py --- a/Lib/test/test_yield_from.py +++ b/Lib/test/test_yield_from.py @@ -8,10 +8,7 @@ """ import unittest -import io -import sys import inspect -import parser from test.support import captured_stderr, disable_gc, gc_collect diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -94,7 +94,6 @@ import string import sys import time -import collections import tempfile import contextlib import warnings diff --git a/Lib/zipfile.py b/Lib/zipfile.py --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -5,7 +5,6 @@ """ import io import os -import re import importlib.util import sys import time -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 14:52:01 2016 From: python-checkins at python.org (xavier.degaye) Date: Fri, 16 Dec 2016 19:52:01 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTcx?= =?utf-8?q?=3A_Temporarily_skip_test=5Fover_until_a_permanent_solution_is_?= =?utf-8?q?found?= Message-ID: <20161216195200.66336.81520.2BDD68E3@psf.io> https://hg.python.org/cpython/rev/1386795d266e changeset: 105685:1386795d266e branch: 3.5 parent: 105678:7f11020b64ef user: Xavier de Gaye date: Fri Dec 16 20:49:10 2016 +0100 summary: Issue #28971: Temporarily skip test_over until a permanent solution is found for issue #28971. files: Lib/test/test_nntplib.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -132,6 +132,8 @@ self.assertLessEqual(art_num, last) self._check_art_dict(art_dict) + @unittest.skipIf(True, 'temporarily skipped until a permanent solution' + ' is found for issue #28971') def test_over(self): resp, count, first, last, name = self.server.group(self.GROUP_NAME) start = last - 10 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 14:52:01 2016 From: python-checkins at python.org (xavier.degaye) Date: Fri, 16 Dec 2016 19:52:01 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328971=3A_Merge_3=2E6?= Message-ID: <20161216195200.102754.56292.1C595F01@psf.io> https://hg.python.org/cpython/rev/b51914417b41 changeset: 105687:b51914417b41 parent: 105684:25b8b5cf8e2f parent: 105686:a33047e08711 user: Xavier de Gaye date: Fri Dec 16 20:51:09 2016 +0100 summary: Issue #28971: Merge 3.6 files: Lib/test/test_nntplib.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -132,6 +132,8 @@ self.assertLessEqual(art_num, last) self._check_art_dict(art_dict) + @unittest.skipIf(True, 'temporarily skipped until a permanent solution' + ' is found for issue #28971') def test_over(self): resp, count, first, last, name = self.server.group(self.GROUP_NAME) start = last - 10 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 14:52:00 2016 From: python-checkins at python.org (xavier.degaye) Date: Fri, 16 Dec 2016 19:52:00 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328971=3A_Merge_3=2E5?= Message-ID: <20161216195200.15813.83414.023D0C49@psf.io> https://hg.python.org/cpython/rev/a33047e08711 changeset: 105686:a33047e08711 branch: 3.6 parent: 105681:8d5b0f8c672d parent: 105685:1386795d266e user: Xavier de Gaye date: Fri Dec 16 20:50:10 2016 +0100 summary: Issue #28971: Merge 3.5 files: Lib/test/test_nntplib.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_nntplib.py b/Lib/test/test_nntplib.py --- a/Lib/test/test_nntplib.py +++ b/Lib/test/test_nntplib.py @@ -132,6 +132,8 @@ self.assertLessEqual(art_num, last) self._check_art_dict(art_dict) + @unittest.skipIf(True, 'temporarily skipped until a permanent solution' + ' is found for issue #28971') def test_over(self): resp, count, first, last, name = self.server.group(self.GROUP_NAME) start = last - 10 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 17:01:26 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 16 Dec 2016 22:01:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_merge?= Message-ID: <20161216220126.21768.75580.04A405B3@psf.io> https://hg.python.org/cpython/rev/b3d27b5f2d23 changeset: 105689:b3d27b5f2d23 branch: 3.6 parent: 105686:a33047e08711 parent: 105688:c23f8614151d user: Raymond Hettinger date: Fri Dec 16 13:59:32 2016 -0800 summary: merge files: Lib/functools.py | 6 ++++-- Lib/test/test_functools.py | 13 +++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -574,14 +574,16 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - full = (len(cache) >= maxsize) + # Use the __len__() method instead of the len() function + # which could potentially be wrapped in an lru_cache itself. + full = (cache.__len__() >= maxsize) misses += 1 return result def cache_info(): """Report cache statistics""" with lock: - return _CacheInfo(hits, misses, maxsize, len(cache)) + return _CacheInfo(hits, misses, maxsize, cache.__len__()) def cache_clear(): """Clear the cache and cache statistics""" diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1,4 +1,5 @@ import abc +import builtins import collections import copy from itertools import permutations @@ -1189,6 +1190,18 @@ self.assertEqual(misses, 4) self.assertEqual(currsize, 2) + def test_lru_reentrancy_with_len(self): + # Test to make sure the LRU cache code isn't thrown-off by + # caching the built-in len() function. Since len() can be + # cached, we shouldn't use it inside the lru code itself. + old_len = builtins.len + try: + builtins.len = self.module.lru_cache(4)(len) + for i in [0, 0, 1, 2, 3, 3, 4, 5, 6, 1, 7, 2, 1]: + self.assertEqual(len('abcdefghijklmn'[:i]), i) + finally: + builtins.len = old_len + def test_lru_type_error(self): # Regression test for issue #28653. # lru_cache was leaking when one of the arguments diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,6 +14,9 @@ to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. +- Issue #28991: functools.lru_cache() was susceptible to an obscure $ + bug triggerable by a monkey-patched len() function. + - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 17:01:26 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 16 Dec 2016 22:01:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161216220126.21696.44930.531EB2F2@psf.io> https://hg.python.org/cpython/rev/c6346144a9bb changeset: 105690:c6346144a9bb parent: 105687:b51914417b41 parent: 105689:b3d27b5f2d23 user: Raymond Hettinger date: Fri Dec 16 13:59:57 2016 -0800 summary: merge files: Lib/functools.py | 6 ++++-- Lib/test/test_functools.py | 13 +++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -574,14 +574,16 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - full = (len(cache) >= maxsize) + # Use the __len__() method instead of the len() function + # which could potentially be wrapped in an lru_cache itself. + full = (cache.__len__() >= maxsize) misses += 1 return result def cache_info(): """Report cache statistics""" with lock: - return _CacheInfo(hits, misses, maxsize, len(cache)) + return _CacheInfo(hits, misses, maxsize, cache.__len__()) def cache_clear(): """Clear the cache and cache statistics""" diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1,4 +1,5 @@ import abc +import builtins import collections import copy from itertools import permutations @@ -1189,6 +1190,18 @@ self.assertEqual(misses, 4) self.assertEqual(currsize, 2) + def test_lru_reentrancy_with_len(self): + # Test to make sure the LRU cache code isn't thrown-off by + # caching the built-in len() function. Since len() can be + # cached, we shouldn't use it inside the lru code itself. + old_len = builtins.len + try: + builtins.len = self.module.lru_cache(4)(len) + for i in [0, 0, 1, 2, 3, 3, 4, 5, 6, 1, 7, 2, 1]: + self.assertEqual(len('abcdefghijklmn'[:i]), i) + finally: + builtins.len = old_len + def test_lru_type_error(self): # Regression test for issue #28653. # lru_cache was leaking when one of the arguments diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -17,6 +17,9 @@ to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. +- Issue #28991: functools.lru_cache() was susceptible to an obscure $ + bug triggerable by a monkey-patched len() function. + - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 17:01:26 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 16 Dec 2016 22:01:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTkx?= =?utf-8?q?=3A__Fix_obscure_reentrancy_bug_in_functools=2Elru=5Fcache=28?= =?utf-8?b?KS4=?= Message-ID: <20161216220126.34446.49984.FFF02E27@psf.io> https://hg.python.org/cpython/rev/c23f8614151d changeset: 105688:c23f8614151d branch: 3.5 parent: 105685:1386795d266e user: Raymond Hettinger date: Fri Dec 16 13:57:40 2016 -0800 summary: Issue #28991: Fix obscure reentrancy bug in functools.lru_cache(). files: Lib/functools.py | 6 ++++-- Lib/test/test_functools.py | 13 +++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -516,14 +516,16 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - full = (len(cache) >= maxsize) + # Use the __len__() method instead of the len() function + # which could potentially be wrapped in an lru_cache itself. + full = (cache.__len__() >= maxsize) misses += 1 return result def cache_info(): """Report cache statistics""" with lock: - return _CacheInfo(hits, misses, maxsize, len(cache)) + return _CacheInfo(hits, misses, maxsize, cache.__len__()) def cache_clear(): """Clear the cache and cache statistics""" diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1,4 +1,5 @@ import abc +import builtins import collections import copy from itertools import permutations @@ -1162,6 +1163,18 @@ self.assertEqual(misses, 4) self.assertEqual(currsize, 2) + def test_lru_reentrancy_with_len(self): + # Test to make sure the LRU cache code isn't thrown-off by + # caching the built-in len() function. Since len() can be + # cached, we shouldn't use it inside the lru code itself. + old_len = builtins.len + try: + builtins.len = self.module.lru_cache(4)(len) + for i in [0, 0, 1, 2, 3, 3, 4, 5, 6, 1, 7, 2, 1]: + self.assertEqual(len('abcdefghijklmn'[:i]), i) + finally: + builtins.len = old_len + def test_lru_type_error(self): # Regression test for issue #28653. # lru_cache was leaking when one of the arguments diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ - Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). +- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy + bug caused by a monkey-patched len() function. + - Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode astral characters. Patch by Xiang Zhang. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 18:01:04 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 16 Dec 2016 23:01:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328991=3A__Address?= =?utf-8?q?_comment_that_the_=5F=5Flen=5F=5F_call_looked_unattractive?= Message-ID: <20161216230101.96424.26925.71E8B6BE@psf.io> https://hg.python.org/cpython/rev/5ec5bfcf0089 changeset: 105691:5ec5bfcf0089 user: Raymond Hettinger date: Fri Dec 16 14:59:37 2016 -0800 summary: Issue #28991: Address comment that the __len__ call looked unattractive files: Lib/functools.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py --- a/Lib/functools.py +++ b/Lib/functools.py @@ -493,6 +493,7 @@ hits = misses = 0 full = False cache_get = cache.get # bound method to lookup a key or return None + cache_len = cache.__len__ # get cache size without calling len() lock = RLock() # because linkedlist updates aren't threadsafe root = [] # root of the circular doubly linked list root[:] = [root, root, None, None] # initialize by pointing to self @@ -574,16 +575,16 @@ last = root[PREV] link = [last, root, key, result] last[NEXT] = root[PREV] = cache[key] = link - # Use the __len__() method instead of the len() function + # Use the cache_len bound method instead of the len() function # which could potentially be wrapped in an lru_cache itself. - full = (cache.__len__() >= maxsize) + full = (cache_len() >= maxsize) misses += 1 return result def cache_info(): """Report cache statistics""" with lock: - return _CacheInfo(hits, misses, maxsize, cache.__len__()) + return _CacheInfo(hits, misses, maxsize, cache_len()) def cache_clear(): """Clear the cache and cache statistics""" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:57 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogTWVyZ2UgMy41IChp?= =?utf-8?q?ssue_=2328990=29?= Message-ID: <20161217040157.23498.36519.28F5C20B@psf.io> https://hg.python.org/cpython/rev/bfd4f13b478b changeset: 105693:bfd4f13b478b branch: 3.6 user: Yury Selivanov date: Fri Dec 16 11:51:57 2016 -0500 summary: Merge 3.5 (issue #28990) files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 10 ++++++++++ Misc/NEWS | 4 ++++ 3 files changed, 15 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -480,6 +480,7 @@ self._loop.call_soon(self._app_protocol.connection_lost, exc) self._transport = None self._app_transport = None + self._wakeup_waiter(exc) def pause_writing(self): """Called when the low-level transport's buffer goes over diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -85,5 +85,15 @@ # Restore error logging. log.logger.setLevel(log_level) + def test_connection_lost(self): + # From issue #472. + # yield from waiter hang if lost_connection was called. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + self.connection_made(ssl_proto) + ssl_proto.connection_lost(ConnectionAbortedError) + test_utils.run_briefly(self.loop) + self.assertIsInstance(waiter.exception(), ConnectionAbortedError) + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,6 +14,10 @@ must not convert combined table into split table. Patch written by INADA Naoki. +- Issue #28990: Fix SSL hanging if connection is closed before handshake + completed. + (Patch by HoHo-Ho) + Windows ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:58 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Tidy_Misc/NEWS?= =?utf-8?q?_for_3=2E6=2E0rc1+_cherrypicks=2E?= Message-ID: <20161217040157.96211.78804.19893713@psf.io> https://hg.python.org/cpython/rev/d0f989319b29 changeset: 105694:d0f989319b29 branch: 3.6 user: Ned Deily date: Fri Dec 16 15:29:12 2016 -0500 summary: Tidy Misc/NEWS for 3.6.0rc1+ cherrypicks. files: Misc/NEWS | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -14,14 +14,18 @@ must not convert combined table into split table. Patch written by INADA Naoki. -- Issue #28990: Fix SSL hanging if connection is closed before handshake - completed. - (Patch by HoHo-Ho) +- Issue #28990: Fix asynchio SSL hanging if connection is closed before + handshake is completed. (Patch by HoHo-Ho) + +Tools/Demos +----------- + +- Issue #28770: Fix python-gdb.py for fastcalls. Windows ------- -- Issue #28896: Deprecate WindowsRegistryFinder +- Issue #28896: Deprecate WindowsRegistryFinder. Build ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:57 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4Nzcw?= =?utf-8?q?=3A_Update_python-gdb=2Epy_for_fastcalls?= Message-ID: <20161217040157.23319.56530.3BD36D7E@psf.io> https://hg.python.org/cpython/rev/b0efa88c4cf4 changeset: 105692:b0efa88c4cf4 branch: 3.6 parent: 105665:c9a058c78457 user: Victor Stinner date: Tue Nov 22 22:53:18 2016 +0100 summary: Issue #28770: Update python-gdb.py for fastcalls Frame.is_other_python_frame() now also handles _PyCFunction_FastCallDict() frames. Thanks to the new code to handle fast calls, python-gdb.py is now also able to detect the frame. (grafted from f41d02d7da373ccaff97a42b66b051260bd55996) files: Lib/test/test_gdb.py | 20 ++++++------ Tools/gdb/libpython.py | 47 +++++++++++++++++++---------- 2 files changed, 41 insertions(+), 26 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 @@ -679,7 +679,7 @@ def test_pyup_command(self): 'Verify that the "py-up" command works' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up']) + cmds_after_breakpoint=['py-up', 'py-up']) self.assertMultilineMatches(bt, r'''^.* #[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\) @@ -698,7 +698,7 @@ def test_up_at_top(self): 'Verify handling of "py-up" at the top of the stack' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up'] * 4) + cmds_after_breakpoint=['py-up'] * 5) self.assertEndsWith(bt, 'Unable to find an older python frame\n') @@ -708,7 +708,7 @@ def test_up_then_down(self): 'Verify "py-up" followed by "py-down"' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up', 'py-down']) + cmds_after_breakpoint=['py-up', 'py-up', 'py-down']) self.assertMultilineMatches(bt, r'''^.* #[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\) @@ -727,6 +727,7 @@ self.assertMultilineMatches(bt, r'''^.* Traceback \(most recent call first\): + File ".*gdb_sample.py", line 10, in baz id\(42\) File ".*gdb_sample.py", line 7, in bar @@ -815,7 +816,6 @@ ) self.assertIn('Garbage-collecting', gdb_output) - @unittest.skip("FIXME: builtin method is not shown in py-bt and py-bt-full") @unittest.skipIf(python_is_optimized(), "Python was compiled with optimizations") # Some older versions of gdb will fail with @@ -854,7 +854,7 @@ def test_basic_command(self): 'Verify that the "py-print" command works' bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-print args']) + cmds_after_breakpoint=['py-up', 'py-print args']) self.assertMultilineMatches(bt, r".*\nlocal 'args' = \(1, 2, 3\)\n.*") @@ -863,7 +863,7 @@ @unittest.skipUnless(HAS_PYUP_PYDOWN, "test requires py-up/py-down commands") def test_print_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up', 'py-print c', 'py-print b', 'py-print a']) + cmds_after_breakpoint=['py-up', 'py-up', 'py-print c', 'py-print b', 'py-print a']) self.assertMultilineMatches(bt, r".*\nlocal 'c' = 3\nlocal 'b' = 2\nlocal 'a' = 1\n.*") @@ -871,7 +871,7 @@ "Python was compiled with optimizations") def test_printing_global(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-print __name__']) + cmds_after_breakpoint=['py-up', 'py-print __name__']) self.assertMultilineMatches(bt, r".*\nglobal '__name__' = '__main__'\n.*") @@ -879,7 +879,7 @@ "Python was compiled with optimizations") def test_printing_builtin(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-print len']) + cmds_after_breakpoint=['py-up', 'py-print len']) self.assertMultilineMatches(bt, r".*\nbuiltin 'len' = \n.*") @@ -888,7 +888,7 @@ "Python was compiled with optimizations") def test_basic_command(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-locals']) + cmds_after_breakpoint=['py-up', 'py-locals']) self.assertMultilineMatches(bt, r".*\nargs = \(1, 2, 3\)\n.*") @@ -897,7 +897,7 @@ "Python was compiled with optimizations") def test_locals_after_up(self): bt = self.get_stack_trace(script=self.get_sample_script(), - cmds_after_breakpoint=['py-up', 'py-locals']) + cmds_after_breakpoint=['py-up', 'py-up', 'py-locals']) self.assertMultilineMatches(bt, r".*\na = 1\nb = 2\nc = 3\n.*") diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1492,23 +1492,38 @@ ''' if self.is_waiting_for_gil(): return 'Waiting for the GIL' - elif self.is_gc_collect(): + + if self.is_gc_collect(): return 'Garbage-collecting' - else: - # Detect invocations of PyCFunction instances: - older = self.older() - if older and older._gdbframe.name() == 'PyCFunction_Call': - # Within that frame: - # "func" is the local containing the PyObject* of the - # PyCFunctionObject instance - # "f" is the same value, but cast to (PyCFunctionObject*) - # "self" is the (PyObject*) of the 'self' - try: - # Use the prettyprinter for the func: - func = older._gdbframe.read_var('func') - return str(func) - except RuntimeError: - return 'PyCFunction invocation (unable to read "func")' + + # Detect invocations of PyCFunction instances: + older = self.older() + if not older: + return False + + caller = older._gdbframe.name() + if not caller: + return False + + if caller == 'PyCFunction_Call': + # Within that frame: + # "func" is the local containing the PyObject* of the + # PyCFunctionObject instance + # "f" is the same value, but cast to (PyCFunctionObject*) + # "self" is the (PyObject*) of the 'self' + try: + # Use the prettyprinter for the func: + func = older._gdbframe.read_var('func') + return str(func) + except RuntimeError: + return 'PyCFunction invocation (unable to read "func")' + + elif caller == '_PyCFunction_FastCallDict': + try: + func = older._gdbframe.read_var('func_obj') + return str(func) + except RuntimeError: + return 'PyCFunction invocation (unable to read "func_obj")' # This frame isn't worth reporting: return False -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy42IC0+IDMuNik6?= =?utf-8?q?_null_merge_additional_3=2E6=2E0rc1+_cherrypicks?= Message-ID: <20161217040159.34980.97173.D1DB8429@psf.io> https://hg.python.org/cpython/rev/997b6d353f38 changeset: 105695:997b6d353f38 branch: 3.6 parent: 105686:a33047e08711 parent: 105694:d0f989319b29 user: Ned Deily date: Fri Dec 16 16:04:25 2016 -0500 summary: null merge additional 3.6.0rc1+ cherrypicks files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Update_pydoc_t?= =?utf-8?q?opics_for_3=2E6=2E0rc2?= Message-ID: <20161217040159.96449.38203.76711637@psf.io> https://hg.python.org/cpython/rev/cc7196e3ff25 changeset: 105696:cc7196e3ff25 branch: 3.6 parent: 105694:d0f989319b29 user: Ned Deily date: Fri Dec 16 16:33:41 2016 -0500 summary: Update pydoc topics for 3.6.0rc2 files: Lib/pydoc_data/topics.py | 35 +++++++++++++++++++++++++-- 1 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Tue Dec 6 18:51:51 2016 +# Autogenerated by Sphinx on Fri Dec 16 16:33:16 2016 topics = {'assert': '\n' 'The "assert" statement\n' '**********************\n' @@ -2613,7 +2613,8 @@ 'functions, even if they do not contain "await" or "async" ' 'keywords.\n' '\n' - 'It is a "SyntaxError" to use "yield" expressions in "async def"\n' + 'It is a "SyntaxError" to use "yield from" expressions in "async ' + 'def"\n' 'coroutines.\n' '\n' 'An example of a coroutine function:\n' @@ -7087,7 +7088,14 @@ 'generator is done and will cause "StopIteration" to be raised. ' 'The\n' 'returned value (if any) is used as an argument to construct\n' - '"StopIteration" and becomes the "StopIteration.value" attribute.\n', + '"StopIteration" and becomes the "StopIteration.value" attribute.\n' + '\n' + 'In an asynchronous generator function, an empty "return" ' + 'statement\n' + 'indicates that the asynchronous generator is done and will cause\n' + '"StopAsyncIteration" to be raised. A non-empty "return" statement ' + 'is\n' + 'a syntax error in an asynchronous generator function.\n', 'sequence-types': '\n' 'Emulating container types\n' '*************************\n' @@ -11097,6 +11105,27 @@ 'statements.\n' ' See also the Coroutine Objects section.\n' '\n' + ' Asynchronous generator functions\n' + ' A function or method which is defined using "async def" and\n' + ' which uses the "yield" statement is called a *asynchronous\n' + ' generator function*. Such a function, when called, returns ' + 'an\n' + ' asynchronous iterator object which can be used in an "async ' + 'for"\n' + ' statement to execute the body of the function.\n' + '\n' + ' Calling the asynchronous iterator\'s "aiterator.__anext__()"\n' + ' method will return an *awaitable* which when awaited will\n' + ' execute until it provides a value using the "yield" ' + 'expression.\n' + ' When the function executes an empty "return" statement or ' + 'falls\n' + ' off the end, a "StopAsyncIteration" exception is raised and ' + 'the\n' + ' asynchronous iterator will have reached the end of the set ' + 'of\n' + ' values to be yielded.\n' + '\n' ' Built-in functions\n' ' A built-in function object is a wrapper around a C function.\n' ' Examples of built-in functions are "len()" and "math.sin()"\n' -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Version_bump_f?= =?utf-8?q?or_3=2E6=2E0rc2?= Message-ID: <20161217040159.11238.72485.F87D657C@psf.io> https://hg.python.org/cpython/rev/800a67f7806d changeset: 105697:800a67f7806d branch: 3.6 tag: v3.6.0rc2 user: Ned Deily date: Fri Dec 16 16:40:10 2016 -0500 summary: Version bump for 3.6.0rc2 files: Include/patchlevel.h | 4 ++-- Misc/NEWS | 2 +- README | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.6.0rc1+" +#define PY_VERSION "3.6.0rc2" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.6.0 release candidate 2 ============================================== -*Release date: XXXX-XX-XX* +*Release date: 2016-12-16* Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.6.0 release candidate 1 +This is Python version 3.6.0 release candidate 2 ================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Added_tag_v3?= =?utf-8?q?=2E6=2E0rc2_for_changeset_800a67f7806d?= Message-ID: <20161217040159.95943.78221.D8C61845@psf.io> https://hg.python.org/cpython/rev/4e8ed3b9ff44 changeset: 105698:4e8ed3b9ff44 branch: 3.6 user: Ned Deily date: Fri Dec 16 16:42:30 2016 -0500 summary: Added tag v3.6.0rc2 for changeset 800a67f7806d files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 +800a67f7806de45a7abd5273359e704bf147c079 v3.6.0rc2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy42IC0+IDMuNik6?= =?utf-8?q?_Null_merge_v3=2E6=2E0rc2_tag_into_mainline_3=2E6?= Message-ID: <20161217040159.34980.82114.1BB89D4E@psf.io> https://hg.python.org/cpython/rev/ddff3b556fab changeset: 105699:ddff3b556fab branch: 3.6 parent: 105695:997b6d353f38 parent: 105698:4e8ed3b9ff44 user: Ned Deily date: Fri Dec 16 16:52:37 2016 -0500 summary: Null merge v3.6.0rc2 tag into mainline 3.6 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 +800a67f7806de45a7abd5273359e704bf147c079 v3.6.0rc2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_from_3=2E6?= Message-ID: <20161217040159.6600.96607.1B4BCB39@psf.io> https://hg.python.org/cpython/rev/4dc65f0869aa changeset: 105701:4dc65f0869aa parent: 105691:5ec5bfcf0089 parent: 105700:13c20a5f66e6 user: Ned Deily date: Fri Dec 16 22:56:48 2016 -0500 summary: Null merge from 3.6 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 +800a67f7806de45a7abd5273359e704bf147c079 v3.6.0rc2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:01:59 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:01:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy42IC0+IDMuNik6?= =?utf-8?q?_Null_merge_v3=2E6=2E0rc2_release_into_mainline_3=2E6?= Message-ID: <20161217040159.6992.50224.7859EC9C@psf.io> https://hg.python.org/cpython/rev/13c20a5f66e6 changeset: 105700:13c20a5f66e6 branch: 3.6 parent: 105689:b3d27b5f2d23 parent: 105699:ddff3b556fab user: Ned Deily date: Fri Dec 16 22:54:22 2016 -0500 summary: Null merge v3.6.0rc2 release into mainline 3.6 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 +800a67f7806de45a7abd5273359e704bf147c079 v3.6.0rc2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:18:14 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:18:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_from_3=2E6?= Message-ID: <20161217041814.95816.71374.B8896185@psf.io> https://hg.python.org/cpython/rev/ede3ac49b4ac changeset: 105703:ede3ac49b4ac parent: 105701:4dc65f0869aa parent: 105702:21c6cd71bd9c user: Ned Deily date: Fri Dec 16 23:17:52 2016 -0500 summary: Null merge from 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 16 23:18:14 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 17 Dec 2016 04:18:14 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogTWVyZ2UgMy42LjBy?= =?utf-8?q?c2_Misc/NEWS_entries_into_3=2E6=2E1?= Message-ID: <20161217041813.127867.37334.50955FB6@psf.io> https://hg.python.org/cpython/rev/21c6cd71bd9c changeset: 105702:21c6cd71bd9c branch: 3.6 parent: 105700:13c20a5f66e6 user: Ned Deily date: Fri Dec 16 23:16:36 2016 -0500 summary: Merge 3.6.0rc2 Misc/NEWS entries into 3.6.1 files: Misc/NEWS | 111 +++++++++++++++++++++++++---------------- 1 files changed, 67 insertions(+), 44 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -17,62 +17,85 @@ - Issue #28991: functools.lru_cache() was susceptible to an obscure $ bug triggerable by a monkey-patched len() function. +- Issue #28739: f-string expressions no longer accepted as docstrings and + by ast.literal_eval() even if they do not include expressions. + +- Issue #28512: Fixed setting the offset attribute of SyntaxError by + PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +- Issue #28918: Fix the cross compilation of xxlimited when Python has been + built with Py_DEBUG defined. + +- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. + Improve speed of dict literal with constant keys up to 30%. + +Library +------- + +- Issue #28779: multiprocessing.set_forkserver_preload() would crash the + forkserver process if a preloaded module instantiated some + multiprocessing objects such as locks. + +- Issue #28847: dbm.dumb now supports reading read-only files and no longer + writes the index file when it is not changed. + +- Issue #26937: The chown() method of the tarfile.TarFile class does not fail + now when the grp module cannot be imported, as for example on Android + platforms. + +Windows +------- + +- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. + +Tests +----- + +- Issue #28683: Fix the tests that bind() a unix socket and raise + PermissionError on Android for a non-root user. + +- Issue #26939: Add the support.setswitchinterval() function to fix + test_functools hanging on the Android armv7 qemu emulator. + +Build +----- + +- Issue #20211: Do not add the directory for installing C header files and the + directory for installing object code libraries to the cross compilation + search paths. Original patch by Thomas Petazzoni. + +- Issue #28849: Do not define sys.implementation._multiarch on Android. + + +What's New in Python 3.6.0 release candidate 2 +============================================== + +*Release date: 2016-12-16* + +Core and Builtins +----------------- + - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. -- Issue #28739: f-string expressions no longer accepted as docstrings and - by ast.literal_eval() even if they do not include expressions. - -- Issue #28512: Fixed setting the offset attribute of SyntaxError by - PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). - -- Issue #28918: Fix the cross compilation of xxlimited when Python has been - built with Py_DEBUG defined. - -- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. - Improve speed of dict literal with constant keys up to 30%. - -Library -------- - -- Issue #28779: multiprocessing.set_forkserver_preload() would crash the - forkserver process if a preloaded module instantiated some - multiprocessing objects such as locks. - -- Issue #28847: dbm.dumb now supports reading read-only files and no longer - writes the index file when it is not changed. - -- Issue #26937: The chown() method of the tarfile.TarFile class does not fail - now when the grp module cannot be imported, as for example on Android - platforms. - -- Issue #28990: Fix SSL hanging if connection is closed before handshake - completed. - (Patch by HoHo-Ho) +- Issue #28990: Fix asynchio SSL hanging if connection is closed before + handshake is completed. (Patch by HoHo-Ho) + +Tools/Demos +----------- + +- Issue #28770: Fix python-gdb.py for fastcalls. Windows ------- -- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. - -Tests ------ - -- Issue #28683: Fix the tests that bind() a unix socket and raise - PermissionError on Android for a non-root user. - -- Issue #26939: Add the support.setswitchinterval() function to fix - test_functools hanging on the Android armv7 qemu emulator. +- Issue #28896: Deprecate WindowsRegistryFinder. Build ----- -- Issue #20211: Do not add the directory for installing C header files and the - directory for installing object code libraries to the cross compilation - search paths. Original patch by Thomas Petazzoni. - -- Issue #28849: Do not define sys.implementation._multiarch on Android. +- Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. What's New in Python 3.6.0 release candidate 1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 03:20:04 2016 From: python-checkins at python.org (xavier.degaye) Date: Sat, 17 Dec 2016 08:20:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328596=3A_The_pref?= =?utf-8?q?erred_encoding_is_UTF-8_on_Android=2E?= Message-ID: <20161217082003.21768.19902.38C80205@psf.io> https://hg.python.org/cpython/rev/1756beed417c changeset: 105704:1756beed417c user: Xavier de Gaye date: Sat Dec 17 09:19:11 2016 +0100 summary: Issue #28596: The preferred encoding is UTF-8 on Android. files: Lib/_bootlocale.py | 16 +++++++++++----- Lib/locale.py | 24 +++++++++++++++--------- Misc/NEWS | 3 +++ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/Lib/_bootlocale.py b/Lib/_bootlocale.py --- a/Lib/_bootlocale.py +++ b/Lib/_bootlocale.py @@ -14,11 +14,17 @@ try: _locale.CODESET except AttributeError: - def getpreferredencoding(do_setlocale=True): - # This path for legacy systems needs the more complex - # getdefaultlocale() function, import the full locale module. - import locale - return locale.getpreferredencoding(do_setlocale) + if hasattr(sys, 'getandroidapilevel'): + # On Android langinfo.h and CODESET are missing, and UTF-8 is + # always used in mbstowcs() and wcstombs(). + def getpreferredencoding(do_setlocale=True): + return 'UTF-8' + else: + def getpreferredencoding(do_setlocale=True): + # This path for legacy systems needs the more complex + # getdefaultlocale() function, import the full locale module. + import locale + return locale.getpreferredencoding(do_setlocale) else: def getpreferredencoding(do_setlocale=True): assert not do_setlocale diff --git a/Lib/locale.py b/Lib/locale.py --- a/Lib/locale.py +++ b/Lib/locale.py @@ -618,15 +618,21 @@ try: CODESET except NameError: - # Fall back to parsing environment variables :-( - def getpreferredencoding(do_setlocale = True): - """Return the charset that the user is likely using, - by looking at environment variables.""" - res = getdefaultlocale()[1] - if res is None: - # LANG not set, default conservatively to ASCII - res = 'ascii' - return res + if hasattr(sys, 'getandroidapilevel'): + # On Android langinfo.h and CODESET are missing, and UTF-8 is + # always used in mbstowcs() and wcstombs(). + def getpreferredencoding(do_setlocale = True): + return 'UTF-8' + else: + # Fall back to parsing environment variables :-( + def getpreferredencoding(do_setlocale = True): + """Return the charset that the user is likely using, + by looking at environment variables.""" + res = getdefaultlocale()[1] + if res is None: + # LANG not set, default conservatively to ASCII + res = 'ascii' + return res else: def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ - Issue #18896: Python function can now have more than 255 parameters. collections.namedtuple() now supports tuples with more than 255 elements. +- Issue #28596: The preferred encoding is UTF-8 on Android. Patch written by + Chi Hsuan Yen. + - Issue #26919: On Android, operating system data is now always encoded/decoded to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Dec 17 04:06:33 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 17 Dec 2016 09:06:33 +0000 Subject: [Python-checkins] Daily reference leaks (ede3ac49b4ac): sum=3 Message-ID: <20161217090632.96630.55030.4476B000@psf.io> results for ede3ac49b4ac on branch "default" -------------------------------------------- test_collections leaked [7, 0, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [1, 0, -2] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/refloglYA4QP', '--timeout', '7200'] From python-checkins at python.org Sat Dec 17 15:04:50 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 17 Dec 2016 20:04:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E13_release_branch?= Message-ID: <20161217200450.6750.13001.57FF1FBF@psf.io> https://hg.python.org/cpython/rev/6daa88e02392 changeset: 105707:6daa88e02392 branch: 2.7 parent: 105677:eb02db65e148 parent: 105706:1ebacf31c5e8 user: Benjamin Peterson date: Sat Dec 17 12:04:43 2016 -0800 summary: merge 2.7.13 release branch files: .hgtags | 1 + Misc/NEWS | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 d33e0cf91556723fb8cebefdad1f3bce43b2244d v2.7.12 4d6fd49eeb14bb47f700325eb90d7989fc9e4020 v2.7.13rc1 +a06454b1afa167fbcd8626e4abc144ce15461067 v2.7.13 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -20,7 +20,7 @@ What's New in Python 2.7.13 =========================== -*Release date: 2016-12-XX* +*Release date: 2016-12-17* Core and Builtins ----------------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:04:50 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 17 Dec 2016 20:04:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogMi43LjEzIGZpbmFs?= =?utf-8?q?_bump?= Message-ID: <20161217200450.127809.90284.9E78EBD4@psf.io> https://hg.python.org/cpython/rev/a06454b1afa1 changeset: 105705:a06454b1afa1 branch: 2.7 tag: v2.7.13 parent: 105614:5315db3171b0 user: Benjamin Peterson date: Sat Dec 17 12:00:35 2016 -0800 summary: 2.7.13 final bump files: Include/patchlevel.h | 6 +++--- Misc/NEWS | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,11 +23,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 13 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.13rc1" +#define PY_VERSION "2.7.13" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 2.7.13 =========================== -*Release date: 2016-12-XX* +*Release date: 2016-12-17* Core and Builtins ----------------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:04:50 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 17 Dec 2016 20:04:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Added_tag_v2?= =?utf-8?q?=2E7=2E13_for_changeset_a06454b1afa1?= Message-ID: <20161217200450.34566.61571.EC0528CE@psf.io> https://hg.python.org/cpython/rev/1ebacf31c5e8 changeset: 105706:1ebacf31c5e8 branch: 2.7 user: Benjamin Peterson date: Sat Dec 17 12:00:42 2016 -0800 summary: Added tag v2.7.13 for changeset a06454b1afa1 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 d33e0cf91556723fb8cebefdad1f3bce43b2244d v2.7.12 4d6fd49eeb14bb47f700325eb90d7989fc9e4020 v2.7.13rc1 +a06454b1afa167fbcd8626e4abc144ce15461067 v2.7.13 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:16:45 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 17 Dec 2016 20:16:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDAw?= =?utf-8?q?=3A_Fixed_bytes_formatting_of_octals_with_zero_padding_in_alter?= =?utf-8?q?nate?= Message-ID: <20161217201645.96424.31955.7DC447E5@psf.io> https://hg.python.org/cpython/rev/96d728c14267 changeset: 105708:96d728c14267 branch: 3.5 parent: 105688:c23f8614151d user: Serhiy Storchaka date: Sat Dec 17 21:48:03 2016 +0200 summary: Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. files: Lib/test/test_format.py | 34 ++++++++++++++++++++++------ Misc/NEWS | 3 ++ Objects/bytesobject.c | 5 +-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -114,6 +114,7 @@ testcommon("%o", 100000000000, "1351035564000") testcommon("%d", 10, "10") testcommon("%d", 100000000000, "100000000000") + big = 123456789012345678901234567890 testcommon("%d", big, "123456789012345678901234567890") testcommon("%d", -big, "-123456789012345678901234567890") @@ -133,6 +134,7 @@ testcommon("%.31d", big, "0123456789012345678901234567890") testcommon("%32.31d", big, " 0123456789012345678901234567890") testcommon("%d", float(big), "123456________________________", 6) + big = 0x1234567890abcdef12345 # 21 hex digits testcommon("%x", big, "1234567890abcdef12345") testcommon("%x", -big, "-1234567890abcdef12345") @@ -156,19 +158,26 @@ testcommon("%#X", big, "0X1234567890ABCDEF12345") testcommon("%#x", big, "0x1234567890abcdef12345") testcommon("%#x", -big, "-0x1234567890abcdef12345") + testcommon("%#27x", big, " 0x1234567890abcdef12345") + testcommon("%#-27x", big, "0x1234567890abcdef12345 ") + testcommon("%#027x", big, "0x00001234567890abcdef12345") + testcommon("%#.23x", big, "0x001234567890abcdef12345") testcommon("%#.23x", -big, "-0x001234567890abcdef12345") + testcommon("%#27.23x", big, " 0x001234567890abcdef12345") + testcommon("%#-27.23x", big, "0x001234567890abcdef12345 ") + testcommon("%#027.23x", big, "0x00001234567890abcdef12345") testcommon("%#+.23x", big, "+0x001234567890abcdef12345") testcommon("%# .23x", big, " 0x001234567890abcdef12345") testcommon("%#+.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+26.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+27.23X", big, "+0X001234567890ABCDEF12345 ") - testcommon("%#+27.23X", big, " +0X001234567890ABCDEF12345") # next one gets two leading zeroes from precision, and another from the # 0 flag and the width testcommon("%#+027.23X", big, "+0X0001234567890ABCDEF12345") + testcommon("%# 027.23X", big, " 0X0001234567890ABCDEF12345") # same, except no 0 flag testcommon("%#+27.23X", big, " +0X001234567890ABCDEF12345") + testcommon("%#-+27.23x", big, "+0x001234567890abcdef12345 ") + testcommon("%#- 27.23x", big, " 0x001234567890abcdef12345 ") + big = 0o12345670123456701234567012345670 # 32 octal digits testcommon("%o", big, "12345670123456701234567012345670") testcommon("%o", -big, "-12345670123456701234567012345670") @@ -191,13 +200,21 @@ testcommon("%o", big, "12345670123456701234567012345670") testcommon("%#o", big, "0o12345670123456701234567012345670") testcommon("%#o", -big, "-0o12345670123456701234567012345670") + testcommon("%#38o", big, " 0o12345670123456701234567012345670") + testcommon("%#-38o", big, "0o12345670123456701234567012345670 ") + testcommon("%#038o", big, "0o000012345670123456701234567012345670") + testcommon("%#.34o", big, "0o0012345670123456701234567012345670") testcommon("%#.34o", -big, "-0o0012345670123456701234567012345670") + testcommon("%#38.34o", big, " 0o0012345670123456701234567012345670") + testcommon("%#-38.34o", big, "0o0012345670123456701234567012345670 ") + testcommon("%#038.34o", big, "0o000012345670123456701234567012345670") testcommon("%#+.34o", big, "+0o0012345670123456701234567012345670") testcommon("%# .34o", big, " 0o0012345670123456701234567012345670") - testcommon("%#+.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#-+.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#-+37.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#+37.34o", big, "+0o0012345670123456701234567012345670") + testcommon("%#+38.34o", big, " +0o0012345670123456701234567012345670") + testcommon("%#-+38.34o", big, "+0o0012345670123456701234567012345670 ") + testcommon("%#- 38.34o", big, " 0o0012345670123456701234567012345670 ") + testcommon("%#+038.34o", big, "+0o00012345670123456701234567012345670") + testcommon("%# 038.34o", big, " 0o00012345670123456701234567012345670") # next one gets one leading zero from precision testcommon("%.33o", big, "012345670123456701234567012345670") # base marker added in spite of leading zero (different to Python 2) @@ -208,6 +225,7 @@ testcommon("%035.33o", big, "00012345670123456701234567012345670") # base marker shouldn't change the size testcommon("%0#35.33o", big, "0o012345670123456701234567012345670") + # Some small ints, in both Python int and flavors). testcommon("%d", 42, "42") testcommon("%d", -42, "-42") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate + form. + - Issue #28512: Fixed setting the offset attribute of SyntaxError by PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -882,7 +882,7 @@ if (width > len) width--; } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); if (fill != ' ') { @@ -904,8 +904,7 @@ if (fill == ' ') { if (sign) *res++ = sign; - if ((flags & F_ALT) && - (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); *res++ = *pbuf++; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:16:45 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 17 Dec 2016 20:16:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329000=3A_Fixed_bytes_formatting_of_octals_with_?= =?utf-8?q?zero_padding_in_alternate?= Message-ID: <20161217201645.23377.99831.5B0096EF@psf.io> https://hg.python.org/cpython/rev/4e55e011dd80 changeset: 105710:4e55e011dd80 parent: 105704:1756beed417c parent: 105709:29c9c414c310 user: Serhiy Storchaka date: Sat Dec 17 22:15:10 2016 +0200 summary: Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. files: Lib/test/test_format.py | 34 ++++++++++++++++++++++------ Misc/NEWS | 3 ++ Objects/bytesobject.c | 5 +-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -114,6 +114,7 @@ testcommon("%o", 100000000000, "1351035564000") testcommon("%d", 10, "10") testcommon("%d", 100000000000, "100000000000") + big = 123456789012345678901234567890 testcommon("%d", big, "123456789012345678901234567890") testcommon("%d", -big, "-123456789012345678901234567890") @@ -133,6 +134,7 @@ testcommon("%.31d", big, "0123456789012345678901234567890") testcommon("%32.31d", big, " 0123456789012345678901234567890") testcommon("%d", float(big), "123456________________________", 6) + big = 0x1234567890abcdef12345 # 21 hex digits testcommon("%x", big, "1234567890abcdef12345") testcommon("%x", -big, "-1234567890abcdef12345") @@ -156,19 +158,26 @@ testcommon("%#X", big, "0X1234567890ABCDEF12345") testcommon("%#x", big, "0x1234567890abcdef12345") testcommon("%#x", -big, "-0x1234567890abcdef12345") + testcommon("%#27x", big, " 0x1234567890abcdef12345") + testcommon("%#-27x", big, "0x1234567890abcdef12345 ") + testcommon("%#027x", big, "0x00001234567890abcdef12345") + testcommon("%#.23x", big, "0x001234567890abcdef12345") testcommon("%#.23x", -big, "-0x001234567890abcdef12345") + testcommon("%#27.23x", big, " 0x001234567890abcdef12345") + testcommon("%#-27.23x", big, "0x001234567890abcdef12345 ") + testcommon("%#027.23x", big, "0x00001234567890abcdef12345") testcommon("%#+.23x", big, "+0x001234567890abcdef12345") testcommon("%# .23x", big, " 0x001234567890abcdef12345") testcommon("%#+.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+26.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+27.23X", big, "+0X001234567890ABCDEF12345 ") - testcommon("%#+27.23X", big, " +0X001234567890ABCDEF12345") # next one gets two leading zeroes from precision, and another from the # 0 flag and the width testcommon("%#+027.23X", big, "+0X0001234567890ABCDEF12345") + testcommon("%# 027.23X", big, " 0X0001234567890ABCDEF12345") # same, except no 0 flag testcommon("%#+27.23X", big, " +0X001234567890ABCDEF12345") + testcommon("%#-+27.23x", big, "+0x001234567890abcdef12345 ") + testcommon("%#- 27.23x", big, " 0x001234567890abcdef12345 ") + big = 0o12345670123456701234567012345670 # 32 octal digits testcommon("%o", big, "12345670123456701234567012345670") testcommon("%o", -big, "-12345670123456701234567012345670") @@ -191,13 +200,21 @@ testcommon("%o", big, "12345670123456701234567012345670") testcommon("%#o", big, "0o12345670123456701234567012345670") testcommon("%#o", -big, "-0o12345670123456701234567012345670") + testcommon("%#38o", big, " 0o12345670123456701234567012345670") + testcommon("%#-38o", big, "0o12345670123456701234567012345670 ") + testcommon("%#038o", big, "0o000012345670123456701234567012345670") + testcommon("%#.34o", big, "0o0012345670123456701234567012345670") testcommon("%#.34o", -big, "-0o0012345670123456701234567012345670") + testcommon("%#38.34o", big, " 0o0012345670123456701234567012345670") + testcommon("%#-38.34o", big, "0o0012345670123456701234567012345670 ") + testcommon("%#038.34o", big, "0o000012345670123456701234567012345670") testcommon("%#+.34o", big, "+0o0012345670123456701234567012345670") testcommon("%# .34o", big, " 0o0012345670123456701234567012345670") - testcommon("%#+.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#-+.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#-+37.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#+37.34o", big, "+0o0012345670123456701234567012345670") + testcommon("%#+38.34o", big, " +0o0012345670123456701234567012345670") + testcommon("%#-+38.34o", big, "+0o0012345670123456701234567012345670 ") + testcommon("%#- 38.34o", big, " 0o0012345670123456701234567012345670 ") + testcommon("%#+038.34o", big, "+0o00012345670123456701234567012345670") + testcommon("%# 038.34o", big, " 0o00012345670123456701234567012345670") # next one gets one leading zero from precision testcommon("%.33o", big, "012345670123456701234567012345670") # base marker added in spite of leading zero (different to Python 2) @@ -208,6 +225,7 @@ testcommon("%035.33o", big, "00012345670123456701234567012345670") # base marker shouldn't change the size testcommon("%0#35.33o", big, "0o012345670123456701234567012345670") + # Some small ints, in both Python int and flavors). testcommon("%d", 42, "42") testcommon("%d", -42, "-42") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate + form. + - Issue #18896: Python function can now have more than 255 parameters. collections.namedtuple() now supports tuples with more than 255 elements. diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -974,7 +974,7 @@ /* Write the numeric prefix for "x", "X" and "o" formats if the alternate form is used. For example, write "0x" for the "%#x" format. */ - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); if (fill != ' ') { @@ -999,8 +999,7 @@ if (fill == ' ') { if (sign) *res++ = sign; - if ((flags & F_ALT) && - (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); *res++ = *pbuf++; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:16:45 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 17 Dec 2016 20:16:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329000=3A_Fixed_bytes_formatting_of_octals_with_zero_p?= =?utf-8?q?adding_in_alternate?= Message-ID: <20161217201645.6823.86989.D0BB2874@psf.io> https://hg.python.org/cpython/rev/29c9c414c310 changeset: 105709:29c9c414c310 branch: 3.6 parent: 105702:21c6cd71bd9c parent: 105708:96d728c14267 user: Serhiy Storchaka date: Sat Dec 17 22:13:05 2016 +0200 summary: Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. files: Lib/test/test_format.py | 34 ++++++++++++++++++++++------ Misc/NEWS | 3 ++ Objects/bytesobject.c | 5 +-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -114,6 +114,7 @@ testcommon("%o", 100000000000, "1351035564000") testcommon("%d", 10, "10") testcommon("%d", 100000000000, "100000000000") + big = 123456789012345678901234567890 testcommon("%d", big, "123456789012345678901234567890") testcommon("%d", -big, "-123456789012345678901234567890") @@ -133,6 +134,7 @@ testcommon("%.31d", big, "0123456789012345678901234567890") testcommon("%32.31d", big, " 0123456789012345678901234567890") testcommon("%d", float(big), "123456________________________", 6) + big = 0x1234567890abcdef12345 # 21 hex digits testcommon("%x", big, "1234567890abcdef12345") testcommon("%x", -big, "-1234567890abcdef12345") @@ -156,19 +158,26 @@ testcommon("%#X", big, "0X1234567890ABCDEF12345") testcommon("%#x", big, "0x1234567890abcdef12345") testcommon("%#x", -big, "-0x1234567890abcdef12345") + testcommon("%#27x", big, " 0x1234567890abcdef12345") + testcommon("%#-27x", big, "0x1234567890abcdef12345 ") + testcommon("%#027x", big, "0x00001234567890abcdef12345") + testcommon("%#.23x", big, "0x001234567890abcdef12345") testcommon("%#.23x", -big, "-0x001234567890abcdef12345") + testcommon("%#27.23x", big, " 0x001234567890abcdef12345") + testcommon("%#-27.23x", big, "0x001234567890abcdef12345 ") + testcommon("%#027.23x", big, "0x00001234567890abcdef12345") testcommon("%#+.23x", big, "+0x001234567890abcdef12345") testcommon("%# .23x", big, " 0x001234567890abcdef12345") testcommon("%#+.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+26.23X", big, "+0X001234567890ABCDEF12345") - testcommon("%#-+27.23X", big, "+0X001234567890ABCDEF12345 ") - testcommon("%#+27.23X", big, " +0X001234567890ABCDEF12345") # next one gets two leading zeroes from precision, and another from the # 0 flag and the width testcommon("%#+027.23X", big, "+0X0001234567890ABCDEF12345") + testcommon("%# 027.23X", big, " 0X0001234567890ABCDEF12345") # same, except no 0 flag testcommon("%#+27.23X", big, " +0X001234567890ABCDEF12345") + testcommon("%#-+27.23x", big, "+0x001234567890abcdef12345 ") + testcommon("%#- 27.23x", big, " 0x001234567890abcdef12345 ") + big = 0o12345670123456701234567012345670 # 32 octal digits testcommon("%o", big, "12345670123456701234567012345670") testcommon("%o", -big, "-12345670123456701234567012345670") @@ -191,13 +200,21 @@ testcommon("%o", big, "12345670123456701234567012345670") testcommon("%#o", big, "0o12345670123456701234567012345670") testcommon("%#o", -big, "-0o12345670123456701234567012345670") + testcommon("%#38o", big, " 0o12345670123456701234567012345670") + testcommon("%#-38o", big, "0o12345670123456701234567012345670 ") + testcommon("%#038o", big, "0o000012345670123456701234567012345670") + testcommon("%#.34o", big, "0o0012345670123456701234567012345670") testcommon("%#.34o", -big, "-0o0012345670123456701234567012345670") + testcommon("%#38.34o", big, " 0o0012345670123456701234567012345670") + testcommon("%#-38.34o", big, "0o0012345670123456701234567012345670 ") + testcommon("%#038.34o", big, "0o000012345670123456701234567012345670") testcommon("%#+.34o", big, "+0o0012345670123456701234567012345670") testcommon("%# .34o", big, " 0o0012345670123456701234567012345670") - testcommon("%#+.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#-+.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#-+37.34o", big, "+0o0012345670123456701234567012345670") - testcommon("%#+37.34o", big, "+0o0012345670123456701234567012345670") + testcommon("%#+38.34o", big, " +0o0012345670123456701234567012345670") + testcommon("%#-+38.34o", big, "+0o0012345670123456701234567012345670 ") + testcommon("%#- 38.34o", big, " 0o0012345670123456701234567012345670 ") + testcommon("%#+038.34o", big, "+0o00012345670123456701234567012345670") + testcommon("%# 038.34o", big, " 0o00012345670123456701234567012345670") # next one gets one leading zero from precision testcommon("%.33o", big, "012345670123456701234567012345670") # base marker added in spite of leading zero (different to Python 2) @@ -208,6 +225,7 @@ testcommon("%035.33o", big, "00012345670123456701234567012345670") # base marker shouldn't change the size testcommon("%0#35.33o", big, "0o012345670123456701234567012345670") + # Some small ints, in both Python int and flavors). testcommon("%d", 42, "42") testcommon("%d", -42, "-42") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate + form. + - Issue #26919: On Android, operating system data is now always encoded/decoded to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -974,7 +974,7 @@ /* Write the numeric prefix for "x", "X" and "o" formats if the alternate form is used. For example, write "0x" for the "%#x" format. */ - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); if (fill != ' ') { @@ -999,8 +999,7 @@ if (fill == ' ') { if (sign) *res++ = sign; - if ((flags & F_ALT) && - (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); *res++ = *pbuf++; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:38:11 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 17 Dec 2016 20:38:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_for_porting_HOWTO_update?= Message-ID: <20161217203811.21768.46382.D9E8A036@psf.io> https://hg.python.org/cpython/rev/a8d15e133778 changeset: 105712:a8d15e133778 branch: 3.6 parent: 105709:29c9c414c310 parent: 105711:d95f19892fd0 user: Brett Cannon date: Sat Dec 17 12:37:41 2016 -0800 summary: Merge for porting HOWTO update files: Doc/howto/pyporting.rst | 110 +++++++++++++++------------ 1 files changed, 61 insertions(+), 49 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -17,7 +17,8 @@ please see :ref:`cporting-howto`. If you would like to read one core Python developer's take on why Python 3 - came into existence, you can read Nick Coghlan's `Python 3 Q & A`_. + came into existence, you can read Nick Coghlan's `Python 3 Q & A`_ or + Brett Cannon's `Why Python 3 exists`_. For help with porting, you can email the python-porting_ mailing list with questions. @@ -32,8 +33,7 @@ #. Make sure you have good test coverage (coverage.py_ can help; ``pip install coverage``) #. Learn the differences between Python 2 & 3 -#. Use Modernize_ or Futurize_ to update your code (``pip install modernize`` or - ``pip install future``, respectively) +#. Use Futurize_ (or Modernize_) to update your code (e.g. ``pip install future``) #. Use Pylint_ to help make sure you don't regress on your Python 3 support (``pip install pylint``) #. Use caniusepython3_ to find out which of your dependencies are blocking your @@ -41,10 +41,9 @@ #. Once your dependencies are no longer blocking you, use continuous integration to make sure you stay compatible with Python 2 & 3 (tox_ can help test against multiple versions of Python; ``pip install tox``) - -If you are dropping support for Python 2 entirely, then after you learn the -differences between Python 2 & 3 you can run 2to3_ over your code and skip the -rest of the steps outlined above. +#. Consider using optional static type checking to make sure your type usage + works in both Python 2 & 3 (e.g. use mypy_ to check your typing under both + Python 2 & Python 3). Details @@ -54,7 +53,7 @@ **today**! Even if your dependencies are not supporting Python 3 yet that does not mean you can't modernize your code **now** to support Python 3. Most changes required to support Python 3 lead to cleaner code using newer practices even in -Python 2. +Python 2 code. Another key point is that modernizing your Python 2 code to also support Python 3 is largely automated for you. While you might have to make some API @@ -82,12 +81,13 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -supported and thus is not receiving bugfixes. This means **you** will have to -work around any issues you come across with Python 2.6. There are also some +freely upported and thus is not receiving bugfixes. This means **you** will have +to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier for you if you only support the versions of Python that you have to support. + Make sure you specify the proper version support in your ``setup.py`` file -------------------------------------------------------------------------- @@ -98,6 +98,7 @@ also specify each major/minor version of Python that you do support, e.g. ``Programming Language :: Python :: 2.7``. + Have good test coverage ----------------------- @@ -106,10 +107,11 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get past 90%). If you +coverage (and don't feel bad if you can't easily get passed 90%). If you don't already have a tool to measure test coverage then coverage.py_ is recommended. + Learn the differences between Python 2 & 3 ------------------------------------------- @@ -127,13 +129,15 @@ Once you feel like you know what is different in Python 3 compared to Python 2, it's time to update your code! You have a choice between two tools in porting -your code automatically: Modernize_ and Futurize_. Which tool you choose will +your code automatically: Futurize_ and Modernize_. Which tool you choose will depend on how much like Python 3 you want your code to be. Futurize_ does its best to make Python 3 idioms and practices exist in Python 2, e.g. backporting the ``bytes`` type from Python 3 so that you have semantic parity between the major versions of Python. Modernize_, on the other hand, is more conservative and targets a Python 2/3 subset of -Python, relying on six_ to help provide compatibility. +Python, directly relying on six_ to help provide compatibility. As Python 3 is +the future, it might be best to consider Futurize to begin adjusting to any new +practices that Python 3 introduces which you are not accustomed to yet. Regardless of which tool you choose, they will update your code to run under Python 3 while staying compatible with the version of Python 2 you started with. @@ -153,6 +157,7 @@ though, there are only a couple of things to watch out for which can be considered large issues that may be hard to debug if not watched for. + Division ++++++++ @@ -173,6 +178,7 @@ code would begin to fail (e.g. a user-defined class that uses ``/`` to signify some operation but not ``//`` for the same thing or at all). + Text versus binary data +++++++++++++++++++++++ @@ -189,7 +195,7 @@ pronounced, Python 3 did what most languages created in the age of the internet have done and made text and binary data distinct types that cannot blindly be mixed together (Python predates widespread access to the internet). For any code -that only deals with text or only binary data, this separation doesn't pose an +that deals only with text or only binary data, this separation doesn't pose an issue. But for code that has to deal with both, it does mean you might have to now care about when you are using text compared to binary data, which is why this cannot be entirely automated. @@ -198,15 +204,15 @@ (it is **highly** recommended you don't design APIs that can take both due to the difficulty of keeping the code working; as stated earlier it is difficult to do well). In Python 2 this means making sure the APIs that take text can work -with ``unicode`` in Python 2 and those that work with binary data work with the -``bytes`` type from Python 3 and thus a subset of ``str`` in Python 2 (which the -``bytes`` type in Python 2 is an alias for). Usually the biggest issue is -realizing which methods exist for which types in Python 2 & 3 simultaneously +with ``unicode`` and those that work with binary data work with the +``bytes`` type from Python 3 (which is a subset of ``str`` in Python 2 and acts +as an alias for ``bytes`` type in Python 2). Usually the biggest issue is +realizing which methods exist on which types in Python 2 & 3 simultaneously (for text that's ``unicode`` in Python 2 and ``str`` in Python 3, for binary that's ``str``/``bytes`` in Python 2 and ``bytes`` in Python 3). The following table lists the **unique** methods of each data type across Python 2 & 3 (e.g., the ``decode()`` method is usable on the equivalent binary data type in -either Python 2 or 3, but it can't be used by the text data type consistently +either Python 2 or 3, but it can't be used by the textual data type consistently between Python 2 and 3 because ``str`` in Python 3 doesn't have the method). Do note that as of Python 3.5 the ``__mod__`` method was added to the bytes type. @@ -232,10 +238,11 @@ having to keep track of what type of data you are working with. The next issue is making sure you know whether the string literals in your code -represent text or binary data. At minimum you should add a ``b`` prefix to any -literal that presents binary data. For text you should either use the -``from __future__ import unicode_literals`` statement or add a ``u`` prefix to -the text literal. +represent text or binary data. You should add a ``b`` prefix to any +literal that presents binary data. For text you should add a ``u`` prefix to +the text literal. (there is a :mod:`__future__` import to force all unspecified +literals to be Unicode, but usage has shown it isn't as effective as adding a +``b`` or ``u`` prefix to all literals explicitly) As part of this dichotomy you also need to be careful about opening files. Unless you have been working on Windows, there is a chance you have not always @@ -243,11 +250,13 @@ binary reading). Under Python 3, binary files and text files are clearly distinct and mutually incompatible; see the :mod:`io` module for details. Therefore, you **must** make a decision of whether a file will be used for -binary access (allowing binary data to be read and/or written) or text access +binary access (allowing binary data to be read and/or written) or textual access (allowing text data to be read and/or written). You should also use :func:`io.open` for opening files instead of the built-in :func:`open` function as the :mod:`io` module is consistent from Python 2 to 3 while the built-in :func:`open` function -is not (in Python 3 it's actually :func:`io.open`). +is not (in Python 3 it's actually :func:`io.open`). Do not bother with the +outdated practice of using :func:`codecs.open` as that's only necessary for +keeping compatibility with Python 2.5. The constructors of both ``str`` and ``bytes`` have different semantics for the same arguments between Python 2 & 3. Passing an integer to ``bytes`` in Python 2 @@ -274,21 +283,22 @@ #. Make sure that your code that works with text also works with ``unicode`` and code for binary data works with ``bytes`` in Python 2 (see the table above for what methods you cannot use for each type) -#. Mark all binary literals with a ``b`` prefix, use a ``u`` prefix or - :mod:`__future__` import statement for text literals +#. Mark all binary literals with a ``b`` prefix, textual literals with a ``u`` + prefix #. Decode binary data to text as soon as possible, encode text as binary data as late as possible #. Open files using :func:`io.open` and make sure to specify the ``b`` mode when appropriate -#. Be careful when indexing binary data +#. Be careful when indexing into binary data Use feature detection instead of version detection ++++++++++++++++++++++++++++++++++++++++++++++++++ + Inevitably you will have code that has to choose what to do based on what version of Python is running. The best way to do this is with feature detection of whether the version of Python you're running under supports what you need. -If for some reason that doesn't work then you should make the version check is +If for some reason that doesn't work then you should make the version check be against Python 2 and not Python 3. To help explain this, let's look at an example. @@ -340,14 +350,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function - from __future__ import unicode_literals You can also run Python 2 with the ``-3`` flag to be warned about various compatibility issues your code triggers during execution. If you turn warnings into errors with ``-Werror`` then you can make sure that you don't accidentally miss a warning. - You can also use the Pylint_ project and its ``--py3k`` flag to lint your code to receive warnings when your code begins to deviate from Python 3 compatibility. This also prevents you from having to run Modernize_ or Futurize_ @@ -364,22 +372,23 @@ project was created to help you determine which projects -- directly or indirectly -- are blocking you from supporting Python 3. There is both a command-line tool as well as a web interface at -https://caniusepython3.com . +https://caniusepython3.com. The project also provides code which you can integrate into your test suite so that you will have a failing test when you no longer have dependencies blocking you from using Python 3. This allows you to avoid having to manually check your dependencies and to be notified quickly when you can start running on Python 3. + Update your ``setup.py`` file to denote Python 3 compatibility -------------------------------------------------------------- Once your code works under Python 3, you should update the classifiers in your ``setup.py`` to contain ``Programming Language :: Python :: 3`` and to not -specify sole Python 2 support. This will tell -anyone using your code that you support Python 2 **and** 3. Ideally you will -also want to add classifiers for each major/minor version of Python you now -support. +specify sole Python 2 support. This will tell anyone using your code that you +support Python 2 **and** 3. Ideally you will also want to add classifiers for +each major/minor version of Python you now support. + Use continuous integration to stay compatible --------------------------------------------- @@ -404,20 +413,17 @@ you typically run your tests under while developing. -Dropping Python 2 support completely -==================================== +Consider using optional static type checking +-------------------------------------------- -If you are able to fully drop support for Python 2, then the steps required -to transition to Python 3 simplify greatly. - -#. Update your code to only support Python 2.7 -#. Make sure you have good test coverage (coverage.py_ can help) -#. Learn the differences between Python 2 & 3 -#. Use 2to3_ to rewrite your code to run only under Python 3 - -After this your code will be fully Python 3 compliant but in a way that is not -supported by Python 2. You should also update the classifiers in your -``setup.py`` to contain ``Programming Language :: Python :: 3 :: Only``. +Another way to help port your code is to use a static type checker like +mypy_ or pytype_ on your code. These tools can be used to analyze your code as +if it's being run under Python 2, then you can run the tool a second time as if +your code is running under Python 3. By running a static type checker twice like +this you can discover if you're e.g. misusing binary data type in one version +of Python compared to another. If you add optional type hints to your code you +can also explicitly state whether your APIs use textual or binary data, helping +to make sure everything functions as expected in both versions of Python. .. _2to3: https://docs.python.org/3/library/2to3.html @@ -428,13 +434,19 @@ .. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib .. _importlib2: https://pypi.python.org/pypi/importlib2 .. _Modernize: https://python-modernize.readthedocs.org/en/latest/ +.. _mypy: http://mypy-lang.org/ .. _Porting to Python 3: http://python3porting.com/ .. _Pylint: https://pypi.python.org/pypi/pylint + .. _Python 3 Q & A: https://ncoghlan-devs-python-notes.readthedocs.org/en/latest/python3/questions_and_answers.html +.. _pytype: https://github.com/google/pytype .. _python-future: http://python-future.org/ .. _python-porting: https://mail.python.org/mailman/listinfo/python-porting .. _six: https://pypi.python.org/pypi/six .. _tox: https://pypi.python.org/pypi/tox .. _trove classifier: https://pypi.python.org/pypi?%3Aaction=list_classifiers + .. _"What's New": https://docs.python.org/3/whatsnew/index.html + +.. _Why Python 3 exists: http://www.snarky.ca/why-python-3-exists -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:38:11 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 17 Dec 2016 20:38:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Update_porting?= =?utf-8?q?_HOWTO_to_drop_unicode=5Fliterals_and_mention_static_type_check?= =?utf-8?q?ing?= Message-ID: <20161217203811.21630.68814.89E4C57A@psf.io> https://hg.python.org/cpython/rev/d95f19892fd0 changeset: 105711:d95f19892fd0 branch: 3.5 parent: 105708:96d728c14267 user: Brett Cannon date: Sat Dec 17 12:37:20 2016 -0800 summary: Update porting HOWTO to drop unicode_literals and mention static type checking files: Doc/howto/pyporting.rst | 110 +++++++++++++++------------ 1 files changed, 61 insertions(+), 49 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -17,7 +17,8 @@ please see :ref:`cporting-howto`. If you would like to read one core Python developer's take on why Python 3 - came into existence, you can read Nick Coghlan's `Python 3 Q & A`_. + came into existence, you can read Nick Coghlan's `Python 3 Q & A`_ or + Brett Cannon's `Why Python 3 exists`_. For help with porting, you can email the python-porting_ mailing list with questions. @@ -32,8 +33,7 @@ #. Make sure you have good test coverage (coverage.py_ can help; ``pip install coverage``) #. Learn the differences between Python 2 & 3 -#. Use Modernize_ or Futurize_ to update your code (``pip install modernize`` or - ``pip install future``, respectively) +#. Use Futurize_ (or Modernize_) to update your code (e.g. ``pip install future``) #. Use Pylint_ to help make sure you don't regress on your Python 3 support (``pip install pylint``) #. Use caniusepython3_ to find out which of your dependencies are blocking your @@ -41,10 +41,9 @@ #. Once your dependencies are no longer blocking you, use continuous integration to make sure you stay compatible with Python 2 & 3 (tox_ can help test against multiple versions of Python; ``pip install tox``) - -If you are dropping support for Python 2 entirely, then after you learn the -differences between Python 2 & 3 you can run 2to3_ over your code and skip the -rest of the steps outlined above. +#. Consider using optional static type checking to make sure your type usage + works in both Python 2 & 3 (e.g. use mypy_ to check your typing under both + Python 2 & Python 3). Details @@ -54,7 +53,7 @@ **today**! Even if your dependencies are not supporting Python 3 yet that does not mean you can't modernize your code **now** to support Python 3. Most changes required to support Python 3 lead to cleaner code using newer practices even in -Python 2. +Python 2 code. Another key point is that modernizing your Python 2 code to also support Python 3 is largely automated for you. While you might have to make some API @@ -82,12 +81,13 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -supported and thus is not receiving bugfixes. This means **you** will have to -work around any issues you come across with Python 2.6. There are also some +freely upported and thus is not receiving bugfixes. This means **you** will have +to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier for you if you only support the versions of Python that you have to support. + Make sure you specify the proper version support in your ``setup.py`` file -------------------------------------------------------------------------- @@ -98,6 +98,7 @@ also specify each major/minor version of Python that you do support, e.g. ``Programming Language :: Python :: 2.7``. + Have good test coverage ----------------------- @@ -106,10 +107,11 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get past 90%). If you +coverage (and don't feel bad if you can't easily get passed 90%). If you don't already have a tool to measure test coverage then coverage.py_ is recommended. + Learn the differences between Python 2 & 3 ------------------------------------------- @@ -127,13 +129,15 @@ Once you feel like you know what is different in Python 3 compared to Python 2, it's time to update your code! You have a choice between two tools in porting -your code automatically: Modernize_ and Futurize_. Which tool you choose will +your code automatically: Futurize_ and Modernize_. Which tool you choose will depend on how much like Python 3 you want your code to be. Futurize_ does its best to make Python 3 idioms and practices exist in Python 2, e.g. backporting the ``bytes`` type from Python 3 so that you have semantic parity between the major versions of Python. Modernize_, on the other hand, is more conservative and targets a Python 2/3 subset of -Python, relying on six_ to help provide compatibility. +Python, directly relying on six_ to help provide compatibility. As Python 3 is +the future, it might be best to consider Futurize to begin adjusting to any new +practices that Python 3 introduces which you are not accustomed to yet. Regardless of which tool you choose, they will update your code to run under Python 3 while staying compatible with the version of Python 2 you started with. @@ -153,6 +157,7 @@ though, there are only a couple of things to watch out for which can be considered large issues that may be hard to debug if not watched for. + Division ++++++++ @@ -173,6 +178,7 @@ code would begin to fail (e.g. a user-defined class that uses ``/`` to signify some operation but not ``//`` for the same thing or at all). + Text versus binary data +++++++++++++++++++++++ @@ -189,7 +195,7 @@ pronounced, Python 3 did what most languages created in the age of the internet have done and made text and binary data distinct types that cannot blindly be mixed together (Python predates widespread access to the internet). For any code -that only deals with text or only binary data, this separation doesn't pose an +that deals only with text or only binary data, this separation doesn't pose an issue. But for code that has to deal with both, it does mean you might have to now care about when you are using text compared to binary data, which is why this cannot be entirely automated. @@ -198,15 +204,15 @@ (it is **highly** recommended you don't design APIs that can take both due to the difficulty of keeping the code working; as stated earlier it is difficult to do well). In Python 2 this means making sure the APIs that take text can work -with ``unicode`` in Python 2 and those that work with binary data work with the -``bytes`` type from Python 3 and thus a subset of ``str`` in Python 2 (which the -``bytes`` type in Python 2 is an alias for). Usually the biggest issue is -realizing which methods exist for which types in Python 2 & 3 simultaneously +with ``unicode`` and those that work with binary data work with the +``bytes`` type from Python 3 (which is a subset of ``str`` in Python 2 and acts +as an alias for ``bytes`` type in Python 2). Usually the biggest issue is +realizing which methods exist on which types in Python 2 & 3 simultaneously (for text that's ``unicode`` in Python 2 and ``str`` in Python 3, for binary that's ``str``/``bytes`` in Python 2 and ``bytes`` in Python 3). The following table lists the **unique** methods of each data type across Python 2 & 3 (e.g., the ``decode()`` method is usable on the equivalent binary data type in -either Python 2 or 3, but it can't be used by the text data type consistently +either Python 2 or 3, but it can't be used by the textual data type consistently between Python 2 and 3 because ``str`` in Python 3 doesn't have the method). Do note that as of Python 3.5 the ``__mod__`` method was added to the bytes type. @@ -232,10 +238,11 @@ having to keep track of what type of data you are working with. The next issue is making sure you know whether the string literals in your code -represent text or binary data. At minimum you should add a ``b`` prefix to any -literal that presents binary data. For text you should either use the -``from __future__ import unicode_literals`` statement or add a ``u`` prefix to -the text literal. +represent text or binary data. You should add a ``b`` prefix to any +literal that presents binary data. For text you should add a ``u`` prefix to +the text literal. (there is a :mod:`__future__` import to force all unspecified +literals to be Unicode, but usage has shown it isn't as effective as adding a +``b`` or ``u`` prefix to all literals explicitly) As part of this dichotomy you also need to be careful about opening files. Unless you have been working on Windows, there is a chance you have not always @@ -243,11 +250,13 @@ binary reading). Under Python 3, binary files and text files are clearly distinct and mutually incompatible; see the :mod:`io` module for details. Therefore, you **must** make a decision of whether a file will be used for -binary access (allowing binary data to be read and/or written) or text access +binary access (allowing binary data to be read and/or written) or textual access (allowing text data to be read and/or written). You should also use :func:`io.open` for opening files instead of the built-in :func:`open` function as the :mod:`io` module is consistent from Python 2 to 3 while the built-in :func:`open` function -is not (in Python 3 it's actually :func:`io.open`). +is not (in Python 3 it's actually :func:`io.open`). Do not bother with the +outdated practice of using :func:`codecs.open` as that's only necessary for +keeping compatibility with Python 2.5. The constructors of both ``str`` and ``bytes`` have different semantics for the same arguments between Python 2 & 3. Passing an integer to ``bytes`` in Python 2 @@ -274,21 +283,22 @@ #. Make sure that your code that works with text also works with ``unicode`` and code for binary data works with ``bytes`` in Python 2 (see the table above for what methods you cannot use for each type) -#. Mark all binary literals with a ``b`` prefix, use a ``u`` prefix or - :mod:`__future__` import statement for text literals +#. Mark all binary literals with a ``b`` prefix, textual literals with a ``u`` + prefix #. Decode binary data to text as soon as possible, encode text as binary data as late as possible #. Open files using :func:`io.open` and make sure to specify the ``b`` mode when appropriate -#. Be careful when indexing binary data +#. Be careful when indexing into binary data Use feature detection instead of version detection ++++++++++++++++++++++++++++++++++++++++++++++++++ + Inevitably you will have code that has to choose what to do based on what version of Python is running. The best way to do this is with feature detection of whether the version of Python you're running under supports what you need. -If for some reason that doesn't work then you should make the version check is +If for some reason that doesn't work then you should make the version check be against Python 2 and not Python 3. To help explain this, let's look at an example. @@ -340,14 +350,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function - from __future__ import unicode_literals You can also run Python 2 with the ``-3`` flag to be warned about various compatibility issues your code triggers during execution. If you turn warnings into errors with ``-Werror`` then you can make sure that you don't accidentally miss a warning. - You can also use the Pylint_ project and its ``--py3k`` flag to lint your code to receive warnings when your code begins to deviate from Python 3 compatibility. This also prevents you from having to run Modernize_ or Futurize_ @@ -364,22 +372,23 @@ project was created to help you determine which projects -- directly or indirectly -- are blocking you from supporting Python 3. There is both a command-line tool as well as a web interface at -https://caniusepython3.com . +https://caniusepython3.com. The project also provides code which you can integrate into your test suite so that you will have a failing test when you no longer have dependencies blocking you from using Python 3. This allows you to avoid having to manually check your dependencies and to be notified quickly when you can start running on Python 3. + Update your ``setup.py`` file to denote Python 3 compatibility -------------------------------------------------------------- Once your code works under Python 3, you should update the classifiers in your ``setup.py`` to contain ``Programming Language :: Python :: 3`` and to not -specify sole Python 2 support. This will tell -anyone using your code that you support Python 2 **and** 3. Ideally you will -also want to add classifiers for each major/minor version of Python you now -support. +specify sole Python 2 support. This will tell anyone using your code that you +support Python 2 **and** 3. Ideally you will also want to add classifiers for +each major/minor version of Python you now support. + Use continuous integration to stay compatible --------------------------------------------- @@ -404,20 +413,17 @@ you typically run your tests under while developing. -Dropping Python 2 support completely -==================================== +Consider using optional static type checking +-------------------------------------------- -If you are able to fully drop support for Python 2, then the steps required -to transition to Python 3 simplify greatly. - -#. Update your code to only support Python 2.7 -#. Make sure you have good test coverage (coverage.py_ can help) -#. Learn the differences between Python 2 & 3 -#. Use 2to3_ to rewrite your code to run only under Python 3 - -After this your code will be fully Python 3 compliant but in a way that is not -supported by Python 2. You should also update the classifiers in your -``setup.py`` to contain ``Programming Language :: Python :: 3 :: Only``. +Another way to help port your code is to use a static type checker like +mypy_ or pytype_ on your code. These tools can be used to analyze your code as +if it's being run under Python 2, then you can run the tool a second time as if +your code is running under Python 3. By running a static type checker twice like +this you can discover if you're e.g. misusing binary data type in one version +of Python compared to another. If you add optional type hints to your code you +can also explicitly state whether your APIs use textual or binary data, helping +to make sure everything functions as expected in both versions of Python. .. _2to3: https://docs.python.org/3/library/2to3.html @@ -428,13 +434,19 @@ .. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib .. _importlib2: https://pypi.python.org/pypi/importlib2 .. _Modernize: https://python-modernize.readthedocs.org/en/latest/ +.. _mypy: http://mypy-lang.org/ .. _Porting to Python 3: http://python3porting.com/ .. _Pylint: https://pypi.python.org/pypi/pylint + .. _Python 3 Q & A: https://ncoghlan-devs-python-notes.readthedocs.org/en/latest/python3/questions_and_answers.html +.. _pytype: https://github.com/google/pytype .. _python-future: http://python-future.org/ .. _python-porting: https://mail.python.org/mailman/listinfo/python-porting .. _six: https://pypi.python.org/pypi/six .. _tox: https://pypi.python.org/pypi/tox .. _trove classifier: https://pypi.python.org/pypi?%3Aaction=list_classifiers + .. _"What's New": https://docs.python.org/3/whatsnew/index.html + +.. _Why Python 3 exists: http://www.snarky.ca/why-python-3-exists -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:38:11 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 17 Dec 2016 20:38:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_for_the_porting_HOWTO_update?= Message-ID: <20161217203811.22024.21880.F1E06A49@psf.io> https://hg.python.org/cpython/rev/d9e5ec7c6887 changeset: 105713:d9e5ec7c6887 parent: 105710:4e55e011dd80 parent: 105712:a8d15e133778 user: Brett Cannon date: Sat Dec 17 12:38:00 2016 -0800 summary: Merge for the porting HOWTO update files: Doc/howto/pyporting.rst | 110 +++++++++++++++------------ 1 files changed, 61 insertions(+), 49 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -17,7 +17,8 @@ please see :ref:`cporting-howto`. If you would like to read one core Python developer's take on why Python 3 - came into existence, you can read Nick Coghlan's `Python 3 Q & A`_. + came into existence, you can read Nick Coghlan's `Python 3 Q & A`_ or + Brett Cannon's `Why Python 3 exists`_. For help with porting, you can email the python-porting_ mailing list with questions. @@ -32,8 +33,7 @@ #. Make sure you have good test coverage (coverage.py_ can help; ``pip install coverage``) #. Learn the differences between Python 2 & 3 -#. Use Modernize_ or Futurize_ to update your code (``pip install modernize`` or - ``pip install future``, respectively) +#. Use Futurize_ (or Modernize_) to update your code (e.g. ``pip install future``) #. Use Pylint_ to help make sure you don't regress on your Python 3 support (``pip install pylint``) #. Use caniusepython3_ to find out which of your dependencies are blocking your @@ -41,10 +41,9 @@ #. Once your dependencies are no longer blocking you, use continuous integration to make sure you stay compatible with Python 2 & 3 (tox_ can help test against multiple versions of Python; ``pip install tox``) - -If you are dropping support for Python 2 entirely, then after you learn the -differences between Python 2 & 3 you can run 2to3_ over your code and skip the -rest of the steps outlined above. +#. Consider using optional static type checking to make sure your type usage + works in both Python 2 & 3 (e.g. use mypy_ to check your typing under both + Python 2 & Python 3). Details @@ -54,7 +53,7 @@ **today**! Even if your dependencies are not supporting Python 3 yet that does not mean you can't modernize your code **now** to support Python 3. Most changes required to support Python 3 lead to cleaner code using newer practices even in -Python 2. +Python 2 code. Another key point is that modernizing your Python 2 code to also support Python 3 is largely automated for you. While you might have to make some API @@ -82,12 +81,13 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -supported and thus is not receiving bugfixes. This means **you** will have to -work around any issues you come across with Python 2.6. There are also some +freely upported and thus is not receiving bugfixes. This means **you** will have +to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier for you if you only support the versions of Python that you have to support. + Make sure you specify the proper version support in your ``setup.py`` file -------------------------------------------------------------------------- @@ -98,6 +98,7 @@ also specify each major/minor version of Python that you do support, e.g. ``Programming Language :: Python :: 2.7``. + Have good test coverage ----------------------- @@ -106,10 +107,11 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get past 90%). If you +coverage (and don't feel bad if you can't easily get passed 90%). If you don't already have a tool to measure test coverage then coverage.py_ is recommended. + Learn the differences between Python 2 & 3 ------------------------------------------- @@ -127,13 +129,15 @@ Once you feel like you know what is different in Python 3 compared to Python 2, it's time to update your code! You have a choice between two tools in porting -your code automatically: Modernize_ and Futurize_. Which tool you choose will +your code automatically: Futurize_ and Modernize_. Which tool you choose will depend on how much like Python 3 you want your code to be. Futurize_ does its best to make Python 3 idioms and practices exist in Python 2, e.g. backporting the ``bytes`` type from Python 3 so that you have semantic parity between the major versions of Python. Modernize_, on the other hand, is more conservative and targets a Python 2/3 subset of -Python, relying on six_ to help provide compatibility. +Python, directly relying on six_ to help provide compatibility. As Python 3 is +the future, it might be best to consider Futurize to begin adjusting to any new +practices that Python 3 introduces which you are not accustomed to yet. Regardless of which tool you choose, they will update your code to run under Python 3 while staying compatible with the version of Python 2 you started with. @@ -153,6 +157,7 @@ though, there are only a couple of things to watch out for which can be considered large issues that may be hard to debug if not watched for. + Division ++++++++ @@ -173,6 +178,7 @@ code would begin to fail (e.g. a user-defined class that uses ``/`` to signify some operation but not ``//`` for the same thing or at all). + Text versus binary data +++++++++++++++++++++++ @@ -189,7 +195,7 @@ pronounced, Python 3 did what most languages created in the age of the internet have done and made text and binary data distinct types that cannot blindly be mixed together (Python predates widespread access to the internet). For any code -that only deals with text or only binary data, this separation doesn't pose an +that deals only with text or only binary data, this separation doesn't pose an issue. But for code that has to deal with both, it does mean you might have to now care about when you are using text compared to binary data, which is why this cannot be entirely automated. @@ -198,15 +204,15 @@ (it is **highly** recommended you don't design APIs that can take both due to the difficulty of keeping the code working; as stated earlier it is difficult to do well). In Python 2 this means making sure the APIs that take text can work -with ``unicode`` in Python 2 and those that work with binary data work with the -``bytes`` type from Python 3 and thus a subset of ``str`` in Python 2 (which the -``bytes`` type in Python 2 is an alias for). Usually the biggest issue is -realizing which methods exist for which types in Python 2 & 3 simultaneously +with ``unicode`` and those that work with binary data work with the +``bytes`` type from Python 3 (which is a subset of ``str`` in Python 2 and acts +as an alias for ``bytes`` type in Python 2). Usually the biggest issue is +realizing which methods exist on which types in Python 2 & 3 simultaneously (for text that's ``unicode`` in Python 2 and ``str`` in Python 3, for binary that's ``str``/``bytes`` in Python 2 and ``bytes`` in Python 3). The following table lists the **unique** methods of each data type across Python 2 & 3 (e.g., the ``decode()`` method is usable on the equivalent binary data type in -either Python 2 or 3, but it can't be used by the text data type consistently +either Python 2 or 3, but it can't be used by the textual data type consistently between Python 2 and 3 because ``str`` in Python 3 doesn't have the method). Do note that as of Python 3.5 the ``__mod__`` method was added to the bytes type. @@ -232,10 +238,11 @@ having to keep track of what type of data you are working with. The next issue is making sure you know whether the string literals in your code -represent text or binary data. At minimum you should add a ``b`` prefix to any -literal that presents binary data. For text you should either use the -``from __future__ import unicode_literals`` statement or add a ``u`` prefix to -the text literal. +represent text or binary data. You should add a ``b`` prefix to any +literal that presents binary data. For text you should add a ``u`` prefix to +the text literal. (there is a :mod:`__future__` import to force all unspecified +literals to be Unicode, but usage has shown it isn't as effective as adding a +``b`` or ``u`` prefix to all literals explicitly) As part of this dichotomy you also need to be careful about opening files. Unless you have been working on Windows, there is a chance you have not always @@ -243,11 +250,13 @@ binary reading). Under Python 3, binary files and text files are clearly distinct and mutually incompatible; see the :mod:`io` module for details. Therefore, you **must** make a decision of whether a file will be used for -binary access (allowing binary data to be read and/or written) or text access +binary access (allowing binary data to be read and/or written) or textual access (allowing text data to be read and/or written). You should also use :func:`io.open` for opening files instead of the built-in :func:`open` function as the :mod:`io` module is consistent from Python 2 to 3 while the built-in :func:`open` function -is not (in Python 3 it's actually :func:`io.open`). +is not (in Python 3 it's actually :func:`io.open`). Do not bother with the +outdated practice of using :func:`codecs.open` as that's only necessary for +keeping compatibility with Python 2.5. The constructors of both ``str`` and ``bytes`` have different semantics for the same arguments between Python 2 & 3. Passing an integer to ``bytes`` in Python 2 @@ -274,21 +283,22 @@ #. Make sure that your code that works with text also works with ``unicode`` and code for binary data works with ``bytes`` in Python 2 (see the table above for what methods you cannot use for each type) -#. Mark all binary literals with a ``b`` prefix, use a ``u`` prefix or - :mod:`__future__` import statement for text literals +#. Mark all binary literals with a ``b`` prefix, textual literals with a ``u`` + prefix #. Decode binary data to text as soon as possible, encode text as binary data as late as possible #. Open files using :func:`io.open` and make sure to specify the ``b`` mode when appropriate -#. Be careful when indexing binary data +#. Be careful when indexing into binary data Use feature detection instead of version detection ++++++++++++++++++++++++++++++++++++++++++++++++++ + Inevitably you will have code that has to choose what to do based on what version of Python is running. The best way to do this is with feature detection of whether the version of Python you're running under supports what you need. -If for some reason that doesn't work then you should make the version check is +If for some reason that doesn't work then you should make the version check be against Python 2 and not Python 3. To help explain this, let's look at an example. @@ -340,14 +350,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function - from __future__ import unicode_literals You can also run Python 2 with the ``-3`` flag to be warned about various compatibility issues your code triggers during execution. If you turn warnings into errors with ``-Werror`` then you can make sure that you don't accidentally miss a warning. - You can also use the Pylint_ project and its ``--py3k`` flag to lint your code to receive warnings when your code begins to deviate from Python 3 compatibility. This also prevents you from having to run Modernize_ or Futurize_ @@ -364,22 +372,23 @@ project was created to help you determine which projects -- directly or indirectly -- are blocking you from supporting Python 3. There is both a command-line tool as well as a web interface at -https://caniusepython3.com . +https://caniusepython3.com. The project also provides code which you can integrate into your test suite so that you will have a failing test when you no longer have dependencies blocking you from using Python 3. This allows you to avoid having to manually check your dependencies and to be notified quickly when you can start running on Python 3. + Update your ``setup.py`` file to denote Python 3 compatibility -------------------------------------------------------------- Once your code works under Python 3, you should update the classifiers in your ``setup.py`` to contain ``Programming Language :: Python :: 3`` and to not -specify sole Python 2 support. This will tell -anyone using your code that you support Python 2 **and** 3. Ideally you will -also want to add classifiers for each major/minor version of Python you now -support. +specify sole Python 2 support. This will tell anyone using your code that you +support Python 2 **and** 3. Ideally you will also want to add classifiers for +each major/minor version of Python you now support. + Use continuous integration to stay compatible --------------------------------------------- @@ -404,20 +413,17 @@ you typically run your tests under while developing. -Dropping Python 2 support completely -==================================== +Consider using optional static type checking +-------------------------------------------- -If you are able to fully drop support for Python 2, then the steps required -to transition to Python 3 simplify greatly. - -#. Update your code to only support Python 2.7 -#. Make sure you have good test coverage (coverage.py_ can help) -#. Learn the differences between Python 2 & 3 -#. Use 2to3_ to rewrite your code to run only under Python 3 - -After this your code will be fully Python 3 compliant but in a way that is not -supported by Python 2. You should also update the classifiers in your -``setup.py`` to contain ``Programming Language :: Python :: 3 :: Only``. +Another way to help port your code is to use a static type checker like +mypy_ or pytype_ on your code. These tools can be used to analyze your code as +if it's being run under Python 2, then you can run the tool a second time as if +your code is running under Python 3. By running a static type checker twice like +this you can discover if you're e.g. misusing binary data type in one version +of Python compared to another. If you add optional type hints to your code you +can also explicitly state whether your APIs use textual or binary data, helping +to make sure everything functions as expected in both versions of Python. .. _2to3: https://docs.python.org/3/library/2to3.html @@ -428,13 +434,19 @@ .. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib .. _importlib2: https://pypi.python.org/pypi/importlib2 .. _Modernize: https://python-modernize.readthedocs.org/en/latest/ +.. _mypy: http://mypy-lang.org/ .. _Porting to Python 3: http://python3porting.com/ .. _Pylint: https://pypi.python.org/pypi/pylint + .. _Python 3 Q & A: https://ncoghlan-devs-python-notes.readthedocs.org/en/latest/python3/questions_and_answers.html +.. _pytype: https://github.com/google/pytype .. _python-future: http://python-future.org/ .. _python-porting: https://mail.python.org/mailman/listinfo/python-porting .. _six: https://pypi.python.org/pypi/six .. _tox: https://pypi.python.org/pypi/tox .. _trove classifier: https://pypi.python.org/pypi?%3Aaction=list_classifiers + .. _"What's New": https://docs.python.org/3/whatsnew/index.html + +.. _Why Python 3 exists: http://www.snarky.ca/why-python-3-exists -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:39:45 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 17 Dec 2016 20:39:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_Merge?= Message-ID: <20161217203945.95989.17449.10084273@psf.io> https://hg.python.org/cpython/rev/88c21db793cb changeset: 105715:88c21db793cb branch: 2.7 parent: 105714:287d4290b1b4 parent: 105707:6daa88e02392 user: Brett Cannon date: Sat Dec 17 12:39:36 2016 -0800 summary: Merge files: .hgtags | 1 + Misc/NEWS | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 d33e0cf91556723fb8cebefdad1f3bce43b2244d v2.7.12 4d6fd49eeb14bb47f700325eb90d7989fc9e4020 v2.7.13rc1 +a06454b1afa167fbcd8626e4abc144ce15461067 v2.7.13 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -20,7 +20,7 @@ What's New in Python 2.7.13 =========================== -*Release date: 2016-12-XX* +*Release date: 2016-12-17* Core and Builtins ----------------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 15:39:45 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 17 Dec 2016 20:39:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_the_por?= =?utf-8?q?ting_HOWTO?= Message-ID: <20161217203945.96211.5793.A4C06B56@psf.io> https://hg.python.org/cpython/rev/287d4290b1b4 changeset: 105714:287d4290b1b4 branch: 2.7 parent: 105677:eb02db65e148 user: Brett Cannon date: Sat Dec 17 12:38:54 2016 -0800 summary: Update the porting HOWTO files: Doc/howto/pyporting.rst | 196 ++++++++++++++++++--------- 1 files changed, 128 insertions(+), 68 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -17,7 +17,8 @@ please see :ref:`cporting-howto`. If you would like to read one core Python developer's take on why Python 3 - came into existence, you can read Nick Coghlan's `Python 3 Q & A`_. + came into existence, you can read Nick Coghlan's `Python 3 Q & A`_ or + Brett Cannon's `Why Python 3 exists`_. For help with porting, you can email the python-porting_ mailing list with questions. @@ -28,24 +29,21 @@ To make your project be single-source Python 2/3 compatible, the basic steps are: -#. Update your code to drop support for Python 2.5 or older (supporting only - Python 2.7 is ideal) +#. Only worry about supporting Python 2.7 #. Make sure you have good test coverage (coverage.py_ can help; ``pip install coverage``) #. Learn the differences between Python 2 & 3 -#. Use Modernize_ or Futurize_ to update your code (``pip install modernize`` or - ``pip install future``, respectively) +#. Use Futurize_ (or Modernize_) to update your code (e.g. ``pip install future``) #. Use Pylint_ to help make sure you don't regress on your Python 3 support - (if only supporting Python 2.7/3.4 or newer; ``pip install pylint``) + (``pip install pylint``) #. Use caniusepython3_ to find out which of your dependencies are blocking your use of Python 3 (``pip install caniusepython3``) #. Once your dependencies are no longer blocking you, use continuous integration to make sure you stay compatible with Python 2 & 3 (tox_ can help test against multiple versions of Python; ``pip install tox``) - -If you are dropping support for Python 2 entirely, then after you learn the -differences between Python 2 & 3 you can run 2to3_ over your code and skip the -rest of the steps outlined above. +#. Consider using optional static type checking to make sure your type usage + works in both Python 2 & 3 (e.g. use mypy_ to check your typing under both + Python 2 & Python 3). Details @@ -55,7 +53,7 @@ **today**! Even if your dependencies are not supporting Python 3 yet that does not mean you can't modernize your code **now** to support Python 3. Most changes required to support Python 3 lead to cleaner code using newer practices even in -Python 2. +Python 2 code. Another key point is that modernizing your Python 2 code to also support Python 3 is largely automated for you. While you might have to make some API @@ -67,26 +65,28 @@ your code to support Python 2 & 3 simultaneously. -Drop support for Python 2.5 and older (at least) ------------------------------------------------- +Drop support for Python 2.6 and older +------------------------------------- While you can make Python 2.5 work with Python 3, it is **much** easier if you -only have to work with Python 2.6 or newer (and easier still if you only have -to work with Python 2.7). If dropping Python 2.5 is not an option then the six_ -project can help you support Python 2.5 & 3 simultaneously +only have to work with Python 2.7. If dropping Python 2.5 is not an +option then the six_ project can help you support Python 2.5 & 3 simultaneously (``pip install six``). Do realize, though, that nearly all the projects listed in this HOWTO will not be available to you. -If you are able to only support Python 2.6 or newer, then the required changes +If you are able to skip Python 2.5 and older, then the required changes to your code should continue to look and feel like idiomatic Python code. At worst you will have to use a function instead of a method in some instances or have to import a function instead of using a built-in one, but otherwise the overall transformation should not feel foreign to you. -But please aim for Python 2.7. Bugfixes for that version of Python will continue -until 2020 while Python 2.6 is no longer supported. There are also some tools -mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and -this will become more commonplace as time goes on. +But you should aim for only supporting Python 2.7. Python 2.6 is no longer +freely upported and thus is not receiving bugfixes. This means **you** will have +to work around any issues you come across with Python 2.6. There are also some +tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), +and this will become more commonplace as time goes on. It will simply be easier +for you if you only support the versions of Python that you have to support. + Make sure you specify the proper version support in your ``setup.py`` file -------------------------------------------------------------------------- @@ -98,6 +98,7 @@ also specify each major/minor version of Python that you do support, e.g. ``Programming Language :: Python :: 2.7``. + Have good test coverage ----------------------- @@ -106,10 +107,11 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get past 90%). If you +coverage (and don't feel bad if you can't easily get passed 90%). If you don't already have a tool to measure test coverage then coverage.py_ is recommended. + Learn the differences between Python 2 & 3 ------------------------------------------- @@ -127,13 +129,15 @@ Once you feel like you know what is different in Python 3 compared to Python 2, it's time to update your code! You have a choice between two tools in porting -your code automatically: Modernize_ and Futurize_. Which tool you choose will +your code automatically: Futurize_ and Modernize_. Which tool you choose will depend on how much like Python 3 you want your code to be. Futurize_ does its best to make Python 3 idioms and practices exist in Python 2, e.g. backporting the ``bytes`` type from Python 3 so that you have semantic parity between the major versions of Python. Modernize_, on the other hand, is more conservative and targets a Python 2/3 subset of -Python, relying on six_ to help provide compatibility. +Python, directly relying on six_ to help provide compatibility. As Python 3 is +the future, it might be best to consider Futurize to begin adjusting to any new +practices that Python 3 introduces which you are not accustomed to yet. Regardless of which tool you choose, they will update your code to run under Python 3 while staying compatible with the version of Python 2 you started with. @@ -153,6 +157,7 @@ though, there are only a couple of things to watch out for which can be considered large issues that may be hard to debug if not watched for. + Division ++++++++ @@ -169,8 +174,10 @@ division or continue using ``/`` and expect a float The reason that ``/`` isn't simply translated to ``//`` automatically is that if -an object defines its own ``__div__`` method but not ``__floordiv__`` then your -code would begin to fail. +an object defines a ``__truediv__`` method but not ``__floordiv__`` then your +code would begin to fail (e.g. a user-defined class that uses ``/`` to +signify some operation but not ``//`` for the same thing or at all). + Text versus binary data +++++++++++++++++++++++ @@ -188,7 +195,7 @@ pronounced, Python 3 did what most languages created in the age of the internet have done and made text and binary data distinct types that cannot blindly be mixed together (Python predates widespread access to the internet). For any code -that only deals with text or only binary data, this separation doesn't pose an +that deals only with text or only binary data, this separation doesn't pose an issue. But for code that has to deal with both, it does mean you might have to now care about when you are using text compared to binary data, which is why this cannot be entirely automated. @@ -197,22 +204,21 @@ (it is **highly** recommended you don't design APIs that can take both due to the difficulty of keeping the code working; as stated earlier it is difficult to do well). In Python 2 this means making sure the APIs that take text can work -with ``unicode`` in Python 2 and those that work with binary data work with the -``bytes`` type from Python 3 and thus a subset of ``str`` in Python 2 (which the -``bytes`` type in Python 2 is an alias for). Usually the biggest issue is -realizing which methods exist for which types in Python 2 & 3 simultaneously +with ``unicode`` and those that work with binary data work with the +``bytes`` type from Python 3 (which is a subset of ``str`` in Python 2 and acts +as an alias for ``bytes`` type in Python 2). Usually the biggest issue is +realizing which methods exist on which types in Python 2 & 3 simultaneously (for text that's ``unicode`` in Python 2 and ``str`` in Python 3, for binary that's ``str``/``bytes`` in Python 2 and ``bytes`` in Python 3). The following table lists the **unique** methods of each data type across Python 2 & 3 (e.g., the ``decode()`` method is usable on the equivalent binary data type in -either Python 2 or 3, but it can't be used by the text data type consistently -between Python 2 and 3 because ``str`` in Python 3 doesn't have the method). +either Python 2 or 3, but it can't be used by the textual data type consistently +between Python 2 and 3 because ``str`` in Python 3 doesn't have the method). Do +note that as of Python 3.5 the ``__mod__`` method was added to the bytes type. ======================== ===================== **Text data** **Binary data** ------------------------ --------------------- -__mod__ (``%`` operator) ------------------------- --------------------- \ decode ------------------------ --------------------- encode @@ -232,10 +238,11 @@ having to keep track of what type of data you are working with. The next issue is making sure you know whether the string literals in your code -represent text or binary data. At minimum you should add a ``b`` prefix to any -literal that presents binary data. For text you should either use the -``from __future__ import unicode_literals`` statement or add a ``u`` prefix to -the text literal. +represent text or binary data. You should add a ``b`` prefix to any +literal that presents binary data. For text you should add a ``u`` prefix to +the text literal. (there is a :mod:`__future__` import to force all unspecified +literals to be Unicode, but usage has shown it isn't as effective as adding a +``b`` or ``u`` prefix to all literals explicitly) As part of this dichotomy you also need to be careful about opening files. Unless you have been working on Windows, there is a chance you have not always @@ -243,11 +250,13 @@ binary reading). Under Python 3, binary files and text files are clearly distinct and mutually incompatible; see the :mod:`io` module for details. Therefore, you **must** make a decision of whether a file will be used for -binary access (allowing binary data to be read and/or written) or text access +binary access (allowing binary data to be read and/or written) or textual access (allowing text data to be read and/or written). You should also use :func:`io.open` for opening files instead of the built-in :func:`open` function as the :mod:`io` module is consistent from Python 2 to 3 while the built-in :func:`open` function -is not (in Python 3 it's actually :func:`io.open`). +is not (in Python 3 it's actually :func:`io.open`). Do not bother with the +outdated practice of using :func:`codecs.open` as that's only necessary for +keeping compatibility with Python 2.5. The constructors of both ``str`` and ``bytes`` have different semantics for the same arguments between Python 2 & 3. Passing an integer to ``bytes`` in Python 2 @@ -274,13 +283,58 @@ #. Make sure that your code that works with text also works with ``unicode`` and code for binary data works with ``bytes`` in Python 2 (see the table above for what methods you cannot use for each type) -#. Mark all binary literals with a ``b`` prefix, use a ``u`` prefix or - :mod:`__future__` import statement for text literals +#. Mark all binary literals with a ``b`` prefix, textual literals with a ``u`` + prefix #. Decode binary data to text as soon as possible, encode text as binary data as late as possible #. Open files using :func:`io.open` and make sure to specify the ``b`` mode when appropriate -#. Be careful when indexing binary data +#. Be careful when indexing into binary data + + +Use feature detection instead of version detection +++++++++++++++++++++++++++++++++++++++++++++++++++ + +Inevitably you will have code that has to choose what to do based on what +version of Python is running. The best way to do this is with feature detection +of whether the version of Python you're running under supports what you need. +If for some reason that doesn't work then you should make the version check be +against Python 2 and not Python 3. To help explain this, let's look at an +example. + +Let's pretend that you need access to a feature of importlib_ that +is available in Python's standard library since Python 3.3 and available for +Python 2 through importlib2_ on PyPI. You might be tempted to write code to +access e.g. the ``importlib.abc`` module by doing the following:: + + import sys + + if sys.version_info[0] == 3: + from importlib import abc + else: + from importlib2 import abc + +The problem with this code is what happens when Python 4 comes out? It would +be better to treat Python 2 as the exceptional case instead of Python 3 and +assume that future Python versions will be more compatible with Python 3 than +Python 2:: + + import sys + + if sys.version_info[0] > 2: + from importlib import abc + else: + from importlib2 import abc + +The best solution, though, is to do no version detection at all and instead rely +on feature detection. That avoids any potential issues of getting the version +detection wrong and helps keep you future-compatible:: + + try: + from importlib import abc + except ImportError: + from importlib2 import abc + Prevent compatibility regressions --------------------------------- @@ -296,14 +350,12 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function - from __future__ import unicode_literals You can also run Python 2 with the ``-3`` flag to be warned about various compatibility issues your code triggers during execution. If you turn warnings into errors with ``-Werror`` then you can make sure that you don't accidentally miss a warning. - You can also use the Pylint_ project and its ``--py3k`` flag to lint your code to receive warnings when your code begins to deviate from Python 3 compatibility. This also prevents you from having to run Modernize_ or Futurize_ @@ -320,22 +372,23 @@ project was created to help you determine which projects -- directly or indirectly -- are blocking you from supporting Python 3. There is both a command-line tool as well as a web interface at -https://caniusepython3.com . +https://caniusepython3.com. The project also provides code which you can integrate into your test suite so that you will have a failing test when you no longer have dependencies blocking you from using Python 3. This allows you to avoid having to manually check your dependencies and to be notified quickly when you can start running on Python 3. + Update your ``setup.py`` file to denote Python 3 compatibility -------------------------------------------------------------- Once your code works under Python 3, you should update the classifiers in your ``setup.py`` to contain ``Programming Language :: Python :: 3`` and to not -specify sole Python 2 support. This will tell -anyone using your code that you support Python 2 **and** 3. Ideally you will -also want to add classifiers for each major/minor version of Python you now -support. +specify sole Python 2 support. This will tell anyone using your code that you +support Python 2 **and** 3. Ideally you will also want to add classifiers for +each major/minor version of Python you now support. + Use continuous integration to stay compatible --------------------------------------------- @@ -347,10 +400,12 @@ Python 2 or 3 support. You may also want to use the ``-bb`` flag with the Python 3 interpreter to -trigger an exception when you are comparing bytes to strings. Usually it's -simply ``False``, but if you made a mistake in your separation of text/binary -data handling you may be accidentally comparing text and binary data. This flag -will raise an exception when that occurs to help track down such cases. +trigger an exception when you are comparing bytes to strings or bytes to an int +(the latter is available starting in Python 3.5). By default type-differing +comparisons simply return ``False``, but if you made a mistake in your +separation of text/binary data handling or indexing on bytes you wouldn't easily +find the mistake. This flag will raise an exception when these kinds of +comparisons occur, making the mistake much easier to track down. And that's mostly it! At this point your code base is compatible with both Python 2 and 3 simultaneously. Your testing will also be set up so that you @@ -358,20 +413,17 @@ you typically run your tests under while developing. -Dropping Python 2 support completely -==================================== +Consider using optional static type checking +-------------------------------------------- -If you are able to fully drop support for Python 2, then the steps required -to transition to Python 3 simplify greatly. - -#. Update your code to only support Python 2.7 -#. Make sure you have good test coverage (coverage.py_ can help) -#. Learn the differences between Python 2 & 3 -#. Use 2to3_ to rewrite your code to run only under Python 3 - -After this your code will be fully Python 3 compliant but in a way that is not -supported by Python 2. You should also update the classifiers in your -``setup.py`` to contain ``Programming Language :: Python :: 3 :: Only``. +Another way to help port your code is to use a static type checker like +mypy_ or pytype_ on your code. These tools can be used to analyze your code as +if it's being run under Python 2, then you can run the tool a second time as if +your code is running under Python 3. By running a static type checker twice like +this you can discover if you're e.g. misusing binary data type in one version +of Python compared to another. If you add optional type hints to your code you +can also explicitly state whether your APIs use textual or binary data, helping +to make sure everything functions as expected in both versions of Python. .. _2to3: https://docs.python.org/3/library/2to3.html @@ -379,14 +431,22 @@ .. _cheat sheet: http://python-future.org/compatible_idioms.html .. _coverage.py: https://pypi.python.org/pypi/coverage .. _Futurize: http://python-future.org/automatic_conversion.html +.. _importlib: https://docs.python.org/3/library/importlib.html#module-importlib +.. _importlib2: https://pypi.python.org/pypi/importlib2 .. _Modernize: https://python-modernize.readthedocs.org/en/latest/ +.. _mypy: http://mypy-lang.org/ .. _Porting to Python 3: http://python3porting.com/ .. _Pylint: https://pypi.python.org/pypi/pylint + .. _Python 3 Q & A: https://ncoghlan-devs-python-notes.readthedocs.org/en/latest/python3/questions_and_answers.html +.. _pytype: https://github.com/google/pytype .. _python-future: http://python-future.org/ .. _python-porting: https://mail.python.org/mailman/listinfo/python-porting .. _six: https://pypi.python.org/pypi/six .. _tox: https://pypi.python.org/pypi/tox .. _trove classifier: https://pypi.python.org/pypi?%3Aaction=list_classifiers + .. _"What's New": https://docs.python.org/3/whatsnew/index.html + +.. _Why Python 3 exists: http://www.snarky.ca/why-python-3-exists -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 16:32:22 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 17 Dec 2016 21:32:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI1Nzc4?= =?utf-8?q?=3A_winreg_does_not_truncase_string_correctly_=28Patch_by_Eryk_?= =?utf-8?q?Sun=29?= Message-ID: <20161217213222.6732.46324.B8EEA390@psf.io> https://hg.python.org/cpython/rev/8cee4862fb34 changeset: 105716:8cee4862fb34 branch: 3.6 parent: 105712:a8d15e133778 user: Steve Dower date: Sat Dec 17 13:30:27 2016 -0800 summary: Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) files: Lib/test/test_winreg.py | 14 +++++++++++++- Misc/NEWS | 2 ++ PC/winreg.c | 13 ++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -57,7 +57,7 @@ def delete_tree(self, root, subkey): try: - hkey = OpenKey(root, subkey, KEY_ALL_ACCESS) + hkey = OpenKey(root, subkey, 0, KEY_ALL_ACCESS) except OSError: # subkey does not exist return @@ -368,6 +368,18 @@ finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) + def test_read_string_containing_null(self): + # Test for issue 25778: REG_SZ should not contain null characters + try: + with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: + self.assertNotEqual(ck.handle, 0) + test_val = "A string\x00 with a null" + SetValueEx(ck, "test_name", 0, REG_SZ, test_val) + ret_val, ret_type = QueryValueEx(ck, "test_name") + self.assertEqual(ret_type, REG_SZ) + self.assertEqual(ret_val, "A string") + finally: + DeleteKey(HKEY_CURRENT_USER, test_key_name) @unittest.skipUnless(REMOTE_NAME, "Skipping remote registry tests") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -49,6 +49,8 @@ Windows ------- +- Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) + - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. Tests diff --git a/PC/winreg.c b/PC/winreg.c --- a/PC/winreg.c +++ b/PC/winreg.c @@ -719,14 +719,13 @@ case REG_SZ: case REG_EXPAND_SZ: { - /* the buffer may or may not have a trailing NULL */ + /* REG_SZ should be a NUL terminated string, but only by + * convention. The buffer may have been saved without a NUL + * or with embedded NULs. To be consistent with reg.exe and + * regedit.exe, consume only up to the first NUL. */ wchar_t *data = (wchar_t *)retDataBuf; - int len = retDataSize / 2; - if (retDataSize && data[len-1] == '\0') - retDataSize -= 2; - if (retDataSize <= 0) - data = L""; - obData = PyUnicode_FromWideChar(data, retDataSize/2); + size_t len = wcsnlen(data, retDataSize / sizeof(wchar_t)); + obData = PyUnicode_FromWideChar(data, len); break; } case REG_MULTI_SZ: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 16:32:22 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 17 Dec 2016 21:32:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325778=3A_winreg_does_not_truncase_string_correc?= =?utf-8?q?tly_=28Patch_by_Eryk_Sun=29?= Message-ID: <20161217213222.10818.17765.A59DAD24@psf.io> https://hg.python.org/cpython/rev/3014854e68e4 changeset: 105717:3014854e68e4 parent: 105713:d9e5ec7c6887 parent: 105716:8cee4862fb34 user: Steve Dower date: Sat Dec 17 13:31:58 2016 -0800 summary: Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) files: Lib/test/test_winreg.py | 14 +++++++++++++- Misc/NEWS | 2 ++ PC/winreg.c | 13 ++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py --- a/Lib/test/test_winreg.py +++ b/Lib/test/test_winreg.py @@ -57,7 +57,7 @@ def delete_tree(self, root, subkey): try: - hkey = OpenKey(root, subkey, KEY_ALL_ACCESS) + hkey = OpenKey(root, subkey, 0, KEY_ALL_ACCESS) except OSError: # subkey does not exist return @@ -368,6 +368,18 @@ finally: DeleteKey(HKEY_CURRENT_USER, test_key_name) + def test_read_string_containing_null(self): + # Test for issue 25778: REG_SZ should not contain null characters + try: + with CreateKey(HKEY_CURRENT_USER, test_key_name) as ck: + self.assertNotEqual(ck.handle, 0) + test_val = "A string\x00 with a null" + SetValueEx(ck, "test_name", 0, REG_SZ, test_val) + ret_val, ret_type = QueryValueEx(ck, "test_name") + self.assertEqual(ret_type, REG_SZ) + self.assertEqual(ret_val, "A string") + finally: + DeleteKey(HKEY_CURRENT_USER, test_key_name) @unittest.skipUnless(REMOTE_NAME, "Skipping remote registry tests") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -497,6 +497,8 @@ Windows ------- +- Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) + - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default - Issue #28522: Fixes mishandled buffer reallocation in getpathp.c diff --git a/PC/winreg.c b/PC/winreg.c --- a/PC/winreg.c +++ b/PC/winreg.c @@ -719,14 +719,13 @@ case REG_SZ: case REG_EXPAND_SZ: { - /* the buffer may or may not have a trailing NULL */ + /* REG_SZ should be a NUL terminated string, but only by + * convention. The buffer may have been saved without a NUL + * or with embedded NULs. To be consistent with reg.exe and + * regedit.exe, consume only up to the first NUL. */ wchar_t *data = (wchar_t *)retDataBuf; - int len = retDataSize / 2; - if (retDataSize && data[len-1] == '\0') - retDataSize -= 2; - if (retDataSize <= 0) - data = L""; - obData = PyUnicode_FromWideChar(data, retDataSize/2); + size_t len = wcsnlen(data, retDataSize / sizeof(wchar_t)); + obData = PyUnicode_FromWideChar(data, len); break; } case REG_MULTI_SZ: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 22:05:49 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 18 Dec 2016 03:05:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_=2328407_Improve_test_coverage_of_make=5Fmsgid=2E?= Message-ID: <20161218030549.128449.85048.1B382202@psf.io> https://hg.python.org/cpython/rev/c016ab381894 changeset: 105720:c016ab381894 parent: 105717:3014854e68e4 parent: 105719:87671b1f7ff4 user: R David Murray date: Sat Dec 17 22:04:48 2016 -0500 summary: Merge #28407 Improve test coverage of make_msgid. files: Lib/test/test_email/test_email.py | 12 ++++++++++++ Misc/ACKS | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -11,6 +11,7 @@ from io import StringIO, BytesIO from itertools import chain from random import choice +from socket import getfqdn try: from threading import Thread except ImportError: @@ -3314,6 +3315,17 @@ email.utils.make_msgid(domain='testdomain-string')[-19:], '@testdomain-string>') + def test_make_msgid_idstring(self): + self.assertEqual( + email.utils.make_msgid(idstring='test-idstring', + domain='testdomain-string')[-33:], + '.test-idstring at testdomain-string>') + + def test_make_msgid_default_domain(self): + self.assertTrue( + email.utils.make_msgid().endswith( + '@' + getfqdn() + '>')) + def test_Generator_linend(self): # Issue 14645. with openfile('msg_26.txt', newline='\n') as f: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -189,6 +189,7 @@ Anthony Briggs Keith Briggs Tobias Brink +Dillon Brock Richard Brodie Michael Broghton Ammar Brohi -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 22:05:49 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 18 Dec 2016 03:05:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzI4NDA3IEltcHJv?= =?utf-8?q?ve_test_coverage_of_make=5Fmsgid=2E?= Message-ID: <20161218030549.34541.56047.22C0FF6B@psf.io> https://hg.python.org/cpython/rev/8687b3554b1f changeset: 105718:8687b3554b1f branch: 3.5 parent: 105711:d95f19892fd0 user: R David Murray date: Sat Dec 17 22:03:44 2016 -0500 summary: #28407 Improve test coverage of make_msgid. Patch by Dillon Brock. files: Lib/test/test_email/test_email.py | 12 ++++++++++++ Misc/ACKS | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -11,6 +11,7 @@ from io import StringIO, BytesIO from itertools import chain from random import choice +from socket import getfqdn try: from threading import Thread except ImportError: @@ -3294,6 +3295,17 @@ email.utils.make_msgid(domain='testdomain-string')[-19:], '@testdomain-string>') + def test_make_msgid_idstring(self): + self.assertEqual( + email.utils.make_msgid(idstring='test-idstring', + domain='testdomain-string')[-33:], + '.test-idstring at testdomain-string>') + + def test_make_msgid_default_domain(self): + self.assertTrue( + email.utils.make_msgid().endswith( + '@' + getfqdn() + '>')) + def test_Generator_linend(self): # Issue 14645. with openfile('msg_26.txt', newline='\n') as f: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -187,6 +187,7 @@ Anthony Briggs Keith Briggs Tobias Brink +Dillon Brock Richard Brodie Michael Broghton Ammar Brohi -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 17 22:05:49 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 18 Dec 2016 03:05:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_=2328407_Improve_test_coverage_of_make=5Fmsgid=2E?= Message-ID: <20161218030549.21746.85423.CA461C44@psf.io> https://hg.python.org/cpython/rev/87671b1f7ff4 changeset: 105719:87671b1f7ff4 branch: 3.6 parent: 105716:8cee4862fb34 parent: 105718:8687b3554b1f user: R David Murray date: Sat Dec 17 22:04:20 2016 -0500 summary: Merge #28407 Improve test coverage of make_msgid. files: Lib/test/test_email/test_email.py | 12 ++++++++++++ Misc/ACKS | 1 + 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py --- a/Lib/test/test_email/test_email.py +++ b/Lib/test/test_email/test_email.py @@ -11,6 +11,7 @@ from io import StringIO, BytesIO from itertools import chain from random import choice +from socket import getfqdn try: from threading import Thread except ImportError: @@ -3314,6 +3315,17 @@ email.utils.make_msgid(domain='testdomain-string')[-19:], '@testdomain-string>') + def test_make_msgid_idstring(self): + self.assertEqual( + email.utils.make_msgid(idstring='test-idstring', + domain='testdomain-string')[-33:], + '.test-idstring at testdomain-string>') + + def test_make_msgid_default_domain(self): + self.assertTrue( + email.utils.make_msgid().endswith( + '@' + getfqdn() + '>')) + def test_Generator_linend(self): # Issue 14645. with openfile('msg_26.txt', newline='\n') as f: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -189,6 +189,7 @@ Anthony Briggs Keith Briggs Tobias Brink +Dillon Brock Richard Brodie Michael Broghton Ammar Brohi -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 00:43:52 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 18 Dec 2016 05:43:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_spelling_a?= =?utf-8?q?nd_grammar_in_code_comments_and_documentation?= Message-ID: <20161218054352.10780.72979.7CBDF0B4@psf.io> https://hg.python.org/cpython/rev/06ceaf679213 changeset: 105722:06ceaf679213 branch: 3.5 parent: 105718:8687b3554b1f user: Martin Panter date: Sun Dec 18 01:23:09 2016 +0000 summary: Fix spelling and grammar in code comments and documentation files: Doc/library/shutil.rst | 2 +- Lib/distutils/tests/test_bdist_rpm.py | 2 +- Lib/test/test_unicode.py | 2 +- Misc/HISTORY | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -581,7 +581,7 @@ By default :mod:`shutil` provides these formats: - - *zip*: ZIP file (unpacking compressed files works only if corresponding + - *zip*: ZIP file (unpacking compressed files works only if the corresponding module is available). - *tar*: uncompressed tar file. - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py +++ b/Lib/distutils/tests/test_bdist_rpm.py @@ -96,7 +96,7 @@ @unittest.skipIf(find_executable('rpmbuild') is None, 'the rpmbuild command is not found') def test_no_optimize_flag(self): - # let's create a package that brakes bdist_rpm + # let's create a package that breaks bdist_rpm tmp_dir = self.mkdtemp() os.environ['HOME'] = tmp_dir # to confine dir '.rpmdb' creation pkg_dir = os.path.join(tmp_dir, 'foo') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2615,7 +2615,7 @@ b'repr=%V', None, b'abc\xff') # not supported: copy the raw format string. these tests are just here - # to check for crashs and should not be considered as specifications + # to check for crashes and should not be considered as specifications check_format('%s', b'%1%s', b'abc') check_format('%1abc', diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -2194,7 +2194,7 @@ NULL). - Issue #10829: Refactor PyUnicode_FromFormat(), use the same function to parse - the format string in the 3 steps, fix crashs on invalid format strings. + the format string in the 3 steps, fix crashes on invalid format strings. - Issue #13007: whichdb should recognize gdbm 1.9 magic numbers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 00:43:52 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 18 Dec 2016 05:43:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_spelling_i?= =?utf-8?q?n_code_comments?= Message-ID: <20161218054352.32214.29082.C0602F13@psf.io> https://hg.python.org/cpython/rev/34b9fe09a2b7 changeset: 105721:34b9fe09a2b7 branch: 2.7 parent: 105715:88c21db793cb user: Martin Panter date: Sun Dec 18 05:27:49 2016 +0000 summary: Fix spelling in code comments files: Lib/distutils/tests/test_bdist_rpm.py | 2 +- Lib/test/test_unicode.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py +++ b/Lib/distutils/tests/test_bdist_rpm.py @@ -99,7 +99,7 @@ @unittest.skipIf(find_executable('rpmbuild') is None, 'the rpmbuild command is not found') def test_no_optimize_flag(self): - # let's create a package that brakes bdist_rpm + # let's create a package that breaks bdist_rpm tmp_dir = self.mkdtemp() os.environ['HOME'] = tmp_dir # to confine dir '.rpmdb' creation pkg_dir = os.path.join(tmp_dir, 'foo') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1814,7 +1814,7 @@ b'repr=%V', None, b'abc\xff') # not supported: copy the raw format string. these tests are just here - # to check for crashs and should not be considered as specifications + # to check for crashes and should not be considered as specifications check_format(u'%s', b'%1%s', b'abc') check_format(u'%1abc', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 00:43:53 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 18 Dec 2016 05:43:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_spelling_and_grammar_from_3=2E5?= Message-ID: <20161218054353.23436.66194.5DB05D81@psf.io> https://hg.python.org/cpython/rev/c9cfa1fdcfcf changeset: 105723:c9cfa1fdcfcf branch: 3.6 parent: 105719:87671b1f7ff4 parent: 105722:06ceaf679213 user: Martin Panter date: Sun Dec 18 05:37:21 2016 +0000 summary: Merge spelling and grammar from 3.5 files: Doc/library/shutil.rst | 2 +- Lib/distutils/tests/test_bdist_rpm.py | 2 +- Lib/test/test_unicode.py | 2 +- Misc/HISTORY | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -581,7 +581,7 @@ By default :mod:`shutil` provides these formats: - - *zip*: ZIP file (unpacking compressed files works only if corresponding + - *zip*: ZIP file (unpacking compressed files works only if the corresponding module is available). - *tar*: uncompressed tar file. - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py +++ b/Lib/distutils/tests/test_bdist_rpm.py @@ -94,7 +94,7 @@ @unittest.skipIf(find_executable('rpmbuild') is None, 'the rpmbuild command is not found') def test_no_optimize_flag(self): - # let's create a package that brakes bdist_rpm + # let's create a package that breaks bdist_rpm tmp_dir = self.mkdtemp() os.environ['HOME'] = tmp_dir # to confine dir '.rpmdb' creation pkg_dir = os.path.join(tmp_dir, 'foo') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2639,7 +2639,7 @@ b'repr=%V', None, b'abc\xff') # not supported: copy the raw format string. these tests are just here - # to check for crashs and should not be considered as specifications + # to check for crashes and should not be considered as specifications check_format('%s', b'%1%s', b'abc') check_format('%1abc', diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -2194,7 +2194,7 @@ NULL). - Issue #10829: Refactor PyUnicode_FromFormat(), use the same function to parse - the format string in the 3 steps, fix crashs on invalid format strings. + the format string in the 3 steps, fix crashes on invalid format strings. - Issue #13007: whichdb should recognize gdbm 1.9 magic numbers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 00:43:53 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 18 Dec 2016 05:43:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTg3?= =?utf-8?q?=3A_Typos=2C_grammar=2C_spelling_in_documentation?= Message-ID: <20161218054353.95845.40771.44C163BD@psf.io> https://hg.python.org/cpython/rev/a46a20a1f286 changeset: 105724:a46a20a1f286 branch: 3.6 user: Martin Panter date: Sun Dec 18 01:26:53 2016 +0000 summary: Issue #28987: Typos, grammar, spelling in documentation files: Doc/whatsnew/3.6.rst | 2 +- Misc/NEWS | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -360,7 +360,7 @@ PEP 487: Descriptor Protocol Enhancements ----------------------------------------- -:pep:`487` extends the descriptor protocol has to include the new optional +:pep:`487` extends the descriptor protocol to include the new optional :meth:`~object.__set_name__` method. Whenever a new class is defined, the new method will be called on all descriptors included in the definition, providing them with a reference to the class being defined and the name given to the diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -17,10 +17,10 @@ to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. -- Issue #28991: functools.lru_cache() was susceptible to an obscure $ +- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy bug triggerable by a monkey-patched len() function. -- Issue #28739: f-string expressions no longer accepted as docstrings and +- Issue #28739: f-string expressions are no longer accepted as docstrings and by ast.literal_eval() even if they do not include expressions. - Issue #28512: Fixed setting the offset attribute of SyntaxError by @@ -49,7 +49,7 @@ Windows ------- -- Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) +- Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. @@ -84,7 +84,7 @@ must not convert combined table into split table. Patch written by INADA Naoki. -- Issue #28990: Fix asynchio SSL hanging if connection is closed before +- Issue #28990: Fix asyncio SSL hanging if connection is closed before handshake is completed. (Patch by HoHo-Ho) Tools/Demos -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 00:43:53 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 18 Dec 2016 05:43:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328987=3A_Merge_doc_and_comment_fixes_from_3=2E6?= Message-ID: <20161218054353.6992.82738.C39994DD@psf.io> https://hg.python.org/cpython/rev/28cf4ffcfbf3 changeset: 105725:28cf4ffcfbf3 parent: 105720:c016ab381894 parent: 105724:a46a20a1f286 user: Martin Panter date: Sun Dec 18 05:41:55 2016 +0000 summary: Issue #28987: Merge doc and comment fixes from 3.6 files: Doc/library/shutil.rst | 2 +- Doc/whatsnew/3.6.rst | 2 +- Lib/distutils/tests/test_bdist_rpm.py | 2 +- Lib/test/test_unicode.py | 2 +- Misc/HISTORY | 2 +- Misc/NEWS | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -581,7 +581,7 @@ By default :mod:`shutil` provides these formats: - - *zip*: ZIP file (unpacking compressed files works only if corresponding + - *zip*: ZIP file (unpacking compressed files works only if the corresponding module is available). - *tar*: uncompressed tar file. - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -360,7 +360,7 @@ PEP 487: Descriptor Protocol Enhancements ----------------------------------------- -:pep:`487` extends the descriptor protocol has to include the new optional +:pep:`487` extends the descriptor protocol to include the new optional :meth:`~object.__set_name__` method. Whenever a new class is defined, the new method will be called on all descriptors included in the definition, providing them with a reference to the class being defined and the name given to the diff --git a/Lib/distutils/tests/test_bdist_rpm.py b/Lib/distutils/tests/test_bdist_rpm.py --- a/Lib/distutils/tests/test_bdist_rpm.py +++ b/Lib/distutils/tests/test_bdist_rpm.py @@ -94,7 +94,7 @@ @unittest.skipIf(find_executable('rpmbuild') is None, 'the rpmbuild command is not found') def test_no_optimize_flag(self): - # let's create a package that brakes bdist_rpm + # let's create a package that breaks bdist_rpm tmp_dir = self.mkdtemp() os.environ['HOME'] = tmp_dir # to confine dir '.rpmdb' creation pkg_dir = os.path.join(tmp_dir, 'foo') diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2639,7 +2639,7 @@ b'repr=%V', None, b'abc\xff') # not supported: copy the raw format string. these tests are just here - # to check for crashs and should not be considered as specifications + # to check for crashes and should not be considered as specifications check_format('%s', b'%1%s', b'abc') check_format('%1abc', diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -6495,7 +6495,7 @@ NULL). - Issue #10829: Refactor PyUnicode_FromFormat(), use the same function to parse - the format string in the 3 steps, fix crashs on invalid format strings. + the format string in the 3 steps, fix crashes on invalid format strings. - Issue #13007: whichdb should recognize gdbm 1.9 magic numbers. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -23,14 +23,14 @@ to/from UTF-8, instead of the locale encoding to avoid inconsistencies with os.fsencode() and os.fsdecode() which are already using UTF-8. -- Issue #28991: functools.lru_cache() was susceptible to an obscure $ +- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy bug triggerable by a monkey-patched len() function. - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki. -- Issue #28739: f-string expressions no longer accepted as docstrings and +- Issue #28739: f-string expressions are no longer accepted as docstrings and by ast.literal_eval() even if they do not include expressions. - Issue #28512: Fixed setting the offset attribute of SyntaxError by @@ -497,7 +497,7 @@ Windows ------- -- Issue #25778: winreg does not truncase string correctly (Patch by Eryk Sun) +- Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 00:43:53 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 18 Dec 2016 05:43:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_One_more_typo_fix_for_3=2E?= =?utf-8?q?7?= Message-ID: <20161218054353.21696.59115.BEE17A09@psf.io> https://hg.python.org/cpython/rev/40f1b06ec989 changeset: 105726:40f1b06ec989 user: Martin Panter date: Sun Dec 18 01:37:12 2016 +0000 summary: One more typo fix for 3.7 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 @@ -197,7 +197,7 @@ Library ------- -- Issue #16255: subrocess.Popen uses /system/bin/sh on Android as the shell, +- Issue #16255: subprocess.Popen uses /system/bin/sh on Android as the shell, instead of /bin/sh. - Issue #28779: multiprocessing.set_forkserver_preload() would crash the -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Dec 18 04:05:34 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 18 Dec 2016 09:05:34 +0000 Subject: [Python-checkins] Daily reference leaks (40f1b06ec989): sum=-2 Message-ID: <20161218090534.6646.20025.5D39FCB1@psf.io> results for 40f1b06ec989 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/reflogRAfnKo', '--timeout', '7200'] From python-checkins at python.org Sun Dec 18 15:02:59 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 18 Dec 2016 20:02:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzI5MDA1OiBjbGFy?= =?utf-8?q?ify_terminology_in_tutorial_=27method=27_discussion=2E?= Message-ID: <20161218200259.96734.43789.8CE008AE@psf.io> https://hg.python.org/cpython/rev/6f89f5eb4422 changeset: 105727:6f89f5eb4422 branch: 3.5 parent: 105722:06ceaf679213 user: R David Murray date: Sun Dec 18 14:59:58 2016 -0500 summary: #29005: clarify terminology in tutorial 'method' discussion. Patch by Jim Fasarakis-Hilliard. files: Doc/tutorial/classes.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -374,11 +374,11 @@ called without any --- even if the argument isn't actually used... Actually, you may have guessed the answer: the special thing about methods is -that the object is passed as the first argument of the function. In our +that the instance object is passed as the first argument of the function. In our example, the call ``x.f()`` is exactly equivalent to ``MyClass.f(x)``. In general, calling a method with a list of *n* arguments is equivalent to calling the corresponding function with an argument list that is created by inserting -the method's object before the first argument. +the method's instance object before the first argument. If you still don't understand how methods work, a look at the implementation can perhaps clarify matters. When an instance attribute is referenced that isn't a @@ -906,4 +906,3 @@ namespace; the name :attr:`~object.__dict__` is an attribute but not a global name. Obviously, using this violates the abstraction of namespace implementation, and should be restricted to things like post-mortem debuggers. - -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 15:02:59 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 18 Dec 2016 20:02:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2329005=3A_clarify_terminology_in_tutorial_=27?= =?utf-8?q?method=27_discussion=2E?= Message-ID: <20161218200259.34446.91643.8D748079@psf.io> https://hg.python.org/cpython/rev/3cc193be79ab changeset: 105729:3cc193be79ab parent: 105726:40f1b06ec989 parent: 105728:7314e08dc907 user: R David Murray date: Sun Dec 18 15:01:38 2016 -0500 summary: Merge: #29005: clarify terminology in tutorial 'method' discussion. files: Doc/tutorial/classes.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -374,11 +374,11 @@ called without any --- even if the argument isn't actually used... Actually, you may have guessed the answer: the special thing about methods is -that the object is passed as the first argument of the function. In our +that the instance object is passed as the first argument of the function. In our example, the call ``x.f()`` is exactly equivalent to ``MyClass.f(x)``. In general, calling a method with a list of *n* arguments is equivalent to calling the corresponding function with an argument list that is created by inserting -the method's object before the first argument. +the method's instance object before the first argument. If you still don't understand how methods work, a look at the implementation can perhaps clarify matters. When an instance attribute is referenced that isn't a @@ -906,4 +906,3 @@ namespace; the name :attr:`~object.__dict__` is an attribute but not a global name. Obviously, using this violates the abstraction of namespace implementation, and should be restricted to things like post-mortem debuggers. - -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 18 15:02:59 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 18 Dec 2016 20:02:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge=3A_=2329005=3A_clarify_terminology_in_tutorial_=27method?= =?utf-8?q?=27_discussion=2E?= Message-ID: <20161218200259.128270.50140.15A8D249@psf.io> https://hg.python.org/cpython/rev/7314e08dc907 changeset: 105728:7314e08dc907 branch: 3.6 parent: 105724:a46a20a1f286 parent: 105727:6f89f5eb4422 user: R David Murray date: Sun Dec 18 15:00:23 2016 -0500 summary: Merge: #29005: clarify terminology in tutorial 'method' discussion. files: Doc/tutorial/classes.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -374,11 +374,11 @@ called without any --- even if the argument isn't actually used... Actually, you may have guessed the answer: the special thing about methods is -that the object is passed as the first argument of the function. In our +that the instance object is passed as the first argument of the function. In our example, the call ``x.f()`` is exactly equivalent to ``MyClass.f(x)``. In general, calling a method with a list of *n* arguments is equivalent to calling the corresponding function with an argument list that is created by inserting -the method's object before the first argument. +the method's instance object before the first argument. If you still don't understand how methods work, a look at the implementation can perhaps clarify matters. When an instance attribute is referenced that isn't a @@ -906,4 +906,3 @@ namespace; the name :attr:`~object.__dict__` is an attribute but not a global name. Obviously, using this violates the abstraction of namespace implementation, and should be restricted to things like post-mortem debuggers. - -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 01:07:49 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 19 Dec 2016 06:07:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIwMTkx?= =?utf-8?q?=3A_Fixed_a_crash_in_resource=2Eprlimit=28=29_when_pass_a_seque?= =?utf-8?q?nce_that?= Message-ID: <20161219060749.6646.95924.6C28F2EF@psf.io> https://hg.python.org/cpython/rev/dac72bc14c00 changeset: 105730:dac72bc14c00 branch: 3.5 parent: 105727:6f89f5eb4422 user: Serhiy Storchaka date: Mon Dec 19 08:04:15 2016 +0200 summary: Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. files: Lib/test/test_resource.py | 14 +++++ Misc/NEWS | 3 + Modules/resource.c | 64 +++++++++++++------------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -158,6 +158,20 @@ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, limit), limit) + # Issue 20191: Reference counting bug + @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit') + @support.requires_linux_version(2, 6, 36) + def test_prlimit_refcount(self): + class BadSeq: + def __len__(self): + return 2 + def __getitem__(self, key): + return limits[key] - 1 # new reference + + limits = resource.getrlimit(resource.RLIMIT_AS) + self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, BadSeq()), + limits) + def test_main(verbose=None): support.run_unittest(ResourceTest) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -130,6 +130,9 @@ Library ------- +- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that + doesn't own its elements as limits. + - Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks. diff --git a/Modules/resource.c b/Modules/resource.c --- a/Modules/resource.c +++ b/Modules/resource.c @@ -107,29 +107,46 @@ } static int -py2rlimit(PyObject *curobj, PyObject *maxobj, struct rlimit *rl_out) +py2rlimit(PyObject *limits, struct rlimit *rl_out) { + PyObject *curobj, *maxobj; + limits = PySequence_Tuple(limits); + if (!limits) + /* Here limits is a borrowed reference */ + return -1; + + if (PyTuple_GET_SIZE(limits) != 2) { + PyErr_SetString(PyExc_ValueError, + "expected a tuple of 2 integers"); + goto error; + } + curobj = PyTuple_GET_ITEM(limits, 0); + maxobj = PyTuple_GET_ITEM(limits, 1); #if !defined(HAVE_LARGEFILE_SUPPORT) rl_out->rlim_cur = PyLong_AsLong(curobj); if (rl_out->rlim_cur == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; rl_out->rlim_max = PyLong_AsLong(maxobj); if (rl_out->rlim_max == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; #else /* The limits are probably bigger than a long */ rl_out->rlim_cur = PyLong_AsLongLong(curobj); if (rl_out->rlim_cur == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; rl_out->rlim_max = PyLong_AsLongLong(maxobj); if (rl_out->rlim_max == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; #endif + Py_DECREF(limits); rl_out->rlim_cur = rl_out->rlim_cur & RLIM_INFINITY; rl_out->rlim_max = rl_out->rlim_max & RLIM_INFINITY; return 0; +error: + Py_DECREF(limits); + return -1; } static PyObject* @@ -172,7 +189,7 @@ { struct rlimit rl; int resource; - PyObject *limits, *curobj, *maxobj; + PyObject *limits; if (!PyArg_ParseTuple(args, "iO:setrlimit", &resource, &limits)) return NULL; @@ -183,21 +200,8 @@ return NULL; } - limits = PySequence_Tuple(limits); - if (!limits) - /* Here limits is a borrowed reference */ + if (py2rlimit(limits, &rl) < 0) { return NULL; - - if (PyTuple_GET_SIZE(limits) != 2) { - PyErr_SetString(PyExc_ValueError, - "expected a tuple of 2 integers"); - goto error; - } - curobj = PyTuple_GET_ITEM(limits, 0); - maxobj = PyTuple_GET_ITEM(limits, 1); - - if (py2rlimit(curobj, maxobj, &rl) < 0) { - goto error; } if (setrlimit(resource, &rl) == -1) { @@ -209,15 +213,9 @@ "not allowed to raise maximum limit"); else PyErr_SetFromErrno(PyExc_OSError); - goto error; + return NULL; } - Py_DECREF(limits); - Py_INCREF(Py_None); - return Py_None; - - error: - Py_DECREF(limits); - return NULL; + Py_RETURN_NONE; } #ifdef HAVE_PRLIMIT @@ -227,10 +225,10 @@ struct rlimit old_limit, new_limit; int resource, retval; pid_t pid; - PyObject *curobj=NULL, *maxobj=NULL; + PyObject *limits = NULL; - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|(OO):prlimit", - &pid, &resource, &curobj, &maxobj)) + if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|O:prlimit", + &pid, &resource, &limits)) return NULL; if (resource < 0 || resource >= RLIM_NLIMITS) { @@ -239,8 +237,8 @@ return NULL; } - if (curobj != NULL) { - if (py2rlimit(curobj, maxobj, &new_limit) < 0) { + if (limits != NULL) { + if (py2rlimit(limits, &new_limit) < 0) { return NULL; } retval = prlimit(pid, resource, &new_limit, &old_limit); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 01:07:49 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 19 Dec 2016 06:07:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2320191=3A_Fixed_a_crash_in_resource=2Eprlimit=28=29_wh?= =?utf-8?q?en_pass_a_sequence_that?= Message-ID: <20161219060749.6732.10264.A6E497C8@psf.io> https://hg.python.org/cpython/rev/7bc2923a41b6 changeset: 105731:7bc2923a41b6 branch: 3.6 parent: 105728:7314e08dc907 parent: 105730:dac72bc14c00 user: Serhiy Storchaka date: Mon Dec 19 08:05:39 2016 +0200 summary: Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. files: Lib/test/test_resource.py | 14 +++++ Misc/NEWS | 3 + Modules/resource.c | 64 +++++++++++++------------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -158,6 +158,20 @@ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, limit), limit) + # Issue 20191: Reference counting bug + @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit') + @support.requires_linux_version(2, 6, 36) + def test_prlimit_refcount(self): + class BadSeq: + def __len__(self): + return 2 + def __getitem__(self, key): + return limits[key] - 1 # new reference + + limits = resource.getrlimit(resource.RLIMIT_AS) + self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, BadSeq()), + limits) + def test_main(verbose=None): support.run_unittest(ResourceTest) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -35,6 +35,9 @@ Library ------- +- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that + doesn't own its elements as limits. + - Issue #28779: multiprocessing.set_forkserver_preload() would crash the forkserver process if a preloaded module instantiated some multiprocessing objects such as locks. diff --git a/Modules/resource.c b/Modules/resource.c --- a/Modules/resource.c +++ b/Modules/resource.c @@ -107,29 +107,46 @@ } static int -py2rlimit(PyObject *curobj, PyObject *maxobj, struct rlimit *rl_out) +py2rlimit(PyObject *limits, struct rlimit *rl_out) { + PyObject *curobj, *maxobj; + limits = PySequence_Tuple(limits); + if (!limits) + /* Here limits is a borrowed reference */ + return -1; + + if (PyTuple_GET_SIZE(limits) != 2) { + PyErr_SetString(PyExc_ValueError, + "expected a tuple of 2 integers"); + goto error; + } + curobj = PyTuple_GET_ITEM(limits, 0); + maxobj = PyTuple_GET_ITEM(limits, 1); #if !defined(HAVE_LARGEFILE_SUPPORT) rl_out->rlim_cur = PyLong_AsLong(curobj); if (rl_out->rlim_cur == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; rl_out->rlim_max = PyLong_AsLong(maxobj); if (rl_out->rlim_max == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; #else /* The limits are probably bigger than a long */ rl_out->rlim_cur = PyLong_AsLongLong(curobj); if (rl_out->rlim_cur == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; rl_out->rlim_max = PyLong_AsLongLong(maxobj); if (rl_out->rlim_max == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; #endif + Py_DECREF(limits); rl_out->rlim_cur = rl_out->rlim_cur & RLIM_INFINITY; rl_out->rlim_max = rl_out->rlim_max & RLIM_INFINITY; return 0; +error: + Py_DECREF(limits); + return -1; } static PyObject* @@ -170,7 +187,7 @@ { struct rlimit rl; int resource; - PyObject *limits, *curobj, *maxobj; + PyObject *limits; if (!PyArg_ParseTuple(args, "iO:setrlimit", &resource, &limits)) return NULL; @@ -181,21 +198,8 @@ return NULL; } - limits = PySequence_Tuple(limits); - if (!limits) - /* Here limits is a borrowed reference */ + if (py2rlimit(limits, &rl) < 0) { return NULL; - - if (PyTuple_GET_SIZE(limits) != 2) { - PyErr_SetString(PyExc_ValueError, - "expected a tuple of 2 integers"); - goto error; - } - curobj = PyTuple_GET_ITEM(limits, 0); - maxobj = PyTuple_GET_ITEM(limits, 1); - - if (py2rlimit(curobj, maxobj, &rl) < 0) { - goto error; } if (setrlimit(resource, &rl) == -1) { @@ -207,15 +211,9 @@ "not allowed to raise maximum limit"); else PyErr_SetFromErrno(PyExc_OSError); - goto error; + return NULL; } - Py_DECREF(limits); - Py_INCREF(Py_None); - return Py_None; - - error: - Py_DECREF(limits); - return NULL; + Py_RETURN_NONE; } #ifdef HAVE_PRLIMIT @@ -225,10 +223,10 @@ struct rlimit old_limit, new_limit; int resource, retval; pid_t pid; - PyObject *curobj=NULL, *maxobj=NULL; + PyObject *limits = NULL; - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|(OO):prlimit", - &pid, &resource, &curobj, &maxobj)) + if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|O:prlimit", + &pid, &resource, &limits)) return NULL; if (resource < 0 || resource >= RLIM_NLIMITS) { @@ -237,8 +235,8 @@ return NULL; } - if (curobj != NULL) { - if (py2rlimit(curobj, maxobj, &new_limit) < 0) { + if (limits != NULL) { + if (py2rlimit(limits, &new_limit) < 0) { return NULL; } retval = prlimit(pid, resource, &new_limit, &old_limit); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 01:07:50 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 19 Dec 2016 06:07:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2320191=3A_Fixed_a_crash_in_resource=2Eprlimit=28?= =?utf-8?q?=29_when_pass_a_sequence_that?= Message-ID: <20161219060749.21720.8660.003D4ED2@psf.io> https://hg.python.org/cpython/rev/b4d2bff1c5f8 changeset: 105732:b4d2bff1c5f8 parent: 105729:3cc193be79ab parent: 105731:7bc2923a41b6 user: Serhiy Storchaka date: Mon Dec 19 08:07:29 2016 +0200 summary: Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. files: Lib/test/test_resource.py | 14 +++++ Misc/NEWS | 3 + Modules/resource.c | 64 +++++++++++++------------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -158,6 +158,20 @@ self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, limit), limit) + # Issue 20191: Reference counting bug + @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit') + @support.requires_linux_version(2, 6, 36) + def test_prlimit_refcount(self): + class BadSeq: + def __len__(self): + return 2 + def __getitem__(self, key): + return limits[key] - 1 # new reference + + limits = resource.getrlimit(resource.RLIMIT_AS) + self.assertEqual(resource.prlimit(0, resource.RLIMIT_AS, BadSeq()), + limits) + def test_main(verbose=None): support.run_unittest(ResourceTest) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -197,6 +197,9 @@ Library ------- +- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that + doesn't own its elements as limits. + - Issue #16255: subprocess.Popen uses /system/bin/sh on Android as the shell, instead of /bin/sh. diff --git a/Modules/resource.c b/Modules/resource.c --- a/Modules/resource.c +++ b/Modules/resource.c @@ -107,29 +107,46 @@ } static int -py2rlimit(PyObject *curobj, PyObject *maxobj, struct rlimit *rl_out) +py2rlimit(PyObject *limits, struct rlimit *rl_out) { + PyObject *curobj, *maxobj; + limits = PySequence_Tuple(limits); + if (!limits) + /* Here limits is a borrowed reference */ + return -1; + + if (PyTuple_GET_SIZE(limits) != 2) { + PyErr_SetString(PyExc_ValueError, + "expected a tuple of 2 integers"); + goto error; + } + curobj = PyTuple_GET_ITEM(limits, 0); + maxobj = PyTuple_GET_ITEM(limits, 1); #if !defined(HAVE_LARGEFILE_SUPPORT) rl_out->rlim_cur = PyLong_AsLong(curobj); if (rl_out->rlim_cur == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; rl_out->rlim_max = PyLong_AsLong(maxobj); if (rl_out->rlim_max == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; #else /* The limits are probably bigger than a long */ rl_out->rlim_cur = PyLong_AsLongLong(curobj); if (rl_out->rlim_cur == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; rl_out->rlim_max = PyLong_AsLongLong(maxobj); if (rl_out->rlim_max == (rlim_t)-1 && PyErr_Occurred()) - return -1; + goto error; #endif + Py_DECREF(limits); rl_out->rlim_cur = rl_out->rlim_cur & RLIM_INFINITY; rl_out->rlim_max = rl_out->rlim_max & RLIM_INFINITY; return 0; +error: + Py_DECREF(limits); + return -1; } static PyObject* @@ -170,7 +187,7 @@ { struct rlimit rl; int resource; - PyObject *limits, *curobj, *maxobj; + PyObject *limits; if (!PyArg_ParseTuple(args, "iO:setrlimit", &resource, &limits)) return NULL; @@ -181,21 +198,8 @@ return NULL; } - limits = PySequence_Tuple(limits); - if (!limits) - /* Here limits is a borrowed reference */ + if (py2rlimit(limits, &rl) < 0) { return NULL; - - if (PyTuple_GET_SIZE(limits) != 2) { - PyErr_SetString(PyExc_ValueError, - "expected a tuple of 2 integers"); - goto error; - } - curobj = PyTuple_GET_ITEM(limits, 0); - maxobj = PyTuple_GET_ITEM(limits, 1); - - if (py2rlimit(curobj, maxobj, &rl) < 0) { - goto error; } if (setrlimit(resource, &rl) == -1) { @@ -207,15 +211,9 @@ "not allowed to raise maximum limit"); else PyErr_SetFromErrno(PyExc_OSError); - goto error; + return NULL; } - Py_DECREF(limits); - Py_INCREF(Py_None); - return Py_None; - - error: - Py_DECREF(limits); - return NULL; + Py_RETURN_NONE; } #ifdef HAVE_PRLIMIT @@ -225,10 +223,10 @@ struct rlimit old_limit, new_limit; int resource, retval; pid_t pid; - PyObject *curobj=NULL, *maxobj=NULL; + PyObject *limits = NULL; - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|(OO):prlimit", - &pid, &resource, &curobj, &maxobj)) + if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i|O:prlimit", + &pid, &resource, &limits)) return NULL; if (resource < 0 || resource >= RLIM_NLIMITS) { @@ -237,8 +235,8 @@ return NULL; } - if (curobj != NULL) { - if (py2rlimit(curobj, maxobj, &new_limit) < 0) { + if (limits != NULL) { + if (py2rlimit(limits, &new_limit) < 0) { return NULL; } retval = prlimit(pid, resource, &new_limit, &old_limit); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 01:47:04 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 19 Dec 2016 06:47:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2325677=3A_Merge_SyntaxError_caret_positioning_from_3?= =?utf-8?q?=2E5?= Message-ID: <20161219064704.35257.44024.B15BFA58@psf.io> https://hg.python.org/cpython/rev/d4effdd699de changeset: 105734:d4effdd699de branch: 3.6 parent: 105731:7bc2923a41b6 parent: 105733:35b50c26f780 user: Martin Panter date: Mon Dec 19 06:46:01 2016 +0000 summary: Issue #25677: Merge SyntaxError caret positioning from 3.5 files: Lib/test/test_cmd_line_script.py | 33 ++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + Python/errors.c | 5 +-- Python/pythonrun.c | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -10,6 +10,7 @@ import os.path import py_compile import subprocess +import io import textwrap from test import support @@ -539,6 +540,38 @@ text = stderr.decode('ascii') self.assertEqual(text, "some text") + def test_syntaxerror_unindented_caret_position(self): + script = "1 + 1 = 2\n" + with support.temp_dir() as script_dir: + script_name = _make_test_script(script_dir, 'script', script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() + # Confirm that the caret is located under the first 1 character + self.assertIn("\n 1 + 1 = 2\n ^", text) + + def test_syntaxerror_indented_caret_position(self): + script = textwrap.dedent("""\ + if True: + 1 + 1 = 2 + """) + with support.temp_dir() as script_dir: + script_name = _make_test_script(script_dir, 'script', script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() + # Confirm that the caret is located under the first 1 character + self.assertIn("\n 1 + 1 = 2\n ^", text) + + # Try the same with a form feed at the start of the indented line + script = ( + "if True:\n" + "\f 1 + 1 = 2\n" + ) + script_name = _make_test_script(script_dir, "script", script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), "ascii").read() + self.assertNotIn("\f", text) + self.assertIn("\n 1 + 1 = 2\n ^", text) + def test_main(): support.run_unittest(CmdLineTest) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -851,6 +851,7 @@ Chris Lawrence Mark Lawrence Chris Laws +Michael Layzell Michael Lazar Brian Leair Mathieu Leduc-Hamel diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #25677: Correct the positioning of the syntax error caret for + indented blocks. Based on patch by Michael Layzell. + - Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -1144,11 +1144,8 @@ } fclose(fp); if (i == lineno) { - char *p = linebuf; PyObject *res; - while (*p == ' ' || *p == '\t' || *p == '\014') - p++; - res = PyUnicode_FromString(p); + res = PyUnicode_FromString(linebuf); if (res == NULL) PyErr_Clear(); return res; diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -528,7 +528,7 @@ offset -= (int)(nl+1-text); text = nl+1; } - while (*text == ' ' || *text == '\t') { + while (*text == ' ' || *text == '\t' || *text == '\f') { text++; offset--; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 01:47:04 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 19 Dec 2016 06:47:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325677=3A_Merge_SyntaxError_caret_positioning_fr?= =?utf-8?q?om_3=2E6?= Message-ID: <20161219064704.21696.1543.1B703127@psf.io> https://hg.python.org/cpython/rev/2342726ea0c0 changeset: 105735:2342726ea0c0 parent: 105732:b4d2bff1c5f8 parent: 105734:d4effdd699de user: Martin Panter date: Mon Dec 19 06:46:12 2016 +0000 summary: Issue #25677: Merge SyntaxError caret positioning from 3.6 files: Lib/test/test_cmd_line_script.py | 33 ++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + Python/errors.c | 5 +-- Python/pythonrun.c | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -10,6 +10,7 @@ import os.path import py_compile import subprocess +import io import textwrap from test import support @@ -539,6 +540,38 @@ text = stderr.decode('ascii') self.assertEqual(text, "some text") + def test_syntaxerror_unindented_caret_position(self): + script = "1 + 1 = 2\n" + with support.temp_dir() as script_dir: + script_name = _make_test_script(script_dir, 'script', script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() + # Confirm that the caret is located under the first 1 character + self.assertIn("\n 1 + 1 = 2\n ^", text) + + def test_syntaxerror_indented_caret_position(self): + script = textwrap.dedent("""\ + if True: + 1 + 1 = 2 + """) + with support.temp_dir() as script_dir: + script_name = _make_test_script(script_dir, 'script', script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() + # Confirm that the caret is located under the first 1 character + self.assertIn("\n 1 + 1 = 2\n ^", text) + + # Try the same with a form feed at the start of the indented line + script = ( + "if True:\n" + "\f 1 + 1 = 2\n" + ) + script_name = _make_test_script(script_dir, "script", script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), "ascii").read() + self.assertNotIn("\f", text) + self.assertIn("\n 1 + 1 = 2\n ^", text) + def test_main(): support.run_unittest(CmdLineTest) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -852,6 +852,7 @@ Chris Lawrence Mark Lawrence Chris Laws +Michael Layzell Michael Lazar Brian Leair Mathieu Leduc-Hamel diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #25677: Correct the positioning of the syntax error caret for + indented blocks. Based on patch by Michael Layzell. + - Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -1138,11 +1138,8 @@ } fclose(fp); if (i == lineno) { - char *p = linebuf; PyObject *res; - while (*p == ' ' || *p == '\t' || *p == '\014') - p++; - res = PyUnicode_FromString(p); + res = PyUnicode_FromString(linebuf); if (res == NULL) PyErr_Clear(); return res; diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -528,7 +528,7 @@ offset -= (int)(nl+1-text); text = nl+1; } - while (*text == ' ' || *text == '\t') { + while (*text == ' ' || *text == '\t' || *text == '\f') { text++; offset--; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 01:47:04 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 19 Dec 2016 06:47:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1Njc3?= =?utf-8?q?=3A_Correct_syntax_error_caret_for_indented_blocks=2E?= Message-ID: <20161219064703.10818.38808.327DCEF6@psf.io> https://hg.python.org/cpython/rev/35b50c26f780 changeset: 105733:35b50c26f780 branch: 3.5 parent: 105730:dac72bc14c00 user: Martin Panter date: Sun Dec 11 00:18:36 2016 +0000 summary: Issue #25677: Correct syntax error caret for indented blocks. Based on patch by Michael Layzell. files: Lib/test/test_cmd_line_script.py | 33 ++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 + Python/errors.c | 5 +-- Python/pythonrun.c | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -10,6 +10,7 @@ import os.path import py_compile import subprocess +import io import textwrap from test import support @@ -540,6 +541,38 @@ text = stderr.decode('ascii') self.assertEqual(text, "some text") + def test_syntaxerror_unindented_caret_position(self): + script = "1 + 1 = 2\n" + with support.temp_dir() as script_dir: + script_name = _make_test_script(script_dir, 'script', script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() + # Confirm that the caret is located under the first 1 character + self.assertIn("\n 1 + 1 = 2\n ^", text) + + def test_syntaxerror_indented_caret_position(self): + script = textwrap.dedent("""\ + if True: + 1 + 1 = 2 + """) + with support.temp_dir() as script_dir: + script_name = _make_test_script(script_dir, 'script', script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), 'ascii').read() + # Confirm that the caret is located under the first 1 character + self.assertIn("\n 1 + 1 = 2\n ^", text) + + # Try the same with a form feed at the start of the indented line + script = ( + "if True:\n" + "\f 1 + 1 = 2\n" + ) + script_name = _make_test_script(script_dir, "script", script) + exitcode, stdout, stderr = assert_python_failure(script_name) + text = io.TextIOWrapper(io.BytesIO(stderr), "ascii").read() + self.assertNotIn("\f", text) + self.assertIn("\n 1 + 1 = 2\n ^", text) + def test_main(): support.run_unittest(CmdLineTest) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -840,6 +840,7 @@ Chris Lawrence Mark Lawrence Chris Laws +Michael Layzell Michael Lazar Brian Leair Mathieu Leduc-Hamel diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #25677: Correct the positioning of the syntax error caret for + indented blocks. Based on patch by Michael Layzell. + - Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. diff --git a/Python/errors.c b/Python/errors.c --- a/Python/errors.c +++ b/Python/errors.c @@ -1094,11 +1094,8 @@ } fclose(fp); if (i == lineno) { - char *p = linebuf; PyObject *res; - while (*p == ' ' || *p == '\t' || *p == '\014') - p++; - res = PyUnicode_FromString(p); + res = PyUnicode_FromString(linebuf); if (res == NULL) PyErr_Clear(); return res; diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -528,7 +528,7 @@ offset -= (int)(nl+1-text); text = nl+1; } - while (*text == ' ' || *text == '\t') { + while (*text == ' ' || *text == '\t' || *text == '\f') { text++; offset--; } -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Dec 19 04:05:54 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 19 Dec 2016 09:05:54 +0000 Subject: [Python-checkins] Daily reference leaks (3cc193be79ab): sum=-2 Message-ID: <20161219090554.95845.80489.F7661A74@psf.io> results for 3cc193be79ab 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/reflogQbytKo', '--timeout', '7200'] From python-checkins at python.org Mon Dec 19 04:47:33 2016 From: python-checkins at python.org (xavier.degaye) Date: Mon, 19 Dec 2016 09:47:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4OTk2?= =?utf-8?q?=3A_Skip_two_tests_that_fail_on_Android_with_the_locale_strcoll?= =?utf-8?b?KCkgYW5k?= Message-ID: <20161219094732.128270.60993.6D6EF085@psf.io> https://hg.python.org/cpython/rev/781c56168484 changeset: 105736:781c56168484 branch: 3.6 parent: 105734:d4effdd699de user: Xavier de Gaye date: Mon Dec 19 10:46:14 2016 +0100 summary: Issue #28996: Skip two tests that fail on Android with the locale strcoll() and strxfrm() functions. files: Lib/test/test_locale.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -1,4 +1,4 @@ -from test.support import verbose +from test.support import verbose, is_android import unittest import locale import sys @@ -353,7 +353,7 @@ enc = codecs.lookup(locale.getpreferredencoding(False) or 'ascii').name if enc not in ('utf-8', 'iso8859-1', 'cp1252'): raise unittest.SkipTest('encoding not suitable') - if enc != 'iso8859-1' and (sys.platform == 'darwin' or + if enc != 'iso8859-1' and (sys.platform == 'darwin' or is_android or sys.platform.startswith('freebsd')): raise unittest.SkipTest('wcscoll/wcsxfrm have known bugs') BaseLocalizedTest.setUp(self) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 04:47:33 2016 From: python-checkins at python.org (xavier.degaye) Date: Mon, 19 Dec 2016 09:47:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4OTk2OiBNZXJnZSAzLjYu?= Message-ID: <20161219094732.127903.77007.6059CAD5@psf.io> https://hg.python.org/cpython/rev/5c5cf7687dc1 changeset: 105737:5c5cf7687dc1 parent: 105735:2342726ea0c0 parent: 105736:781c56168484 user: Xavier de Gaye date: Mon Dec 19 10:46:59 2016 +0100 summary: Issue #28996: Merge 3.6. files: Lib/test/test_locale.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_locale.py b/Lib/test/test_locale.py --- a/Lib/test/test_locale.py +++ b/Lib/test/test_locale.py @@ -1,4 +1,4 @@ -from test.support import verbose +from test.support import verbose, is_android import unittest import locale import sys @@ -353,7 +353,7 @@ enc = codecs.lookup(locale.getpreferredencoding(False) or 'ascii').name if enc not in ('utf-8', 'iso8859-1', 'cp1252'): raise unittest.SkipTest('encoding not suitable') - if enc != 'iso8859-1' and (sys.platform == 'darwin' or + if enc != 'iso8859-1' and (sys.platform == 'darwin' or is_android or sys.platform.startswith('freebsd')): raise unittest.SkipTest('wcscoll/wcsxfrm have known bugs') BaseLocalizedTest.setUp(self) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:01:22 2016 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 19 Dec 2016 10:01:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2319542=3A_Fix_bugs_in_WeakValueDictionary=2Esetd?= =?utf-8?q?efault=28=29_and?= Message-ID: <20161219100122.96582.93130.5D81B98E@psf.io> https://hg.python.org/cpython/rev/ac2715d04119 changeset: 105740:ac2715d04119 parent: 105737:5c5cf7687dc1 parent: 105739:f3706a9430da user: Antoine Pitrou date: Mon Dec 19 10:59:15 2016 +0100 summary: Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. Original patch and report by Armin Rigo. files: Lib/test/test_weakref.py | 41 ++++++++++++++++++++++++++++ Lib/weakref.py | 13 +++++--- Misc/NEWS | 4 ++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -6,6 +6,7 @@ import operator import contextlib import copy +import time from test import support from test.support import script_helper @@ -72,6 +73,29 @@ self.cbcalled += 1 + at contextlib.contextmanager +def collect_in_thread(period=0.0001): + """ + Ensure GC collections happen in a different thread, at a high frequency. + """ + threading = support.import_module('threading') + please_stop = False + + def collect(): + while not please_stop: + time.sleep(period) + gc.collect() + + with support.disable_gc(): + t = threading.Thread(target=collect) + t.start() + try: + yield + finally: + please_stop = True + t.join() + + class ReferencesTestCase(TestBase): def test_basic_ref(self): @@ -1636,6 +1660,23 @@ dict = weakref.WeakKeyDictionary() self.assertRegex(repr(dict), '') + def test_threaded_weak_valued_setdefault(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(100000): + x = d.setdefault(10, RefCycle()) + self.assertIsNot(x, None) # we never put None in there! + del x + + def test_threaded_weak_valued_pop(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(100000): + d[10] = RefCycle() + x = d.pop(10, 10) + self.assertIsNot(x, None) # we never put None in there! + + from test import mapping_tests class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -239,24 +239,27 @@ try: o = self.data.pop(key)() except KeyError: + o = None + if o is None: if args: return args[0] - raise - if o is None: - raise KeyError(key) + else: + raise KeyError(key) else: return o def setdefault(self, key, default=None): try: - wr = self.data[key] + o = self.data[key]() except KeyError: + o = None + if o is None: if self._pending_removals: self._commit_removals() self.data[key] = KeyedRef(default, self._remove, key) return default else: - return wr() + return o def update(*args, **kwargs): if not args: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,10 @@ Library ------- +- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and + WeakValueDictionary.pop() when a GC collection happens in another + thread. + - Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:01:22 2016 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 19 Dec 2016 10:01:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE5NTQy?= =?utf-8?q?=3A_Fix_bugs_in_WeakValueDictionary=2Esetdefault=28=29_and?= Message-ID: <20161219100121.96252.60481.544D1DD6@psf.io> https://hg.python.org/cpython/rev/5a542a2bca08 changeset: 105738:5a542a2bca08 branch: 3.5 parent: 105733:35b50c26f780 user: Antoine Pitrou date: Mon Dec 19 10:56:40 2016 +0100 summary: Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. Original patch and report by Armin Rigo. files: Lib/test/test_weakref.py | 41 ++++++++++++++++++++++++++++ Lib/weakref.py | 13 +++++--- Misc/NEWS | 4 ++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -6,6 +6,7 @@ import operator import contextlib import copy +import time from test import support from test.support import script_helper @@ -72,6 +73,29 @@ self.cbcalled += 1 + at contextlib.contextmanager +def collect_in_thread(period=0.0001): + """ + Ensure GC collections happen in a different thread, at a high frequency. + """ + threading = support.import_module('threading') + please_stop = False + + def collect(): + while not please_stop: + time.sleep(period) + gc.collect() + + with support.disable_gc(): + t = threading.Thread(target=collect) + t.start() + try: + yield + finally: + please_stop = True + t.join() + + class ReferencesTestCase(TestBase): def test_basic_ref(self): @@ -1633,6 +1657,23 @@ dict = weakref.WeakKeyDictionary() self.assertRegex(repr(dict), '') + def test_threaded_weak_valued_setdefault(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(100000): + x = d.setdefault(10, RefCycle()) + self.assertIsNot(x, None) # we never put None in there! + del x + + def test_threaded_weak_valued_pop(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(100000): + d[10] = RefCycle() + x = d.pop(10, 10) + self.assertIsNot(x, None) # we never put None in there! + + from test import mapping_tests class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -239,24 +239,27 @@ try: o = self.data.pop(key)() except KeyError: + o = None + if o is None: if args: return args[0] - raise - if o is None: - raise KeyError(key) + else: + raise KeyError(key) else: return o def setdefault(self, key, default=None): try: - wr = self.data[key] + o = self.data[key]() except KeyError: + o = None + if o is None: if self._pending_removals: self._commit_removals() self.data[key] = KeyedRef(default, self._remove, key) return default else: - return wr() + return o def update(*args, **kwargs): if not args: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -133,6 +133,10 @@ Library ------- +- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and + WeakValueDictionary.pop() when a GC collection happens in another + thread. + - Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:01:22 2016 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 19 Dec 2016 10:01:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2319542=3A_Fix_bugs_in_WeakValueDictionary=2Esetdefault?= =?utf-8?b?KCkgYW5k?= Message-ID: <20161219100122.6558.84490.67380F8A@psf.io> https://hg.python.org/cpython/rev/f3706a9430da changeset: 105739:f3706a9430da branch: 3.6 parent: 105736:781c56168484 parent: 105738:5a542a2bca08 user: Antoine Pitrou date: Mon Dec 19 10:58:14 2016 +0100 summary: Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. Original patch and report by Armin Rigo. files: Lib/test/test_weakref.py | 41 ++++++++++++++++++++++++++++ Lib/weakref.py | 13 +++++--- Misc/NEWS | 4 ++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -6,6 +6,7 @@ import operator import contextlib import copy +import time from test import support from test.support import script_helper @@ -72,6 +73,29 @@ self.cbcalled += 1 + at contextlib.contextmanager +def collect_in_thread(period=0.0001): + """ + Ensure GC collections happen in a different thread, at a high frequency. + """ + threading = support.import_module('threading') + please_stop = False + + def collect(): + while not please_stop: + time.sleep(period) + gc.collect() + + with support.disable_gc(): + t = threading.Thread(target=collect) + t.start() + try: + yield + finally: + please_stop = True + t.join() + + class ReferencesTestCase(TestBase): def test_basic_ref(self): @@ -1636,6 +1660,23 @@ dict = weakref.WeakKeyDictionary() self.assertRegex(repr(dict), '') + def test_threaded_weak_valued_setdefault(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(100000): + x = d.setdefault(10, RefCycle()) + self.assertIsNot(x, None) # we never put None in there! + del x + + def test_threaded_weak_valued_pop(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(100000): + d[10] = RefCycle() + x = d.pop(10, 10) + self.assertIsNot(x, None) # we never put None in there! + + from test import mapping_tests class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -239,24 +239,27 @@ try: o = self.data.pop(key)() except KeyError: + o = None + if o is None: if args: return args[0] - raise - if o is None: - raise KeyError(key) + else: + raise KeyError(key) else: return o def setdefault(self, key, default=None): try: - wr = self.data[key] + o = self.data[key]() except KeyError: + o = None + if o is None: if self._pending_removals: self._commit_removals() self.data[key] = KeyedRef(default, self._remove, key) return default else: - return wr() + return o def update(*args, **kwargs): if not args: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,10 @@ Library ------- +- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and + WeakValueDictionary.pop() when a GC collection happens in another + thread. + - Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that doesn't own its elements as limits. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:13:57 2016 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 19 Dec 2016 10:13:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE5NTQy?= =?utf-8?q?=3A_Fix_bugs_in_WeakValueDictionary=2Esetdefault=28=29_and?= Message-ID: <20161219101357.96582.80055.D377048A@psf.io> https://hg.python.org/cpython/rev/bcb1f0698401 changeset: 105741:bcb1f0698401 branch: 2.7 parent: 105721:34b9fe09a2b7 user: Antoine Pitrou date: Mon Dec 19 11:12:58 2016 +0100 summary: Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. Original patch and report by Armin Rigo. files: Lib/test/test_support.py | 10 ++++++ Lib/test/test_weakref.py | 44 ++++++++++++++++++++++++++++ Lib/weakref.py | 13 +++++--- Misc/NEWS | 4 ++ 4 files changed, 66 insertions(+), 5 deletions(-) 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 @@ -1710,3 +1710,13 @@ # The sequence should be deallocated just after the end of iterating gc_collect() test.assertTrue(done[0]) + + at contextlib.contextmanager +def disable_gc(): + have_gc = gc.isenabled() + gc.disable() + try: + yield + finally: + if have_gc: + gc.enable() diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -6,6 +6,7 @@ import operator import contextlib import copy +import time from test import test_support @@ -56,6 +57,32 @@ self.cycle = self + at contextlib.contextmanager +def collect_in_thread(period=0.0001): + """ + Ensure GC collections happen in a different thread, at a high frequency. + """ + threading = test_support.import_module('threading') + please_stop = False + + def collect(): + while not please_stop: + time.sleep(period) + gc.collect() + + with test_support.disable_gc(): + old_interval = sys.getcheckinterval() + sys.setcheckinterval(20) + t = threading.Thread(target=collect) + t.start() + try: + yield + finally: + please_stop = True + t.join() + sys.setcheckinterval(old_interval) + + class TestBase(unittest.TestCase): def setUp(self): @@ -1394,6 +1421,23 @@ self.assertEqual(len(d), 0) self.assertEqual(count, 2) + def test_threaded_weak_valued_setdefault(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(50000): + x = d.setdefault(10, RefCycle()) + self.assertIsNot(x, None) # we never put None in there! + del x + + def test_threaded_weak_valued_pop(self): + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(50000): + d[10] = RefCycle() + x = d.pop(10, 10) + self.assertIsNot(x, None) # we never put None in there! + + from test import mapping_tests class WeakValueDictionaryTestCase(mapping_tests.BasicTestMappingProtocol): diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -202,24 +202,27 @@ try: o = self.data.pop(key)() except KeyError: + o = None + if o is None: if args: return args[0] - raise - if o is None: - raise KeyError, key + else: + raise KeyError, key else: return o def setdefault(self, key, default=None): try: - wr = self.data[key] + o = self.data[key]() except KeyError: + o = None + if o is None: if self._pending_removals: self._commit_removals() self.data[key] = KeyedRef(default, self._remove, key) return default else: - return wr() + return o def update(*args, **kwargs): if not args: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and + WeakValueDictionary.pop() when a GC collection happens in another + thread. + - Issue #28925: cPickle now correctly propagates errors when unpickle instances of old-style classes. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:43:38 2016 From: python-checkins at python.org (xiang.zhang) Date: Mon, 19 Dec 2016 10:43:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDA5?= =?utf-8?q?=3A_Remove_outdated_doc_of_PyUnicode=5FRichCompare=2E?= Message-ID: <20161219104338.95989.48037.EE3ACFC2@psf.io> https://hg.python.org/cpython/rev/8f5ed2a38f64 changeset: 105742:8f5ed2a38f64 branch: 3.5 parent: 105738:5a542a2bca08 user: Xiang Zhang date: Mon Dec 19 18:35:14 2016 +0800 summary: Issue #29009: Remove outdated doc of PyUnicode_RichCompare. files: Doc/c-api/unicode.rst | 4 ---- Include/unicodeobject.h | 4 ---- 2 files changed, 0 insertions(+), 8 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1663,10 +1663,6 @@ * :const:`Py_True` or :const:`Py_False` for successful comparisons * :const:`Py_NotImplemented` in case the type combination is unknown - Note that :const:`Py_EQ` and :const:`Py_NE` comparisons can cause a - :exc:`UnicodeWarning` in case the conversion of the arguments to Unicode fails - with a :exc:`UnicodeDecodeError`. - Possible values for *op* are :const:`Py_GT`, :const:`Py_GE`, :const:`Py_EQ`, :const:`Py_NE`, :const:`Py_LT`, and :const:`Py_LE`. diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2047,10 +2047,6 @@ - Py_True or Py_False for successful comparisons - Py_NotImplemented in case the type combination is unknown - Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in - case the conversion of the arguments to Unicode fails with a - UnicodeDecodeError. - Possible values for op: Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:43:40 2016 From: python-checkins at python.org (xiang.zhang) Date: Mon, 19 Dec 2016 10:43:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI5MDA5OiBNZXJnZSAzLjYu?= Message-ID: <20161219104338.21572.67953.3C541A96@psf.io> https://hg.python.org/cpython/rev/9568343fde42 changeset: 105744:9568343fde42 parent: 105740:ac2715d04119 parent: 105743:da958d01755a user: Xiang Zhang date: Mon Dec 19 18:39:28 2016 +0800 summary: Issue #29009: Merge 3.6. files: Doc/c-api/unicode.rst | 4 ---- Include/unicodeobject.h | 4 ---- 2 files changed, 0 insertions(+), 8 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1668,10 +1668,6 @@ * :const:`Py_True` or :const:`Py_False` for successful comparisons * :const:`Py_NotImplemented` in case the type combination is unknown - Note that :const:`Py_EQ` and :const:`Py_NE` comparisons can cause a - :exc:`UnicodeWarning` in case the conversion of the arguments to Unicode fails - with a :exc:`UnicodeDecodeError`. - Possible values for *op* are :const:`Py_GT`, :const:`Py_GE`, :const:`Py_EQ`, :const:`Py_NE`, :const:`Py_LT`, and :const:`Py_LE`. diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2079,10 +2079,6 @@ - Py_True or Py_False for successful comparisons - Py_NotImplemented in case the type combination is unknown - Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in - case the conversion of the arguments to Unicode fails with a - UnicodeDecodeError. - Possible values for op: Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 05:43:40 2016 From: python-checkins at python.org (xiang.zhang) Date: Mon, 19 Dec 2016 10:43:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329009=3A_Merge_3=2E5=2E?= Message-ID: <20161219104338.21630.96805.30BCA0D4@psf.io> https://hg.python.org/cpython/rev/da958d01755a changeset: 105743:da958d01755a branch: 3.6 parent: 105739:f3706a9430da parent: 105742:8f5ed2a38f64 user: Xiang Zhang date: Mon Dec 19 18:39:02 2016 +0800 summary: Issue #29009: Merge 3.5. files: Doc/c-api/unicode.rst | 4 ---- Include/unicodeobject.h | 4 ---- 2 files changed, 0 insertions(+), 8 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1668,10 +1668,6 @@ * :const:`Py_True` or :const:`Py_False` for successful comparisons * :const:`Py_NotImplemented` in case the type combination is unknown - Note that :const:`Py_EQ` and :const:`Py_NE` comparisons can cause a - :exc:`UnicodeWarning` in case the conversion of the arguments to Unicode fails - with a :exc:`UnicodeDecodeError`. - Possible values for *op* are :const:`Py_GT`, :const:`Py_GE`, :const:`Py_EQ`, :const:`Py_NE`, :const:`Py_LT`, and :const:`Py_LE`. diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -2075,10 +2075,6 @@ - Py_True or Py_False for successful comparisons - Py_NotImplemented in case the type combination is unknown - Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in - case the conversion of the arguments to Unicode fails with a - UnicodeDecodeError. - Possible values for op: Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 07:10:38 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 19 Dec 2016 12:10:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161219121038.32048.97388.AB6E795D@psf.io> https://hg.python.org/cpython/rev/df005bf900d7 changeset: 105747:df005bf900d7 parent: 105744:9568343fde42 parent: 105746:283632069a0d user: Victor Stinner date: Mon Dec 19 13:10:11 2016 +0100 summary: Merge 3.6 files: Doc/reference/datamodel.rst | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1338,11 +1338,14 @@ Called by built-in function :func:`hash` and for operations on members of hashed collections including :class:`set`, :class:`frozenset`, and - :class:`dict`. :meth:`__hash__` should return an integer. The only - required property is that objects which compare equal have the same hash - value; it is advised to somehow mix together (e.g. using exclusive or) the - hash values for the components of the object that also play a part in - comparison of objects. + :class:`dict`. :meth:`__hash__` should return an integer. The only required + property is that objects which compare equal have the same hash value; it is + advised to mix together the hash values of the components of the object that + also play a part in comparison of objects by packing them into a tuple and + hashing the tuple. Example:: + + def __hash__(self): + return hash((self.name, self.nick, self.color)) .. note:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 07:10:41 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 19 Dec 2016 12:10:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5?= Message-ID: <20161219121038.34246.23503.A364F9E0@psf.io> https://hg.python.org/cpython/rev/283632069a0d changeset: 105746:283632069a0d branch: 3.6 parent: 105743:da958d01755a parent: 105745:cb802a78ceea user: Victor Stinner date: Mon Dec 19 13:09:55 2016 +0100 summary: Merge 3.5 files: Doc/reference/datamodel.rst | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1338,11 +1338,14 @@ Called by built-in function :func:`hash` and for operations on members of hashed collections including :class:`set`, :class:`frozenset`, and - :class:`dict`. :meth:`__hash__` should return an integer. The only - required property is that objects which compare equal have the same hash - value; it is advised to somehow mix together (e.g. using exclusive or) the - hash values for the components of the object that also play a part in - comparison of objects. + :class:`dict`. :meth:`__hash__` should return an integer. The only required + property is that objects which compare equal have the same hash value; it is + advised to mix together the hash values of the components of the object that + also play a part in comparison of objects by packing them into a tuple and + hashing the tuple. Example:: + + def __hash__(self): + return hash((self.name, self.nick, self.color)) .. note:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 07:10:41 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 19 Dec 2016 12:10:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogZG9jOiBTdWdnZXN0?= =?utf-8?q?_to_hash=28tuple_of_attr=29_rather_than_XOR?= Message-ID: <20161219121037.96777.65297.A6D26E1D@psf.io> https://hg.python.org/cpython/rev/cb802a78ceea changeset: 105745:cb802a78ceea branch: 3.5 parent: 105742:8f5ed2a38f64 user: Victor Stinner date: Mon Dec 19 13:09:28 2016 +0100 summary: doc: Suggest to hash(tuple of attr) rather than XOR Issue #28383: __hash__ documentation recommends naive XOR to combine but this is suboptimal. Update the doc to suggest to reuse the hash() method using a tuple, with an example. files: Doc/reference/datamodel.rst | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1305,11 +1305,14 @@ Called by built-in function :func:`hash` and for operations on members of hashed collections including :class:`set`, :class:`frozenset`, and - :class:`dict`. :meth:`__hash__` should return an integer. The only - required property is that objects which compare equal have the same hash - value; it is advised to somehow mix together (e.g. using exclusive or) the - hash values for the components of the object that also play a part in - comparison of objects. + :class:`dict`. :meth:`__hash__` should return an integer. The only required + property is that objects which compare equal have the same hash value; it is + advised to mix together the hash values of the components of the object that + also play a part in comparison of objects by packing them into a tuple and + hashing the tuple. Example:: + + def __hash__(self): + return hash((self.name, self.nick, self.color)) .. note:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 07:12:43 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 19 Dec 2016 12:12:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_abstract=2Eh=3A_remove_lon?= =?utf-8?q?g_outdated_comment?= Message-ID: <20161219121237.34282.26029.8620DC81@psf.io> https://hg.python.org/cpython/rev/3ab0a6692e25 changeset: 105748:3ab0a6692e25 user: Victor Stinner date: Mon Dec 19 13:12:08 2016 +0100 summary: abstract.h: remove long outdated comment Issue #28838: The documentation is of the Python C API is more complete and more up to date than this old comment. Removal suggested by Antoine Pitrou. files: Include/abstract.h | 120 +-------------------------------- 1 files changed, 2 insertions(+), 118 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -1,127 +1,11 @@ +/* Abstract Object Interface (many thanks to Jim Fulton) */ + #ifndef Py_ABSTRACTOBJECT_H #define Py_ABSTRACTOBJECT_H #ifdef __cplusplus extern "C" { #endif -/* Abstract Object Interface (many thanks to Jim Fulton) */ - -/* - PROPOSAL: A Generic Python Object Interface for Python C Modules - -Problem - - Python modules written in C that must access Python objects must do - so through routines whose interfaces are described by a set of - include files. Unfortunately, these routines vary according to the - object accessed. To use these routines, the C programmer must check - the type of the object being used and must call a routine based on - the object type. For example, to access an element of a sequence, - the programmer must determine whether the sequence is a list or a - tuple: - - if (is_tupleobject(o)) - e = gettupleitem(o, i) - else if (is_listitem(o)) - e = getlistitem(o, i) - - If the programmer wants to get an item from another type of object - that provides sequence behavior, there is no clear way to do it - correctly. - - The persistent programmer may peruse object.h and find that the - _typeobject structure provides a means of invoking up to (currently - about) 41 special operators. So, for example, a routine can get an - item from any object that provides sequence behavior. However, to - use this mechanism, the programmer must make their code dependent on - the current Python implementation. - - Also, certain semantics, especially memory management semantics, may - differ by the type of object being used. Unfortunately, these - semantics are not clearly described in the current include files. - An abstract interface providing more consistent semantics is needed. - -Proposal - - I propose the creation of a standard interface (with an associated - library of routines and/or macros) for generically obtaining the - services of Python objects. This proposal can be viewed as one - components of a Python C interface consisting of several components. - - From the viewpoint of C access to Python services, we have (as - suggested by Guido in off-line discussions): - - - "Very high level layer": two or three functions that let you exec or - eval arbitrary Python code given as a string in a module whose name is - given, passing C values in and getting C values out using - mkvalue/getargs style format strings. This does not require the user - to declare any variables of type "PyObject *". This should be enough - to write a simple application that gets Python code from the user, - execs it, and returns the output or errors. (Error handling must also - be part of this API.) - - - "Abstract objects layer": which is the subject of this proposal. - It has many functions operating on objects, and lest you do many - things from C that you can also write in Python, without going - through the Python parser. - - - "Concrete objects layer": This is the public type-dependent - interface provided by the standard built-in types, such as floats, - strings, and lists. This interface exists and is currently - documented by the collection of include files provided with the - Python distributions. - - From the point of view of Python accessing services provided by C - modules: - - - "Python module interface": this interface consist of the basic - routines used to define modules and their members. Most of the - current extensions-writing guide deals with this interface. - - - "Built-in object interface": this is the interface that a new - built-in type must provide and the mechanisms and rules that a - developer of a new built-in type must use and follow. - - This proposal is a "first-cut" that is intended to spur - discussion. See especially the lists of notes. - - The Python C object interface will provide four protocols: object, - numeric, sequence, and mapping. Each protocol consists of a - collection of related operations. If an operation that is not - provided by a particular type is invoked, then a standard exception, - NotImplementedError is raised with an operation name as an argument. - In addition, for convenience this interface defines a set of - constructors for building objects of built-in types. This is needed - so new objects can be returned from C functions that otherwise treat - objects generically. - -Memory Management - - For all of the functions described in this proposal, if a function - retains a reference to a Python object passed as an argument, then the - function will increase the reference count of the object. It is - unnecessary for the caller to increase the reference count of an - argument in anticipation of the object's retention. - - All Python objects returned from functions should be treated as new - objects. Functions that return objects assume that the caller will - retain a reference and the reference count of the object has already - been incremented to account for this fact. A caller that does not - retain a reference to an object that is returned from a function - must decrement the reference count of the object (using - DECREF(object)) to prevent memory leaks. - - Note that the behavior mentioned here is different from the current - behavior for some objects (e.g. lists and tuples) when certain - type-specific routines are called directly (e.g. setlistitem). The - proposed abstraction layer will provide a consistent memory - management interface, correcting for inconsistent behavior for some - built-in types. - -Protocols -*/ - - /* === Object Protocol ================================================== */ /* Implemented elsewhere: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 07:16:19 2016 From: python-checkins at python.org (victor.stinner) Date: Mon, 19 Dec 2016 12:16:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogZG9jOiBTdWdnZXN0?= =?utf-8?q?_to_hash=28tuple_of_attr=29_rather_than_XOR?= Message-ID: <20161219121618.34980.72710.937CFD0B@psf.io> https://hg.python.org/cpython/rev/fac2362f248c changeset: 105749:fac2362f248c branch: 2.7 parent: 105741:bcb1f0698401 user: Victor Stinner date: Mon Dec 19 13:15:35 2016 +0100 summary: doc: Suggest to hash(tuple of attr) rather than XOR Issue #28383: __hash__ documentation recommends naive XOR to combine but this is suboptimal. Update the doc to suggest to reuse the hash() method using a tuple, with an example. files: Doc/reference/datamodel.rst | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1409,8 +1409,12 @@ hashed collections including :class:`set`, :class:`frozenset`, and :class:`dict`. :meth:`__hash__` should return an integer. The only required property is that objects which compare equal have the same hash value; it is - advised to somehow mix together (e.g. using exclusive or) the hash values for - the components of the object that also play a part in comparison of objects. + advised to mix together the hash values of the components of the object that + also play a part in comparison of objects by packing them into a tuple and + hashing the tuple. Example:: + + def __hash__(self): + return hash((self.name, self.nick, self.color)) If a class does not define a :meth:`__cmp__` or :meth:`__eq__` method it should not define a :meth:`__hash__` operation either; if it defines -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Mon Dec 19 08:57:54 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 19 Dec 2016 13:57:54 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-12-19 Message-ID: Results for project Python default, build date 2016-12-19 11:03:16 +0000 commit: 3cc193be79ab previous commit: 0b78a8c35357 revision date: 2016-12-18 20:01:38 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-( django_v2 0.32% -2.73% -2.56% 16.92% :-| pybench 0.24% 0.84% 1.69% 4.41% :-| regex_v8 3.61% -1.63% -0.74% 2.26% :-| nbody 0.11% 1.45% 0.90% 2.18% :-) json_dump_v2 0.37% 1.80% 9.77% 9.41% :-| normal_startup 0.89% -0.31% -0.85% 6.77% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-12-19/ 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 Dec 19 08:57:15 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 19 Dec 2016 13:57:15 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-12-19 Message-ID: Results for project Python 2.7, build date 2016-12-19 11:47:28 +0000 commit: 34b9fe09a2b7 previous commit: eb830f1511ef revision date: 2016-12-18 05:27:49 +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.12% -0.81% 5.07% 6.80% :-) pybench 0.17% -0.09% 7.89% 3.43% :-| regex_v8 0.59% 0.02% 0.10% 10.33% :-) nbody 0.12% -0.02% 13.26% 0.95% :-| json_dump_v2 0.14% -0.13% -0.52% 11.21% :-( normal_startup 1.75% -0.03% -2.36% 2.32% :-| ssbench 0.21% 0.04% 0.30% 1.43% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-12-19/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Mon Dec 19 09:15:05 2016 From: python-checkins at python.org (xiang.zhang) Date: Mon, 19 Dec 2016 14:15:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTUw?= =?utf-8?q?=3A_Disallow_-j0_combined_with_-T/-l/-M_in_regrtest=2E?= Message-ID: <20161219141504.96734.4641.1305CB08@psf.io> https://hg.python.org/cpython/rev/cf564121f9f0 changeset: 105750:cf564121f9f0 branch: 3.5 parent: 105745:cb802a78ceea user: Xiang Zhang date: Mon Dec 19 21:01:33 2016 +0800 summary: Issue #28950: Disallow -j0 combined with -T/-l/-M in regrtest. files: Lib/test/regrtest.py | 6 +++--- Lib/test/test_regrtest.py | 3 +++ Misc/NEWS | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -380,11 +380,11 @@ if ns.single and ns.fromfile: parser.error("-s and -f don't go together!") - if ns.use_mp and ns.trace: + if ns.use_mp is not None and ns.trace: parser.error("-T and -j don't go together!") - if ns.use_mp and ns.findleaks: + if ns.use_mp is not None and ns.findleaks: parser.error("-l and -j don't go together!") - if ns.use_mp and ns.memlimit: + if ns.use_mp is not None and ns.memlimit: parser.error("-M and -j don't go together!") if ns.failfast and not (ns.verbose or ns.verbose3): parser.error("-G/--failfast needs either -v or -W") 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 @@ -200,6 +200,9 @@ self.checkError([opt, '2', '-T'], "don't go together") self.checkError([opt, '2', '-l'], "don't go together") self.checkError([opt, '2', '-M', '4G'], "don't go together") + self.checkError([opt, '0', '-T'], "don't go together") + self.checkError([opt, '0', '-l'], "don't go together") + self.checkError([opt, '0', '-M', '4G'], "don't go together") def test_coverage(self): for opt in '-T', '--coverage': diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -549,6 +549,9 @@ Tests ----- +- Issue #28950: Disallow -j0 to be combined with -T/-l/-M in regrtest + command line arguments. + - Issue #28666: Now test.support.rmtree is able to remove unwritable or unreadable directories. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 09:15:05 2016 From: python-checkins at python.org (xiang.zhang) Date: Mon, 19 Dec 2016 14:15:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328950=3A_Disallow_-j0_combined_with_-T/-l_in_regrtest?= =?utf-8?q?=2E?= Message-ID: <20161219141504.128810.53305.9F4BADF8@psf.io> https://hg.python.org/cpython/rev/692834062e80 changeset: 105751:692834062e80 branch: 3.6 parent: 105746:283632069a0d parent: 105750:cf564121f9f0 user: Xiang Zhang date: Mon Dec 19 22:00:22 2016 +0800 summary: Issue #28950: Disallow -j0 combined with -T/-l in regrtest. files: Lib/test/libregrtest/cmdline.py | 4 ++-- Lib/test/regrtest.py | 0 Lib/test/test_regrtest.py | 2 ++ Misc/NEWS | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -301,9 +301,9 @@ if ns.single and ns.fromfile: parser.error("-s and -f don't go together!") - if ns.use_mp and ns.trace: + if ns.use_mp is not None and ns.trace: parser.error("-T and -j don't go together!") - if ns.use_mp and ns.findleaks: + if ns.use_mp is not None and ns.findleaks: parser.error("-l and -j don't go together!") if ns.failfast and not (ns.verbose or ns.verbose3): parser.error("-G/--failfast needs either -v or -W") diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py old mode 100644 new mode 100755 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 @@ -226,6 +226,8 @@ self.checkError([opt, 'foo'], 'invalid int value') self.checkError([opt, '2', '-T'], "don't go together") self.checkError([opt, '2', '-l'], "don't go together") + self.checkError([opt, '0', '-T'], "don't go together") + self.checkError([opt, '0', '-l'], "don't go together") def test_coverage(self): for opt in '-T', '--coverage': diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -66,6 +66,9 @@ Tests ----- +- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest + command line arguments. + - Issue #28683: Fix the tests that bind() a unix socket and raise PermissionError on Android for a non-root user. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 09:15:05 2016 From: python-checkins at python.org (xiang.zhang) Date: Mon, 19 Dec 2016 14:15:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4OTUwOiBNZXJnZSAzLjYu?= Message-ID: <20161219141504.95943.21850.A10DEF6D@psf.io> https://hg.python.org/cpython/rev/3b4d00e20694 changeset: 105752:3b4d00e20694 parent: 105748:3ab0a6692e25 parent: 105751:692834062e80 user: Xiang Zhang date: Mon Dec 19 22:05:46 2016 +0800 summary: Issue #28950: Merge 3.6. files: Lib/test/libregrtest/cmdline.py | 4 ++-- Lib/test/regrtest.py | 0 Lib/test/test_regrtest.py | 2 ++ Misc/NEWS | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -301,9 +301,9 @@ if ns.single and ns.fromfile: parser.error("-s and -f don't go together!") - if ns.use_mp and ns.trace: + if ns.use_mp is not None and ns.trace: parser.error("-T and -j don't go together!") - if ns.use_mp and ns.findleaks: + if ns.use_mp is not None and ns.findleaks: parser.error("-l and -j don't go together!") if ns.failfast and not (ns.verbose or ns.verbose3): parser.error("-G/--failfast needs either -v or -W") diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py old mode 100644 new mode 100755 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 @@ -226,6 +226,8 @@ self.checkError([opt, 'foo'], 'invalid int value') self.checkError([opt, '2', '-T'], "don't go together") self.checkError([opt, '2', '-l'], "don't go together") + self.checkError([opt, '0', '-T'], "don't go together") + self.checkError([opt, '0', '-l'], "don't go together") def test_coverage(self): for opt in '-T', '--coverage': diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -627,6 +627,9 @@ Tests ----- +- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest + command line arguments. + - Issue #28683: Fix the tests that bind() a unix socket and raise PermissionError on Android for a non-root user. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 11:52:09 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 19 Dec 2016 16:52:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328927=3A_bytes=2E?= =?utf-8?q?fromhex=28=29_and_bytearray=2Efromhex=28=29_now_ignore_all_ASCI?= =?utf-8?q?I?= Message-ID: <20161219165209.127867.62473.BB82BBA7@psf.io> https://hg.python.org/cpython/rev/fcc09d9ee7d4 changeset: 105753:fcc09d9ee7d4 user: Serhiy Storchaka date: Mon Dec 19 18:51:37 2016 +0200 summary: Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not only spaces. Patch by Robert Xiao. files: Doc/library/stdtypes.rst | 12 ++++++++++-- Doc/whatsnew/3.7.rst | 4 ++++ Lib/test/test_bytes.py | 8 ++++++++ Misc/NEWS | 3 +++ Objects/bytesobject.c | 4 ++-- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2314,11 +2314,15 @@ This :class:`bytes` class method returns a bytes object, decoding the given string object. The string must contain two hexadecimal digits per - byte, with ASCII spaces being ignored. + byte, with ASCII whitespace being ignored. >>> bytes.fromhex('2Ef0 F1f2 ') b'.\xf0\xf1\xf2' + .. versionchanged:: 3.7 + :meth:`bytes.fromhex` now skips all ASCII whitespace in the string, + not just spaces. + A reverse conversion function exists to transform a bytes object into its hexadecimal representation. @@ -2382,11 +2386,15 @@ This :class:`bytearray` class method returns bytearray object, decoding the given string object. The string must contain two hexadecimal digits - per byte, with ASCII spaces being ignored. + per byte, with ASCII whitespace being ignored. >>> bytearray.fromhex('2Ef0 F1f2 ') bytearray(b'.\xf0\xf1\xf2') + .. versionchanged:: 3.7 + :meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, + not just spaces. + A reverse conversion function exists to transform a bytearray object into its hexadecimal representation. diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -79,6 +79,10 @@ now have more than 255 parameters. (Contributed by Serhiy Storchaka in :issue:`12844` and :issue:`18896`.) +* :meth:`bytes.fromhex` and :meth:`bytearray.fromhex` now ignore all ASCII + whitespace, not only spaces. + (Contributed by Robert Xiao in :issue:`28927`.) + New Modules =========== diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -293,6 +293,14 @@ b = bytearray([0x1a, 0x2b, 0x30]) self.assertEqual(self.type2test.fromhex('1a2B30'), b) self.assertEqual(self.type2test.fromhex(' 1A 2B 30 '), b) + + # check that ASCII whitespace is ignored + self.assertEqual(self.type2test.fromhex(' 1A\n2B\t30\v'), b) + for c in "\x09\x0A\x0B\x0C\x0D\x20": + self.assertEqual(self.type2test.fromhex(c), self.type2test()) + for c in "\x1C\x1D\x1E\x1F\x85\xa0\u2000\u2002\u2028": + self.assertRaises(ValueError, self.type2test.fromhex, c) + self.assertEqual(self.type2test.fromhex('0000'), b'\0\0') self.assertRaises(TypeError, self.type2test.fromhex, b'1B') self.assertRaises(ValueError, self.type2test.fromhex, 'a') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCII + whitespace, not only spaces. Patch by Robert Xiao. + - Issue #25677: Correct the positioning of the syntax error caret for indented blocks. Based on patch by Michael Layzell. diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2378,10 +2378,10 @@ end = str + hexlen; while (str < end) { /* skip over spaces in the input */ - if (*str == ' ') { + if (Py_ISSPACE(*str)) { do { str++; - } while (*str == ' '); + } while (Py_ISSPACE(*str)); if (str >= end) break; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 17:31:51 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 19 Dec 2016 22:31:51 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogRml4ZXMgdGhlIDIu?= =?utf-8?q?7_nuget_packages_to_include_a_shim_bdist=5Fwininst?= Message-ID: <20161219223150.80407.75007.65E1EA14@psf.io> https://hg.python.org/cpython/rev/0391b6875319 changeset: 105754:0391b6875319 branch: 2.7 parent: 105749:fac2362f248c user: Steve Dower date: Mon Dec 19 14:31:27 2016 -0800 summary: Fixes the 2.7 nuget packages to include a shim bdist_wininst files: Tools/nuget/distutils.command.bdist_wininst.py | 20 ++++++++++ Tools/nuget/make_zip.py | 12 +++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Tools/nuget/distutils.command.bdist_wininst.py b/Tools/nuget/distutils.command.bdist_wininst.py new file mode 100644 --- /dev/null +++ b/Tools/nuget/distutils.command.bdist_wininst.py @@ -0,0 +1,20 @@ +"""distutils.command.bdist_wininst + +Suppresses the 'bdist_wininst' command, while still allowing +setuptools to import it without breaking.""" + +from distutils.core import Command +from distutils.errors import DistutilsPlatformError + +class bdist_wininst(Command): + description = "create an executable installer for MS Windows" + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + raise DistutilsPlatformError("bdist_wininst is not supported " + "in this Python distribution") diff --git a/Tools/nuget/make_zip.py b/Tools/nuget/make_zip.py --- a/Tools/nuget/make_zip.py +++ b/Tools/nuget/make_zip.py @@ -9,6 +9,7 @@ import os import tempfile +from itertools import chain from pathlib import Path from zipfile import ZipFile, ZIP_DEFLATED import subprocess @@ -203,8 +204,15 @@ try: for t, s, p, c in layout: - s = source / s.replace("$arch", arch) - copied = copy_to_layout(temp / t.rstrip('/'), rglob(s, p, c)) + fs = source / s.replace("$arch", arch) + files = rglob(fs, p, c) + extra_files = [] + if s == 'Lib' and p == '**/*': + extra_files.append(( + source / 'tools' / 'nuget' / 'distutils.command.bdist_wininst.py', + Path('distutils') / 'command' / 'bdist_wininst.py' + )) + copied = copy_to_layout(temp / t.rstrip('/'), chain(files, extra_files)) print('Copied {} files'.format(copied)) if out: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 19:54:35 2016 From: python-checkins at python.org (inada.naoki) Date: Tue, 20 Dec 2016 00:54:35 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4MTQ3?= =?utf-8?q?=3A_Fix_a_memory_leak_in_split-table_dictionaries?= Message-ID: <20161220005435.106884.46511.4276B462@psf.io> https://hg.python.org/cpython/rev/cc40470c10f8 changeset: 105755:cc40470c10f8 branch: 3.5 parent: 105750:cf564121f9f0 user: INADA Naoki date: Tue Dec 20 09:54:24 2016 +0900 summary: Issue #28147: Fix a memory leak in split-table dictionaries setattr() must not convert combined table into split table. files: Lib/test/test_dict.py | 18 ++++++++++++++++++ Misc/NEWS | 3 +++ Modules/_testcapimodule.c | 10 ++++++++++ Objects/dictobject.c | 21 +++++++++++++++------ 4 files changed, 46 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -836,6 +836,24 @@ pass self._tracked(MyDict()) + @support.cpython_only + def test_splittable_setattr_after_pop(self): + """setattr must not convert combined table into split table""" + # Issue 28147 + import _testcapi + + class C: + pass + a = C() + a.a = 2 + self.assertTrue(_testcapi.dict_hassplittable(a.__dict__)) + # dict.popitem() convert it to combined table + a.__dict__.popitem() + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + # But C should not convert a.__dict__ to split table again. + a.a = 3 + self.assertFalse(_testcapi.dict_hassplittable(a.__dict__)) + def test_iterator_pickling(self): for proto in range(pickle.HIGHEST_PROTOCOL + 1): data = {1:"a", 2:"b", 3:"c"} diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() + must not convert combined table into split table. + - Issue #25677: Correct the positioning of the syntax error caret for indented blocks. Based on patch by Michael Layzell. diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -249,6 +249,15 @@ } +static PyObject* +dict_hassplittable(PyObject *self, PyObject *arg) +{ + if (!PyArg_Parse(arg, "O!:dict_hassplittable", &PyDict_Type, &arg)) { + return NULL; + } + return PyBool_FromLong(_PyDict_HasSplitTable((PyDictObject*)arg)); +} + /* Issue #4701: Check that PyObject_Hash implicitly calls * PyType_Ready if it hasn't already been called */ @@ -3858,6 +3867,7 @@ {"test_datetime_capi", test_datetime_capi, METH_NOARGS}, {"test_list_api", (PyCFunction)test_list_api, METH_NOARGS}, {"test_dict_iteration", (PyCFunction)test_dict_iteration,METH_NOARGS}, + {"dict_hassplittable", dict_hassplittable, METH_O}, {"test_lazy_hash_inheritance", (PyCFunction)test_lazy_hash_inheritance,METH_NOARGS}, {"test_long_api", (PyCFunction)test_long_api, METH_NOARGS}, {"test_xincref_doesnt_leak",(PyCFunction)test_xincref_doesnt_leak, METH_NOARGS}, diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -985,8 +985,10 @@ return NULL; } else if (mp->ma_keys->dk_lookup == lookdict_unicode) { - /* Remove dummy keys */ - if (dictresize(mp, DK_SIZE(mp->ma_keys))) + /* Remove dummy keys + * -1 is required since dictresize() uses key size > minused + */ + if (dictresize(mp, DK_SIZE(mp->ma_keys) - 1)) return NULL; } assert(mp->ma_keys->dk_lookup == lookdict_unicode_nodummy); @@ -2473,7 +2475,8 @@ } /* Convert split table to combined table */ if (mp->ma_keys->dk_lookup == lookdict_split) { - if (dictresize(mp, DK_SIZE(mp->ma_keys))) { + /* -1 is required since dictresize() uses key size > minused */ + if (dictresize(mp, DK_SIZE(mp->ma_keys) - 1)) { Py_DECREF(res); return NULL; } @@ -3848,10 +3851,16 @@ CACHED_KEYS(tp) = NULL; DK_DECREF(cached); } - } else { + } + else { + int was_shared = cached == ((PyDictObject *)dict)->ma_keys; res = PyDict_SetItem(dict, key, value); - if (cached != ((PyDictObject *)dict)->ma_keys) { - /* Either update tp->ht_cached_keys or delete it */ + /* PyDict_SetItem() may call dictresize() and convert split table + * into combined table. In such case, convert it to split + * table again and update type's shared key only when this is + * the only dict sharing key with the type. + */ + if (was_shared && cached != ((PyDictObject *)dict)->ma_keys) { if (cached->dk_refcnt == 1) { CACHED_KEYS(tp) = make_keys_shared(dict); } else { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 19:59:55 2016 From: python-checkins at python.org (inada.naoki) Date: Tue, 20 Dec 2016 00:59:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_null_merge?= Message-ID: <20161220005955.19637.69347.98D31A25@psf.io> https://hg.python.org/cpython/rev/6024f7f8432d changeset: 105756:6024f7f8432d branch: 3.6 parent: 105751:692834062e80 parent: 105755:cc40470c10f8 user: INADA Naoki date: Tue Dec 20 09:58:25 2016 +0900 summary: null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 19 19:59:55 2016 From: python-checkins at python.org (inada.naoki) Date: Tue, 20 Dec 2016 00:59:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_null_merge?= Message-ID: <20161220005955.79546.43109.1E74D8B4@psf.io> https://hg.python.org/cpython/rev/a721bf7dda97 changeset: 105757:a721bf7dda97 parent: 105753:fcc09d9ee7d4 parent: 105756:6024f7f8432d user: INADA Naoki date: Tue Dec 20 09:59:47 2016 +0900 summary: null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 20 02:07:39 2016 From: python-checkins at python.org (inada.naoki) Date: Tue, 20 Dec 2016 07:07:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MDE5?= =?utf-8?q?=3A_Fix_dict=2Efromkeys=28x=29_overallocates_when_x_is_sparce_d?= =?utf-8?q?ict=2E?= Message-ID: <20161220070736.26848.74318.1DEA044D@psf.io> https://hg.python.org/cpython/rev/46e329ef13ae changeset: 105758:46e329ef13ae branch: 2.7 parent: 105754:0391b6875319 user: INADA Naoki date: Tue Dec 20 16:07:18 2016 +0900 summary: Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. Original patch by Rasmus Villemoes. files: Misc/NEWS | 3 +++ Objects/dictobject.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. + Original patch by Rasmus Villemoes. + - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1391,7 +1391,7 @@ PyObject *key; long hash; - if (dictresize(mp, Py_SIZE(seq) / 2 * 3)) { + if (dictresize(mp, ((PyDictObject *)seq)->ma_used / 2 * 3)) { Py_DECREF(d); return NULL; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 20 02:57:34 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 20 Dec 2016 07:57:34 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_merge_3=2E5_=28=2328932=29?= Message-ID: <20161220075733.20179.40755.2CD7F8E1@psf.io> https://hg.python.org/cpython/rev/bfd4140d9c5d changeset: 105760:bfd4140d9c5d branch: 3.6 parent: 105756:6024f7f8432d parent: 105759:2f004cc84153 user: Benjamin Peterson date: Mon Dec 19 23:54:57 2016 -0800 summary: merge 3.5 (#28932) files: Misc/NEWS | 2 ++ Python/random.c | 2 +- configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 3 +++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #28932: Do not include if it does not exist. + - Issue #25677: Correct the positioning of the syntax error caret for indented blocks. Based on patch by Michael Layzell. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -12,7 +12,7 @@ # ifdef HAVE_LINUX_RANDOM_H # include # endif -# if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) +# ifdef HAVE_SYS_RANDOM_H # include # endif # if !defined(HAVE_GETRANDOM) && defined(HAVE_GETRANDOM_SYSCALL) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -7763,7 +7763,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ +sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -2019,7 +2019,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ +sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1033,6 +1033,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RANDOM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 20 02:57:34 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 20 Dec 2016 07:57:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy42ICgjMjg5MzIp?= Message-ID: <20161220075734.19742.70602.BAE11F2E@psf.io> https://hg.python.org/cpython/rev/31df7d9863f3 changeset: 105761:31df7d9863f3 parent: 105757:a721bf7dda97 parent: 105760:bfd4140d9c5d user: Benjamin Peterson date: Mon Dec 19 23:55:24 2016 -0800 summary: merge 3.6 (#28932) files: Misc/NEWS | 2 ++ Python/random.c | 2 +- configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 3 +++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ - Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not only spaces. Patch by Robert Xiao. +- Issue #28932: Do not include if it does not exist. + - Issue #25677: Correct the positioning of the syntax error caret for indented blocks. Based on patch by Michael Layzell. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -12,7 +12,7 @@ # ifdef HAVE_LINUX_RANDOM_H # include # endif -# if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) +# ifdef HAVE_SYS_RANDOM_H # include # endif # if !defined(HAVE_GETRANDOM) && defined(HAVE_GETRANDOM_SYSCALL) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -7763,7 +7763,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ +sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -2019,7 +2019,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ +sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1036,6 +1036,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RANDOM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 20 02:57:34 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 20 Dec 2016 07:57:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_add_a_specific?= =?utf-8?q?_configure_check_for_sys/random=2Eh_=28closes_=2328932=29?= Message-ID: <20161220075733.19561.52155.A826B37D@psf.io> https://hg.python.org/cpython/rev/2f004cc84153 changeset: 105759:2f004cc84153 branch: 3.5 parent: 105755:cc40470c10f8 user: Benjamin Peterson date: Mon Dec 19 23:54:25 2016 -0800 summary: add a specific configure check for sys/random.h (closes #28932) files: Misc/NEWS | 2 ++ Python/random.c | 2 +- configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 3 +++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #28932: Do not include if it does not exist. + - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -9,7 +9,7 @@ # ifdef HAVE_LINUX_RANDOM_H # include # endif -# if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) +# ifdef HAVE_SYS_RANDOM_H # include # endif # if !defined(HAVE_GETRANDOM) && defined(HAVE_GETRANDOM_SYSCALL) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -7714,7 +7714,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ +sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1946,7 +1946,7 @@ poll.h sys/devpoll.h sys/epoll.h sys/poll.h \ sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ +sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1005,6 +1005,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RANDOM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 20 02:57:34 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 20 Dec 2016 07:57:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_add_a_specific?= =?utf-8?q?_configure_check_for_sys/random=2Eh_=28closes_=2328932=29?= Message-ID: <20161220075734.106931.12237.2FACC1E9@psf.io> https://hg.python.org/cpython/rev/32cc37a89b58 changeset: 105762:32cc37a89b58 branch: 2.7 parent: 105758:46e329ef13ae user: Benjamin Peterson date: Mon Dec 19 23:54:25 2016 -0800 summary: add a specific configure check for sys/random.h (closes #28932) files: Misc/NEWS | 2 ++ Python/random.c | 2 +- configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 3 +++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #28932: Do not include if it does not exist. + Library ------- diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -3,7 +3,7 @@ #include #else #include -#if defined(HAVE_GETRANDOM) || defined(HAVE_GETENTROPY) +#ifdef HAVE_SYS_RANDOM_H #include #endif #endif diff --git a/configure b/configure --- a/configure +++ b/configure @@ -7054,7 +7054,7 @@ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ +sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1702,7 +1702,7 @@ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ -sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ +sys/param.h sys/poll.h sys/random.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \ sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -781,6 +781,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_POLL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RANDOM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Dec 20 04:08:05 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 20 Dec 2016 09:08:05 +0000 Subject: [Python-checkins] Daily reference leaks (a721bf7dda97): sum=13 Message-ID: <20161220090805.5927.3988.14FB821E@psf.io> results for a721bf7dda97 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_spawn leaked [2, -2, 2] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog3MNpjU', '--timeout', '7200'] From lp_benchmark_robot at intel.com Tue Dec 20 08:30:30 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 20 Dec 2016 13:30:30 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-12-20 Message-ID: Results for project Python 2.7, build date 2016-12-20 11:47:34 +0000 commit: 0391b6875319 previous commit: 34b9fe09a2b7 revision date: 2016-12-19 22:31:27 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release 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.31% 3.82% 8.11% :-) pybench 0.19% 0.05% 7.94% 3.32% :-| regex_v8 1.83% -0.87% -0.77% 10.96% :-) nbody 0.15% -0.42% 12.89% 1.75% :-| json_dump_v2 0.15% 0.77% 0.26% 10.55% :-( normal_startup 2.02% -0.68% -3.05% 2.91% :-| ssbench 0.15% 0.04% 0.34% 2.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-2016-12-20/ 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 Dec 20 08:36:29 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 20 Dec 2016 13:36:29 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-12-20 Message-ID: <9d063a6a-b356-4ba6-bf2e-cb4f0ad31f7c@irsmsx101.ger.corp.intel.com> Results for project Python default, build date 2016-12-20 11:03:12 +0000 commit: a721bf7dda97 previous commit: 3cc193be79ab revision date: 2016-12-20 00:59:47 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% 2.81% 0.32% 15.03% :-| pybench 0.23% -0.29% 1.41% 5.09% :-| regex_v8 3.60% -0.69% -1.44% 3.46% :-| nbody 0.28% -0.19% 0.71% 2.98% :-) json_dump_v2 0.37% -0.77% 9.08% 9.02% :-| normal_startup 0.99% -0.39% -0.81% 7.04% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-20/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Tue Dec 20 10:03:56 2016 From: python-checkins at python.org (xiang.zhang) Date: Tue, 20 Dec 2016 15:03:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328822=3A_Adjust_i?= =?utf-8?q?ndices_handling_of_PyUnicode=5FFindChar=28=29=2E?= Message-ID: <20161220145550.79585.22491.62D71ECA@psf.io> https://hg.python.org/cpython/rev/ce6a6cc3765d changeset: 105763:ce6a6cc3765d parent: 105761:31df7d9863f3 user: Xiang Zhang date: Tue Dec 20 22:52:33 2016 +0800 summary: Issue #28822: Adjust indices handling of PyUnicode_FindChar(). files: Doc/c-api/unicode.rst | 3 +++ Lib/test/test_unicode.py | 23 +++++++++++++++++++++++ Misc/NEWS | 3 +++ Modules/_testcapimodule.c | 22 ++++++++++++++++++++++ Objects/unicodeobject.c | 12 ++++-------- 5 files changed, 55 insertions(+), 8 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -1625,6 +1625,9 @@ .. versionadded:: 3.3 + .. versionchanged:: 3.7 + *start* and *end* are now adjusted to behave like ``str[start:end]``. + .. c:function:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, \ Py_ssize_t start, Py_ssize_t end) diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2728,6 +2728,29 @@ self.assertEqual(unicode_asucs4(s, len(s), 1), s+'\0') self.assertEqual(unicode_asucs4(s, len(s), 0), s+'\uffff') + # Test PyUnicode_FindChar() + @support.cpython_only + def test_findchar(self): + from _testcapi import unicode_findchar + + for str in "\xa1", "\u8000\u8080", "\ud800\udc02", "\U0001f100\U0001f1f1": + for i, ch in enumerate(str): + self.assertEqual(unicode_findchar(str, ord(ch), 0, len(str), 1), i) + self.assertEqual(unicode_findchar(str, ord(ch), 0, len(str), -1), i) + + str = "!>_= end + self.assertEqual(unicode_findchar(str, ord('!'), 0, 0, 1), -1) + self.assertEqual(unicode_findchar(str, ord('!'), len(str), 0, 1), -1) + # negative + self.assertEqual(unicode_findchar(str, ord('!'), -len(str), -1, 1), 0) + self.assertEqual(unicode_findchar(str, ord('!'), -len(str), -1, -1), 0) + # Test PyUnicode_CopyCharacters() @support.cpython_only def test_copycharacters(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -545,6 +545,9 @@ C API ----- +- Issue #28822: The indices parameters *start* and *end* of PyUnicode_FindChar() + are now adjusted to behave like ``str[start:end]``. + - Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. - Issue #28761: The fields name and doc of structures PyMemberDef, PyGetSetDef, diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1888,6 +1888,27 @@ } static PyObject * +unicode_findchar(PyObject *self, PyObject *args) +{ + PyObject *str; + int direction; + unsigned int ch; + Py_ssize_t result; + Py_ssize_t start, end; + + if (!PyArg_ParseTuple(args, "UInni:unicode_findchar", &str, &ch, + &start, &end, &direction)) { + return NULL; + } + + result = PyUnicode_FindChar(str, (Py_UCS4)ch, start, end, direction); + if (result == -2) + return NULL; + else + return PyLong_FromSsize_t(result); +} + +static PyObject * unicode_copycharacters(PyObject *self, PyObject *args) { PyObject *from, *to, *to_copy; @@ -4121,6 +4142,7 @@ {"unicode_aswidechar", unicode_aswidechar, METH_VARARGS}, {"unicode_aswidecharstring",unicode_aswidecharstring, METH_VARARGS}, {"unicode_asucs4", unicode_asucs4, METH_VARARGS}, + {"unicode_findchar", unicode_findchar, METH_VARARGS}, {"unicode_copycharacters", unicode_copycharacters, METH_VARARGS}, {"unicode_encodedecimal", unicode_encodedecimal, METH_VARARGS}, {"unicode_transformdecimaltoascii", unicode_transformdecimaltoascii, METH_VARARGS}, diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9461,16 +9461,12 @@ int direction) { int kind; - Py_ssize_t result; + Py_ssize_t len, result; if (PyUnicode_READY(str) == -1) return -2; - if (start < 0 || end < 0) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return -2; - } - if (end > PyUnicode_GET_LENGTH(str)) - end = PyUnicode_GET_LENGTH(str); - if (start >= end) + len = PyUnicode_GET_LENGTH(str); + ADJUST_INDICES(start, end, len); + if (end - start < 1) return -1; kind = PyUnicode_KIND(str); result = findchar(PyUnicode_1BYTE_DATA(str) + kind*start, -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Dec 21 04:08:44 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 21 Dec 2016 09:08:44 +0000 Subject: [Python-checkins] Daily reference leaks (ce6a6cc3765d): sum=7 Message-ID: <20161221090843.19742.86625.D1F03BBC@psf.io> results for ce6a6cc3765d on branch "default" -------------------------------------------- test_asyncio leaked [0, 0, 3] memory blocks, sum=3 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-1, 2, -1] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogJpJNbJ', '--timeout', '7200'] From python-checkins at python.org Wed Dec 21 05:56:41 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 21 Dec 2016 10:56:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4ODcx?= =?utf-8?q?=3A_Fixed_a_crash_when_deallocate_deep_ElementTree=2E?= Message-ID: <20161221105641.20215.74535.D8A68A00@psf.io> https://hg.python.org/cpython/rev/957091874ea0 changeset: 105764:957091874ea0 branch: 3.5 parent: 105759:2f004cc84153 user: Serhiy Storchaka date: Wed Dec 21 12:32:56 2016 +0200 summary: Issue #28871: Fixed a crash when deallocate deep ElementTree. files: Lib/test/test_xml_etree_c.py | 10 ++++++++++ Misc/NEWS | 2 ++ Modules/_elementtree.c | 2 ++ 3 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -11,6 +11,7 @@ fresh=['_elementtree', 'xml.etree']) + at unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @support.bigmemtest(size=support._2G + 100, memuse=1, dry_run=False) @@ -54,6 +55,15 @@ del element.attrib self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) + def test_trashcan(self): + # If this test fails, it will most likely die via segfault. + e = root = cET.Element('root') + for i in range(200000): + e = cET.SubElement(e, 'x') + del e + del root + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -138,6 +138,8 @@ Library ------- +- Issue #28871: Fixed a crash when deallocate deep ElementTree. + - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -652,6 +652,7 @@ element_dealloc(ElementObject* self) { PyObject_GC_UnTrack(self); + Py_TRASHCAN_SAFE_BEGIN(self) if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); @@ -662,6 +663,7 @@ RELEASE(sizeof(ElementObject), "destroy element"); Py_TYPE(self)->tp_free((PyObject *)self); + Py_TRASHCAN_SAFE_END(self) } /* -------------------------------------------------------------------- */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 05:56:41 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 21 Dec 2016 10:56:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_from_3=2E5=2E?= Message-ID: <20161221105641.17869.1909.AAE66E9E@psf.io> https://hg.python.org/cpython/rev/9b2e71492b53 changeset: 105765:9b2e71492b53 branch: 3.6 parent: 105760:bfd4140d9c5d parent: 105764:957091874ea0 user: Serhiy Storchaka date: Wed Dec 21 12:35:11 2016 +0200 summary: Merge from 3.5. files: Lib/test/test_xml_etree_c.py | 10 ++++++++++ Misc/NEWS | 2 ++ Modules/_elementtree.c | 2 ++ 3 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -11,6 +11,7 @@ fresh=['_elementtree', 'xml.etree']) + at unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @support.bigmemtest(size=support._2G + 100, memuse=1, dry_run=False) @@ -54,6 +55,15 @@ del element.attrib self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) + def test_trashcan(self): + # If this test fails, it will most likely die via segfault. + e = root = cET.Element('root') + for i in range(200000): + e = cET.SubElement(e, 'x') + del e + del root + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,8 @@ Library ------- +- Issue #28871: Fixed a crash when deallocate deep ElementTree. + - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -626,6 +626,7 @@ element_dealloc(ElementObject* self) { PyObject_GC_UnTrack(self); + Py_TRASHCAN_SAFE_BEGIN(self) if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); @@ -636,6 +637,7 @@ RELEASE(sizeof(ElementObject), "destroy element"); Py_TYPE(self)->tp_free((PyObject *)self); + Py_TRASHCAN_SAFE_END(self) } /* -------------------------------------------------------------------- */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 05:56:41 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 21 Dec 2016 10:56:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgZnJvbSAzLjYu?= Message-ID: <20161221105641.79403.56467.D0F8BCBB@psf.io> https://hg.python.org/cpython/rev/152bf79dc086 changeset: 105766:152bf79dc086 parent: 105763:ce6a6cc3765d parent: 105765:9b2e71492b53 user: Serhiy Storchaka date: Wed Dec 21 12:36:29 2016 +0200 summary: Merge from 3.6. files: Lib/test/test_xml_etree_c.py | 10 ++++++++++ Misc/NEWS | 2 ++ Modules/_elementtree.c | 2 ++ 3 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -11,6 +11,7 @@ fresh=['_elementtree', 'xml.etree']) + at unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @support.bigmemtest(size=support._2G + 100, memuse=1, dry_run=False) @@ -54,6 +55,15 @@ del element.attrib self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) + def test_trashcan(self): + # If this test fails, it will most likely die via segfault. + e = root = cET.Element('root') + for i in range(200000): + e = cET.SubElement(e, 'x') + del e + del root + support.gc_collect() + @unittest.skipUnless(cET, 'requires _elementtree') class TestAliasWorking(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -205,6 +205,8 @@ Library ------- +- Issue #28871: Fixed a crash when deallocate deep ElementTree. + - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -626,6 +626,7 @@ element_dealloc(ElementObject* self) { PyObject_GC_UnTrack(self); + Py_TRASHCAN_SAFE_BEGIN(self) if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); @@ -636,6 +637,7 @@ RELEASE(sizeof(ElementObject), "destroy element"); Py_TYPE(self)->tp_free((PyObject *)self); + Py_TRASHCAN_SAFE_END(self) } /* -------------------------------------------------------------------- */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 05:56:42 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 21 Dec 2016 10:56:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4ODcx?= =?utf-8?q?=3A_Fixed_a_crash_when_deallocate_deep_ElementTree=2E?= Message-ID: <20161221105641.80239.30720.8FE0CAD1@psf.io> https://hg.python.org/cpython/rev/78bf34b6a713 changeset: 105767:78bf34b6a713 branch: 2.7 parent: 105762:32cc37a89b58 user: Serhiy Storchaka date: Wed Dec 21 12:55:28 2016 +0200 summary: Issue #28871: Fixed a crash when deallocate deep ElementTree. Fixed running MiscTests in test_xml_etree_c. files: Lib/test/test_xml_etree_c.py | 11 ++++++++++ Misc/NEWS | 2 + Modules/_elementtree.c | 25 +++++++++++++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -17,6 +17,7 @@ """ + at unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @precisionbigmemtest(size=_2G + 100, memuse=1) @@ -62,12 +63,22 @@ del element.attrib self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) + def test_trashcan(self): + # If this test fails, it will most likely die via segfault. + e = root = cET.Element('root') + for i in range(200000): + e = cET.SubElement(e, 'x') + del e + del root + test_support.gc_collect() + def test_main(): from test import test_xml_etree, test_xml_etree_c # Run the tests specific to the C implementation test_support.run_doctest(test_xml_etree_c, verbosity=True) + test_support.run_unittest(MiscTests) # Assign the C implementation before running the doctests # Patch the __name__, to prevent confusion with the pure Python test diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,6 +18,8 @@ - Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. Original patch by Rasmus Villemoes. +- Issue #28871: Fixed a crash when deallocate deep ElementTree. + - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -121,6 +121,18 @@ #define JOIN_SET(p, flag) ((void*) ((Py_uintptr_t) (JOIN_OBJ(p)) | (flag))) #define JOIN_OBJ(p) ((PyObject*) ((Py_uintptr_t) (p) & ~1)) +/* Py_CLEAR for a PyObject* that uses a join flag. Pass the pointer by + * reference since this function sets it to NULL. +*/ +static void _clear_joined_ptr(PyObject **p) +{ + if (*p) { + PyObject *tmp = JOIN_OBJ(*p); + *p = NULL; + Py_DECREF(tmp); + } +} + /* glue functions (see the init function for details) */ static PyObject* elementtree_parseerror_obj; static PyObject* elementtree_copyelement_obj; @@ -538,17 +550,20 @@ static void element_dealloc(ElementObject* self) { + Py_TRASHCAN_SAFE_BEGIN(self) + + /* discard attributes */ + Py_DECREF(self->tag); + _clear_joined_ptr(&self->text); + _clear_joined_ptr(&self->tail); + if (self->extra) element_dealloc_extra(self); - /* discard attributes */ - Py_DECREF(self->tag); - Py_DECREF(JOIN_OBJ(self->text)); - Py_DECREF(JOIN_OBJ(self->tail)); - RELEASE(sizeof(ElementObject), "destroy element"); PyObject_Del(self); + Py_TRASHCAN_SAFE_END(self) } /* -------------------------------------------------------------------- */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 05:59:45 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 21 Dec 2016 10:59:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328992=3A_Use_byte?= =?utf-8?b?cy5mcm9taGV4KCku?= Message-ID: <20161221105944.3455.64973.8CB6DAC5@psf.io> https://hg.python.org/cpython/rev/44c62456de75 changeset: 105768:44c62456de75 parent: 105766:152bf79dc086 user: Serhiy Storchaka date: Wed Dec 21 12:59:28 2016 +0200 summary: Issue #28992: Use bytes.fromhex(). files: Lib/email/_encoded_words.py | 2 +- Lib/test/multibytecodec_support.py | 2 +- Lib/test/test_unicode.py | 11 ++++------- Lib/urllib/parse.py | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Lib/email/_encoded_words.py b/Lib/email/_encoded_words.py --- a/Lib/email/_encoded_words.py +++ b/Lib/email/_encoded_words.py @@ -62,7 +62,7 @@ # regex based decoder. _q_byte_subber = functools.partial(re.compile(br'=([a-fA-F0-9]{2})').sub, - lambda m: bytes([int(m.group(1), 16)])) + lambda m: bytes.fromhex(m.group(1))) def decode_q(encoded): encoded = encoded.replace(b'_', b' ') diff --git a/Lib/test/multibytecodec_support.py b/Lib/test/multibytecodec_support.py --- a/Lib/test/multibytecodec_support.py +++ b/Lib/test/multibytecodec_support.py @@ -338,7 +338,7 @@ uc = re.findall('', ucmdata) for uni, coded in uc: unich = chr(int(uni, 16)) - codech = bytes(int(c, 16) for c in coded.split()) + codech = bytes.fromhex(coded) self._testpoint(codech, unich) def test_mapping_supplemental(self): diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1793,9 +1793,6 @@ self.assertEqual(seq.decode('utf-8', 'ignore'), res.replace('\uFFFD', '')) - def to_bytestring(self, seq): - return bytes(int(c, 16) for c in seq.split()) - def assertCorrectUTF8Decoding(self, seq, res, err): """ Check that an invalid UTF-8 sequence raises a UnicodeDecodeError when @@ -1851,7 +1848,7 @@ ] FFFD = '\ufffd' for seq in sequences: - self.assertCorrectUTF8Decoding(self.to_bytestring(seq), '\ufffd', + self.assertCorrectUTF8Decoding(bytes.fromhex(seq), '\ufffd', 'unexpected end of data') def test_invalid_cb_for_2bytes_seq(self): @@ -1873,7 +1870,7 @@ ('DF C0', FFFDx2), ('DF FF', FFFDx2), ] for seq, res in sequences: - self.assertCorrectUTF8Decoding(self.to_bytestring(seq), res, + self.assertCorrectUTF8Decoding(bytes.fromhex(seq), res, 'invalid continuation byte') def test_invalid_cb_for_3bytes_seq(self): @@ -1931,7 +1928,7 @@ ('EF BF C0', FFFDx2), ('EF BF FF', FFFDx2), ] for seq, res in sequences: - self.assertCorrectUTF8Decoding(self.to_bytestring(seq), res, + self.assertCorrectUTF8Decoding(bytes.fromhex(seq), res, 'invalid continuation byte') def test_invalid_cb_for_4bytes_seq(self): @@ -2010,7 +2007,7 @@ ('F4 8F BF C0', FFFDx2), ('F4 8F BF FF', FFFDx2) ] for seq, res in sequences: - self.assertCorrectUTF8Decoding(self.to_bytestring(seq), res, + self.assertCorrectUTF8Decoding(bytes.fromhex(seq), res, 'invalid continuation byte') def test_codecs_idna(self): diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -574,7 +574,7 @@ # if the function is never called global _hextobyte if _hextobyte is None: - _hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) + _hextobyte = {(a + b).encode(): bytes.fromhex(a + b) for a in _hexdig for b in _hexdig} for item in bits[1:]: try: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 06:48:57 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 21 Dec 2016 11:48:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NTM4?= =?utf-8?q?=3A_Fix_the_compilation_error_that_occurs_because_if=5Fnameinde?= =?utf-8?b?eCgpIGlz?= Message-ID: <20161221114857.17922.14549.E01186E6@psf.io> https://hg.python.org/cpython/rev/e248bfb0f520 changeset: 105769:e248bfb0f520 branch: 3.6 parent: 105765:9b2e71492b53 user: Xavier de Gaye date: Wed Dec 21 12:46:36 2016 +0100 summary: Issue #28538: Fix the compilation error that occurs because if_nameindex() is available on Android API level 24, but the if_nameindex structure is not defined. files: Misc/NEWS | 4 ++++ configure | 34 +++++++++++++++++++++++++++++++++- configure.ac | 14 +++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -82,6 +82,10 @@ Build ----- +- Issue #28538: Fix the compilation error that occurs because if_nameindex() is + available on Android API level 24, but the if_nameindex structure is not + defined. + - Issue #20211: Do not add the directory for installing C header files and the directory for installing object code libraries to the cross compilation search paths. Original patch by Thomas Petazzoni. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -11198,7 +11198,6 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - if_nameindex \ initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ @@ -12646,6 +12645,39 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +# On Android API level 24 if_nameindex() is available, but the if_nameindex +# structure is not defined. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nameindex" >&5 +$as_echo_n "checking for if_nameindex... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_NET_IF_H +# include +#endif + +int +main () +{ +struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_IF_NAMEINDEX 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -3384,7 +3384,6 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - if_nameindex \ initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ @@ -3737,6 +3736,19 @@ AC_MSG_RESULT(no) ]) +# On Android API level 24 if_nameindex() is available, but the if_nameindex +# structure is not defined. +AC_MSG_CHECKING(for if_nameindex) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_NET_IF_H +# include +#endif +]], [[struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index;]])], + [AC_DEFINE(HAVE_IF_NAMEINDEX, 1, Define to 1 if you have the 'if_nameindex' function.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) +]) + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. AC_MSG_CHECKING(for getaddrinfo) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 06:48:57 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 21 Dec 2016 11:48:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4NTM4OiBNZXJnZSAzLjYu?= Message-ID: <20161221114857.19780.22687.27AEDED5@psf.io> https://hg.python.org/cpython/rev/55bf0b79ec55 changeset: 105770:55bf0b79ec55 parent: 105768:44c62456de75 parent: 105769:e248bfb0f520 user: Xavier de Gaye date: Wed Dec 21 12:48:26 2016 +0100 summary: Issue #28538: Merge 3.6. files: Misc/NEWS | 4 ++++ configure | 34 +++++++++++++++++++++++++++++++++- configure.ac | 14 +++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -579,6 +579,10 @@ Build ----- +- Issue #28538: Fix the compilation error that occurs because if_nameindex() is + available on Android API level 24, but the if_nameindex structure is not + defined. + - Issue #20211: Do not add the directory for installing C header files and the directory for installing object code libraries to the cross compilation search paths. Original patch by Thomas Petazzoni. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -11202,7 +11202,6 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - if_nameindex \ initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ @@ -12650,6 +12649,39 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +# On Android API level 24 if_nameindex() is available, but the if_nameindex +# structure is not defined. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nameindex" >&5 +$as_echo_n "checking for if_nameindex... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_NET_IF_H +# include +#endif + +int +main () +{ +struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_IF_NAMEINDEX 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -3386,7 +3386,6 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - if_nameindex \ initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ @@ -3739,6 +3738,19 @@ AC_MSG_RESULT(no) ]) +# On Android API level 24 if_nameindex() is available, but the if_nameindex +# structure is not defined. +AC_MSG_CHECKING(for if_nameindex) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#ifdef HAVE_NET_IF_H +# include +#endif +]], [[struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index;]])], + [AC_DEFINE(HAVE_IF_NAMEINDEX, 1, Define to 1 if you have the 'if_nameindex' function.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) +]) + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. AC_MSG_CHECKING(for getaddrinfo) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 07:09:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 21 Dec 2016 12:09:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fixed_a_type_error_introdu?= =?utf-8?q?ced_in_issue_=2328992=2E?= Message-ID: <20161221120913.79722.21402.90D9AFD0@psf.io> https://hg.python.org/cpython/rev/6ced540a92bc changeset: 105771:6ced540a92bc user: Serhiy Storchaka date: Wed Dec 21 14:08:55 2016 +0200 summary: Fixed a type error introduced in issue #28992. files: Lib/email/_encoded_words.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/email/_encoded_words.py b/Lib/email/_encoded_words.py --- a/Lib/email/_encoded_words.py +++ b/Lib/email/_encoded_words.py @@ -62,7 +62,7 @@ # regex based decoder. _q_byte_subber = functools.partial(re.compile(br'=([a-fA-F0-9]{2})').sub, - lambda m: bytes.fromhex(m.group(1))) + lambda m: bytes.fromhex(m.group(1).decode())) def decode_q(encoded): encoded = encoded.replace(b'_', b' ') -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Dec 21 09:45:24 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 21 Dec 2016 14:45:24 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-12-21 Message-ID: <0c23829a-41b6-43c4-be5b-665ad8928a70@irsmsx104.ger.corp.intel.com> Results for project Python default, build date 2016-12-21 11:03:36 +0000 commit: ce6a6cc3765d previous commit: a721bf7dda97 revision date: 2016-12-20 14:52:33 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.15% -0.96% -0.64% 14.87% :-| pybench 0.28% -0.17% 1.24% 4.46% :-| regex_v8 3.63% 0.13% -1.31% 3.78% :-| nbody 0.14% 0.18% 0.88% 4.44% :-) json_dump_v2 0.46% -1.07% 8.11% 9.88% :-| normal_startup 1.03% 0.25% -1.02% 6.75% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-12-21/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Wed Dec 21 09:44:22 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 21 Dec 2016 14:44:22 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-12-21 Message-ID: Results for project Python 2.7, build date 2016-12-21 11:47:59 +0000 commit: 32cc37a89b58 previous commit: 0391b6875319 revision date: 2016-12-20 07:54: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.17% 0.13% 3.95% 8.75% :-) pybench 0.19% -0.01% 7.93% 2.29% :-| regex_v8 1.81% -0.27% -1.04% 11.02% :-) nbody 0.10% 0.39% 13.23% 0.82% :-| json_dump_v2 0.15% -0.18% 0.07% 11.38% :-( normal_startup 1.76% 0.37% -2.67% 2.65% :-| ssbench 0.13% -0.25% 0.09% 2.91% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-12-21/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Dec 21 11:31:34 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 21 Dec 2016 16:31:34 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NTM4?= =?utf-8?q?=3A_On_Darwin_net/if=2Eh_requires_that_sys/socket=2Eh_be_includ?= =?utf-8?q?ed?= Message-ID: <20161221163134.20179.56049.712FE685@psf.io> https://hg.python.org/cpython/rev/f34dac552ad8 changeset: 105772:f34dac552ad8 branch: 3.6 parent: 105769:e248bfb0f520 user: Xavier de Gaye date: Wed Dec 21 17:29:59 2016 +0100 summary: Issue #28538: On Darwin net/if.h requires that sys/socket.h be included beforehand. files: configure | 16 ++++++++++++++-- configure.ac | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -12645,13 +12645,25 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -# On Android API level 24 if_nameindex() is available, but the if_nameindex -# structure is not defined. +# On Android API level 24 with android-ndk-r13, if_nameindex() is available, +# but the if_nameindex structure is not defined. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nameindex" >&5 $as_echo_n "checking for if_nameindex... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif #ifdef HAVE_NET_IF_H # include #endif diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -3736,10 +3736,22 @@ AC_MSG_RESULT(no) ]) -# On Android API level 24 if_nameindex() is available, but the if_nameindex -# structure is not defined. +# On Android API level 24 with android-ndk-r13, if_nameindex() is available, +# but the if_nameindex structure is not defined. AC_MSG_CHECKING(for if_nameindex) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif #ifdef HAVE_NET_IF_H # include #endif -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 11:31:34 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 21 Dec 2016 16:31:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4NTM4OiBNZXJnZSAzLjYu?= Message-ID: <20161221163134.17410.53727.92FB1B0C@psf.io> https://hg.python.org/cpython/rev/c568b6ac5e89 changeset: 105773:c568b6ac5e89 parent: 105771:6ced540a92bc parent: 105772:f34dac552ad8 user: Xavier de Gaye date: Wed Dec 21 17:30:50 2016 +0100 summary: Issue #28538: Merge 3.6. files: configure | 16 ++++++++++++++-- configure.ac | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/configure b/configure --- a/configure +++ b/configure @@ -12649,13 +12649,25 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -# On Android API level 24 if_nameindex() is available, but the if_nameindex -# structure is not defined. +# On Android API level 24 with android-ndk-r13, if_nameindex() is available, +# but the if_nameindex structure is not defined. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nameindex" >&5 $as_echo_n "checking for if_nameindex... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif #ifdef HAVE_NET_IF_H # include #endif diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -3738,10 +3738,22 @@ AC_MSG_RESULT(no) ]) -# On Android API level 24 if_nameindex() is available, but the if_nameindex -# structure is not defined. +# On Android API level 24 with android-ndk-r13, if_nameindex() is available, +# but the if_nameindex structure is not defined. AC_MSG_CHECKING(for if_nameindex) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_SYS_SOCKET_H +# include +#endif #ifdef HAVE_NET_IF_H # include #endif -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 21 23:44:03 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 22 Dec 2016 04:44:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgMjg5MjM6?= =?utf-8?q?_Remove_editor_artifacts_from_Tix=2Epy=2C?= Message-ID: <20161222044403.19684.8743.A21B68FD@psf.io> https://hg.python.org/cpython/rev/ef03aff3b195 changeset: 105774:ef03aff3b195 branch: 2.7 parent: 105767:78bf34b6a713 user: Terry Jan Reedy date: Wed Dec 21 23:43:50 2016 -0500 summary: Issue 28923: Remove editor artifacts from Tix.py, including encoding not recognized by codecs.lookup. files: Lib/lib-tk/Tix.py | 4 ---- Misc/NEWS | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Lib/lib-tk/Tix.py b/Lib/lib-tk/Tix.py --- a/Lib/lib-tk/Tix.py +++ b/Lib/lib-tk/Tix.py @@ -1,7 +1,3 @@ -# -*-mode: python; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*- -# -# $Id$ -# # Tix.py -- Tix widget wrappers. # # For Tix, see http://tix.sourceforge.net diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Library ------- +- Issue 28923: Remove editor artifacts from Tix.py, + including encoding not recognized by codecs.lookup. + - Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. Original patch by Rasmus Villemoes. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 00:04:25 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 22 Dec 2016 05:04:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_28923=3A_Remove_editor_artifacts_from_Tix=2Epy=2C?= Message-ID: <20161222050424.6349.9919.1313CA51@psf.io> https://hg.python.org/cpython/rev/4a82412a3c51 changeset: 105776:4a82412a3c51 branch: 3.6 parent: 105772:f34dac552ad8 parent: 105775:eb8667196f93 user: Terry Jan Reedy date: Thu Dec 22 00:02:36 2016 -0500 summary: Issue 28923: Remove editor artifacts from Tix.py, files: Lib/tkinter/tix.py | 4 ---- Misc/NEWS | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1,7 +1,3 @@ -# -*-mode: python; fill-column: 75; tab-width: 8 -*- -# -# $Id$ -# # Tix.py -- Tix widget wrappers. # # For Tix, see http://tix.sourceforge.net diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,8 @@ Library ------- +- Issue 28923: Remove editor artifacts from Tix.py. + - Issue #28871: Fixed a crash when deallocate deep ElementTree. - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 00:04:25 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 22 Dec 2016 05:04:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_28923=3A_Remove_editor_artifacts_from_Tix=2Epy=2C?= Message-ID: <20161222050425.20377.84840.AA9B0AD0@psf.io> https://hg.python.org/cpython/rev/41031fdc924a changeset: 105777:41031fdc924a parent: 105773:c568b6ac5e89 parent: 105776:4a82412a3c51 user: Terry Jan Reedy date: Thu Dec 22 00:04:11 2016 -0500 summary: Issue 28923: Remove editor artifacts from Tix.py, files: Lib/tkinter/tix.py | 4 ---- Misc/NEWS | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1,7 +1,3 @@ -# -*-mode: python; fill-column: 75; tab-width: 8 -*- -# -# $Id$ -# # Tix.py -- Tix widget wrappers. # # For Tix, see http://tix.sourceforge.net diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -205,6 +205,8 @@ Library ------- +- Issue 28923: Remove editor artifacts from Tix.py. + - Issue #28871: Fixed a crash when deallocate deep ElementTree. - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 00:04:25 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 22 Dec 2016 05:04:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgMjg5MjM6?= =?utf-8?q?_Remove_editor_artifacts_from_Tix=2Epy=2E?= Message-ID: <20161222050424.20215.67234.03918A7A@psf.io> https://hg.python.org/cpython/rev/eb8667196f93 changeset: 105775:eb8667196f93 branch: 3.5 parent: 105764:957091874ea0 user: Terry Jan Reedy date: Wed Dec 21 23:59:47 2016 -0500 summary: Issue 28923: Remove editor artifacts from Tix.py. files: Lib/tkinter/tix.py | 4 ---- Misc/NEWS | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1,7 +1,3 @@ -# -*-mode: python; fill-column: 75; tab-width: 8 -*- -# -# $Id$ -# # Tix.py -- Tix widget wrappers. # # For Tix, see http://tix.sourceforge.net diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -138,6 +138,8 @@ Library ------- +- Issue 28923: Remove editor artifacts from Tix.py. + - Issue #28871: Fixed a crash when deallocate deep ElementTree. - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 02:38:06 2016 From: python-checkins at python.org (xiang.zhang) Date: Thu, 22 Dec 2016 07:38:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329044=3A_Merge_3=2E5=2E?= Message-ID: <20161222073805.26808.20139.70E55256@psf.io> https://hg.python.org/cpython/rev/cc61d1d45291 changeset: 105779:cc61d1d45291 branch: 3.6 parent: 105776:4a82412a3c51 parent: 105778:e572c323fe53 user: Xiang Zhang date: Thu Dec 22 15:31:22 2016 +0800 summary: Issue #29044: Merge 3.5. files: Objects/unicodeobject.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -14324,11 +14324,12 @@ if (iobj == NULL) { goto onError; } - v = iobj; + x = PyLong_AsLong(iobj); Py_DECREF(iobj); } - /* Integer input truncated to a character */ - x = PyLong_AsLong(v); + else { + x = PyLong_AsLong(v); + } if (x == -1 && PyErr_Occurred()) goto onError; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 02:38:06 2016 From: python-checkins at python.org (xiang.zhang) Date: Thu, 22 Dec 2016 07:38:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI5MDQ0OiBNZXJnZSAzLjYu?= Message-ID: <20161222073806.106725.63222.6A200034@psf.io> https://hg.python.org/cpython/rev/a1d5388d5da9 changeset: 105780:a1d5388d5da9 parent: 105777:41031fdc924a parent: 105779:cc61d1d45291 user: Xiang Zhang date: Thu Dec 22 15:31:55 2016 +0800 summary: Issue #29044: Merge 3.6. files: Objects/unicodeobject.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -14286,11 +14286,12 @@ if (iobj == NULL) { goto onError; } - v = iobj; + x = PyLong_AsLong(iobj); Py_DECREF(iobj); } - /* Integer input truncated to a character */ - x = PyLong_AsLong(v); + else { + x = PyLong_AsLong(v); + } if (x == -1 && PyErr_Occurred()) goto onError; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 02:38:06 2016 From: python-checkins at python.org (xiang.zhang) Date: Thu, 22 Dec 2016 07:38:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDQ0?= =?utf-8?q?=3A_Fix_a_use-after-free_in_string_=27=25c=27_formatter=2E?= Message-ID: <20161222073805.107800.12813.EF5CCC16@psf.io> https://hg.python.org/cpython/rev/e572c323fe53 changeset: 105778:e572c323fe53 branch: 3.5 parent: 105775:eb8667196f93 user: Xiang Zhang date: Thu Dec 22 15:30:47 2016 +0800 summary: Issue #29044: Fix a use-after-free in string '%c' formatter. files: Objects/unicodeobject.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -14213,11 +14213,12 @@ if (iobj == NULL) { goto onError; } - v = iobj; + x = PyLong_AsLong(iobj); Py_DECREF(iobj); } - /* Integer input truncated to a character */ - x = PyLong_AsLong(v); + else { + x = PyLong_AsLong(v); + } if (x == -1 && PyErr_Occurred()) goto onError; -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Dec 22 04:07:04 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 22 Dec 2016 09:07:04 +0000 Subject: [Python-checkins] Daily reference leaks (41031fdc924a): sum=4 Message-ID: <20161222090704.26751.64667.F4B311FC@psf.io> results for 41031fdc924a on branch "default" -------------------------------------------- test_collections leaked [7, 0, -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/reflogHiUVN7', '--timeout', '7200'] From python-checkins at python.org Thu Dec 22 04:41:16 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 22 Dec 2016 09:41:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI4NzYyOiBNZXJnZSAzLjYu?= Message-ID: <20161222094116.19684.66825.E46064C3@psf.io> https://hg.python.org/cpython/rev/146157d91283 changeset: 105782:146157d91283 parent: 105780:a1d5388d5da9 parent: 105781:51b09b10d4f8 user: Xavier de Gaye date: Thu Dec 22 10:40:44 2016 +0100 summary: Issue #28762: Merge 3.6. files: Misc/NEWS | 3 +++ configure | 31 ++++++++++++++++++++++++++++++- configure.ac | 11 ++++++++++- pyconfig.h.in | 4 ++-- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -581,6 +581,9 @@ Build ----- +- Issue #28762: lockf() is available on Android API level 24, but the F_LOCK + macro is not defined in android-ndk-r13. + - Issue #28538: Fix the compilation error that occurs because if_nameindex() is available on Android API level 24, but the if_nameindex structure is not defined. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -11202,7 +11202,7 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ + initgroups kill killpg lchmod lchown linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ posix_fallocate posix_fadvise pread \ @@ -12694,6 +12694,35 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +# Issue #28762: lockf() is available on Android API level 24, but the F_LOCK +# macro is not defined in android-ndk-r13. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lockf" >&5 +$as_echo_n "checking for lockf... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +lockf(0, F_LOCK, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_LOCKF 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -3386,7 +3386,7 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ + initgroups kill killpg lchmod lchown linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ posix_fallocate posix_fadvise pread \ @@ -3763,6 +3763,15 @@ [AC_MSG_RESULT(no) ]) +# Issue #28762: lockf() is available on Android API level 24, but the F_LOCK +# macro is not defined in android-ndk-r13. +AC_MSG_CHECKING(for lockf) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[lockf(0, F_LOCK, 0);]])], + [AC_DEFINE(HAVE_LOCKF, 1, Define to 1 if you have the 'lockf' function and the F_LOCK macro.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) +]) + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. AC_MSG_CHECKING(for getaddrinfo) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -472,7 +472,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H -/* Define to 1 if you have the `if_nameindex' function. */ +/* Define to 1 if you have the 'if_nameindex' function. */ #undef HAVE_IF_NAMEINDEX /* Define if you have the 'inet_aton' function. */ @@ -574,7 +574,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TIPC_H -/* Define to 1 if you have the `lockf' function. */ +/* Define to 1 if you have the 'lockf' function and the F_LOCK macro. */ #undef HAVE_LOCKF /* Define to 1 if you have the `log1p' function. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 04:41:16 2016 From: python-checkins at python.org (xavier.degaye) Date: Thu, 22 Dec 2016 09:41:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NzYy?= =?utf-8?q?=3A_lockf=28=29_is_available_on_Android_API_level_24=2C_but_the?= Message-ID: <20161222094116.107242.99717.E9AE4005@psf.io> https://hg.python.org/cpython/rev/51b09b10d4f8 changeset: 105781:51b09b10d4f8 branch: 3.6 parent: 105779:cc61d1d45291 user: Xavier de Gaye date: Thu Dec 22 10:38:59 2016 +0100 summary: Issue #28762: lockf() is available on Android API level 24, but the F_LOCK macro is not defined in android-ndk-r13. files: Misc/NEWS | 3 +++ configure | 31 ++++++++++++++++++++++++++++++- configure.ac | 11 ++++++++++- pyconfig.h.in | 4 ++-- 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -84,6 +84,9 @@ Build ----- +- Issue #28762: lockf() is available on Android API level 24, but the F_LOCK + macro is not defined in android-ndk-r13. + - Issue #28538: Fix the compilation error that occurs because if_nameindex() is available on Android API level 24, but the if_nameindex structure is not defined. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -11198,7 +11198,7 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ + initgroups kill killpg lchmod lchown linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ posix_fallocate posix_fadvise pread \ @@ -12690,6 +12690,35 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext +# Issue #28762: lockf() is available on Android API level 24, but the F_LOCK +# macro is not defined in android-ndk-r13. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lockf" >&5 +$as_echo_n "checking for lockf... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +lockf(0, F_LOCK, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +$as_echo "#define HAVE_LOCKF 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -3384,7 +3384,7 @@ futimens futimes gai_strerror getentropy \ getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \ - initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \ + initgroups kill killpg lchmod lchown linkat lstat lutimes mmap \ memrchr mbrtowc mkdirat mkfifo \ mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \ posix_fallocate posix_fadvise pread \ @@ -3761,6 +3761,15 @@ [AC_MSG_RESULT(no) ]) +# Issue #28762: lockf() is available on Android API level 24, but the F_LOCK +# macro is not defined in android-ndk-r13. +AC_MSG_CHECKING(for lockf) +AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[lockf(0, F_LOCK, 0);]])], + [AC_DEFINE(HAVE_LOCKF, 1, Define to 1 if you have the 'lockf' function and the F_LOCK macro.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) +]) + # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. AC_MSG_CHECKING(for getaddrinfo) diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -472,7 +472,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_IEEEFP_H -/* Define to 1 if you have the `if_nameindex' function. */ +/* Define to 1 if you have the 'if_nameindex' function. */ #undef HAVE_IF_NAMEINDEX /* Define if you have the 'inet_aton' function. */ @@ -574,7 +574,7 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TIPC_H -/* Define to 1 if you have the `lockf' function. */ +/* Define to 1 if you have the 'lockf' function and the F_LOCK macro. */ #undef HAVE_LOCKF /* Define to 1 if you have the `log1p' function. */ -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Thu Dec 22 10:14:01 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 22 Dec 2016 15:14:01 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-12-22 Message-ID: <766cf8df-8dcc-4930-b7ac-4a6f7b4d43da@irsmsx101.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-22 11:47:55 +0000 commit: 78bf34b6a713 previous commit: 32cc37a89b58 revision date: 2016-12-21 10:55:28 +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% 2.62% 6.47% 5.16% :-) pybench 0.18% 0.03% 7.95% 2.81% :-| regex_v8 1.83% 0.12% -0.91% 11.21% :-) nbody 0.11% -0.01% 13.22% 1.06% :-| json_dump_v2 0.14% 0.38% 0.45% 10.49% :-( normal_startup 2.05% -0.04% -2.71% 2.82% :-| ssbench 0.26% 0.18% 0.27% 1.96% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-12-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 Thu Dec 22 10:15:21 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 22 Dec 2016 15:15:21 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-12-22 Message-ID: <5f136983-caa2-44b7-9fa8-f0ead9ff0661@irsmsx101.ger.corp.intel.com> Results for project Python default, build date 2016-12-22 11:03:14 +0000 commit: c568b6ac5e89 previous commit: ce6a6cc3765d revision date: 2016-12-21 16:30:50 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.21% 0.79% 0.15% 15.47% :-| pybench 0.27% 0.01% 1.25% 5.39% :-| regex_v8 3.61% -0.00% -1.31% 2.91% :-| nbody 0.14% 0.02% 0.90% 4.53% :-) json_dump_v2 0.33% 1.08% 9.10% 10.23% :-| normal_startup 0.95% -0.19% -0.84% 6.41% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-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 python-checkins at python.org Thu Dec 22 13:02:38 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 22 Dec 2016 18:02:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Grammatical_fi?= =?utf-8?q?xes_following_=23d95f19892fd0?= Message-ID: <20161222180237.107445.36278.17E26C8C@psf.io> https://hg.python.org/cpython/rev/d0fee144284a changeset: 105783:d0fee144284a branch: 3.5 parent: 105778:e572c323fe53 user: Brett Cannon date: Thu Dec 22 10:02:01 2016 -0800 summary: Grammatical fixes following #d95f19892fd0 files: Doc/howto/pyporting.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -81,7 +81,7 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -freely upported and thus is not receiving bugfixes. This means **you** will have +freely supported and thus is not receiving bugfixes. This means **you** will have to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier @@ -107,9 +107,9 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get passed 90%). If you -don't already have a tool to measure test coverage then coverage.py_ is -recommended. +coverage (and don't feel bad if you find it hard to get better than 90% +coverage). If you don't already have a tool to measure test coverage then +coverage.py_ is recommended. Learn the differences between Python 2 & 3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 13:02:38 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 22 Dec 2016 18:02:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge?= Message-ID: <20161222180237.106798.54787.8B8E6960@psf.io> https://hg.python.org/cpython/rev/20ef70c2b3d0 changeset: 105784:20ef70c2b3d0 branch: 3.6 parent: 105781:51b09b10d4f8 parent: 105783:d0fee144284a user: Brett Cannon date: Thu Dec 22 10:02:16 2016 -0800 summary: Merge files: Doc/howto/pyporting.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -81,7 +81,7 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -freely upported and thus is not receiving bugfixes. This means **you** will have +freely supported and thus is not receiving bugfixes. This means **you** will have to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier @@ -107,9 +107,9 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get passed 90%). If you -don't already have a tool to measure test coverage then coverage.py_ is -recommended. +coverage (and don't feel bad if you find it hard to get better than 90% +coverage). If you don't already have a tool to measure test coverage then +coverage.py_ is recommended. Learn the differences between Python 2 & 3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 13:02:40 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 22 Dec 2016 18:02:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <20161222180238.79722.49518.B0EED47F@psf.io> https://hg.python.org/cpython/rev/0181578dc746 changeset: 105785:0181578dc746 parent: 105782:146157d91283 parent: 105784:20ef70c2b3d0 user: Brett Cannon date: Thu Dec 22 10:02:28 2016 -0800 summary: Merge files: Doc/howto/pyporting.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -81,7 +81,7 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -freely upported and thus is not receiving bugfixes. This means **you** will have +freely supported and thus is not receiving bugfixes. This means **you** will have to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier @@ -107,9 +107,9 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get passed 90%). If you -don't already have a tool to measure test coverage then coverage.py_ is -recommended. +coverage (and don't feel bad if you find it hard to get better than 90% +coverage). If you don't already have a tool to measure test coverage then +coverage.py_ is recommended. Learn the differences between Python 2 & 3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 13:03:23 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 22 Dec 2016 18:03:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Grammatical_fi?= =?utf-8?q?xes_for_d95f19892fd0?= Message-ID: <20161222180322.20315.81965.83FE4AB5@psf.io> https://hg.python.org/cpython/rev/edc601b74f31 changeset: 105786:edc601b74f31 branch: 2.7 parent: 105774:ef03aff3b195 user: Brett Cannon date: Thu Dec 22 10:03:11 2016 -0800 summary: Grammatical fixes for d95f19892fd0 files: Doc/howto/pyporting.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -81,7 +81,7 @@ overall transformation should not feel foreign to you. But you should aim for only supporting Python 2.7. Python 2.6 is no longer -freely upported and thus is not receiving bugfixes. This means **you** will have +freely supported and thus is not receiving bugfixes. This means **you** will have to work around any issues you come across with Python 2.6. There are also some tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and this will become more commonplace as time goes on. It will simply be easier @@ -107,9 +107,9 @@ thumb is that if you want to be confident enough in your test suite that any failures that appear after having tools rewrite your code are actual bugs in the tools and not in your code. If you want a number to aim for, try to get over 80% -coverage (and don't feel bad if you can't easily get passed 90%). If you -don't already have a tool to measure test coverage then coverage.py_ is -recommended. +coverage (and don't feel bad if you find it hard to get better than 90% +coverage). If you don't already have a tool to measure test coverage then +coverage.py_ is recommended. Learn the differences between Python 2 & 3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 22 22:15:16 2016 From: python-checkins at python.org (xiang.zhang) Date: Fri, 23 Dec 2016 03:15:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MDM4?= =?utf-8?q?=3A_Fix_duplicate_get=5Fca=5Fcerts=28=29_doc_entry=2E?= Message-ID: <20161223031516.19780.33600.40379C55@psf.io> https://hg.python.org/cpython/rev/94900abda1a5 changeset: 105787:94900abda1a5 branch: 2.7 user: Xiang Zhang date: Fri Dec 23 11:10:19 2016 +0800 summary: Issue #29038: Fix duplicate get_ca_certs() doc entry. files: Doc/library/ssl.rst | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1124,6 +1124,10 @@ does not contain certificates from *capath* unless a certificate was requested and loaded by a SSL connection. + .. note:: + Certificates in a capath directory aren't loaded unless they have + been used at least once. + .. method:: SSLContext.set_default_verify_paths() Load a set of default "certification authority" (CA) certificates from @@ -1287,16 +1291,6 @@ >>> stats['hits'], stats['misses'] (0, 0) -.. method:: SSLContext.get_ca_certs(binary_form=False) - - Returns a list of dicts with information of loaded CA certs. If the - optional argument is true, returns a DER-encoded copy of the CA - certificate. - - .. note:: - Certificates in a capath directory aren't loaded unless they have - been used at least once. - .. attribute:: SSLContext.check_hostname Wether to match the peer cert's hostname with :func:`match_hostname` in -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Dec 23 04:08:07 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 23 Dec 2016 09:08:07 +0000 Subject: [Python-checkins] Daily reference leaks (0181578dc746): sum=5 Message-ID: <20161223090807.4558.62884.F75A65A8@psf.io> results for 0181578dc746 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/reflogCtMMuw', '--timeout', '7200'] From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Added_tag_v3?= =?utf-8?q?=2E6=2E0_for_changeset_41df79263a11?= Message-ID: <20161223092009.16955.52711.1AA46EB8@psf.io> https://hg.python.org/cpython/rev/a7844c655bad changeset: 105789:a7844c655bad branch: 3.6 user: Ned Deily date: Thu Dec 22 19:41:47 2016 -0500 summary: Added tag v3.6.0 for changeset 41df79263a11 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -175,3 +175,4 @@ 8345e066c0ed713c3e510cbc8fafc1c38d6d306b v3.6.0b3 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 +41df79263a11f2429d1dd0cfe12553de3dcb5508 v3.6.0 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_merge_3=2E5?= Message-ID: <20161223092009.107001.66960.C8049E0F@psf.io> https://hg.python.org/cpython/rev/a0aab1d2a8d6 changeset: 105794:a0aab1d2a8d6 branch: 3.6 parent: 105790:ae873d16d0c4 parent: 105793:9cffc1188118 user: Ned Deily date: Fri Dec 23 04:15:34 2016 -0500 summary: merge 3.5 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_documen?= =?utf-8?q?tation_index_sidebar_for_3=2E6=2E0_release=2E?= Message-ID: <20161223092009.107001.88253.793DE974@psf.io> https://hg.python.org/cpython/rev/d1c16588644f changeset: 105792:d1c16588644f branch: 2.7 parent: 105787:94900abda1a5 user: Ned Deily date: Fri Dec 23 04:12:46 2016 -0500 summary: Update documentation index sidebar for 3.6.0 release. files: Doc/tools/templates/indexsidebar.html | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -3,7 +3,7 @@

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Update_documen?= =?utf-8?q?tation_index_sidebar_for_3=2E6=2E0_release=2E?= Message-ID: <20161223092009.19742.41582.662D3BDD@psf.io> https://hg.python.org/cpython/rev/9cffc1188118 changeset: 105793:9cffc1188118 branch: 3.5 parent: 105783:d0fee144284a user: Ned Deily date: Fri Dec 23 04:13:31 2016 -0500 summary: Update documentation index sidebar for 3.6.0 release. files: Doc/tools/templates/indexsidebar.html | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -3,7 +3,7 @@

{% trans %}Docs for other versions{% endtrans %}

-- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Update_documentation_index_sidebar_for_3=2E6=2E0_release?= =?utf-8?q?=2E?= Message-ID: <20161223092009.5907.24665.BCDB5FC9@psf.io> https://hg.python.org/cpython/rev/f138b53ee72e changeset: 105795:f138b53ee72e parent: 105791:29c5dd3f9277 parent: 105794:a0aab1d2a8d6 user: Ned Deily date: Fri Dec 23 04:17:38 2016 -0500 summary: Update documentation index sidebar for 3.6.0 release. files: Doc/tools/templates/indexsidebar.html | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html --- a/Doc/tools/templates/indexsidebar.html +++ b/Doc/tools/templates/indexsidebar.html @@ -4,7 +4,7 @@ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E6=2E0_release_into_default?= Message-ID: <20161223092009.19864.90706.1BCBC010@psf.io> https://hg.python.org/cpython/rev/29c5dd3f9277 changeset: 105791:29c5dd3f9277 parent: 105785:0181578dc746 parent: 105790:ae873d16d0c4 user: Ned Deily date: Fri Dec 23 04:10:46 2016 -0500 summary: Merge 3.6.0 release into default files: .hgtags | 1 + Doc/whatsnew/3.6.rst | 3 + Misc/NEWS | 734 ++++++++++++++++++++++++++++++- README | 4 +- 4 files changed, 729 insertions(+), 13 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -176,3 +176,4 @@ 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 800a67f7806de45a7abd5273359e704bf147c079 v3.6.0rc2 +41df79263a11f2429d1dd0cfe12553de3dcb5508 v3.6.0 diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -47,6 +47,9 @@ when researching a change. This article explains the new features in Python 3.6, compared to 3.5. +Python 3.6 was released on December 23, 2016. ?See the +`changelog `_ for a full +list of changes. .. seealso:: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,8 +2,8 @@ Python News +++++++++++ -What's New in Python 3.7.0 alpha 1 -================================== +What's New in Python 3.7.0 alpha 1? +=================================== *Release date: XXXX-XX-XX* @@ -671,8 +671,720 @@ test_functools hanging on the Android armv7 qemu emulator. -What's New in Python 3.6.0 beta 1 -================================= +What's New in Python 3.6.1 release candidate 1? +=============================================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +- Issue #28932: Do not include if it does not exist. + +- Issue #25677: Correct the positioning of the syntax error caret for + indented blocks. Based on patch by Michael Layzell. + +- Issue #29000: Fixed bytes formatting of octals with zero padding in alternate + form. + +- Issue #26919: On Android, operating system data is now always encoded/decoded + to/from UTF-8, instead of the locale encoding to avoid inconsistencies with + os.fsencode() and os.fsdecode() which are already using UTF-8. + +- Issue #28991: functools.lru_cache() was susceptible to an obscure reentrancy + bug triggerable by a monkey-patched len() function. + +- Issue #28739: f-string expressions are no longer accepted as docstrings and + by ast.literal_eval() even if they do not include expressions. + +- Issue #28512: Fixed setting the offset attribute of SyntaxError by + PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject(). + +- Issue #28918: Fix the cross compilation of xxlimited when Python has been + built with Py_DEBUG defined. + +- Issue #28731: Optimize _PyDict_NewPresized() to create correct size dict. + Improve speed of dict literal with constant keys up to 30%. + +Library +------- + +- Issue 28923: Remove editor artifacts from Tix.py. + +- Issue #28871: Fixed a crash when deallocate deep ElementTree. + +- Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and + WeakValueDictionary.pop() when a GC collection happens in another + thread. + +- Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that + doesn't own its elements as limits. + +- Issue #28779: multiprocessing.set_forkserver_preload() would crash the + forkserver process if a preloaded module instantiated some + multiprocessing objects such as locks. + +- Issue #28847: dbm.dumb now supports reading read-only files and no longer + writes the index file when it is not changed. + +- Issue #26937: The chown() method of the tarfile.TarFile class does not fail + now when the grp module cannot be imported, as for example on Android + platforms. + +Windows +------- + +- Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) + +- Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. + +Tests +----- + +- Issue #28950: Disallow -j0 to be combined with -T/-l in regrtest + command line arguments. + +- Issue #28683: Fix the tests that bind() a unix socket and raise + PermissionError on Android for a non-root user. + +- Issue #26939: Add the support.setswitchinterval() function to fix + test_functools hanging on the Android armv7 qemu emulator. + +Build +----- + +- Issue #28762: lockf() is available on Android API level 24, but the F_LOCK + macro is not defined in android-ndk-r13. + +- Issue #28538: Fix the compilation error that occurs because if_nameindex() is + available on Android API level 24, but the if_nameindex structure is not + defined. + +- Issue #20211: Do not add the directory for installing C header files and the + directory for installing object code libraries to the cross compilation + search paths. Original patch by Thomas Petazzoni. + +- Issue #28849: Do not define sys.implementation._multiarch on Android. + + +What's New in Python 3.6.0? +=========================== + +*Release date: 2016-12-23* + +- No changes since release candidate 2 + + +What's New in Python 3.6.0 release candidate 2? +=============================================== + +*Release date: 2016-12-16* + +Core and Builtins +----------------- + +- Issue #28147: Fix a memory leak in split-table dictionaries: setattr() + must not convert combined table into split table. Patch written by INADA + Naoki. + +- Issue #28990: Fix asyncio SSL hanging if connection is closed before + handshake is completed. (Patch by HoHo-Ho) + +Tools/Demos +----------- + +- Issue #28770: Fix python-gdb.py for fastcalls. + +Windows +------- + +- Issue #28896: Deprecate WindowsRegistryFinder. + +Build +----- + +- Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. + + +What's New in Python 3.6.0 release candidate 1? +=============================================== + +*Release date: 2016-12-06* + +Core and Builtins +----------------- + +- Issue #23722: Rather than silently producing a class that doesn't support + zero-argument ``super()`` in methods, failing to pass the new + ``__classcell__`` namespace entry up to ``type.__new__`` now results in a + ``DeprecationWarning`` and a class that supports zero-argument ``super()``. + +- Issue #28797: Modifying the class __dict__ inside the __set_name__ method of + a descriptor that is used inside that class no longer prevents calling the + __set_name__ method of other descriptors. + +- Issue #28782: Fix a bug in the implementation ``yield from`` when checking + if the next instruction is YIELD_FROM. Regression introduced by WORDCODE + (issue #26647). + +Library +------- + +- Issue #27030: Unknown escapes in re.sub() replacement template are allowed + again. But they still are deprecated and will be disabled in 3.7. + +- Issue #28835: Fix a regression introduced in warnings.catch_warnings(): + call warnings.showwarning() if it was overriden inside the context manager. + +- Issue #27172: To assist with upgrades from 2.7, the previously documented + deprecation of ``inspect.getfullargspec()`` has been reversed. This decision + may be revisited again after the Python 2.7 branch is no longer officially + supported. + +- Issue #24142: Reading a corrupt config file left configparser in an + invalid state. Original patch by Florian H?ch. + +- Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. + +C API +----- + +- Issue #28808: PyUnicode_CompareWithASCIIString() now never raises exceptions. + +Documentation +------------- + +- Issue #23722: The data model reference and the porting section in the What's + New guide now cover the additional ``__classcell__`` handling needed for + custom metaclasses to fully support PEP 487 and zero-argument ``super()``. + +Tools/Demos +----------- + +- Issue #28023: Fix python-gdb.py didn't support new dict implementation. + + +What's New in Python 3.6.0 beta 4? +================================== + +*Release date: 2016-11-21* + +Core and Builtins +----------------- + +- Issue #28532: Show sys.version when -V option is supplied twice. + +- Issue #27100: The with-statement now checks for __enter__ before it + checks for __exit__. This gives less confusing error messages when + both methods are missing. Patch by Jonathan Ellington. + +- Issue #28746: Fix the set_inheritable() file descriptor method on platforms + that do not have the ioctl FIOCLEX and FIONCLEX commands. + +- Issue #26920: Fix not getting the locale's charset upon initializing the + interpreter, on platforms that do not have langinfo. + +- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X + when decode astral characters. Patch by Xiang Zhang. + +- Issue #19398: Extra slash no longer added to sys.path components in case of + empty compile-time PYTHONPATH components. + +- Issue #28665: Improve speed of the STORE_DEREF opcode by 40%. + +- Issue #28583: PyDict_SetDefault didn't combine split table when needed. + Patch by Xiang Zhang. + +- Issue #27243: Change PendingDeprecationWarning -> DeprecationWarning. + As it was agreed in the issue, __aiter__ returning an awaitable + should result in PendingDeprecationWarning in 3.5 and in + DeprecationWarning in 3.6. + +- Issue #26182: Fix a refleak in code that raises DeprecationWarning. + +- Issue #28721: Fix asynchronous generators aclose() and athrow() to + handle StopAsyncIteration propagation properly. + +Library +------- + +- Issue #26273: Add new :data:`socket.TCP_CONGESTION` (Linux 2.6.13) and + :data:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37) constants. Patch written by + Omar Sandoval. + +- Issue #28752: Restored the __reduce__() methods of datetime objects. + +- Issue #28727: Regular expression patterns, _sre.SRE_Pattern objects created + by re.compile(), become comparable (only x==y and x!=y operators). This + change should fix the issue #18383: don't duplicate warning filters when the + warnings module is reloaded (thing usually only done in unit tests). + +- Issue #20572: The subprocess.Popen.wait method's undocumented + endtime parameter now raises a DeprecationWarning. + +- Issue #25659: In ctypes, prevent a crash calling the from_buffer() and + from_buffer_copy() methods on abstract classes like Array. + +- Issue #19717: Makes Path.resolve() succeed on paths that do not exist. + Patch by Vajrasky Kok + +- Issue #28563: Fixed possible DoS and arbitrary code execution when handle + plural form selections in the gettext module. The expression parser now + supports exact syntax supported by GNU gettext. + +- Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when + the garbage collector is invoked in other thread. Based on patch by + Sebastian Cufre. + +- Issue #28600: Optimize loop.call_soon. + +- Issue #28613: Fix get_event_loop() return the current loop if + called from coroutines/callbacks. + +- Issue #28634: Fix asyncio.isfuture() to support unittest.Mock. + +- Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. + +- Issue #28639: Fix inspect.isawaitable to always return bool + Patch by Justin Mayfield. + +- Issue #28652: Make loop methods reject socket kinds they do not support. + +- Issue #28653: Fix a refleak in functools.lru_cache. + +- Issue #28703: Fix asyncio.iscoroutinefunction to handle Mock objects. + +- Issue #28704: Fix create_unix_server to support Path-like objects + (PEP 519). + +- Issue #28720: Add collections.abc.AsyncGenerator. + +Documentation +------------- + +- Issue #28513: Documented command-line interface of zipfile. + +Tests +----- + +- Issue #28666: Now test.support.rmtree is able to remove unwritable or + unreadable directories. + +- Issue #23839: Various caches now are cleared before running every test file. + +Build +----- + +- Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and + Michael Haubenwallner. + +- Issue #26359: Rename --with-optimiations to --enable-optimizations. + +- Issue #28676: Prevent missing 'getentropy' declaration warning on macOS. + Patch by Gareth Rees. + + +What's New in Python 3.6.0 beta 3? +================================== + +*Release date: 2016-10-31* + +Core and Builtins +----------------- + +- Issue #28128: Deprecation warning for invalid str and byte escape + sequences now prints better information about where the error + occurs. Patch by Serhiy Storchaka and Eric Smith. + +- Issue #28509: dict.update() no longer allocate unnecessary large memory. + +- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug + build. + +- Issue #28517: Fixed of-by-one error in the peephole optimizer that caused + keeping unreachable code. + +- Issue #28214: Improved exception reporting for problematic __set_name__ + attributes. + +- Issue #23782: Fixed possible memory leak in _PyTraceback_Add() and exception + loss in PyTraceBack_Here(). + +- Issue #28471: Fix "Python memory allocator called without holding the GIL" + crash in socket.setblocking. + +Library +------- + +- Issue #27517: LZMA compressor and decompressor no longer raise exceptions if + given empty data twice. Patch by Benjamin Fogle. + +- Issue #28549: Fixed segfault in curses's addch() with ncurses6. + +- Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tar + file with compression before trying to open it without compression. Otherwise + it had 50% chance failed with ignore_zeros=True. + +- Issue #23262: The webbrowser module now supports Firefox 36+ and derived + browsers. Based on patch by Oleg Broytman. + +- Issue #27939: Fixed bugs in tkinter.ttk.LabeledScale and tkinter.Scale caused + by representing the scale as float value internally in Tk. tkinter.IntVar + now works if float value is set to underlying Tk variable. + +- Issue #18844: The various ways of specifying weights for random.choices() + now produce the same result sequences. + +- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space + at the start of new line after printing a month's calendar. Patch by + Xiang Zhang. + +- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces. + Based on patch by Kaarle Ritvanen. + +- Issue #28353: os.fwalk() no longer fails on broken links. + +- Issue #28430: Fix iterator of C implemented asyncio.Future doesn't accept + non-None value is passed to it.send(val). + +- Issue #27025: Generated names for Tkinter widgets now start by the "!" prefix + for readability (was "`"). + +- Issue #25464: Fixed HList.header_exists() in tkinter.tix module by addin + a workaround to Tix library bug. + +- Issue #28488: shutil.make_archive() no longer adds entry "./" to ZIP archive. + +- Issue #25953: re.sub() now raises an error for invalid numerical group + reference in replacement template even if the pattern is not found in + the string. Error message for invalid group reference now includes the + group index and the position of the reference. + Based on patch by SilentGhost. + +- Issue #18219: Optimize csv.DictWriter for large number of columns. + Patch by Mariatta Wijaya. + +- Issue #28448: Fix C implemented asyncio.Future didn't work on Windows. + +- Issue #28480: Fix error building socket module when multithreading is + disabled. + +- Issue #24452: Make webbrowser support Chrome on Mac OS X. + +- Issue #20766: Fix references leaked by pdb in the handling of SIGINT + handlers. + +- Issue #28492: Fix how StopIteration exception is raised in _asyncio.Future. + +- Issue #28500: Fix asyncio to handle async gens GC from another thread. + +- Issue #26923: Fix asyncio.Gather to refuse being cancelled once all + children are done. + Patch by Johannes Ebke. + +- Issue #26796: Don't configure the number of workers for default + threadpool executor. + Initial patch by Hans Lawrenz. + +- Issue #28544: Implement asyncio.Task in C. + +Windows +------- + +- Issue #28522: Fixes mishandled buffer reallocation in getpathp.c + +Build +----- + +- Issue #28444: Fix missing extensions modules when cross compiling. + +- Issue #28208: Update Windows build and OS X installers to use SQLite 3.14.2. + +- Issue #28248: Update Windows build and OS X installers to use OpenSSL 1.0.2j. + +Tests +----- + +- Issue #26944: Fix test_posix for Android where 'id -G' is entirely wrong or + missing the effective gid. + +- Issue #28409: regrtest: fix the parser of command line arguments. + + +What's New in Python 3.6.0 beta 2? +================================== + +*Release date: 2016-10-10* + +Core and Builtins +----------------- + +- Issue #28183: Optimize and cleanup dict iteration. + +- Issue #26081: Added C implementation of asyncio.Future. + Original patch by Yury Selivanov. + +- Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters(). + Patch by Xiang Zhang. + +- Issue #28376: The type of long range iterator is now registered as Iterator. + Patch by Oren Milman. + +- Issue #28376: Creating instances of range_iterator by calling range_iterator + type now is deprecated. Patch by Oren Milman. + +- Issue #28376: The constructor of range_iterator now checks that step is not 0. + Patch by Oren Milman. + +- Issue #26906: Resolving special methods of uninitialized type now causes + implicit initialization of the type instead of a fail. + +- Issue #18287: PyType_Ready() now checks that tp_name is not NULL. + Original patch by Niklas Koep. + +- Issue #24098: Fixed possible crash when AST is changed in process of + compiling it. + +- Issue #28201: Dict reduces possibility of 2nd conflict in hash table when + hashes have same lower bits. + +- Issue #28350: String constants with null character no longer interned. + +- Issue #26617: Fix crash when GC runs during weakref callbacks. + +- Issue #27942: String constants now interned recursively in tuples and frozensets. + +- Issue #21578: Fixed misleading error message when ImportError called with + invalid keyword args. + +- Issue #28203: Fix incorrect type in complex(1.0, {2:3}) error message. + Patch by Soumya Sharma. + +- Issue #28086: Single var-positional argument of tuple subtype was passed + unscathed to the C-defined function. Now it is converted to exact tuple. + +- Issue #28214: Now __set_name__ is looked up on the class instead of the + instance. + +- Issue #27955: Fallback on reading /dev/urandom device when the getrandom() + syscall fails with EPERM, for example when blocked by SECCOMP. + +- Issue #28192: Don't import readline in isolated mode. + +- Upgrade internal unicode databases to Unicode version 9.0.0. + +- Issue #28131: Fix a regression in zipimport's compile_source(). zipimport + should use the same optimization level as the interpreter. + +- Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly + optimize memcpy(). + +- Issue #28120: Fix dict.pop() for splitted dictionary when trying to remove a + "pending key" (Not yet inserted in split-table). Patch by Xiang Zhang. + +- Issue #26182: Raise DeprecationWarning when async and await keywords are + used as variable/attribute/class/function name. + +Library +------- + +- Issue #27998: Fixed bytes path support in os.scandir() on Windows. + Patch by Eryk Sun. + +- Issue #28317: The disassembler now decodes FORMAT_VALUE argument. + +- Issue #26293: Fixed writing ZIP files that starts not from the start of the + file. Offsets in ZIP file now are relative to the start of the archive in + conforming to the specification. + +- Issue #28380: unittest.mock Mock autospec functions now properly support + assert_called, assert_not_called, and assert_called_once. + +- Issue #27181 remove statistics.geometric_mean and defer until 3.7. + +- Issue #28229: lzma module now supports pathlib. + +- Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. + +- Issue #28225: bz2 module now supports pathlib. Initial patch by Ethan Furman. + +- Issue #28227: gzip now supports pathlib. Patch by Ethan Furman. + +- Issue #27358: Optimized merging var-keyword arguments and improved error + message when pass a non-mapping as a var-keyword argument. + +- Issue #28257: Improved error message when pass a non-iterable as + a var-positional argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL. + +- Issue #28322: Fixed possible crashes when unpickle itertools objects from + incorrect pickle data. Based on patch by John Leitch. + +- Issue #28228: imghdr now supports pathlib. + +- Issue #28226: compileall now supports pathlib. + +- Issue #28314: Fix function declaration (C flags) for the getiterator() method + of xml.etree.ElementTree.Element. + +- Issue #28148: Stop using localtime() and gmtime() in the time + module. + + Introduced platform independent _PyTime_localtime API that is + similar to POSIX localtime_r, but available on all platforms. Patch + by Ed Schouten. + +- Issue #28253: Fixed calendar functions for extreme months: 0001-01 + and 9999-12. + + Methods itermonthdays() and itermonthdays2() are reimplemented so + that they don't call itermonthdates() which can cause datetime.date + under/overflow. + +- Issue #28275: Fixed possible use after free in the decompress() + methods of the LZMADecompressor and BZ2Decompressor classes. + Original patch by John Leitch. + +- Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation() + if pass invalid string-like object as a name. Patch by Xiang Zhang. + +- Issue #18844: random.choices() now has k as a keyword-only argument + to improve the readability of common cases and come into line + with the signature used in other languages. + +- Issue #18893: Fix invalid exception handling in Lib/ctypes/macholib/dyld.py. + Patch by Madison May. + +- Issue #27611: Fixed support of default root window in the tkinter.tix module. + Added the master parameter in the DisplayStyle constructor. + +- Issue #27348: In the traceback module, restore the formatting of exception + messages like "Exception: None". This fixes a regression introduced in + 3.5a2. + +- Issue #25651: Allow falsy values to be used for msg parameter of subTest(). + +- Issue #27778: Fix a memory leak in os.getrandom() when the getrandom() is + interrupted by a signal and a signal handler raises a Python exception. + +- Issue #28200: Fix memory leak on Windows in the os module (fix + path_converter() function). + +- Issue #25400: RobotFileParser now correctly returns default values for + crawl_delay and request_rate. Initial patch by Peter Wirtz. + +- Issue #27932: Prevent memory leak in win32_ver(). + +- Fix UnboundLocalError in socket._sendfile_use_sendfile. + +- Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of + os.stat(). Patch by Eryk Sun. + +- Issue #22493: Warning message emitted by using inline flags in the middle of + regular expression now contains a (truncated) regex pattern. + Patch by Tim Graham. + +- Issue #25270: Prevent codecs.escape_encode() from raising SystemError when + an empty bytestring is passed. + +- Issue #28181: Get antigravity over HTTPS. Patch by Kaartic Sivaraam. + +- Issue #25895: Enable WebSocket URL schemes in urllib.parse.urljoin. + Patch by Gergely Imreh and Markus Holtermann. + +- Issue #28114: Fix a crash in parse_envlist() when env contains byte strings. + Patch by Eryk Sun. + +- Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). + +- Issue #27906: Fix socket accept exhaustion during high TCP traffic. + Patch by Kevin Conway. + +- Issue #28174: Handle when SO_REUSEPORT isn't properly supported. + Patch by Seth Michael Larson. + +- Issue #26654: Inspect functools.partial in asyncio.Handle.__repr__. + Patch by iceboy. + +- Issue #26909: Fix slow pipes IO in asyncio. + Patch by INADA Naoki. + +- Issue #28176: Fix callbacks race in asyncio.SelectorLoop.sock_connect. + +- Issue #27759: Fix selectors incorrectly retain invalid file descriptors. + Patch by Mark Williams. + +- Issue #28368: Refuse monitoring processes if the child watcher has no + loop attached. + Patch by Vincent Michel. + +- Issue #28369: Raise RuntimeError when transport's FD is used with + add_reader, add_writer, etc. + +- Issue #28370: Speedup asyncio.StreamReader.readexactly. + Patch by ????????? ????. + +- Issue #28371: Deprecate passing asyncio.Handles to run_in_executor. + +- Issue #28372: Fix asyncio to support formatting of non-python coroutines. + +- Issue #28399: Remove UNIX socket from FS before binding. + Patch by ????????? ????. + +- Issue #27972: Prohibit Tasks to await on themselves. + +Windows +------- + +- Issue #28402: Adds signed catalog files for stdlib on Windows. + +- Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by + Eryk Sun) + +- Issue #28251: Improvements to help manuals on Windows. + +- Issue #28110: launcher.msi has different product codes between 32-bit and + 64-bit + +- Issue #28161: Opening CON for write access fails + +- Issue #28162: WindowsConsoleIO readall() fails if first line starts with + Ctrl+Z + +- Issue #28163: WindowsConsoleIO fileno() passes wrong flags to + _open_osfhandle + +- Issue #28164: _PyIO_get_console_type fails for various paths + +- Issue #28137: Renames Windows path file to ._pth + +- Issue #28138: Windows ._pth file should allow import site + +C API +----- + +- Issue #28426: Deprecated undocumented functions PyUnicode_AsEncodedObject(), + PyUnicode_AsDecodedObject(), PyUnicode_AsDecodedUnicode() and + PyUnicode_AsEncodedUnicode(). + +Build +----- + +- Issue #28258: Fixed build with Estonian locale (python-config and distclean + targets in Makefile). Patch by Arfrever Frehtes Taifersar Arahesis. + +- Issue #26661: setup.py now detects system libffi with multiarch wrapper. + +- Issue #15819: Remove redundant include search directory option for building + outside the source tree. + +Tests +----- + +- Issue #28217: Adds _testconsole module to test console input. + + +What's New in Python 3.6.0 beta 1? +================================== *Release date: 2016-09-12* @@ -1182,8 +1894,8 @@ - Issue #27883: Update sqlite to 3.14.1.0 on Windows. -What's New in Python 3.6.0 alpha 4 -================================== +What's New in Python 3.6.0 alpha 4? +=================================== *Release date: 2016-08-15* @@ -1418,8 +2130,9 @@ - Issue #10910: Avoid C++ compilation errors on FreeBSD and OS X. Also update FreedBSD version checks for the original ctype UTF-8 workaround. -What's New in Python 3.6.0 alpha 3 -================================== + +What's New in Python 3.6.0 alpha 3? +=================================== *Release date: 2016-07-11* @@ -1626,8 +2339,8 @@ Android build. -What's New in Python 3.6.0 alpha 2 -================================== +What's New in Python 3.6.0 alpha 2? +=================================== *Release date: 2016-06-13* @@ -6783,5 +7496,4 @@ ".cp35-win32.pyd") will now be loaded in preference to those without tags. - **(For information about older versions, consult the HISTORY file.)** diff --git a/README b/README --- a/README +++ b/README @@ -170,8 +170,8 @@ Install that version using "make install". Install all other versions using "make altinstall". -For example, if you want to install Python 2.6, 2.7 and 3.7 with 2.7 being the -primary version, you would execute "make install" in your 2.7 build directory +For example, if you want to install Python 2.7, 3.6, and 3.7 with 3.7 being the +primary version, you would execute "make install" in your 3.7 build directory and "make altinstall" in the others. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Update_docs_an?= =?utf-8?q?d_patchlevel_for_3=2E6=2E0_final=2E?= Message-ID: <20161223092008.16930.15520.9563A991@psf.io> https://hg.python.org/cpython/rev/41df79263a11 changeset: 105788:41df79263a11 branch: 3.6 tag: v3.6.0 parent: 105697:800a67f7806d user: Ned Deily date: Thu Dec 22 18:38:47 2016 -0500 summary: Update docs and patchlevel for 3.6.0 final. files: Doc/whatsnew/3.6.rst | 3 + Include/patchlevel.h | 6 +- Misc/HISTORY | 4301 +++++++++++++++++++++++++++++ Misc/NEWS | 4344 +----------------------------- README | 8 +- 5 files changed, 4337 insertions(+), 4325 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -47,6 +47,9 @@ when researching a change. This article explains the new features in Python 3.6, compared to 3.5. +Python 3.6 was released on December 23, 2016. ?See the +`changelog `_ for a full +list of changes. .. seealso:: diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.6.0rc2" +#define PY_VERSION "3.6.0" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -8,6 +8,4307 @@ ====================================================================== +What's New in Python 3.4.0? +=========================== + +Release date: 2014-03-16 + +Library +------- + +- Issue #20939: Fix test_geturl failure in test_urllibnet due to + new redirect of http://www.python.org/ to https://www.python.org. + +Documentation +------------- + +- Merge in all documentation changes since branching 3.4.0rc1. + + +What's New in Python 3.4.0 release candidate 3? +=============================================== + +Release date: 2014-03-09 + +Core and Builtins +----------------- + +- Issue #20786: Fix signatures for dict.__delitem__ and + property.__delete__ builtins. + +Library +------- + +- Issue #20839: Don't trigger a DeprecationWarning in the still supported + pkgutil.get_loader() API when __loader__ isn't set on a module (nor + when pkgutil.find_loader() is called directly). + +Build +----- + +- Issue #14512: Launch pydoc -b instead of pydocgui.pyw on Windows. + +- Issue #20748: Uninstalling pip does not leave behind the pyc of + the uninstaller anymore. + +- Issue #20568: The Windows installer now installs the unversioned ``pip`` + command in addition to the versioned ``pip3`` and ``pip3.4`` commands. + +- Issue #20757: The ensurepip helper for the Windows uninstaller now skips + uninstalling pip (rather than failing) if the user has updated pip to a + different version from the one bundled with ensurepip. + +- Issue #20465: Update OS X and Windows installer builds to use + SQLite 3.8.3.1. + + +What's New in Python 3.4.0 release candidate 2? +=============================================== + +Release date: 2014-02-23 + +Core and Builtins +----------------- + +- Issue #20625: Parameter names in __annotations__ were not mangled properly. + Discovered by Jonas Wielicki, patch by Yury Selivanov. + +- Issue #20261: In pickle, lookup __getnewargs__ and __getnewargs_ex__ on the + type of the object. + +- Issue #20619: Give the AST nodes of keyword-only arguments a column and line + number. + +- Issue #20526: Revert changes of issue #19466 which introduces a regression: + don't clear anymore the state of Python threads early during the Python + shutdown. + +Library +------- + +- Issue #20710: The pydoc summary line no longer displays the "self" parameter + for bound methods. + +- Issue #20566: Change asyncio.as_completed() to use a Queue, to + avoid O(N**2) behavior. + +- Issue #20704: Implement new debug API in asyncio. Add new methods + BaseEventLoop.set_debug() and BaseEventLoop.get_debug(). + Add support for setting 'asyncio.tasks._DEBUG' variable with + 'PYTHONASYNCIODEBUG' environment variable. + +- asyncio: Refactoring and fixes: BaseEventLoop.sock_connect() raises an + error if the address is not resolved; use __slots__ in Handle and + TimerHandle; as_completed() and wait() raise TypeError if the passed + list of Futures is a single Future; call_soon() and other 'call_*()' + functions raise TypeError if the passed callback is a coroutine + function; _ProactorBasePipeTransport uses _FlowControlMixin; + WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol() + to consider pausing receiving if the watermark limits have changed; + fix _check_resolved_address() for IPv6 address; and other minor + improvements, along with multiple documentation updates. + +- Issue #20684: Fix inspect.getfullargspec() to not to follow __wrapped__ + chains. Make its behaviour consistent with bound methods first argument. + Patch by Nick Coghlan and Yury Selivanov. + +- Issue #20681: Add new error handling API in asyncio. New APIs: + loop.set_exception_handler(), loop.default_exception_handler(), and + loop.call_exception_handler(). + +- Issue #20673: Implement support for UNIX Domain Sockets in asyncio. + New APIs: loop.create_unix_connection(), loop.create_unix_server(), + streams.open_unix_connection(), and streams.start_unix_server(). + +- Issue #20616: Add a format() method to tracemalloc.Traceback. + +- Issue #19744: the ensurepip installation step now just prints a warning to + stderr rather than failing outright if SSL/TLS is unavailable. This allows + local installation of POSIX builds without SSL/TLS support. + +- Issue #20594: Avoid name clash with the libc function posix_close. + +Build +----- + +- Issue #20641: Run MSI custom actions (pip installation, pyc compilation) + with the NoImpersonate flag, to support elevated execution (UAC). + +- Issue #20221: Removed conflicting (or circular) hypot definition when + compiled with VS 2010 or above. Initial patch by Tabrez Mohammed. + +- Issue #20609: Restored the ability to build 64-bit Windows binaries on + 32-bit Windows, which was broken by the change in issue #19788. + + +What's New in Python 3.4.0 release candidate 1? +=============================================== + +Release date: 2014-02-10 + +Core and Builtins +----------------- + +- Issue #19255: The builtins module is restored to initial value before + cleaning other modules. The sys and builtins modules are cleaned last. + +- Issue #20588: Make Python-ast.c C89 compliant. + +- Issue #20437: Fixed 22 potential bugs when deleting object references. + +- Issue #20500: Displaying an exception at interpreter shutdown no longer + risks triggering an assertion failure in PyObject_Str. + +- Issue #20538: UTF-7 incremental decoder produced inconsistent string when + input was truncated in BASE64 section. + +- Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the + internal codec marking system added for issue #19619 to throw LookupError + for known non-text encodings at stream construction time. The existing + output type checks remain in place to deal with unmarked third party + codecs. + +- Issue #17162: Add PyType_GetSlot. + +- Issue #20162: Fix an alignment issue in the siphash24() hash function which + caused a crash on PowerPC 64-bit (ppc64). + +Library +------- + +- Issue #20530: The signatures for slot builtins have been updated + to reflect the fact that they only accept positional-only arguments. + +- Issue #20517: Functions in the os module that accept two filenames + now register both filenames in the exception on failure. + +- Issue #20563: The ipaddress module API is now considered stable. + +- Issue #14983: email.generator now always adds a line end after each MIME + boundary marker, instead of doing so only when there is an epilogue. This + fixes an RFC compliance bug and solves an issue with signed MIME parts. + +- Issue #20540: Fix a performance regression (vs. Python 3.2) when layering + a multiprocessing Connection over a TCP socket. For small payloads, Nagle's + algorithm would introduce idle delays before the entire transmission of a + message. + +- Issue #16983: the new email header parsing code will now decode encoded words + that are (incorrectly) surrounded by quotes, and register a defect. + +- Issue #19772: email.generator no longer mutates the message object when + doing a down-transform from 8bit to 7bit CTEs. + +- Issue #20536: the statistics module now correctly handle Decimal instances + with positive exponents + +- Issue #18805: the netmask/hostmask parsing in ipaddress now more reliably + filters out illegal values and correctly allows any valid prefix length. + +- Issue #20481: For at least Python 3.4, the statistics module will require + that all inputs for a single operation be of a single consistent type, or + else a mixed of ints and a single other consistent type. This avoids + some interoperability issues that arose with the previous approach of + coercing to a suitable common type. + +- Issue #20478: the statistics module now treats collections.Counter inputs + like any other iterable. + +- Issue #17369: get_filename was raising an exception if the filename + parameter's RFC2231 encoding was broken in certain ways. This was + a regression relative to python2. + +- Issue #20013: Some imap servers disconnect if the current mailbox is + deleted, and imaplib did not handle that case gracefully. Now it + handles the 'bye' correctly. + +- Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3 + version. That is, do *not* raise an error if unicode is passed to + email.message.Message.set_payload. + +- Issue #20476: If a non-compat32 policy is used with any of the email parsers, + EmailMessage is now used as the factory class. The factory class should + really come from the policy; that will get fixed in 3.5. + +- Issue #19920: TarFile.list() no longer fails when outputs a listing + containing non-encodable characters. Based on patch by Vajrasky Kok. + +- Issue #20515: Fix NULL pointer dereference introduced by issue #20368. + +- Issue #19186: Restore namespacing of expat symbols inside the pyexpat module. + +- Issue #20053: ensurepip (and hence venv) are no longer affected by the + settings in the default pip configuration file. + +- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the + debug output every time it is called, regardless of the compilation cache. + +- Issue #20368: The null character now correctly passed from Tcl to Python. + Improved error handling in variables-related commands. + +- Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline + translation settings. + +- tracemalloc: Fix slicing traces and fix slicing a traceback. + +- Issue #20354: Fix an alignment issue in the tracemalloc module on 64-bit + platforms. Bug seen on 64-bit Linux when using "make profile-opt". + +- Issue #17159: inspect.signature now accepts duck types of functions, + which adds support for Cython functions. Initial patch by Stefan Behnel. + +- Issue #18801: Fix inspect.classify_class_attrs to correctly classify + object.__new__ and object.__init__. + +- Fixed cmath.isinf's name in its argument parsing code. + +- Issue #20311, #20452: poll and epoll now round the timeout away from zero, + instead of rounding towards zero, in select and selectors modules: + select.epoll.poll(), selectors.PollSelector.poll() and + selectors.EpollSelector.poll(). For example, a timeout of one microsecond + (1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded to + zero. However, the granularity property and asyncio's resolution feature + were removed again. + +- asyncio: Some refactoring; various fixes; add write flow control to + unix pipes; Future.set_exception() instantiates the exception + argument if it is a class; improved proactor pipe transport; support + wait_for(f, None); don't log broken/disconnected pipes; use + ValueError instead of assert for forbidden subprocess_{shell,exec} + arguments; added a convenience API for subprocess management; added + StreamReader.at_eof(); properly handle duplicate coroutines/futures + in gather(), wait(), as_completed(); use a bytearray for buffering + in StreamReader; and more. + +- Issue #20288: fix handling of invalid numeric charrefs in HTMLParser. + +- Issue #20424: Python implementation of io.StringIO now supports lone surrogates. + +- Issue #20308: inspect.signature now works on classes without user-defined + __init__ or __new__ methods. + +- Issue #20372: inspect.getfile (and a bunch of other inspect functions that + use it) doesn't crash with unexpected AttributeError on classes defined in C + without __module__. + +- Issue #20356: inspect.signature formatting uses '/' to separate + positional-only parameters from others. + +- Issue #20223: inspect.signature now supports methods defined with + functools.partialmethods. + +- Issue #19456: ntpath.join() now joins relative paths correctly when a drive + is present. + +- Issue #19077: tempfile.TemporaryDirectory cleanup no longer fails when + called during shutdown. Emitting resource warning in __del__ no longer fails. + Original patch by Antoine Pitrou. + +- Issue #20394: Silence Coverity warning in audioop module. + +- Issue #20367: Fix behavior of concurrent.futures.as_completed() for + duplicate arguments. Patch by Glenn Langford. + +- Issue #8260: The read(), readline() and readlines() methods of + codecs.StreamReader returned incomplete data when were called after + readline() or read(size). Based on patch by Amaury Forgeot d'Arc. + +- Issue #20105: the codec exception chaining now correctly sets the + traceback of the original exception as its __traceback__ attribute. + +- Issue #17481: inspect.getfullargspec() now uses inspect.signature() API. + +- Issue #15304: concurrent.futures.wait() can block forever even if + Futures have completed. Patch by Glenn Langford. + +- Issue #14455: plistlib: fix serializing integers in the range + of an unsigned long long but outside of the range of signed long long for + binary plist files. + +IDLE +---- + +- Issue #20406: Use Python application icons for Idle window title bars. + Patch mostly by Serhiy Storchaka. + +- Update the python.gif icon for the Idle classbrowser and pathbowser + from the old green snake to the new blue and yellow snakes. + +- Issue #17721: Remove non-functional configuration dialog help button until we + make it actually gives some help when clicked. Patch by Guilherme Sim?es. + +Tests +----- + +- Issue #20532: Tests which use _testcapi now are marked as CPython only. + +- Issue #19920: Added tests for TarFile.list(). Based on patch by Vajrasky Kok. + +- Issue #19990: Added tests for the imghdr module. Based on patch by + Claudiu Popa. + +- Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+. + +Tools/Demos +----------- + +- Issue #20530: Argument Clinic's signature format has been revised again. + The new syntax is highly human readable while still preventing false + positives. The syntax also extends Python syntax to denote "self" and + positional-only parameters, allowing inspect.Signature objects to be + totally accurate for all supported builtins in Python 3.4. + +- Issue #20456: Argument Clinic now observes the C preprocessor conditional + compilation statements of the C files it parses. When a Clinic block is + inside a conditional code, it adjusts its output to match, including + automatically generating an empty methoddef macro. + +- Issue #20456: Cloned functions in Argument Clinic now use the correct + name, not the name of the function they were cloned from, for text + strings inside generated code. + +- Issue #20456: Fixed Argument Clinic's test suite and "--converters" feature. + +- Issue #20456: Argument Clinic now allows specifying different names + for a parameter in Python and C, using "as" on the parameter line. + +- Issue #20326: Argument Clinic now uses a simple, unique signature to + annotate text signatures in docstrings, resulting in fewer false + positives. "self" parameters are also explicitly marked, allowing + inspect.Signature() to authoritatively detect (and skip) said parameters. + +- Issue #20326: Argument Clinic now generates separate checksums for the + input and output sections of the block, allowing external tools to verify + that the input has not changed (and thus the output is not out-of-date). + +Build +----- + +- Issue #20465: Update SQLite shipped with OS X installer to 3.8.3. + +C-API +----- + +- Issue #20517: Added new functions allowing OSError exceptions to reference + two filenames instead of one: PyErr_SetFromErrnoWithFilenameObjects() and + PyErr_SetExcFromWindowsErrWithFilenameObjects(). + +Documentation +------------- + +- Issue #20488: Change wording to say importlib is *the* implementation of + import instead of just *an* implementation. + +- Issue #6386: Clarify in the tutorial that specifying a symlink to execute + means the directory containing the executed script and not the symlink is + added to sys.path. + + +What's New in Python 3.4.0 Beta 3? +================================== + +Release date: 2014-01-26 + +Core and Builtins +----------------- + +- Issue #20189: Four additional builtin types (PyTypeObject, + PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) + have been modified to provide introspection information for builtins. + +- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and + IndentationError. + +- Issue #2382: SyntaxError cursor "^" is now written at correct position in most + cases when multibyte characters are in line (before "^"). This still not + works correctly with wide East Asian characters. + +- Issue #18960: The first line of Python script could be executed twice when + the source encoding was specified on the second line. Now the source encoding + declaration on the second line isn't effective if the first line contains + anything except a comment. 'python -x' works now again with files with the + source encoding declarations, and can be used to make Python batch files + on Windows. + +Library +------- + +- asyncio: Various improvements and small changes not all covered by + issues listed below. E.g. wait_for() now cancels the inner task if + the timeout occcurs; tweaked the set of exported symbols; renamed + Empty/Full to QueueEmpty/QueueFull; "with (yield from lock)" now + uses a separate context manager; readexactly() raises if not enough + data was read; PTY support tweaks. + +- Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum + between the resolution of the BaseEventLoop.time() method and the resolution + of the selector. The granuarility is used in the scheduler to round time and + deadline. + +- Issue #20311: selectors: Add a resolution attribute to BaseSelector. + +- Issue #20189: unittest.mock now no longer assumes that any object for + which it could get an inspect.Signature is a callable written in Python. + Fix courtesy of Michael Foord. + +- Issue #20317: ExitStack.__exit__ could create a self-referential loop if an + exception raised by a cleanup operation already had its context set + correctly (for example, by the @contextmanager decorator). The infinite + loop this caused is now avoided by checking if the expected context is + already set before trying to fix it. + +- Issue #20374: Fix build with GNU readline >= 6.3. + +- Issue #20262: Warnings are raised now when duplicate names are added in the + ZIP file or too long ZIP file comment is truncated. + +- Issue #20165: The unittest module no longer considers tests marked with + @expectedFailure successful if they pass. + +- Issue #18574: Added missing newline in 100-Continue reply from + http.server.BaseHTTPRequestHandler. Patch by Nikolaus Rath. + +- Issue #20270: urllib.urlparse now supports empty ports. + +- Issue #20243: TarFile no longer raise ReadError when opened in write mode. + +- Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't + write complete output on close. + +- Issue #20245: The open functions in the tarfile module now correctly handle + empty mode. + +- Issue #20242: Fixed basicConfig() format strings for the alternative + formatting styles. Thanks to kespindler for the bug report and patch. + +- Issue #20246: Fix buffer overflow in socket.recvfrom_into. + +- Issues #20206 and #5803: Fix edge case in email.quoprimime.encode where it + truncated lines ending in a character needing encoding but no newline by + using a more efficient algorithm that doesn't have the bug. + +- Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in + modules and in documentation. Initial patch contributed by Vajrasky Kok. + +- Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri() + functions now conform to PEP 3333 when handle non-ASCII URLs. + +- Issue #19097: Raise the correct Exception when cgi.FieldStorage is given an + invalid fileobj. + +- Issue #20152: Ported Python/import.c over to Argument Clinic. + +- Issue #13107: argparse and optparse no longer raises an exception when output + a help on environment with too small COLUMNS. Based on patch by + Elazar Gershuni. + +- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly + asked for. + +- Issue #18960: The tokenize module now ignore the source encoding declaration + on the second line if the first line contains anything except a comment. + +- Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU + consumption. + +- Issue #20113: os.readv() and os.writev() now raise an OSError exception on + error instead of returning -1. + +- Issue #19719: Make importlib.abc.MetaPathFinder.find_module(), + PathEntryFinder.find_loader(), and Loader.load_module() use PEP 451 APIs to + help with backwards-compatibility. + +- Issue #20144: inspect.Signature now supports parsing simple symbolic + constants as parameter default values in __text_signature__. + +- Issue #20072: Fixed multiple errors in tkinter with wantobjects is False. + +- Issue #20229: Avoid plistlib deprecation warning in platform.mac_ver(). + +- Issue #14455: Fix some problems with the new binary plist support in plistlib. + +IDLE +---- + +- Issue #17390: Add Python version to Idle editor window title bar. + Original patches by Edmond Burnett and Kent Johnson. + +- Issue #18960: IDLE now ignores the source encoding declaration on the second + line if the first line contains anything except a comment. + +Tests +----- + +- Issue #20358: Tests for curses.window.overlay and curses.window.overwrite + no longer specify min{row,col} > max{row,col}. + +- Issue #19804: The test_find_mac test in test_uuid is now skipped if the + ifconfig executable is not available. + +- Issue #19886: Use better estimated memory requirements for bigmem tests. + +Tools/Demos +----------- + +- Issue #20390: Argument Clinic's "file" output preset now defaults to + "{dirname}/clinic/{basename}.h". + +- Issue #20390: Argument Clinic's "class" directive syntax has been extended + with two new required arguments: "typedef" and "type_object". + +- Issue #20390: Argument Clinic: If __new__ or __init__ functions didn't use + kwargs (or args), the PyArg_NoKeywords (or PyArg_NoPositional) calls + generated are only run when the type object is an exact match. + +- Issue #20390: Argument Clinic now fails if you have required parameters after + optional parameters. + +- Issue #20390: Argument Clinic converters now have a new template they can + inject code into: "modifiers". Code put there is run in the parsing + function after argument parsing but before the call to the impl. + +- Issue #20376: Argument Clinic now escapes backslashes in docstrings. + +- Issue #20381: Argument Clinic now sanity checks the default argument when + c_default is also specified, providing a nice failure message for + disallowed values. + +- Issue #20189: Argument Clinic now ensures that parser functions for + __new__ are always of type newfunc, the type of the tp_new slot. + Similarly, parser functions for __init__ are now always of type initproc, + the type of tp_init. + +- Issue #20189: Argument Clinic now suppresses the docstring for __new__ + and __init__ functions if no docstring is provided in the input. + +- Issue #20189: Argument Clinic now suppresses the "self" parameter in the + impl for @staticmethod functions. + +- Issue #20294: Argument Clinic now supports argument parsing for __new__ and + __init__ functions. + +- Issue #20299: Argument Clinic custom converters may now change the default + value of c_default and py_default with a class member. + +- Issue #20287: Argument Clinic's output is now configurable, allowing + delaying its output or even redirecting it to a separate file. + +- Issue #20226: Argument Clinic now permits simple expressions + (e.g. "sys.maxsize - 1") as default values for parameters. + +- Issue #19936: Added executable bits or shebang lines to Python scripts which + requires them. Disable executable bits and shebang lines in test and + benchmark files in order to prevent using a random system python, and in + source files of modules which don't provide command line interface. Fixed + shebang lines in the unittestgui and checkpip scripts. + +- Issue #20268: Argument Clinic now supports cloning the parameters and + return converter of existing functions. + +- Issue #20228: Argument Clinic now has special support for class special + methods. + +- Issue #20214: Fixed a number of small issues and documentation errors in + Argument Clinic (see issue for details). + +- Issue #20196: Fixed a bug where Argument Clinic did not generate correct + parsing code for functions with positional-only parameters where all arguments + are optional. + +- Issue #18960: 2to3 and the findnocoding.py script now ignore the source + encoding declaration on the second line if the first line contains anything + except a comment. + +- Issue #19723: The marker comments Argument Clinic uses have been changed + to improve readability. + +- Issue #20157: When Argument Clinic renames a parameter because its name + collides with a C keyword, it no longer exposes that rename to PyArg_Parse. + +- Issue #20141: Improved Argument Clinic's support for the PyArg_Parse "O!" + format unit. + +- Issue #20144: Argument Clinic now supports simple symbolic constants + as parameter default values. + +- Issue #20143: The line numbers reported in Argument Clinic errors are + now more accurate. + +- Issue #20142: Py_buffer variables generated by Argument Clinic are now + initialized with a default value. + +Build +----- + +- Issue #12837: Silence a tautological comparison warning on OS X under Clang in + socketmodule.c. + + +What's New in Python 3.4.0 Beta 2? +================================== + +Release date: 2014-01-05 + +Core and Builtins +----------------- + +- Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. + +- Issue #19526: Exclude all new API from the stable ABI. Exceptions can be + made if a need is demonstrated. + +- Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" + argument is not in range [0; 255]. + +- Issue #19995: %c, %o, %x, and %X now issue a DeprecationWarning on non-integer + input; reworded docs to clarify that an integer type should define both __int__ + and __index__. + +- Issue #19787: PyThread_set_key_value() now always set the value. In Python + 3.3, the function did nothing if the key already exists (if the current value + is a non-NULL pointer). + +- Issue #14432: Remove the thread state field from the frame structure. Fix a + crash when a generator is created in a C thread that is destroyed while the + generator is still used. The issue was that a generator contains a frame, and + the frame kept a reference to the Python state of the destroyed C thread. The + crash occurs when a trace function is setup. + +- Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python + has no concrete GIL. If PyGILState_Ensure() is called from a new thread for + the first time and PyEval_InitThreads() was not called yet, a GIL needs to be + created. + +- Issue #17576: Deprecation warning emitted now when __int__() or __index__() + return not int instance. + +- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes. + +- Issue #19736: Add module-level statvfs constants defined for GNU/glibc + based systems. + +- Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder. + +- Issue #19729: In str.format(), fix recursive expansion in format spec. + +- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2 + billion characters) input strings in _Py_dg_strtod. + +Library +------- + +- Issue #20154: Deadlock in asyncio.StreamReader.readexactly(). + +- Issue #16113: Remove sha3 module again. + +- Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix. + +- Fix breakage in TestSuite.countTestCases() introduced by issue #11798. + +- Issue #20108: Avoid parameter name clash in inspect.getcallargs(). + +- Issue #19918: Fix PurePath.relative_to() under Windows. + +- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl + module, rather than silently let them emit clear text data. + +- Issue #20046: Locale alias table no longer contains entities which can be + calculated. Generalized support of the euro modifier. + +- Issue #20027: Fixed locale aliases for devanagari locales. + +- Issue #20067: Tkinter variables now work when wantobjects is false. + +- Issue #19020: Tkinter now uses splitlist() instead of split() in configure + methods. + +- Issue #19744: ensurepip now provides a better error message when Python is + built without SSL/TLS support (pip currently requires that support to run, + even if only operating with local wheel files) + +- Issue #19734: ensurepip now ignores all pip environment variables to avoid + odd behaviour based on user configuration settings + +- Fix TypeError on "setup.py upload --show-response". + +- Issue #20045: Fix "setup.py register --list-classifiers". + +- Issue #18879: When a method is looked up on a temporary file, avoid closing + the file before the method is possibly called. + +- Issue #20037: Avoid crashes when opening a text file late at interpreter + shutdown. + +- Issue #19967: Thanks to the PEP 442, asyncio.Future now uses a + destructor to log uncaught exceptions, instead of the dedicated + _TracebackLogger class. + +- Added a Task.current_task() class method to asyncio. + +- Issue #19850: Set SA_RESTART in asyncio when registering a signal + handler to limit EINTR occurrences. + +- Implemented write flow control in asyncio for proactor event loop (Windows). + +- Change write buffer in asyncio use to avoid O(N**2) behavior. Make + write()/sendto() accept bytearray/memoryview. + +- Issue #20034: Updated alias mapping to most recent locale.alias file + from X.org distribution using makelocalealias.py. + +- Issue #5815: Fixed support for locales with modifiers. Fixed support for + locale encodings with hyphens. + +- Issue #20026: Fix the sqlite module to handle correctly invalid isolation + level (wrong type). + +- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and + quotechar fields. Original patch by Vajrasky Kok. + +- Issue #19855: uuid.getnode() on Unix now looks on the PATH for the + executables used to find the mac address, with /sbin and /usr/sbin as + fallbacks. + +- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection. + Original patch by Simon Sapin. + +- Issue #19946: multiprocessing now uses runpy to initialize __main__ in + child processes when necessary, allowing it to correctly handle scripts + without suffixes and submodules that use explicit relative imports or + otherwise rely on parent modules being correctly imported prior to + execution. + +- Issue #19921: When Path.mkdir() is called with parents=True, any missing + parent is created with the default permissions, ignoring the mode argument + (mimicking the POSIX "mkdir -p" command). + +- Issue #19887: Improve the Path.resolve() algorithm to support certain + symlink chains. + +- Issue #19912: Fixed numerous bugs in ntpath.splitunc(). + +- Issue #19911: ntpath.splitdrive() now correctly processes the '?' character + (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE). + +- Issue #19532: python -m compileall with no filename/directory arguments now + respects the -f and -q flags instead of ignoring them. + +- Issue #19623: Fixed writing to unseekable files in the aifc module. + +- Issue #19946: multiprocessing.spawn now raises ImportError when the module to + be used as the main module cannot be imported. + +- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX. + Fixed integer overflow in the eventmask parameter. + +- Issue #19063: if a Charset's body_encoding was set to None, the email + package would generate a message claiming the Content-Transfer-Encoding + was 7bit, and produce garbage output for the content. This now works. + A couple of other set_payload mishandlings of non-ASCII are also fixed. + In addition, calling set_payload with a string argument without + specifying a charset now raises an error (this is a new error in 3.4). + +- Issue #15475: Add __sizeof__ implementations for itertools objects. + +- Issue #19944: Fix importlib.find_spec() so it imports parents as needed + and move the function to importlib.util. + +- Issue #19880: Fix a reference leak in unittest.TestCase. Explicitly break + reference cycles between frames and the _Outcome instance. + +- Issue #17429: platform.linux_distribution() now decodes files from the UTF-8 + encoding with the surrogateescape error handler, instead of decoding from the + locale encoding in strict mode. It fixes the function on Fedora 19 which is + probably the first major distribution release with a non-ASCII name. Patch + written by Toshio Kuratomi. + +- Issue #19343: Expose FreeBSD-specific APIs in resource module. Original + patch by Koobs. + +- Issue #19929: Call os.read with 32768 within subprocess.Popen.communicate + rather than 4096 for efficiency. A microbenchmark shows Linux and OS X + both using ~50% less cpu time this way. + +- Issue #19506: Use a memoryview to avoid a data copy when piping data + to stdin within subprocess.Popen.communicate. 5-10% less cpu usage. + +- Issue #19876: selectors unregister() no longer raises ValueError or OSError + if the FD is closed (as long as it was registered). + +- Issue #19908: pathlib now joins relative Windows paths correctly when a drive + is present. Original patch by Antoine Pitrou. + +- Issue #19296: Silence compiler warning in dbm_open + +- Issue #6784: Strings from Python 2 can now be unpickled as bytes + objects by setting the encoding argument of Unpickler to be 'bytes'. + Initial patch by Merlijn van Deen. + +- Issue #19839: Fix regression in bz2 module's handling of non-bzip2 data at + EOF, and analogous bug in lzma module. + +- Issue #19881: Fix pickling bug where cpickle would emit bad pickle data for + large bytes string (i.e., with size greater than 2**32-1). + +- Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when + no exception detail exists (no colon following the exception's name, or + a colon does follow but no text follows the colon). + +- Issue #19927: Add __eq__ to path-based loaders in importlib. + +- Issue #19827: On UNIX, setblocking() and settimeout() methods of + socket.socket can now avoid a second syscall if the ioctl() function can be + used, or if the non-blocking flag of the socket is unchanged. + +- Issue #19785: smtplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19784: poplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19783: nntplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19782: imaplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #20123: Fix pydoc.synopsis() for "binary" modules. + +- Issue #19834: Support unpickling of exceptions pickled by Python 2. + +- Issue #19781: ftplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19509: Add SSLContext.check_hostname to match the peer's certificate + with server_hostname on handshake. + +- Issue #15798: Fixed subprocess.Popen() to no longer fail if file + descriptor 0, 1 or 2 is closed. + +- Issue #17897: Optimized unpickle prefetching. + +- Issue #3693: Make the error message more helpful when the array.array() + constructor is given a str. Move the array module typecode documentation to + the docstring of the constructor. + +- Issue #19088: Fixed incorrect caching of the copyreg module in + object.__reduce__() and object.__reduce_ex__(). + +- Issue #19698: Removed exec_module() methods from + importlib.machinery.BuiltinImporter and ExtensionFileLoader. + +- Issue #18864: Added a setter for ModuleSpec.has_location. + +- Fixed _pickle.Unpickler to not fail when loading empty strings as + persistent IDs. + +- Issue #11480: Fixed copy.copy to work with classes with custom metaclasses. + Patch by Daniel Urban. + +- Issue #6477: Added support for pickling the types of built-in singletons + (i.e., Ellipsis, NotImplemented, None). + +- Issue #19713: Add remaining PEP 451-related deprecations and move away + from using find_module/find_loaer/load_module. + +- Issue #19708: Update pkgutil to use the new importer APIs. + +- Issue #19703: Update pydoc to use the new importer APIs. + +- Issue #19851: Fixed a regression in reloading sub-modules. + +- ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME. + +- Issue #19802: Add socket.SO_PRIORITY. + +- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with + virtual interface. Original patch by Kent Frazier. + +- Issue #11489: JSON decoder now accepts lone surrogates. + +- Issue #19545: Avoid chained exceptions while passing stray % to + time.strptime(). Initial patch by Claudiu Popa. + +IDLE +---- + +- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. + +- Issue #19481: print() of string subclass instance in IDLE no longer hangs. + +- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial + shell window is present. + +Tests +----- + +- Issue #20055: Fix test_shutil under Windows with symlink privileges held. + Patch by Vajrasky Kok. + +- Issue #20070: Don't run test_urllib2net when network resources are not + enabled. + +- Issue #19938: Re-enabled test_bug_1333982 in test_dis, which had been + disabled since 3.0 due to the changes in listcomp handling. + +- Issue #19320: test_tcl no longer fails when wantobjects is false. + +- Issue #19919: Fix flaky SSL test. connect_ex() sometimes returns + EWOULDBLOCK on Windows or VMs hosted on Windows. + +- Issue #19912: Added tests for ntpath.splitunc(). + +- Issue #19828: Fixed test_site when the whole suite is run with -S. + +- Issue #19928: Implemented a test for repr() of cell objects. + +- Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and + test_statistics when python is run with -OO. + +- Issue #19926: Removed unneeded test_main from test_abstract_numbers. + Patch by Vajrasky Kok. + +- Issue #19572: More skipped tests explicitly marked as skipped. + +- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound. + +- Issue #19588: Fixed tests in test_random that were silently skipped most + of the time. Patch by Julian Gindi. + +Build +----- + +- Issue #19728: Enable pip installation by default on Windows. + +- Issue #16136: Remove VMS support + +- Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and + run Python's unit tests with multiple versions of OpenSSL. + +- Issue #19922: define _INCLUDE__STDC_A1_SOURCE in HP-UX to include mbstate_t + for mbrtowc(). + +- Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the + pythoncore sub-project. This should prevent build errors due a previous + build's python(_d).exe still running. + +Documentation +------------- + +- Issue #20265: Updated some parts of the Using Windows document. + +- Issue #20266: Updated some parts of the Windows FAQ. + +- Issue #20255: Updated the about and bugs pages. + +- Issue #20253: Fixed a typo in the ipaddress docs that advertised an + illegal attribute name. Found by INADA Naoki. + +- Issue #18840: Introduce the json module in the tutorial, and de-emphasize + the pickle module. + +- Issue #19845: Updated the Compiling Python on Windows section. + +- Issue #19795: Improved markup of True/False constants. + +Tools/Demos +----------- + +- Issue #19659: Added documentation for Argument Clinic. + +- Issue #19976: Argument Clinic METH_NOARGS functions now always + take two parameters. + + +What's New in Python 3.4.0 Beta 1? +================================== + +Release date: 2013-11-24 + +Core and Builtins +----------------- + +- Use the repr of a module name in more places in import, especially + exceptions. + +- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an + internal API to throw LookupError for known non-text encodings, rather + than attempting the encoding or decoding operation and then throwing a + TypeError for an unexpected output type. (The latter mechanism remains + in place for third party non-text encodings) + +- Issue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'. + Python now uses SipHash24 on all major platforms. + +- Issue #12892: The utf-16* and utf-32* encoders no longer allow surrogate code + points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer decode + byte sequences that correspond to surrogate code points. The surrogatepass + error handler now works with the utf-16* and utf-32* codecs. Based on + patches by Victor Stinner and Kang-Hao (Kenny) Lu. + +- Issue #17806: Added keyword-argument support for "tabsize" to + str/bytes.expandtabs(). + +- Issue #17828: Output type errors in str.encode(), bytes.decode() and + bytearray.decode() now direct users to codecs.encode() or codecs.decode() + as appropriate. + +- Issue #17828: The interpreter now attempts to chain errors that occur in + codec processing with a replacement exception of the same type that + includes the codec name in the error message. It ensures it only does this + when the creation of the replacement exception won't lose any information. + +- Issue #19466: Clear the frames of daemon threads earlier during the + Python shutdown to call object destructors. So "unclosed file" resource + warnings are now correctly emitted for daemon threads. + +- Issue #19514: Deduplicate some _Py_IDENTIFIER declarations. + Patch by Andrei Dorian Duma. + +- Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses + of a given type. + +- Issue #19428: zipimport now handles errors when reading truncated or invalid + ZIP archive. + +- Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle + exceptions when merging fast locals into f_locals of a frame. + PyEval_GetLocals() now raises an exception and return NULL on failure. + +- Issue #19369: Optimized the usage of __length_hint__(). + +- Issue #28026: Raise ImportError when exec_module() exists but + create_module() is missing. + +- Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the + Python executable and not removed by the linker's optimizer. + +- Issue #19306: Add extra hints to the faulthandler module's stack + dumps that these are "upside down". + +Library +------- + +- Issue #3158: doctest can now find doctests in functions and methods + written in C. + +- Issue #13477: Added command line interface to the tarfile module. + Original patch by Berker Peksag. + +- Issue #19674: inspect.signature() now produces a correct signature + for some builtins. + +- Issue #19722: Added opcode.stack_effect(), which + computes the stack effect of bytecode instructions. + +- Issue #19735: Implement private function ssl._create_stdlib_context() to + create SSLContext objects in Python's stdlib module. It provides a single + configuration point and makes use of SSLContext.load_default_certs(). + +- Issue #16203: Add re.fullmatch() function and regex.fullmatch() method, + which anchor the pattern at both ends of the string to match. + Original patch by Matthew Barnett. + +- Issue #13592: Improved the repr for regular expression pattern objects. + Based on patch by Hugo Lopes Tavares. + +- Issue #19641: Added the audioop.byteswap() function to convert big-endian + samples to little-endian and vice versa. + +- Issue #15204: Deprecated the 'U' mode in file-like objects. + +- Issue #17810: Implement PEP 3154, pickle protocol 4. + +- Issue #19668: Added support for the cp1125 encoding. + +- Issue #19689: Add ssl.create_default_context() factory function. It creates + a new SSLContext object with secure default settings. + +- Issue #19727: os.utime(..., None) is now potentially more precise + under Windows. + +- Issue #17201: ZIP64 extensions now are enabled by default. Patch by + William Mallard. + +- Issue #19292: Add SSLContext.load_default_certs() to load default root CA + certificates from default stores or system stores. By default the method + loads CA certs for authentication of server certs. + +- Issue #19673: Add pathlib to the stdlib as a provisional module (PEP 428). + +- Issue #16596: pdb in a generator now properly skips over yield and + yield from rather than stepping out of the generator into its + caller. (This is essential for stepping through asyncio coroutines.) + +- Issue #17916: Added dis.Bytecode.from_traceback() and + dis.Bytecode.current_offset to easily display "current instruction" + markers in the new disassembly API (Patch by Claudiu Popa). + +- Issue #19552: venv now supports bootstrapping pip into virtual environments + +- Issue #17134: Finalize interface to Windows' certificate store. Cert and + CRL enumeration are now two functions. enum_certificates() also returns + purpose flags as set of OIDs. + +- Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils + equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX. + +- Issue #8813: Add SSLContext.verify_flags to change the verification flags + of the context in order to enable certification revocation list (CRL) + checks or strict X509 rules. + +- Issue #18294: Fix the zlib module to make it 64-bit safe. + +- Issue #19682: Fix compatibility issue with old version of OpenSSL that + was introduced by Issue #18379. + +- Issue #14455: plistlib now supports binary plists and has an updated API. + +- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on + big-endian platforms. + +- Issue #18379: SSLSocket.getpeercert() returns CA issuer AIA fields, OCSP + and CRL distribution points. + +- Issue #18138: Implement cadata argument of SSLContext.load_verify_location() + to load CA certificates and CRL from memory. It supports PEM and DER + encoded strings. + +- Issue #18775: Add name and block_size attribute to HMAC object. They now + provide the same API elements as non-keyed cryptographic hash functions. + +- Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC + module supports digestmod names, e.g. hmac.HMAC('sha1'). + +- Issue #19449: in csv's writerow, handle non-string keys when generating the + error message that certain keys are not in the 'fieldnames' list. + +- Issue #13633: Added a new convert_charrefs keyword arg to HTMLParser that, + when True, automatically converts all character references. + +- Issue #2927: Added the unescape() function to the html module. + +- Issue #8402: Added the escape() function to the glob module. + +- Issue #17618: Add Base85 and Ascii85 encoding/decoding to the base64 module. + +- Issue #19634: time.strftime("%y") now raises a ValueError on AIX when given a + year before 1900. + +- Fix test.support.bind_port() to not cause an error when Python was compiled + on a system with SO_REUSEPORT defined in the headers but run on a system + with an OS kernel that does not support that reasonably new socket option. + +- Fix compilation error under gcc of the ctypes module bundled libffi for arm. + +- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID, + NID, short name and long name. + +- Issue #19282: dbm.open now supports the context management protocol. + (Initial patch by Claudiu Popa) + +- Issue #8311: Added support for writing any bytes-like objects in the aifc, + sunau, and wave modules. + +- Issue #5202: Added support for unseekable files in the wave module. + +- Issue #19544 and Issue #1180: Restore global option to ignore + ~/.pydistutils.cfg in Distutils, accidentally removed in backout of + distutils2 changes. + +- Issue #19523: Closed FileHandler leak which occurred when delay was set. + +- Issue #19544 and Issue #6516: Restore support for --user and --group + parameters to sdist command accidentally rolled back as part of the + distutils2 rollback. + +- Issue #13674: Prevented time.strftime from crashing on Windows when given + a year before 1900 and a format of %y. + +- Issue #19406: implementation of the ensurepip module (part of PEP 453). + Patch by Donald Stufft and Nick Coghlan. + +- Issue #19544 and Issue #6286: Restore use of urllib over http allowing use + of http_proxy for Distutils upload command, a feature accidentally lost + in the rollback of distutils2. + +- Issue #19544 and Issue #7457: Restore the read_pkg_file method to + distutils.dist.DistributionMetadata accidentally removed in the undo of + distutils2. + +- Issue #16685: Added support for any bytes-like objects in the audioop module. + Removed support for strings. + +- Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` + to socket module. Patch by Atsuo Ishimoto. + +- Issue #19261: Added support for writing 24-bit samples in the sunau module. + +- Issue #1097797: Added CP273 encoding, used on IBM mainframes in + Germany and Austria. Mapping provided by Michael Bierenfeld. + +- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms. + +- Issue #19378: Fixed a number of cases in the dis module where the new + "file" parameter was not being honoured correctly + +- Issue #19378: Removed the "dis.Bytecode.show_info" method + +- Issue #19378: Renamed the "dis.Bytecode.display_code" method to + "dis.Bytecode.dis" and converted it to returning a string rather than + printing output. + +- Issue #19378: the "line_offset" parameter in the new "dis.get_instructions" + API has been renamed to "first_line" (and the default value and usage + changed accordingly). This should reduce confusion with the more common use + of "offset" in the dis docs to refer to bytecode offsets. + +- Issue #18678: Corrected spwd struct member names in spwd module: + sp_nam->sp_namp, and sp_pwd->sp_pwdp. The old names are kept as extra + structseq members, for backward compatibility. + +- Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises + TypeError instead of TclError on wrong number of arguments. Original patch + by Guilherme Polo. + +- Issue #10197: Rework subprocess.get[status]output to use subprocess + functionality and thus to work on Windows. Patch by Nick Coghlan + +- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of + integers instead of a string. Based on patch by Guilherme Polo. + +- Issue #19403: contextlib.redirect_stdout is now reentrant + +- Issue #19286: Directories in ``package_data`` are no longer added to + the filelist, preventing failure outlined in the ticket. + +- Issue #19480: HTMLParser now accepts all valid start-tag names as defined + by the HTML5 standard. + +- Issue #15114: The html.parser module now raises a DeprecationWarning when the + strict argument of HTMLParser or the HTMLParser.error method are used. + +- Issue #19410: Undo the special-casing removal of '' for + importlib.machinery.FileFinder. + +- Issue #19424: Fix the warnings module to accept filename containing surrogate + characters. + +- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. + +- Issue #19227: Remove pthread_atfork() handler. The handler was added to + solve #18747 but has caused issues. + +- Issue #19420: Fix reference leak in module initialization code of + _hashopenssl.c + +- Issue #19329: Optimized compiling charsets in regular expressions. + +- Issue #19227: Try to fix deadlocks caused by re-seeding then OpenSSL + pseudo-random number generator on fork(). + +- Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more than + 100 headers are read. Adapted from patch by Jyrki Pulliainen. + +- Issue #16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to + prevent readline() calls from consuming too much memory. Patch by Jyrki + Pulliainen. + +- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to + prevent readline() calls from consuming too much memory. Patch by Jyrki + Pulliainen. + +- Issue #17997: Change behavior of ``ssl.match_hostname()`` to follow RFC 6125, + for security reasons. It now doesn't match multiple wildcards nor wildcards + inside IDN fragments. + +- Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit + line length. Patch by Emil Lind. + +- Issue #19330: the unnecessary wrapper functions have been removed from the + implementations of the new contextlib.redirect_stdout and + contextlib.suppress context managers, which also ensures they provide + reasonable help() output on instances + +- Issue #19393: Fix symtable.symtable function to not be confused when there are + functions or classes named "top". + +- Issue #18685: Restore re performance to pre-PEP 393 levels. + +- Issue #19339: telnetlib module is now using time.monotonic() when available + to compute timeout. + +- Issue #19399: fix sporadic test_subprocess failure. + +- Issue #13234: Fix os.listdir to work with extended paths on Windows. + Patch by Santoso Wijaya. + +- Issue #19375: The site module adding a "site-python" directory to sys.path, + if it exists, is now deprecated. + +- Issue #19379: Lazily import linecache in the warnings module, to make + startup with warnings faster until a warning gets printed. + +- Issue #19288: Fixed the "in" operator of dbm.gnu databases for string + argument. Original patch by Arfrever Frehtes Taifersar Arahesis. + +- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string + argument. Original patch by Arfrever Frehtes Taifersar Arahesis. + +- Issue #19327: Fixed the working of regular expressions with too big charset. + +- Issue #17400: New 'is_global' attribute for ipaddress to tell if an address + is allocated by IANA for global or private networks. + +- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin + Williams. + +- Issue #19365: Optimized the parsing of long replacement string in re.sub*() + functions. + +- Issue #19352: Fix unittest discovery when a module can be reached + through several paths (e.g. under Debian/Ubuntu with virtualenv). + +- Issue #15207: Fix mimetypes to read from correct part of Windows registry + Original patch by Dave Chambers + +- Issue #16595: Add prlimit() to resource module. + +- Issue #19324: Expose Linux-specific constants in resource module. + +- Load SSL's error strings in hashlib. + +- Issue #18527: Upgrade internal copy of zlib to 1.2.8. + +- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy. + +- Issue #8964: fix platform._sys_version to handle IronPython 2.6+. + Patch by Martin Matusiak. + +- Issue #19413: Restore pre-3.3 reload() semantics of re-finding modules. + +- Issue #18958: Improve error message for json.load(s) while passing a string + that starts with a UTF-8 BOM. + +- Issue #19307: Improve error message for json.load(s) while passing objects + of the wrong type. + +- Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by + limiting the call to readline(). Original patch by Micha? + Jastrz?bski and Giampaolo Rodola. + +- Issue #17087: Improved the repr for regular expression match objects. + +Tests +----- + +- Issue #19664: test_userdict's repr test no longer depends on the order + of dict elements. + +- Issue #19440: Clean up test_capi by removing an unnecessary __future__ + import, converting from test_main to unittest.main, and running the + _testcapi module tests as subTests of a unittest TestCase method. + +- Issue #19378: the main dis module tests are now run with both stdout + redirection *and* passing an explicit file parameter + +- Issue #19378: removed the not-actually-helpful assertInstructionMatches + and assertBytecodeExactlyMatches helpers from bytecode_helper + +- Issue #18702: All skipped tests now reported as skipped. + +- Issue #19439: interpreter embedding tests are now executed on Windows + (Patch by Zachary Ware) + +- Issue #19085: Added basic tests for all tkinter widget options. + +- Issue #19384: Fix test_py_compile for root user, patch by Claudiu Popa. + +Documentation +------------- + +- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also, + attempt to reduce confusion in the glossary by not saying there are + different "types" of arguments and parameters. + +Build +----- + +- Issue #19358: "make clinic" now runs the Argument Clinic preprocessor + over all CPython source files. + +- Update SQLite to 3.8.1, xz to 5.0.5, and Tcl/Tk to 8.6.1 on Windows. + +- Issue #16632: Enable DEP and ASLR on Windows. + +- Issue #17791: Drop PREFIX and EXEC_PREFIX definitions from PC/pyconfig.h + +- Add workaround for VS 2010 nmake clean issue. VS 2010 doesn't set up PATH + for nmake.exe correctly. + +- Issue #19550: Implement Windows installer changes of PEP 453 (ensurepip). + +- Issue #19520: Fix compiler warning in the _sha3 module on 32bit Windows. + +- Issue #19356: Avoid using a C variabled named "_self", it's a reserved + word in some C compilers. + +- Issue #15792: Correct build options on Win64. Patch by Jeremy Kloth. + +- Issue #19373: Apply upstream change to Tk 8.5.15 fixing OS X 10.9 + screen refresh problem for OS X installer build. + +- Issue #19649: On OS X, the same set of file names are now installed + in bin directories for all configurations: non-framework vs framework, + and single arch vs universal builds. pythonx.y-32 is now always + installed for 64-bit/32-bit universal builds. The obsolete and + undocumented pythonw* symlinks are no longer installed anywhere. + +- Issue #19553: PEP 453 - "make install" and "make altinstall" now install or + upgrade pip by default, using the bundled pip provided by the new ensurepip + module. A new configure option, --with-ensurepip[=upgrade|install|no], is + available to override the default ensurepip "--upgrade" option. The option + can also be set with "make [alt]install ENSUREPIP=[upgrade|install|no]". + +- Issue #19551: PEP 453 - the OS X installer now installs pip by default. + +- Update third-party libraries for OS X installers: xz 5.0.3 -> 5.0.5, + SQLite 3.7.13 -> 3.8.1 + +- Issue #15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1. + Some third-party projects, such as Matplotlib and PIL/Pillow, + depended on being able to build with Tcl and Tk frameworks in + /Library/Frameworks. + +Tools/Demos +----------- + +- Issue #19730: Argument Clinic now supports all the existing PyArg + "format units" as legacy converters, as well as two new features: + "self converters" and the "version" directive. + +- Issue #19552: pyvenv now bootstraps pip into virtual environments by + default (pass --without-pip to request the old behaviour) + +- Issue #19390: Argument Clinic no longer accepts malformed Python + and C ids. + + +What's New in Python 3.4.0 Alpha 4? +=================================== + +Release date: 2013-10-20 + +Core and Builtins +----------------- + +- Issue #19301: Give classes and functions that are explicitly marked global a + global qualname. + +- Issue #19279: UTF-7 decoder no longer produces illegal strings. + +- Issue #16612: Add "Argument Clinic", a compile-time preprocessor for + C files to generate argument parsing code. (See PEP 436.) + +- Issue #18810: Shift stat calls in importlib.machinery.FileFinder such that + the code is optimistic that if something exists in a directory named exactly + like the possible package being searched for that it's in actuality a + directory. + +- Issue #18416: importlib.machinery.PathFinder now treats '' as the cwd and + importlib.machinery.FileFinder no longer special-cases '' to '.'. This leads + to modules imported from cwd to now possess an absolute file path for + __file__ (this does not affect modules specified by path on the CLI but it + does affect -m/runpy). It also allows FileFinder to be more consistent by not + having an edge case. + +- Issue #4555: All exported C symbols are now prefixed with either + "Py" or "_Py". + +- Issue #19219: Speed up marshal.loads(), and make pyc files slightly + (5% to 10%) smaller. + +- Issue #19221: Upgrade Unicode database to version 6.3.0. + +- Issue #16742: The result of the C callback PyOS_ReadlineFunctionPointer must + now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL + if an error occurred), instead of a string allocated by PyMem_Malloc() or + PyMem_Realloc(). + +- Issue #19199: Remove ``PyThreadState.tick_counter`` field + +- Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at + least one place so as to avoid regressions. + +- Issue #19087: Improve bytearray allocation in order to allow cheap popping + of data at the front (slice deletion). + +- Issue #19014: memoryview.cast() is now allowed on zero-length views. + +- Issue #18690: memoryview is now automatically registered with + collections.abc.Sequence + +- Issue #19078: memoryview now correctly supports the reversed builtin + (Patch by Claudiu Popa) + +Library +------- + +- Issue #17457: unittest test discovery now works with namespace packages. + Patch by Claudiu Popa. + +- Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX. + Patch by David Edelsohn. + +- Issue #18606: Add the new "statistics" module (PEP 450). Contributed + by Steven D'Aprano. + +- Issue #12866: The audioop module now supports 24-bit samples. + +- Issue #19254: Provide an optimized Python implementation of pbkdf2_hmac. + +- Issues #19201, Issue #19222, Issue #19223: Add "x" mode (exclusive creation) + in opening file to bz2, gzip and lzma modules. Patches by Tim Heaney and + Vajrasky Kok. + +- Fix a reference count leak in _sre. + +- Issue #19262: Initial check in of the 'asyncio' package (a.k.a. Tulip, + a.k.a. PEP 3156). There are no docs yet, and the PEP is slightly + out of date with the code. This module will have *provisional* status + in Python 3.4. + +- Issue #19276: Fixed the wave module on 64-bit big-endian platforms. + +- Issue #19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager + to ``contextlib.suppress`` in order to be more consistent with existing + descriptions of that operation elsewhere in the language and standard + library documentation (Patch by Zero Piraeus). + +- Issue #18891: Completed the new email package (provisional) API additions + by adding new classes EmailMessage, MIMEPart, and ContentManager. + +- Issue #18281: Unused stat constants removed from `tarfile`. + +- Issue #18999: Multiprocessing now supports 'contexts' with the same API + as the module, but bound to specified start methods. + +- Issue #18468: The re.split, re.findall, and re.sub functions and the group() + and groups() methods of match object now always return a string or a bytes + object. + +- Issue #18725: The textwrap module now supports truncating multiline text. + +- Issue #18776: atexit callbacks now display their full traceback when they + raise an exception. + +- Issue #17827: Add the missing documentation for ``codecs.encode`` and + ``codecs.decode``. + +- Issue #19218: Rename collections.abc to _collections_abc in order to + speed up interpreter start. + +- Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5 + password-based key derivation functions with HMAC as pseudorandom function. + +- Issue #19131: The aifc module now correctly reads and writes sampwidth of + compressed streams. + +- Issue #19209: Remove import of copyreg from the os module to speed up + interpreter startup. stat_result and statvfs_result are now hard-coded to + reside in the os module. + +- Issue #19205: Don't import the 're' module in site and sysconfig module to + speed up interpreter start. + +- Issue #9548: Add a minimal "_bootlocale" module that is imported by the + _io module instead of the full locale module. + +- Issue #18764: Remove the 'print' alias for the PDB 'p' command so that it no + longer shadows the print function. + +- Issue #19158: A rare race in BoundedSemaphore could allow .release() too + often. + +- Issue #15805: Add contextlib.redirect_stdout(). + +- Issue #18716: Deprecate the formatter module. + +- Issue #10712: 2to3 has a new "asserts" fixer that replaces deprecated names + of unittest methods (e.g. failUnlessEqual -> assertEqual). + +- Issue #18037: 2to3 now escapes ``'\u'`` and ``'\U'`` in native strings. + +- Issue #17839: base64.decodebytes and base64.encodebytes now accept any + object that exports a 1 dimensional array of bytes (this means the same + is now also true for base64_codec) + +- Issue #19132: The pprint module now supports compact mode. + +- Issue #19137: The pprint module now correctly formats instances of set and + frozenset subclasses. + +- Issue #10042: functools.total_ordering now correctly handles + NotImplemented being returned by the underlying comparison function (Patch + by Katie Miller) + +- Issue #19092: contextlib.ExitStack now correctly reraises exceptions + from the __exit__ callbacks of inner context managers (Patch by Hrvoje + Nik?i?) + +- Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except + when necessary. Patch by Oscar Benjamin. + +- Issue #5845: In site.py, only load readline history from ~/.python_history + if no history has been read already. This avoids double writes to the + history file at shutdown. + +- Properly initialize all fields of a SSL object after allocation. + +- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the + SSL handshake hasn't been done. + +- Issue #4366: Fix building extensions on all platforms when --enable-shared + is used. + +- Issue #19030: Fixed `inspect.getmembers` and `inspect.classify_class_attrs` + to attempt activating descriptors before falling back to a __dict__ search + for faulty descriptors. `inspect.classify_class_attrs` no longer returns + Attributes whose home class is None. + +C API +----- + +- Issue #1772673: The type of `char*` arguments now changed to `const char*`. + +- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API + to allow embedding applications like Blender to force a particular + encoding and error handler for the standard IO streams (initial patch by + Bastien Montagne) + +Tests +----- + +- Issue #19275: Fix test_site on AMD64 Snow Leopard + +- Issue #14407: Fix unittest test discovery in test_concurrent_futures. + +- Issue #18919: Unified and extended tests for audio modules: aifc, sunau and + wave. + +- Issue #18714: Added tests for ``pdb.find_function()``. + +Documentation +------------- + +- Issue #18758: Fixed and improved cross-references. + +- Issue #18972: Modernize email examples and use the argparse module in them. + +Build +----- + +- Issue #19130: Correct PCbuild/readme.txt, Python 3.3 and 3.4 require VS 2010. + +- Issue #15663: Update OS X 10.6+ installer to use Tcl/Tk 8.5.15. + +- Issue #14499: Fix several problems with OS X universal build support: + 1. ppc arch detection for extension module builds broke with Xcode 5 + 2. ppc arch detection in configure did not work on OS X 10.4 + 3. -sysroot and -arch flags were unnecessarily duplicated + 4. there was no obvious way to configure an intel-32 only build. + +- Issue #19019: Change the OS X installer build script to use CFLAGS instead + of OPT for special build options. By setting OPT, some compiler-specific + options like -fwrapv were overridden and thus not used, which could result + in broken interpreters when building with clang. + + +What's New in Python 3.4.0 Alpha 3? +=================================== + +Release date: 2013-09-29 + +Core and Builtins +----------------- + +- Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional. + +- Issue #19098: Prevent overflow in the compiler when the recursion limit is set + absurdly high. + +Library +------- + +- Issue #18929: `inspect.classify_class_attrs()` now correctly finds class + attributes returned by `dir()` that are located in the metaclass. + +- Issue #18950: Fix miscellaneous bugs in the sunau module. + Au_read.readframes() now updates current file position and reads correct + number of frames from multichannel stream. Au_write.writeframesraw() now + correctly updates current file position. Au_read.getnframes() now returns an + integer (as in Python 2). Au_read and Au_write now correctly works with file + object if start file position is not a zero. + +- Issue #18594: The fast path for collections.Counter() was never taken + due to an over-restrictive type check. + +- Issue #19053: ZipExtFile.read1() with non-zero argument no more returns empty + bytes until end of data. + +- logging: added support for Unix domain sockets to SocketHandler and + DatagramHandler. + +- Issue #18996: TestCase.assertEqual() now more cleverly shorten differing + strings in error report. + +- Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. + +- Issue #18978: ``urllib.request.Request`` now allows the method to be + indicated on the class and no longer sets it to None in ``__init__``. + +- Issue #18626: the inspect module now offers a basic command line + introspection interface (Initial patch by Claudiu Popa) + +- Issue #3015: Fixed tkinter with wantobject=False. Any Tcl command call + returned empty string. + +- Issue #19037: The mailbox module now makes all changes to maildir files + before moving them into place, to avoid race conditions with other programs + that may be accessing the maildir directory. + +- Issue #14984: On POSIX systems, when netrc is called without a filename + argument (and therefore is reading the user's $HOME/.netrc file), it now + enforces the same security rules as typical ftp clients: the .netrc file must + be owned by the user that owns the process and must not be readable by any + other user. + +- Issue #18873: The tokenize module now detects Python source code encoding + only in comment lines. + +- Issue #17764: Enable http.server to bind to a user specified network + interface. Patch contributed by Malte Swart. + +- Issue #18937: Add an assertLogs() context manager to unittest.TestCase + to ensure that a block of code emits a message using the logging module. + +- Issue #17324: Fix http.server's request handling case on trailing '/'. Patch + contributed by Vajrasky Kok. + +- Issue #19018: The heapq.merge() function no longer suppresses IndexError + in the underlying iterables. + +- Issue #18784: The uuid module no longer attempts to load libc via ctypes.CDLL + if all the necessary functions have already been found in libuuid. Patch by + Evgeny Sologubov. + +- The :envvar:`PYTHONFAULTHANDLER` environment variable now only enables the + faulthandler module if the variable is non-empty. Same behaviour than other + variables like :envvar:`PYTHONDONTWRITEBYTECODE`. + +- Issue #1565525: New function ``traceback.clear_frames`` will clear + the local variables of all the stack frames referenced by a traceback + object. + +Tests +----- + +- Issue #18952: Fix regression in support data downloads introduced when + test.support was converted to a package. Regression noticed by Zachary + Ware. + +IDLE +---- + +- Issue #18873: IDLE now detects Python source code encoding only in comment + lines. + +- Issue #18988: The "Tab" key now works when a word is already autocompleted. + +Documentation +------------- + +- Issue #17003: Unified the size argument names in the io module with common + practice. + +Build +----- + +- Issue #18596: Support the use of address sanity checking in recent versions + of clang and GCC by appropriately marking known false alarms in the small + object allocator. Patch contributed by Dhiru Kholia. + +Tools/Demos +----------- + +- Issue #18873: 2to3 and the findnocoding.py script now detect Python source + code encoding only in comment lines. + + +What's New in Python 3.4.0 Alpha 2? +=================================== + +Release date: 2013-09-09 + +Core and Builtins +----------------- + +- Issue #18942: sys._debugmallocstats() output was damaged on Windows. + +- Issue #18571: Implementation of the PEP 446: file descriptors and file + handles are now created non-inheritable; add functions + os.get/set_inheritable(), os.get/set_handle_inheritable() and + socket.socket.get/set_inheritable(). + +- Issue #11619: The parser and the import machinery do not encode Unicode + filenames anymore on Windows. + +- Issue #18808: Non-daemon threads are now automatically joined when + a sub-interpreter is shutdown (it would previously dump a fatal error). + +- Remove support for compiling on systems without getcwd(). + +- Issue #18774: Remove last bits of GNU PTH thread code and thread_pth.h. + +- Issue #18771: Add optimization to set object lookups to reduce the cost + of hash collisions. The core idea is to inspect a second key/hash pair + for each cache line retrieved. + +- Issue #16105: When a signal handler fails to write to the file descriptor + registered with ``signal.set_wakeup_fd()``, report an exception instead + of ignoring the error. + +- Issue #18722: Remove uses of the "register" keyword in C code. + +- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. + +- Issue #16499: Add command line option for isolated mode. + +- Issue #15301: Parsing fd, uid, and gid parameters for builtins + in Modules/posixmodule.c is now far more robust. + +- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() + fail. + +- Issue #17934: Add a clear() method to frame objects, to help clean up + expensive details (local variables) and break reference cycles. + +- Issue #18780: %-formatting codes %d, %i, and %u now treat int-subclasses + as int (displays value of int-subclass instead of str(int-subclass) ). + +Library +------- + +- Issue #18808: Thread.join() now waits for the underlying thread state to + be destroyed before returning. This prevents unpredictable aborts in + Py_EndInterpreter() when some non-daemon threads are still running. + +- Issue #18458: Prevent crashes with newer versions of libedit. Its readline + emulation has changed from 0-based indexing to 1-based like gnu readline. + +- Issue #18852: Handle case of ``readline.__doc__`` being ``None`` in the new + readline activation code in ``site.py``. + +- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in + the _sre module. + +- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even + when input list contains duplicates. + +- Issue #18878: sunau.open now supports the context management protocol. Based on + patches by Claudiu Popa and R. David Murray. + +- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast + 64-bit pointer to long (32 bits). + +- Issue #18876: The FileIO.mode attribute now better reflects the actual mode + under which the file was opened. Patch by Erik Bray. + +- Issue #16853: Add new selectors module. + +- Issue #18882: Add threading.main_thread() function. + +- Issue #18901: The sunau getparams method now returns a namedtuple rather than + a plain tuple. Patch by Claudiu Popa. + +- Issue #17487: The result of the wave getparams method now is pickleable again. + Patch by Claudiu Popa. + +- Issue #18756: os.urandom() now uses a lazily-opened persistent file + descriptor, so as to avoid using many file descriptors when run in + parallel from multiple threads. + +- Issue #18418: After fork(), reinit all threads states, not only active ones. + Patch by A. Jesse Jiryu Davis. + +- Issue #17974: Switch unittest from using getopt to using argparse. + +- Issue #11798: TestSuite now drops references to own tests after execution. + +- Issue #16611: http.cookie now correctly parses the 'secure' and 'httponly' + cookie flags. + +- Issue #11973: Fix a problem in kevent. The flags and fflags fields are now + properly handled as unsigned. + +- Issue #18807: ``pyvenv`` now takes a --copies argument allowing copies + instead of symlinks even where symlinks are available and the default. + +- Issue #18538: ``python -m dis`` now uses argparse for argument processing. + Patch by Michele Orr?. + +- Issue #18394: Close cgi.FieldStorage's optional file. + +- Issue #17702: On error, os.environb now suppresses the exception context + when raising a new KeyError with the original key. + +- Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. + +- Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj + argument. + +- Issue #17211: Yield a namedtuple in pkgutil. + Patch by Ramchandra Apte. + +- Issue #18324: set_payload now correctly handles binary input. This also + supersedes the previous fixes for #14360, #1717, and #16564. + +- Issue #18794: Add a fileno() method and a closed attribute to select.devpoll + objects. + +- Issue #17119: Fixed integer overflows when processing large strings and tuples + in the tkinter module. + +- Issue #15352: Rebuild frozen modules when marshal.c is changed. + +- Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork. + A pthread_atfork() parent handler is used to seed the PRNG with pid, time + and some stack data. + +- Issue #8865: Concurrent invocation of select.poll.poll() now raises a + RuntimeError exception. Patch by Christian Schubert. + +- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of + OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. + +- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. + +- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke + malloc weak symbols. + +- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes + inside subjectAltName correctly. Formerly the module has used OpenSSL's + GENERAL_NAME_print() function to get the string representation of ASN.1 + strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and + ``uniformResourceIdentifier`` (URI). + +- Issue #18701: Remove support of old CPython versions (<3.0) from C code. + +- Issue #18756: Improve error reporting in os.urandom() when the failure + is due to something else than /dev/urandom not existing (for example, + exhausting the file descriptor limit). + +- Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel + 3.11 or newer. It's only defined on system with 3.11 uapi headers, too. + +- Issue #18532: Change the builtin hash algorithms' names to lower case names + as promised by hashlib's documentation. + +- Issue #8713: add new spwan and forkserver start methods, and new functions + get_all_start_methods, get_start_method, and set_start_method, to + multiprocessing. + +- Issue #18405: Improve the entropy of crypt.mksalt(). + +- Issue #12015: The tempfile module now uses a suffix of 8 random characters + instead of 6, to reduce the risk of filename collision. The entropy was + reduced when uppercase letters were removed from the charset used to generate + random characters. + +- Issue #18585: Add :func:`textwrap.shorten` to collapse and truncate a + piece of text to a given length. + +- Issue #18598: Tweak exception message for importlib.import_module() to + include the module name when a key argument is missing. + +- Issue #19151: Fix docstring and use of _get_supported_file_loaders() to + reflect 2-tuples. + +- Issue #19152: Add ExtensionFileLoader.get_filename(). + +- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get + docstrings and ValueError messages. Patch by Zhongyue Luo + +- Fix refcounting issue with extension types in tkinter. + +- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error + if methods have annotations; it now correctly displays the annotations. + +- Issue #18600: Added policy argument to email.message.Message.as_string, + and as_bytes and __bytes__ methods to Message. + +- Issue #18671: Output more information when logging exceptions occur. + +- Issue #18621: Prevent the site module's patched builtins from keeping + too many references alive for too long. + +- Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. + +- Issue #8860: Fixed rounding in timedelta constructor. + +- Issue #18849: Fixed a Windows-specific tempfile bug where collision with an + existing directory caused mkstemp and related APIs to fail instead of + retrying. Report and fix by Vlad Shcherbina. + +- Issue #18920: argparse's default destination for the version action (-v, + --version) has also been changed to stdout, to match the Python executable. + +Tests +----- + +- Issue #18623: Factor out the _SuppressCoreFiles context manager into + test.support. Patch by Valerie Lambert. + +- Issue #12037: Fix test_email for desktop Windows. + +- Issue #15507: test_subprocess's test_send_signal could fail if the test + runner were run in an environment where the process inherited an ignore + setting for SIGINT. Restore the SIGINT handler to the desired + KeyboardInterrupt raising one during that test. + +- Issue #16799: Switched from getopt to argparse style in regrtest's argument + parsing. Added more tests for regrtest's argument parsing. + +- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as + possible, since "localhost" goes through a DNS lookup under recent Windows + versions. + +IDLE +---- + +- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster. + +Documentation +------------- + +- Issue #18743: Fix references to non-existent "StringIO" module. + +- Issue #18783: Removed existing mentions of Python long type in docstrings, + error messages and comments. + +Build +----- + +- Issue #1584: Provide configure options to override default search paths for + Tcl and Tk when building _tkinter. + +- Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit + installer. It is no longer necessary to install a third-party version of + Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 + shipped in OS X 10.6 and later releases. + +Tools/Demos +----------- + +- Issue #18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write + their version strings to stdout, and not to sderr. + + +What's New in Python 3.4.0 Alpha 1? +=================================== + +Release date: 2013-08-03 + +Core and Builtins +----------------- + +- Issue #16741: Fix an error reporting in int(). + +- Issue #17899: Fix rare file descriptor leak in os.listdir(). + +- Issue #10241: Clear extension module dict copies at interpreter shutdown. + Patch by Neil Schemenauer, minimally modified. + +- Issue #9035: ismount now recognises volumes mounted below a drive root + on Windows. Original patch by Atsuo Ishimoto. + +- Issue #18214: Improve finalization of Python modules to avoid setting + their globals to None, in most cases. + +- Issue #18112: PEP 442 implementation (safe object finalization). + +- Issue #18552: Check return value of PyArena_AddPyObject() in + obj2ast_object(). + +- Issue #18560: Fix potential NULL pointer dereference in sum(). + +- Issue #18520: Add a new PyStructSequence_InitType2() function, same than + PyStructSequence_InitType() except that it has a return value (0 on success, + -1 on error). + +- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0], + prefix and exec_prefix if the operation system does not obey MAXPATHLEN. + +- Issue #18408: Fix many various bugs in code handling errors, especially + on memory allocation failure (MemoryError). + +- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all(). + +- Issue #18342: Use the repr of a module name when an import fails when using + ``from ... import ...``. + +- Issue #17872: Fix a segfault in marshal.load() when input stream returns + more bytes than requested. + +- Issue #18338: `python --version` now prints version string to stdout, and + not to stderr. Patch by Berker Peksag and Michael Dickens. + +- Issue #18426: Fix NULL pointer dereference in C extension import when + PyModule_GetDef() returns an error. + +- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix + a stack overflow in the marshal module (fix a crash in test_marshal). + Patch written by Jeremy Kloth. + +- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory + allocators. + +- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the + tstate is first removed from TLS and then deallocated. + +- Issue #13483: Use VirtualAlloc in obmalloc on Windows. + +- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise + OverflowError when an argument of %c format is out of range. + +- Issue #18111: The min() and max() functions now support a default argument + to be returned instead of raising a ValueError on an empty sequence. + (Contributed by Julian Berman.) + +- Issue #18137: Detect integer overflow on precision in float.__format__() + and complex.__format__(). + +- Issue #15767: Introduce ModuleNotFoundError which is raised when a module + could not be found. + +- Issue #18183: Fix various unicode operations on strings with large unicode + codepoints. + +- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). + +- Issue #18038: SyntaxError raised during compilation sources with illegal + encoding now always contains an encoding name. + +- Issue #17931: Resolve confusion on Windows between pids and process + handles. + +- Tweak the exception message when the magic number or size value in a bytecode + file is truncated. + +- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators: + change the C type of seqiterobject.it_index from long to Py_ssize_t. + +- Issue #18065: Don't set __path__ to the package name for frozen packages. + +- Issue #18088: When reloading a module, unconditionally reset all relevant + attributes on the module (e.g. __name__, __loader__, __package__, __file__, + __cached__). + +- Issue #17937: Try harder to collect cyclic garbage at shutdown. + +- Issue #12370: Prevent class bodies from interfering with the __class__ + closure. + +- Issue #17644: Fix a crash in str.format when curly braces are used in square + brackets. + +- Issue #17237: Fix crash in the ASCII decoder on m68k. + +- Issue #17927: Frame objects kept arguments alive if they had been + copied into a cell, even if the cell was cleared. + +- Issue #1545463: At shutdown, defer finalization of codec modules so + that stderr remains usable. + +- Issue #7330: Implement width and precision (ex: "%5.3s") for the format + string of PyUnicode_FromFormat() function, original patch written by Ysj Ray. + +- Issue #1545463: Global variables caught in reference cycles are now + garbage-collected at shutdown. + +- Issue #17094: Clear stale thread states after fork(). Note that this + is a potentially disruptive change since it may release some system + resources which would otherwise remain perpetually alive (e.g. database + connections kept in thread-local storage). + +- Issue #17408: Avoid using an obsolete instance of the copyreg module when + the interpreter is shutdown and then started again. + +- Issue #5845: Enable tab-completion in the interactive interpreter by + default, thanks to a new sys.__interactivehook__. + +- Issue #17115,17116: Module initialization now includes setting __package__ and + __loader__ attributes to None. + +- Issue #17853: Ensure locals of a class that shadow free variables always win + over the closures. + +- Issue #17863: In the interactive console, don't loop forever if the encoding + can't be fetched from stdin. + +- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__. + +- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules. + +- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3, + such as was shipped with Centos 5 and Mac OS X 10.4. + +- Issue #17413: sys.settrace callbacks were being passed a string instead of an + exception instance for the 'value' element of the arg tuple if the exception + originated from C code; now an exception instance is always provided. + +- Issue #17782: Fix undefined behaviour on platforms where + ``struct timespec``'s "tv_nsec" member is not a C long. + +- Issue #17722: When looking up __round__, resolve descriptors. + +- Issue #16061: Speed up str.replace() for replacing 1-character strings. + +- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__ + method. + +- Issue #17643: Add __callback__ attribute to weakref.ref. + +- Issue #16447: Fixed potential segmentation fault when setting __name__ on a + class. + +- Issue #17669: Fix crash involving finalization of generators using yield from. + +- Issue #14439: Python now prints the traceback on runpy failure at startup. + +- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() + when running on valgrind. + +- Issue #17619: Make input() check for Ctrl-C correctly on Windows. + +- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during + the importlib transition. + +- Issue #17610: Don't rely on non-standard behavior of the C qsort() function. + +- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been + disabled by default. It can be re-enabled with the `-X showrefcount` option. + +- Issue #17328: Fix possible refleak in dict.setdefault. + +- Issue #17275: Corrected class name in init error messages of the C version of + BufferedWriter and BufferedRandom. + +- Issue #7963: Fixed misleading error message that issued when object is + called without arguments. + +- Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. + +- Issue #5308: Raise ValueError when marshalling too large object (a sequence + with size >= 2**31), instead of producing illegal marshal data. + +- Issue #12983: Bytes literals with invalid ``\x`` escape now raise a SyntaxError + and a full traceback including line number. + +- Issue #16967: In function definition, evaluate positional defaults before + keyword-only defaults. + +- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) + in the interpreter. + +- Issue #17137: When a Unicode string is resized, the internal wide character + string (wstr) format is now cleared. + +- Issue #17043: The unicode-internal decoder no longer read past the end of + input buffer. + +- Issue #17098: All modules now have __loader__ set even if they pre-exist the + bootstrapping of importlib. + +- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. + +- Issue #16772: The base argument to the int constructor no longer accepts + floats, or other non-integer objects with an __int__ method. Objects + with an __index__ method are now accepted. + +- Issue #10156: In the interpreter's initialization phase, unicode globals + are now initialized dynamically as needed. + +- Issue #16980: Fix processing of escaped non-ascii bytes in the + unicode-escape-decode decoder. + +- Issue #16975: Fix error handling bug in the escape-decode bytes decoder. + +- Issue #14850: Now a charmap decoder treats U+FFFE as "undefined mapping" + in any mapping, not only in a string. + +- Issue #16613: Add *m* argument to ``collections.Chainmap.new_child`` to + allow the new child map to be specified explicitly. + +- Issue #16730: importlib.machinery.FileFinder now no longers raises an + exception when trying to populate its cache and it finds out the directory is + unreadable or has turned into a file. Reported and diagnosed by + David Pritchard. + +- Issue #16906: Fix a logic error that prevented most static strings from being + cleared. + +- Issue #11461: Fix the incremental UTF-16 decoder. Original patch by + Amaury Forgeot d'Arc. + +- Issue #16856: Fix a segmentation fault from calling repr() on a dict with + a key whose repr raise an exception. + +- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. + +- Issue #16761: Calling int() with base argument only now raises TypeError. + +- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py + when retrieving a REG_DWORD value. This corrects functions like + winreg.QueryValueEx that may have been returning truncated values. + +- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg + when passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx. + +- Issue #11939: Set the st_dev attribute of stat_result to allow Windows to + take advantage of the os.path.samefile/sameopenfile/samestat implementations + used by other platforms. + +- Issue #16772: The int() constructor's second argument (base) no longer + accepts non integer values. Consistent with the behavior in Python 2. + +- Issue #14470: Remove w9xpopen support per PEP 11. + +- Issue #9856: Replace deprecation warning with raising TypeError + in object.__format__. Patch by Florent Xicluna. + +- Issue #16597: In buffered and text IO, call close() on the underlying stream + if invoking flush() fails. + +- Issue #16722: In the bytes() constructor, try to call __bytes__ on the + argument before __index__. + +- Issue #16421: loading multiple modules from one shared object is now + handled correctly (previously, the first module loaded from that file + was silently returned). Patch by V?clav ?milauer. + +- Issue #16602: When a weakref's target was part of a long deallocation + chain, the object could remain reachable through its weakref even though + its refcount had dropped to zero. + +- Issue #16495: Remove extraneous NULL encoding check from bytes_decode(). + +- Issue #16619: Create NameConstant AST class to represent None, True, and False + literals. As a result, these constants are never loaded at runtime from + builtins. + +- Issue #16455: On FreeBSD and Solaris, if the locale is C, the + ASCII/surrogateescape codec is now used (instead of the locale encoding) to + decode the command line arguments. This change fixes inconsistencies with + os.fsencode() and os.fsdecode(), because these operating systems announce an + ASCII locale encoding, but actually use the ISO-8859-1 encoding in practice. + +- Issue #16562: Optimize dict equality testing. Patch by Serhiy Storchaka. + +- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread + +- Issue #16592: stringlib_bytes_join doesn't raise MemoryError on allocation + failure. + +- Issue #16546: Fix: ast.YieldFrom argument is now mandatory. + +- Issue #16514: Fix regression causing a traceback when sys.path[0] is None + (actually, any non-string or non-bytes type). + +- Issue #16306: Fix multiple error messages when unknown command line + parameters where passed to the interpreter. Patch by Hieu Nguyen. + +- Issue #16215: Fix potential double memory free in str.replace(). Patch + by Serhiy Storchaka. + +- Issue #16290: A float return value from the __complex__ special method is no + longer accepted in the complex() constructor. + +- Issue #16416: On Mac OS X, operating system data are now always + encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding + (which may be ASCII if no locale environment variable is set), to avoid + inconsistencies with os.fsencode() and os.fsdecode() functions which are + already using UTF-8/surrogateescape. + +- Issue #16453: Fix equality testing of dead weakref objects. + +- Issue #9535: Fix pending signals that have been received but not yet + handled by Python to not persist after os.fork() in the child process. + +- Issue #14794: Fix slice.indices to return correct results for huge values, + rather than raising OverflowError. + +- Issue #15001: fix segfault on "del sys.modules['__main__']". Patch by Victor + Stinner. + +- Issue #8271: the utf-8 decoder now outputs the correct number of U+FFFD + characters when used with the 'replace' error handler on invalid utf-8 + sequences. Patch by Serhiy Storchaka, tests by Ezio Melotti. + +- Issue #5765: Apply a hard recursion limit in the compiler instead of + blowing the stack and segfaulting. Initial patch by Andrea Griffini. + +- Issue #16402: When slicing a range, fix shadowing of exceptions from + __index__. + +- Issue #16336: fix input checking in the surrogatepass error handler. + Patch by Serhiy Storchaka. + +- Issue #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now + raises an error. + +- Issue #7317: Display full tracebacks when an error occurs asynchronously. + Patch by Alon Horev with update by Alexey Kachayev. + +- Issue #16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH + not set at all. + +- Issue #10189: Improve the error reporting of SyntaxErrors related to global + and nonlocal statements. + +- Fix segfaults on setting __qualname__ on builtin types and attempting to + delete it on any type. + +- Issue #14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch + written by Serhiy Storchaka. + +- Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass + received a nonempty dict from the constructor. + +- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a + class's __dict__ and on type. + +- Issue #12805: Make bytes.join and bytearray.join faster when the separator + is empty. Patch by Serhiy Storchaka. + +- Issue #6074: Ensure cached bytecode files can always be updated by the + user that created them, even when the source file is read-only. + +- Issue #15958: bytes.join and bytearray.join now accept arbitrary buffer + objects. + +- Issue #14783: Improve int() docstring and switch docstrings for str(), + range(), and slice() to use multi-line signatures. + +- Issue #16160: Subclass support now works for types.SimpleNamespace. + +- Issue #16148: Implement PEP 424, adding operator.length_hint and + PyObject_LengthHint. + +- Upgrade Unicode data (UCD) to version 6.2. + +- Issue #15379: Fix passing of non-BMP characters as integers for the charmap + decoder (already working as unicode strings). Patch by Serhiy Storchaka. + +- Issue #15144: Fix possible integer overflow when handling pointers as integer + values, by using `Py_uintptr_t` instead of `size_t`. Patch by Serhiy + Storchaka. + +- Issue #15965: Explicitly cast `AT_FDCWD` as (int). Required on Solaris 10 + (which defines `AT_FDCWD` as ``0xffd19553``), harmless on other platforms. + +- Issue #15839: Convert SystemErrors in `super()` to RuntimeErrors. + +- Issue #15448: Buffered IO now frees the buffer when closed, instead + of when deallocating. + +- Issue #15846: Fix SystemError which happened when using `ast.parse()` in an + exception handler on code with syntax errors. + +- Issue #15897: zipimport.c doesn't check return value of fseek(). + Patch by Felipe Cruz. + +- Issue #15801: Make sure mappings passed to '%' formatting are actually + subscriptable. + +- Issue #15111: __import__ should propagate ImportError when raised as a + side-effect of a module triggered from using fromlist. + +- Issue #15022: Add pickle and comparison support to types.SimpleNamespace. + +Library +------- + +- Issue #4331: Added functools.partialmethod (Initial patch by Alon Horev) + +- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit + platforms. Patch by Yogesh Chaudhari. + +- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li). + +- Issue #14323: Expanded the number of digits in the coefficients for the + RGB -- YIQ conversions so that they match the FCC NTSC versions. + +- Issue #17998: Fix an internal error in regular expression engine. + +- Issue #17557: Fix os.getgroups() to work with the modified behavior of + getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik. + +- Issue #18608: Avoid keeping a strong reference to the locale module + inside the _io module. + +- Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, + and make it GC-aware. + +- Issue #15699: The readline module now uses PEP 3121-style module + initialization, so as to reclaim allocated resources (Python callbacks) + at shutdown. Original patch by Robin Schreiber. + +- Issue #17616: wave.open now supports the context management protocol. + +- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns + 'SHA1' instead of 'SHA'. + +- Issue #13266: Added inspect.unwrap to easily unravel __wrapped__ chains + (initial patch by Daniel Urban and Aaron Iles) + +- Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL. + +- Issue #18559: Fix NULL pointer dereference error in _pickle module + +- Issue #18556: Check the return type of PyUnicode_AsWideChar() in ctype's + U_set(). + +- Issue #17818: aifc.getparams now returns a namedtuple. + +- Issue #18549: Eliminate dead code in socket_ntohl() + +- Issue #18530: Remove additional stat call from posixpath.ismount. + Patch by Alex Gaynor. + +- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() + +- Issue #9177: Calling read() or write() now raises ValueError, not + AttributeError, on a closed SSL socket. Patch by Senko Rasic. + +- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + + gcc. + +- Issue #18479: Changed venv Activate.ps1 to make deactivate a function, and + removed Deactivate.ps1. + +- Issue #18480: Add missing call to PyType_Ready to the _elementtree extension. + +- Issue #17778: Fix test discovery for test_multiprocessing. (Patch by + Zachary Ware.) + +- Issue #18393: The private module _gestalt and private functions + platform._mac_ver_gestalt, platform._mac_ver_lookup and + platform._bcd2str have been removed. This does not affect the public + interface of the platform module. + +- Issue #17482: functools.update_wrapper (and functools.wraps) now set the + __wrapped__ attribute correctly even if the underlying function has a + __wrapped__ attribute set. + +- Issue #18431: The new email header parser now decodes RFC2047 encoded words + in structured headers. + +- Issue #18432: The sched module's queue method was incorrectly returning + an iterator instead of a list. + +- Issue #18044: The new email header parser was mis-parsing encoded words where + an encoded character immediately followed the '?' that follows the CTE + character, resulting in a decoding failure. They are now decoded correctly. + +- Issue #18101: Tcl.split() now process strings nested in a tuple as it + do with byte strings. + +- Issue #18116: getpass was always getting an error when testing /dev/tty, + and thus was always falling back to stdin, and would then raise an exception + if stdin could not be used (such as /dev/null). It also leaked an open file. + All of these issues are now fixed. + +- Issue #17198: Fix a NameError in the dbm module. Patch by Valentina + Mukhamedzhanova. + +- Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form. + +- Issue #18020: improve html.escape speed by an order of magnitude. + Patch by Matt Bryant. + +- Issue #18347: ElementTree's html serializer now preserves the case of + closing tags. + +- Issue #17261: Ensure multiprocessing's proxies use proper address. + +- Issue #18343: faulthandler.register() now keeps the previous signal handler + when the function is called twice, so faulthandler.unregister() restores + correctly the original signal handler. + +- Issue #17097: Make multiprocessing ignore EINTR. + +- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a + segfault inside the _pickle C extension. + +- Issue #18240: The HMAC module is no longer restricted to bytes and accepts + any bytes-like object, e.g. memoryview. Original patch by Jonas Borgstr?m. + +- Issue #18224: Removed pydoc script from created venv, as it causes problems + on Windows and adds no value over and above python -m pydoc ... + +- Issue #18155: The csv module now correctly handles csv files that use + a delimiter character that has a special meaning in regexes, instead of + throwing an exception. + +- Issue #14360: encode_quopri can now be successfully used as an encoder + when constructing a MIMEApplication object. + +- Issue #11390: Add -o and -f command line options to the doctest CLI to + specify doctest options (and convert it to using argparse). + +- Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input + string in longer than 2 gigabytes, and ssl.SSLContext.load_cert_chain() + raises a ValueError if the password is longer than 2 gigabytes. The ssl + module does not support partial write. + +- Issue #11016: Add C implementation of the stat module as _stat. + +- Issue #18248: Fix libffi build on AIX. + +- Issue #18259: Declare sethostname in socketmodule.c for AIX + +- Issue #18147: Add diagnostic functions to ssl.SSLContext(). get_ca_list() + lists all loaded CA certificates and cert_store_stats() returns amount of + loaded X.509 certs, X.509 CA certs and CRLs. + +- Issue #18167: cgi.FieldStorage no longer fails to handle multipart/form-data + when ``\r\n`` appears at end of 65535 bytes without other newlines. + +- Issue #18076: Introduce importlib.util.decode_source(). + +- Issue #18357: add tests for dictview set difference. + Patch by Fraser Tweedale. + +- importlib.abc.SourceLoader.get_source() no longer changes SyntaxError or + UnicodeDecodeError into ImportError. + +- Issue #18058, 18057: Make the namespace package loader meet the + importlib.abc.InspectLoader ABC, allowing for namespace packages to work with + runpy. + +- Issue #17177: The imp module is pending deprecation. + +- subprocess: Prevent a possible double close of parent pipe fds when the + subprocess exec runs into an error. Prevent a regular multi-close of the + /dev/null fd when any of stdin, stdout and stderr was set to DEVNULL. + +- Issue #18194: Introduce importlib.util.cache_from_source() and + source_from_cache() while documenting the equivalent functions in imp as + deprecated. + +- Issue #17907: Document imp.new_module() as deprecated in favour of + types.ModuleType. + +- Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document as deprecated + imp.get_magic(). + +- Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache. + Patch by Mark Levitt + +- Issue #18193: Add importlib.reload(). + +- Issue #18157: Stop using imp.load_module() in pydoc. + +- Issue #16102: Make uuid._netbios_getnode() work again on Python 3. + +- Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. + +- Issue #18143: Implement ssl.get_default_verify_paths() in order to debug + the default locations for cafile and capath. + +- Issue #17314: Move multiprocessing.forking over to importlib. + +- Issue #11959: SMTPServer and SMTPChannel now take an optional map, use of + which avoids affecting global state. + +- Issue #18109: os.uname() now decodes fields from the locale encoding, and + socket.gethostname() now decodes the hostname from the locale encoding, + instead of using the UTF-8 encoding in strict mode. + +- Issue #18089: Implement importlib.abc.InspectLoader.load_module. + +- Issue #18088: Introduce importlib.abc.Loader.init_module_attrs for setting + module attributes. Leads to the pending deprecation of + importlib.util.module_for_loader. + +- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to + ruleline. This helps in handling certain types invalid urls in a conservative + manner. Patch contributed by Mher Movsisyan. + +- Issue #18070: Have importlib.util.module_for_loader() set attributes + unconditionally in order to properly support reloading. + +- Added importlib.util.module_to_load to return a context manager to provide the + proper module object to load. + +- Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw + stream's read() returns more bytes than requested. + +- Issue #18011: As was originally intended, base64.b32decode() now raises a + binascii.Error if there are non-b32-alphabet characters present in the input + string, instead of a TypeError. + +- Issue #18072: Implement importlib.abc.InspectLoader.get_code() and + importlib.abc.ExecutionLoader.get_code(). + +- Issue #8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL + sockets. + +- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X + with port None or "0" and flags AI_NUMERICSERV. + +- Issue #16986: ElementTree now correctly works with string input when the + internal XML encoding is not UTF-8 or US-ASCII. + +- Issue #17996: socket module now exposes AF_LINK constant on BSD and OSX. + +- Issue #17900: Allowed pickling of recursive OrderedDicts. Decreased pickled + size and pickling time. + +- Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an + initial patch by Trent Nelson. + +- Issue #17812: Fixed quadratic complexity of base64.b32encode(). + Optimize base64.b32encode() and base64.b32decode() (speed up to 3x). + +- Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of + service using certificates with many wildcards (CVE-2013-2099). + +- Issue #15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. + +- Issue #14596: The struct.Struct() objects now use a more compact + implementation. + +- Issue #17981: logging's SysLogHandler now closes the socket when it catches + socket OSErrors. + +- Issue #17964: Fix os.sysconf(): the return type of the C sysconf() function + is long, not int. + +- Fix typos in the multiprocessing module. + +- Issue #17754: Make ctypes.util.find_library() independent of the locale. + +- Issue #17968: Fix memory leak in os.listxattr(). + +- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator + characters() and ignorableWhitespace() methods. Original patch by Sebastian + Ortiz Vasquez. + +- Issue #17732: Ignore distutils.cfg options pertaining to install paths if a + virtual environment is active. + +- Issue #17915: Fix interoperability of xml.sax with file objects returned by + codecs.open(). + +- Issue #16601: Restarting iteration over tarfile really restarts rather + than continuing from where it left off. Patch by Michael Birtwell. + +- Issue #17289: The readline module now plays nicer with external modules + or applications changing the rl_completer_word_break_characters global + variable. Initial patch by Bradley Froehle. + +- Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit + platforms. Patch by Federico Schwindt. + +- Issue #11816: multiple improvements to the dis module: get_instructions + generator, ability to redirect output to a file, Bytecode and Instruction + abstractions. Patch by Nick Coghlan, Ryan Kelly and Thomas Kluyver. + +- Issue #13831: Embed stringification of remote traceback in local + traceback raised when pool task raises an exception. + +- Issue #15528: Add weakref.finalize to support finalization using + weakref callbacks. + +- Issue #14173: Avoid crashing when reading a signal handler during + interpreter shutdown. + +- Issue #15902: Fix imp.load_module() accepting None as a file when loading an + extension module. + +- Issue #13721: SSLSocket.getpeercert() and SSLSocket.do_handshake() now + raise an OSError with ENOTCONN, instead of an AttributeError, when the + SSLSocket is not connected. + +- Issue #14679: add an __all__ (that contains only HTMLParser) to html.parser. + +- Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by + Thomas Barlow. + +- Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by + extension load_module()) now have a better chance of working when reloaded. + +- Issue #17804: New function ``struct.iter_unpack`` allows for streaming + struct unpacking. + +- Issue #17830: When keyword.py is used to update a keyword file, it now + preserves the line endings of the original file. + +- Issue #17272: Making the urllib.request's Request.full_url a descriptor. + Fixes bugs with assignment to full_url. Patch by Demian Brecht. + +- Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures + +- Issue #11714: Use 'with' statements to assure a Semaphore releases a + condition variable. Original patch by Thomas Rachel. + +- Issue #16624: `subprocess.check_output` now accepts an `input` argument, + allowing the subprocess's stdin to be provided as a (byte) string. + Patch by Zack Weinberg. + +- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with + Unix domain sockets. + +- Issue #16694: Add a pure Python implementation of the operator module. + Patch by Zachary Ware. + +- Issue #11182: remove the unused and undocumented pydoc.Scanner class. + Patch by Martin Morrison. + +- Issue #17741: Add ElementTree.XMLPullParser, an event-driven parser for + non-blocking applications. + +- Issue #17555: Fix ForkAwareThreadLock so that size of after fork + registry does not grow exponentially with generation of process. + +- Issue #17707: fix regression in multiprocessing.Queue's get() method where + it did not block for short timeouts. + +- Issue #17720: Fix the Python implementation of pickle.Unpickler to correctly + process the APPENDS opcode when it is used on non-list objects. + +- Issue #17012: shutil.which() no longer falls back to the PATH environment + variable if an empty path argument is specified. Patch by Serhiy Storchaka. + +- Issue #17710: Fix pickle raising a SystemError on bogus input. + +- Issue #17341: Include the invalid name in the error messages from re about + invalid group names. + +- Issue #17702: os.environ now raises KeyError with the original environment + variable name (str on UNIX), instead of using the encoded name (bytes on + UNIX). + +- Issue #16163: Make the importlib based version of pkgutil.iter_importers + work for submodules. Initial patch by Berker Peksag. + +- Issue #16804: Fix a bug in the 'site' module that caused running + 'python -S -m site' to incorrectly throw an exception. + +- Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal. + Initial patch by Daniel Riti. + +- Issue #2118: SMTPException is now a subclass of OSError. + +- Issue #17016: Get rid of possible pointer wraparounds and integer overflows + in the re module. Patch by Nickolai Zeldovich. + +- Issue #16658: add missing return to HTTPConnection.send(). + Patch by Jeff Knupp. + +- Issue #9556: the logging package now allows specifying a time-of-day for a + TimedRotatingFileHandler to rotate. + +- Issue #14971: unittest test discovery no longer gets confused when a function + has a different __name__ than its name in the TestCase class dictionary. + +- Issue #17487: The wave getparams method now returns a namedtuple rather than + a plain tuple. + +- Issue #17675: socket repr() provides local and remote addresses (if any). + Patch by Giampaolo Rodola' + +- Issue #17093: Make the ABCs in importlib.abc provide default values or raise + reasonable exceptions for their methods to make them more amenable to super() + calls. + +- Issue #17566: Make importlib.abc.Loader.module_repr() optional instead of an + abstractmethod; now it raises NotImplementedError so as to be ignored by default. + +- Issue #17678: Remove the use of deprecated method in http/cookiejar.py by + changing the call to get_origin_req_host() to origin_req_host. + +- Issue #17666: Fix reading gzip files with an extra field. + +- Issue #16475: Support object instancing, recursion and interned strings + in marshal + +- Issue #17502: Process DEFAULT values in mock side_effect that returns iterator. + +- Issue #16795: On the ast.arguments object, unify vararg with varargannotation + and kwarg and kwargannotation. Change the column offset of ast.Attribute to be + at the attribute name. + +- Issue #17434: Properly raise a SyntaxError when a string occurs between future + imports. + +- Issue #17117: Import and @importlib.util.set_loader now set __loader__ when + it has a value of None or the attribute doesn't exist. + +- Issue #17032: The "global" in the "NameError: global name 'x' is not defined" + error message has been removed. Patch by Ram Rachum. + +- Issue #18080: When building a C extension module on OS X, if the compiler + is overridden with the CC environment variable, use the new compiler as + the default for linking if LDSHARED is not also overridden. This restores + Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. + +- Issue #18113: Fixed a refcount leak in the curses.panel module's + set_userptr() method. Reported by Atsuo Ishimoto. + +- Implement PEP 443 "Single-dispatch generic functions". + +- Implement PEP 435 "Adding an Enum type to the Python standard library". + +- Issue #15596: Faster pickling of unicode strings. + +- Issue #17572: Avoid chained exceptions when passing bad directives to + time.strptime(). Initial patch by Claudiu Popa. + +- Issue #17435: threading.Timer's __init__ method no longer uses mutable + default values for the args and kwargs parameters. + +- Issue #17526: fix an IndexError raised while passing code without filename to + inspect.findsource(). Initial patch by Tyler Doyle. + +- Issue #17540: Added style parameter to logging formatter configuration by dict. + +- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial + patch by Michele Orr?. + +- Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. + +- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, + iceweasel, iceape. + +- Issue #17150: pprint now uses line continuations to wrap long string + literals. + +- Issue #17488: Change the subprocess.Popen bufsize parameter default value + from unbuffered (0) to buffering (-1) to match the behavior existing code + expects and match the behavior of the subprocess module in Python 2 to avoid + introducing hard to track down bugs. + +- Issue #17521: Corrected non-enabling of logger following two calls to + fileConfig(). + +- Issue #17508: Corrected logging MemoryHandler configuration in dictConfig() + where the target handler wasn't configured first. + +- Issue #17209: curses.window.get_wch() now correctly handles KeyboardInterrupt + (CTRL+c). + +- Issue #5713: smtplib now handles 421 (closing connection) error codes when + sending mail by closing the socket and reporting the 421 error code via the + exception appropriate to the command that received the error response. + +- Issue #16997: unittest.TestCase now provides a subTest() context manager + to procedurally generate, in an easy way, small test instances. + +- Issue #17485: Also delete the Request Content-Length header if the data + attribute is deleted. (Follow on to issue Issue #16464). + +- Issue #15927: CVS now correctly parses escaped newlines and carriage + when parsing with quoting turned off. + +- Issue #17467: add readline and readlines support to mock_open in + unittest.mock. + +- Issue #13248: removed deprecated and undocumented difflib.isbjunk, + isbpopular. + +- Issue #17192: Update the ctypes module's libffi to v3.0.13. This + specifically addresses a stack misalignment issue on x86 and issues on + some more recent platforms. + +- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. + +- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + +- Issue #17474: Remove the deprecated methods of Request class. + +- Issue #16709: unittest discover order is no-longer filesystem specific. Patch + by Jeff Ramnani. + +- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. + +- Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files + rather than -1. + +- Issue #17460: Remove the strict argument of HTTPConnection and removing the + DeprecationWarning being issued from 3.2 onwards. + +- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. + +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the + caching of compiled regular expressions. + +- Added missing FeedParser and BytesFeedParser to email.parser.__all__. + +- Issue #17431: Fix missing import of BytesFeedParser in email.parser. + +- Issue #12921: http.server's send_error takes an explain argument to send more + information in response. Patch contributed by Karl. + +- Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. + +- Issue #1285086: Get rid of the refcounting hack and speed up + urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). + +- Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ + is not set, harmonizing with what happens when the attribute is set to None. + +- Expose the O_PATH constant in the os module if it is available. + +- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused + a failure while decoding empty object literals when object_pairs_hook was + specified. + +- Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO + queue now uses a deque instead of a list. + +- Issue #15806: Add contextlib.ignore(). This creates a context manager to + ignore specified exceptions, replacing the "except SomeException: pass" idiom. + +- Issue #14645: The email generator classes now produce output using the + specified linesep throughout. Previously if the prolog, epilog, or + body were stored with a different linesep, that linesep was used. This + fix corrects an RFC non-compliance issue with smtplib.send_message. + +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + +- Issue #16962: Use getdents64 instead of the obsolete getdents syscall + in the subprocess module on Linux. + +- Issue #16935: unittest now counts the module as skipped if it raises SkipTest, + instead of counting it as an error. Patch by Zachary Ware. + +- Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. + +- Issue #17223: array module: Fix a crasher when converting an array containing + invalid characters (outside range [U+0000; U+10ffff]) to Unicode: + repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. + +- Issue #17197: profile/cProfile modules refactored so that code of run() and + runctx() utility functions is not duplicated in both modules. + +- Issue #14720: sqlite3: Convert datetime microseconds correctly. + Patch by Lowe Thiderman. + +- Issue #15132: Allow a list for the defaultTest argument of + unittest.TestProgram. Patch by Jyrki Pulliainen. + +- Issue #17225: JSON decoder now counts columns in the first line starting + with 1, as in other lines. + +- Issue #6623: Added explicit DeprecationWarning for ftplib.netrc, which has + been deprecated and undocumented for a long time. + +- Issue #13700: Fix byte/string handling in imaplib authentication when an + authobject is specified. + +- Issue #13153: Tkinter functions now raise TclError instead of ValueError when + a string argument contains non-BMP character. + +- Issue #9669: Protect re against infinite loops on zero-width matching in + non-greedy repeat. Patch by Matthew Barnett. + +- Issue #13169: The maximal repetition number in a regular expression has been + increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on + 64-bit). + +- Issue #17143: Fix a missing import in the trace module. Initial patch by + Berker Peksag. + +- Issue #15220: email.feedparser's line splitting algorithm is now simpler and + faster. + +- Issue #16743: Fix mmap overflow check on 32 bit Windows. + +- Issue #16996: webbrowser module now uses shutil.which() to find a + web-browser on the executable search path. + +- Issue #16800: tempfile.gettempdir() no longer left temporary files when + the disk is full. Original patch by Amir Szekely. + +- Issue #17192: Import libffi-3.0.12. + +- Issue #16564: Fixed regression relative to Python2 in the operation of + email.encoders.encode_7or8bit when used with binary data. + +- Issue #17052: unittest discovery should use self.testLoader. + +- Issue #4591: Uid and gid values larger than 2**31 are supported now. + +- Issue #17141: random.vonmisesvariate() no longer hangs for large kappas. + +- Issue #17149: Fix random.vonmisesvariate to always return results in + [0, 2*math.pi]. + +- Issue #1470548: XMLGenerator now works with binary output streams. + +- Issue #6975: os.path.realpath() now correctly resolves multiple nested + symlinks on POSIX platforms. + +- Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the + filename as a URI, allowing custom options to be passed. + +- Issue #16564: Fixed regression relative to Python2 in the operation of + email.encoders.encode_noop when used with binary data. + +- Issue #10355: The mode, name, encoding and newlines properties now work on + SpooledTemporaryFile objects even when they have not yet rolled over. + Obsolete method xreadline (which has never worked in Python 3) has been + removed. + +- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in + avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(), + and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for + 32-bit samples. max() and rms() no more returns a negative result and + various other functions now work correctly with 32-bit sample -0x80000000. + +- Issue #17073: Fix some integer overflows in sqlite3 module. + +- Issue #16723: httplib.HTTPResponse no longer marked closed when the connection + is automatically closed. + +- Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by + Brian Thorne. + +- Issue #16948: Fix quoted printable body encoding for non-latin1 character + sets in the email package. + +- Issue #16811: Fix folding of headers with no value in the provisional email + policies. + +- Issue #17132: Update symbol for "yield from" grammar changes. + +- Issue #17076: Make copying of xattrs more tolerant of missing FS support. + Patch by Thomas Wouters. + +- Issue #17089: Expat parser now correctly works with string input when the + internal XML encoding is not UTF-8 or US-ASCII. It also now accepts bytes + and strings larger than 2 GiB. + +- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple + parses nested mutating sequence. + +- Issue #5289: Fix ctypes.util.find_library on Solaris. + +- Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying + stream or a decoder produces data of an unexpected type (i.e. when + io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec). + +- Issue #17015: When it has a spec, a Mock object now inspects its signature + when matching calls, so that arguments can be matched positionally or + by name. + +- Issue #15633: httplib.HTTPResponse is now mark closed when the server + sends less than the advertised Content-Length. + +- Issue #12268: The io module file object write methods no longer abort early + when one of its write system calls is interrupted (EINTR). + +- Issue #6972: The zipfile module no longer overwrites files outside of + its destination path when extracting malicious zip files. + +- Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an + incomplete "End of Central Directory" record. Original patch by Guilherme + Polo and Alan McIntyre. + +- Issue #17071: Signature.bind() now works when one of the keyword arguments + is named ``self``. + +- Issue #12004: Fix an internal error in PyZipFile when writing an invalid + Python file. Patch by Ben Morgan. + +- Have py_compile use importlib as much as possible to avoid code duplication. + Code now raises FileExistsError if the file path to be used for the + byte-compiled file is a symlink or non-regular file as a warning that import + will not keep the file path type if it writes to that path. + +- Issue #16972: Have site.addpackage() consider already known paths even when + none are explicitly passed in. Bug report and fix by Kirill. + +- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``) + now fills the ``os.environ`` variable correctly. + +- Issue #15505: `unittest.installHandler` no longer assumes SIGINT handler is + set to a callable object. + +- Issue #13454: Fix a crash when deleting an iterator created by itertools.tee() + if all other iterators were very advanced before. + +- Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries + and bytes data. Patch by Jonas Wagner. + +- Issue #16957: shutil.which() no longer searches a bare file name in the + current directory on Unix and no longer searches a relative file path with + a directory part in PATH directories. Patch by Thomas Kluyver. + +- Issue #1159051: GzipFile now raises EOFError when reading a corrupted file + with truncated header or footer. + +- Issue #16993: shutil.which() now preserves the case of the path and extension + on Windows. + +- Issue #16992: On Windows in signal.set_wakeup_fd, validate the file + descriptor argument. + +- Issue #16422: For compatibility with the Python version, the C version of + decimal now uses strings instead of integers for rounding mode constants. + +- Issue #15861: tkinter now correctly works with lists and tuples containing + strings with whitespaces, backslashes or unbalanced braces. + +- Issue #9720: zipfile now writes correct local headers for files larger than + 4 GiB. + +- Issue #16955: Fix the poll() method for multiprocessing's socket + connections on Windows. + +- SSLContext.load_dh_params() now properly closes the input file. + +- Issue #15031: Refactor some .pyc management code to cut down on code + duplication. Thanks to Ronan Lamy for the report and taking an initial stab + at the problem. + +- Issue #16398: Optimize deque.rotate() so that it only moves pointers + and doesn't touch the underlying data with increfs and decrefs. + +- Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed. + +- Issue #13899: ``\A``, ``\Z``, and ``\B`` now correctly match the A, Z, + and B literals when used inside character classes (e.g. ``'[\A]'``). + Patch by Matthew Barnett. + +- Issue #15545: Fix regression in sqlite3's iterdump method where it was + failing if the connection used a row factory (such as sqlite3.Row) that + produced unsortable objects. (Regression was introduced by fix for 9750). + +- fcntl: add F_DUPFD_CLOEXEC constant, available on Linux 2.6.24+. + +- Issue #15972: Fix error messages when os functions expecting a file name or + file descriptor receive the incorrect type. + +- Issue #8109: The ssl module now has support for server-side SNI, thanks + to a :meth:`SSLContext.set_servername_callback` method. Patch by Daniel + Black. + +- Issue #16860: In tempfile, use O_CLOEXEC when available to set the + close-on-exec flag atomically. + +- Issue #16674: random.getrandbits() is now 20-40% faster for small integers. + +- Issue #16009: JSON error messages now provide more information. + +- Issue #16828: Fix error incorrectly raised by bz2.compress(b'') and + bz2.BZ2Compressor.compress(b''). Initial patch by Martin Packman. + +- Issue #16833: In http.client.HTTPConnection, do not concatenate the request + headers and body when the payload exceeds 16 KB, since it can consume more + memory for no benefit. Patch by Benno Leslie. + +- Issue #16541: tk_setPalette() now works with keyword arguments. + +- Issue #16820: In configparser, `parser.popitem()` no longer raises ValueError. + This makes `parser.clean()` work correctly. + +- Issue #16820: In configparser, ``parser['section'] = {}`` now preserves + section order within the parser. This makes `parser.update()` preserve section + order as well. + +- Issue #16820: In configparser, ``parser['DEFAULT'] = {}`` now correctly + clears previous values stored in the default section. Same goes for + ``parser.update({'DEFAULT': {}})``. + +- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. + +- Issue #16787: Increase asyncore and asynchat default output buffers size, to + decrease CPU usage and increase throughput. + +- Issue #10527: make multiprocessing use poll() instead of select() if available. + +- Issue #16688: Now regexes contained backreferences correctly work with + non-ASCII strings. Patch by Matthew Barnett. + +- Issue #16486: Make aifc files act as context managers. + +- Issue #16485: Now file descriptors are closed if file header patching failed + on closing an aifc file. + +- Issue #16640: Run less code under a lock in sched module. + +- Issue #16165: sched.scheduler.run() no longer blocks a scheduler for other + threads. + +- Issue #16641: Default values of sched.scheduler.enter() are no longer + modifiable. + +- Issue #16618: Make glob.glob match consistently across strings and bytes + regarding leading dots. Patch by Serhiy Storchaka. + +- Issue #16788: Add samestat to Lib/ntpath.py + +- Issue #16713: Parsing of 'tel' urls using urlparse separates params from + path. + +- Issue #16443: Add docstrings to regular expression match objects. + Patch by Anton Kasyanov. + +- Issue #15701: Fix HTTPError info method call to return the headers information. + +- Issue #16752: Add a missing import to modulefinder. Patch by Berker Peksag. + +- Issue #16646: ftplib.FTP.makeport() might lose socket error details. + (patch by Serhiy Storchaka) + +- Issue #16626: Fix infinite recursion in glob.glob() on Windows when the + pattern contains a wildcard in the drive or UNC path. Patch by Serhiy + Storchaka. + +- Issue #15783: Except for the number methods, the C version of decimal now + supports all None default values present in decimal.py. These values were + largely undocumented. + +- Issue #11175: argparse.FileType now accepts encoding and errors + arguments. Patch by Lucas Maystre. + +- Issue #16488: epoll() objects now support the `with` statement. Patch + by Serhiy Storchaka. + +- Issue #16298: In HTTPResponse.read(), close the socket when there is no + Content-Length and the incoming stream is finished. Patch by Eran + Rundstein. + +- Issue #16049: Add abc.ABC class to enable the use of inheritance to create + ABCs, rather than the more cumbersome metaclass=ABCMeta. Patch by Bruno + Dupuis. + +- Expose the TCP_FASTOPEN and MSG_FASTOPEN flags in socket when they're + available. + +- Issue #15701: Add a .headers attribute to urllib.error.HTTPError. Patch + contributed by Berker Peksag. + +- Issue #15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree + that caused it to not ignore certain errors when ignore_errors was set. + Patch by Alessandro Moura and Serhiy Storchaka. + +- Issue #16248: Disable code execution from the user's home directory by + tkinter when the -E flag is passed to Python. Patch by Zachary Ware. + +- Issue #13390: New function :func:`sys.getallocatedblocks()` returns the + number of memory blocks currently allocated. + +- Issue #16628: Fix a memory leak in ctypes.resize(). + +- Issue #13614: Fix setup.py register failure with invalid rst in description. + Patch by Julien Courteau and Pierre Paul Lefebvre. + +- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by + Philip Jenvey, tested by Mageia and Debian. + +- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later + on. Initial patch by SilentGhost and Jeff Ramnani. + +- Issue #13120: Allow calling pdb.set_trace() from thread. + Patch by Ilya Sandler. + +- Issue #16585: Make CJK encoders support error handlers that return bytes per + PEP 383. + +- Issue #10182: The re module doesn't truncate indices to 32 bits anymore. + Patch by Serhiy Storchaka. + +- Issue #16333: use (",", ": ") as default separator in json when indent is + specified, to avoid trailing whitespace. Patch by Serhiy Storchaka. + +- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous + list() calls aren't added to filter(), map(), and zip() which are directly + passed enumerate(). + +- Issue #16464: Reset the Content-Length header when a urllib Request is reused + with new data. + +- Issue #12848: The pure Python pickle implementation now treats object + lengths as unsigned 32-bit integers, like the C implementation does. + Patch by Serhiy Storchaka. + +- Issue #16423: urllib.request now has support for ``data:`` URLs. Patch by + Mathias Panzenb?ck. + +- Issue #4473: Add a POP3.stls() to switch a clear-text POP3 session into + an encrypted POP3 session, on supported servers. Patch by Lorenzo Catucci. + +- Issue #4473: Add a POP3.capa() method to query the capabilities advertised + by the POP3 server. Patch by Lorenzo Catucci. + +- Issue #4473: Ensure the socket is shutdown cleanly in POP3.close(). + Patch by Lorenzo Catucci. + +- Issue #16522: added FAIL_FAST flag to doctest. + +- Issue #15627: Add the importlib.abc.InspectLoader.source_to_code() method. + +- Issue #16408: Fix file descriptors not being closed in error conditions + in the zipfile module. Patch by Serhiy Storchaka. + +- Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak + references to bound methods. + +- Issue #16469: Fix exceptions from float -> Fraction and Decimal -> Fraction + conversions for special values to be consistent with those for float -> int + and Decimal -> int. Patch by Alexey Kachayev. + +- Issue #16481: multiprocessing no longer leaks process handles on Windows. + +- Issue #12428: Add a pure Python implementation of functools.partial(). + Patch by Brian Thorne. + +- Issue #16140: The subprocess module no longer double closes its child + subprocess.PIPE parent file descriptors on child error prior to exec(). + +- Remove a bare print to stdout from the subprocess module that could have + happened if the child process wrote garbage to its pre-exec error pipe. + +- The subprocess module now raises its own SubprocessError instead of a + RuntimeError in various error situations which should not normally happen. + +- Issue #16327: The subprocess module no longer leaks file descriptors + used for stdin/stdout/stderr pipes to the child when fork() fails. + +- Issue #14396: Handle the odd rare case of waitpid returning 0 when not + expected in subprocess.Popen.wait(). + +- Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access + previously-freed memory. Patch by Serhiy Storchaka. + +- Issue #16357: fix calling accept() on a SSLSocket created through + SSLContext.wrap_socket(). Original patch by Jeff McNeil. + +- Issue #16409: The reporthook callback made by the legacy + urllib.request.urlretrieve API now properly supplies a constant non-zero + block_size as it did in Python 3.2 and 2.7. This matches the behavior of + urllib.request.URLopener.retrieve. + +- Issue #16431: Use the type information when constructing a Decimal subtype + from a Decimal argument. + +- Issue #15641: Clean up deprecated classes from importlib. + Patch by Taras Lyapun. + +- Issue #16350: zlib.decompressobj().decompress() now accumulates data from + successive calls after EOF in unused_data, instead of only saving the argument + to the last call. decompressobj().flush() now correctly sets unused_data and + unconsumed_tail. A bug in the handling of MemoryError when setting the + unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. + +- Issue #12759: sre_parse now raises a proper error when the name of the group + is missing. Initial patch by Serhiy Storchaka. + +- Issue #16152: fix tokenize to ignore whitespace at the end of the code when + no newline is found. Patch by Ned Batchelder. + +- Issue #16284: Prevent keeping unnecessary references to worker functions + in concurrent.futures ThreadPoolExecutor. + +- Issue #16230: Fix a crash in select.select() when one of the lists changes + size while iterated on. Patch by Serhiy Storchaka. + +- Issue #16228: Fix a crash in the json module where a list changes size + while it is being encoded. Patch by Serhiy Storchaka. + +- Issue #16351: New function gc.get_stats() returns per-generation collection + statistics. + +- Issue #14897: Enhance error messages of struct.pack and + struct.pack_into. Patch by Matti M?ki. + +- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. + Patch by Serhiy Storchaka. + +- Issue #12890: cgitb no longer prints spurious

tags in text + mode when the logdir option is specified. + +- Issue #16307: Fix multiprocessing.Pool.map_async not calling its callbacks. + Patch by Janne Karila. + +- Issue #16305: Fix a segmentation fault occurring when interrupting + math.factorial. + +- Issue #16116: Fix include and library paths to be correct when building C + extensions in venvs. + +- Issue #16245: Fix the value of a few entities in html.entities.html5. + +- Issue #16301: Fix the localhost verification in urllib/request.py for ``file://`` + urls. + +- Issue #16250: Fix the invocations of URLError which had misplaced filename + attribute for exception. + +- Issue #10836: Fix exception raised when file not found in urlretrieve + Initial patch by Ezio Melotti. + +- Issue #14398: Fix size truncation and overflow bugs in the bz2 module. + +- Issue #12692: Fix resource leak in urllib.request when talking to an HTTP + server that does not include a ``Connection: close`` header in its responses. + +- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. + Patch by Atsuo Ishimoto. + +- Improve performance of `lzma.LZMAFile` (see also issue #16034). + +- Issue #16220: wsgiref now always calls close() on an iterable response. + Patch by Brent Tubbs. + +- Issue #16270: urllib may hang when used for retrieving files via FTP by using + a context manager. Patch by Giampaolo Rodola'. + +- Issue #16461: Wave library should be able to deal with 4GB wav files, + and sample rate of 44100 Hz. + +- Issue #16176: Properly identify Windows 8 via platform.platform() + +- Issue #16088: BaseHTTPRequestHandler's send_error method includes a + Content-Length header in its response now. Patch by Antoine Pitrou. + +- Issue #16114: The subprocess module no longer provides a misleading error + message stating that args[0] did not exist when either the cwd or executable + keyword arguments specified a path that did not exist. + +- Issue #16169: Fix ctypes.WinError()'s confusion between errno and winerror. + +- Issue #16110: logging.fileConfig now accepts a pre-initialised ConfigParser + instance. + +- Issue #1492704: shutil.copyfile() raises a distinct SameFileError now if + source and destination are the same file. Patch by Atsuo Ishimoto. + +- Issue #13896: Make shelf instances work with 'with' as context managers. + Original patch by Filip Gruszczy?ski. + +- Issue #15417: Add support for csh and fish in venv activation scripts. + +- Issue #14377: ElementTree.write and some of the module-level functions have + a new parameter - *short_empty_elements*. It controls how elements with no + contents are emitted. + +- Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element + element_factory (fixes a regression in SimpleTAL). + +- Issue #9650: List commonly used format codes in time.strftime and + time.strptime docsttings. Original patch by Mike Hoy. + +- Issue #15452: logging configuration socket listener now has a verify option + that allows an application to apply a verification function to the + received configuration data before it is acted upon. + +- Issue #16034: Fix performance regressions in the new `bz2.BZ2File` + implementation. Initial patch by Serhiy Storchaka. + +- `pty.spawn()` now returns the child process status returned by `os.waitpid()`. + +- Issue #15756: `subprocess.poll()` now properly handles `errno.ECHILD` to + return a returncode of 0 when the child has already exited or cannot be waited + on. + +- Issue #15323: Improve failure message of `Mock.assert_called_once_with()`. + +- Issue #16064: ``unittest -m`` claims executable is "python", not "python3". + +- Issue #12376: Pass on parameters in `TextTestResult.__init__()` super call. + +- Issue #15222: Insert blank line after each message in mbox mailboxes. + +- Issue #16013: Fix `csv.Reader` parsing issue with ending quote characters. + Patch by Serhiy Storchaka. + +- Issue #15421: Fix an OverflowError in `Calendar.itermonthdates()` after + `datetime.MAXYEAR`. Patch by C?dric Krier. + +- Issue #16112: platform.architecture does not correctly escape argument to + /usr/bin/file. Patch by David Benjamin. + +- Issue #15970: `xml.etree.ElementTree` now serializes correctly the empty HTML + elements 'meta' and 'param'. + +- Issue #15842: The `SocketIO.{readable,writable,seekable}` methods now raise + ValueError when the file-like object is closed. Patch by Alessandro Moura. + +- Issue #15876: Fix a refleak in the `curses` module: window.encoding. + +- Issue #15881: Fix `atexit` hook in `multiprocessing`. Original patch by Chris + McDonough. + +- Issue #15841: The readable(), writable() and seekable() methods of + `io.BytesIO` and `io.StringIO` objects now raise ValueError when the object + has been closed. Patch by Alessandro Moura. + +- Issue #15447: Use `subprocess.DEVNULL` in webbrowser, instead of opening + `os.devnull` explicitly and leaving it open. + +- Issue #15509: `webbrowser.UnixBrowser` no longer passes empty arguments to + Popen when ``%action`` substitutions produce empty strings. + +- Issue #12776, issue #11839: Call `argparse` type function (specified by + add_argument) only once. Before, the type function was called twice in the + case where the default was specified and the argument was given as well. This + was especially problematic for the FileType type, as a default file would + always be opened, even if a file argument was specified on the command line. + +- Issue #15906: Fix a regression in argparse caused by the preceding change, + when ``action='append'``, ``type='str'`` and ``default=[]``. + +- Issue #16113: Added sha3 module based on the Keccak reference implementation + 3.2. The `hashlib` module has four additional hash algorithms: `sha3_224`, + `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common + code was moved from _hashopenssl.c to hashlib.h. + +- ctypes.call_commethod was removed, since its only usage was in the defunct + samples directory. + +- Issue #16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. + +- Issue #16832: add abc.get_cache_token() to expose cache validity checking + support in ABCMeta. + +IDLE +---- + +- Issue #18429: Format / Format Paragraph, now works when comment blocks + are selected. As with text blocks, this works best when the selection + only includes complete lines. + +- Issue #18226: Add docstrings and unittests for FormatParagraph.py. + Original patches by Todd Rovito and Phil Webster. + +- Issue #18279: Format - Strip trailing whitespace no longer marks a file as + changed when it has not been changed. This fix followed the addition of a + test file originally written by Phil Webster (the issue's main goal). + +- Issue #7136: In the Idle File menu, "New Window" is renamed "New File". + Patch by Tal Einat, Roget Serwy, and Todd Rovito. + +- Remove dead imports of imp. + +- Issue #18196: Avoid displaying spurious SystemExit tracebacks. + +- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition. + +- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". + Original patch by Sarah K. + +- Issue #18055: Move IDLE off of imp and on to importlib. + +- Issue #15392: Create a unittest framework for IDLE. + Initial patch by Rajagopalasarma Jayakrishnan. + See Lib/idlelib/idle_test/README.txt for how to run Idle tests. + +- Issue #14146: Highlight source line while debugging on Windows. + +- Issue #17838: Allow sys.stdin to be reassigned. + +- Issue #13495: Avoid loading the color delegator twice in IDLE. + +- Issue #17798: Allow IDLE to edit new files when specified on command line. + +- Issue #14735: Update IDLE docs to omit "Control-z on Windows". + +- Issue #17532: Always include Options menu for IDLE on OS X. + Patch by Guilherme Sim?es. + +- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit(). + +- Issue #17657: Show full Tk version in IDLE's about dialog. + Patch by Todd Rovito. + +- Issue #17613: Prevent traceback when removing syntax colorizer in IDLE. + +- Issue #1207589: Backwards-compatibility patch for right-click menu in IDLE. + +- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box. + +- Issue #17625: In IDLE, close the replace dialog after it is used. + +- Issue #14254: IDLE now handles readline correctly across shell restarts. + +- Issue #17614: IDLE no longer raises exception when quickly closing a file. + +- Issue #6698: IDLE now opens just an editor window when configured to do so. + +- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + +- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. + +- Issue #17114: IDLE now uses non-strict config parser. + +- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase + interface and support all mandatory methods and properties. + +- Issue #5066: Update IDLE docs. Patch by Todd Rovito. + +- Issue #16829: IDLE printing no longer fails if there are spaces or other + special characters in the file path. + +- Issue #16491: IDLE now prints chained exception tracebacks. + +- Issue #16819: IDLE method completion now correctly works for bytes literals. + +- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by + Roger Serwy. + +- Issue #16511: Use default IDLE width and height if config param is not valid. + Patch Serhiy Storchaka. + +- Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. + Patch by Todd Rovito. + +- Issue #16123: IDLE - deprecate running without a subprocess. + Patch by Roger Serwy. + +Tests +----- + +- Issue #1666318: Add a test that shutil.copytree() retains directory + permissions. Patch by Catherine Devlin. + +- Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json + and make them discoverable by unittest. Patch by Zachary Ware. + +- Fix a fcntl test case on KFreeBSD, Debian #708653 (Petr Salinger). + +- Issue #18396: Fix spurious test failure in test_signal on Windows when + faulthandler is enabled (Patch by Jeremy Kloth) + +- Issue #17046: Fix broken test_executable_without_cwd in test_subprocess. + +- Issue #15415: Add new temp_dir() and change_cwd() context managers to + test.support, and refactor temp_cwd() to use them. Patch by Chris Jerdonek. + +- Issue #15494: test.support is now a package rather than a module (Initial + patch by Indra Talip) + +- Issue #17944: test_zipfile now discoverable and uses subclassing to + generate tests for different compression types. Fixed a bug with skipping + some tests due to use of exhausted iterators. + +- Issue #18266: test_largefile now works with unittest test discovery and + supports running only selected tests. Patch by Zachary Ware. + +- Issue #17767: test_locale now works with unittest test discovery. + Original patch by Zachary Ware. + +- Issue #18375: Assume --randomize when --randseed is used for running the + testsuite. + +- Issue #11185: Fix test_wait4 under AIX. Patch by S?bastien Sabl?. + +- Issue #18207: Fix test_ssl for some versions of OpenSSL that ignore seconds + in ASN1_TIME fields. + +- Issue #18094: test_uuid no longer reports skipped tests as passed. + +- Issue #17992: Add timeouts to asyncore and asynchat tests so that they won't + accidentally hang. + +- Issue #17833: Fix test_gdb failures seen on machines where debug symbols + for glibc are available (seen on PPC64 Linux). + +- Issue #7855: Add tests for ctypes/winreg for issues found in IronPython. + Initial patch by Dino Viehland. + +- Issue #11078: test___all__ now checks for duplicates in __all__. + Initial patch by R. David Murray. + +- Issue #17712: Fix test_gdb failures on Ubuntu 13.04. + +- Issue #17835: Fix test_io when the default OS pipe buffer size is larger + than one million bytes. + +- Issue #17065: Use process-unique key for winreg tests to avoid failures if + test is run multiple times in parallel (eg: on a buildbot host). + +- Issue #12820: add tests for the xml.dom.minicompat module. + Patch by John Chandler and Phil Connell. + +- Issue #17691: test_univnewlines now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17790: test_set now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17789: test_random now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17779: test_osx_env now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17766: test_iterlen now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17690: test_time now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17692: test_sqlite now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #11995: test_pydoc doesn't import all sys.path modules anymore. + +- Issue #17448: test_sax now skips if there are no xml parsers available + instead of raising an ImportError. + +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + +- Issue #10652: make tcl/tk tests run after __all__ test, patch by + Zachary Ware. + +- Issue #11963: remove human verification from test_parser and test_subprocess. + +- Issue #11732: add a new suppress_crash_popup() context manager to test.support + that disables crash popups on Windows and use it in test_faulthandler and + test_capi. + +- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. + +- Issue #17283: Share code between `__main__.py` and `regrtest.py` in + `Lib/test`. + +- Issue #17249: convert a test in test_capi to use unittest and reap threads. + +- Issue #17107: Test client-side SNI support in urllib.request thanks to + the new server-side SNI support in the ssl module. Initial patch by + Daniel Black. + +- Issue #17041: Fix testing when Python is configured with the + --without-doc-strings. + +- Issue #16923: Fix ResourceWarnings in test_ssl. + +- Issue #15539: Added regression tests for Tools/scripts/pindent.py. + +- Issue #17479: test_io now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17066: test_robotparser now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17334: test_index now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17333: test_imaplib now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17082: test_dbm* now work with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17079: test_ctypes now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17304: test_hash now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17303: test_future* now work with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17163: test_file now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16925: test_configparser now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16918: test_codecs now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16919: test_crypt now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16910: test_bytes, test_unicode, and test_userstring now work with + unittest test discovery. Patch by Zachary Ware. + +- Issue #16905: test_warnings now works with unittest test discovery. + Initial patch by Berker Peksag. + +- Issue #16898: test_bufio now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16888: test_array now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16896: test_asyncore now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16897: test_bisect now works with unittest test discovery. + Initial patch by Zachary Ware. + +- Issue #16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath + now work with unittest test discovery. Patch by Zachary Ware. + +- Issue #16748: test_heapq now works with unittest test discovery. + +- Issue #10646: Tests rearranged for os.samefile/samestat to check for not + just symlinks but also hard links. + +- Issue #15302: Switch regrtest from using getopt to using argparse. + +- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize + options. + +- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for + localhost tests. + +- Issue #16664: Add regression tests for glob's behaviour concerning entries + starting with a ".". Patch by Sebastian Kreft. + +- Issue #13390: The ``-R`` option to regrtest now also checks for memory + allocation leaks, using :func:`sys.getallocatedblocks()`. + +- Issue #16559: Add more tests for the json module, including some from the + official test suite at json.org. Patch by Serhiy Storchaka. + +- Issue #16661: Fix the `os.getgrouplist()` test by not assuming that it gives + the same output as :command:`id -G`. + +- Issue #16115: Add some tests for the executable argument to + subprocess.Popen(). Initial patch by Kushal Das. + +- Issue #16126: PyErr_Format format mismatch in _testcapimodule.c. + Patch by Serhiy Storchaka. + +- Issue #15304: Fix warning message when `os.chdir()` fails inside + `test.support.temp_cwd()`. Patch by Chris Jerdonek. + +- Issue #15802: Fix test logic in `TestMaildir.test_create_tmp()`. Patch by + Serhiy Storchaka. + +- Issue #15557: Added a test suite for the webbrowser module, thanks to Anton + Barkovsky. + +- Issue #16698: Skip posix test_getgroups when built with OS X + deployment target prior to 10.6. + +Build +----- + +- Issue #16067: Add description into MSI file to replace installer's + temporary name. + +- Issue #18257: Fix readlink usage in python-config. Install the python + version again on Darwin. + +- Issue #18481: Add C coverage reporting with gcov and lcov. A new make target + "coverage-report" creates an instrumented Python build, runs unit tests + and creates a HTML. The report can be updated with "make coverage-lcov". + +- Issue #17845: Clarified the message printed when some module are not built. + +- Issue #18256: Compilation fix for recent AIX releases. Patch by + David Edelsohn. + +- Issue #17547: In configure, explicitly pass -Wformat for the benefit for GCC + 4.8. + +- Issue #15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 + on Windows. + +- Issue #17591: Use lowercase filenames when including Windows header files. + Patch by Roumen Petrov. + +- Issue #17550: Fix the --enable-profiling configure switch. + +- Issue #17425: Build with openssl 1.0.1d on Windows. + +- Issue #16754: Fix the incorrect shared library extension on linux. Introduce + two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of + SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. + +- Issue #5033: Fix building of the sqlite3 extension module when the + SQLite library version has "beta" in it. Patch by Andreas Pelme. + +- Issue #17228: Fix building without pymalloc. + +- Issue #3718: Use AC_ARG_VAR to set MACHDEP in configure.ac. + +- Issue #16235: Implement python-config as a shell script. + +- Issue #16769: Remove outdated Visual Studio projects. + +- Issue #17031: Fix running regen in cross builds. + +- Issue #3754: fix typo in pthread AC_CACHE_VAL. + +- Issue #15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; + use _PYTHON_PROJECT_BASE in distutils/sysconfig.py. + +- Drop support for Windows 2000 (changeset e52df05b496a). + +- Issue #17029: Let h2py search the multiarch system include directory. + +- Issue #16953: Fix socket module compilation on platforms with + HAVE_BROKEN_POLL. Patch by Jeffrey Armstrong. + +- Issue #16320: Remove redundant Makefile dependencies for strings and bytes. + +- Cross compiling needs host and build settings. configure no longer + creates a broken PYTHON_FOR_BUILD variable when --build is missing. + +- Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs are + defined in cross compiling mode, too. + +- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. + +- Issue #16593: Have BSD 'make -s' do the right thing, thanks to Daniel Shahaf + +- Issue #16262: fix out-of-src-tree builds, if mercurial is not installed. + +- Issue #15298: ensure _sysconfigdata is generated in build directory, not + source directory. + +- Issue #15833: Fix a regression in 3.3 that resulted in exceptions being + raised if importlib failed to write byte-compiled files. This affected + attempts to build Python out-of-tree from a read-only source directory. + +- Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError + after 2801bf875a24 (see #15801). + +- Issue #16135: Remove OS/2 support. + +- Issue #15819: Make sure we can build Python out-of-tree from a read-only + source directory. (Somewhat related to issue #9860.) + +- Issue #15587: Enable Tk high-resolution text rendering on Macs with + Retina displays. Applies to Tkinter apps, such as IDLE, on OS X + framework builds linked with Cocoa Tk 8.5. + +- Issue #17161: make install now also installs a python3 man page. + +C-API +----- + +- Issue #18351: Fix various issues in a function in importlib provided to help + PyImport_ExecCodeModuleWithPathnames() (and thus by extension + PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx()). + +- Issue #15767: Added PyErr_SetImportErrorSubclass(). + +- PyErr_SetImportError() now sets TypeError when its msg argument is set. + +- Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and + PyObject_CallMethod() now changed to `const char*`. Based on patches by + J?rg M?ller and Lars Buitinck. + +- Issue #17206: Py_CLEAR(), Py_DECREF(), Py_XINCREF() and Py_XDECREF() now + expand their arguments once instead of multiple times. Patch written by Illia + Polosukhin. + +- Issue #17522: Add the PyGILState_Check() API. + +- Issue #17327: Add PyDict_SetDefault. + +- Issue #16881: Fix Py_ARRAY_LENGTH macro for GCC < 3.1. + +- Issue #16505: Remove unused Py_TPFLAGS_INT_SUBCLASS. + +- Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned + (unsigned long and unsigned int) to avoid an undefined behaviour with + Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is + now unsigned too (unsigned long, instead of long). + +- Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified + endianness detection and handling. + +Documentation +------------- + +- Issue #23006: Improve the documentation and indexing of dict.__missing__. + Add an entry in the language datamodel special methods section. + Revise and index its discussion in the stdtypes mapping/dict section. + +- Issue #17701: Improving strftime documentation. + +- Issue #18440: Clarify that `hash()` can truncate the value returned from an + object's custom `__hash__()` method. + +- Issue #17844: Add links to encoders and decoders for bytes-to-bytes codecs. + +- Issue #14097: improve the "introduction" page of the tutorial. + +- Issue #17977: The documentation for the cadefault argument's default value + in urllib.request.urlopen() is fixed to match the code. + +- Issue #6696: add documentation for the Profile objects, and improve + profile/cProfile docs. Patch by Tom Pinckney. + +- Issue #15940: Specify effect of locale on time functions. + +- Issue #17538: Document XML vulnerabilties + +- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. + Patch by Ramchandra Apte + +- Issue #17047: remove doubled words in docs and docstrings + reported by Serhiy Storchaka and Matthew Barnett. + +- Issue #15465: Document the versioning macros in the C API docs rather than + the standard library docs. Patch by Kushal Das. + +- Issue #16406: Combine the pages for uploading and registering to PyPI. + +- Issue #16403: Document how distutils uses the maintainer field in + PKG-INFO. Patch by Jyrki Pulliainen. + +- Issue #16695: Document how glob handles filenames starting with a + dot. Initial patch by Jyrki Pulliainen. + +- Issue #8890: Stop advertising an insecure practice by replacing uses + of the /tmp directory with better alternatives in the documentation. + Patch by Geoff Wilson. + +- Issue #17203: add long option names to unittest discovery docs. + +- Issue #13094: add "Why do lambdas defined in a loop with different values + all return the same result?" programming FAQ. + +- Issue #14901: Update portions of the Windows FAQ. + Patch by Ashish Nitin Patil. + +- Issue #16267: Better document the 3.3+ approach to combining + @abstractmethod with @staticmethod, @classmethod and @property + +- Issue #15209: Clarify exception chaining description in exceptions module + documentation + +- Issue #15990: Improve argument/parameter documentation. + +- Issue #16209: Move the documentation for the str built-in function to a new + str class entry in the "Text Sequence Type" section. + +- Issue #13538: Improve str() and object.__str__() documentation. + +- Issue #16489: Make it clearer that importlib.find_loader() needs parent + packages to be explicitly imported. + +- Issue #16400: Update the description of which versions of a given package + PyPI displays. + +- Issue #15677: Document that zlib and gzip accept a compression level of 0 to + mean 'no compression'. Patch by Brian Brazil. + +- Issue #16197: Update winreg docstrings and documentation to match code. + Patch by Zachary Ware. + +- Issue #8040: added a version switcher to the documentation. Patch by + Yury Selivanov. + +- Issue #16241: Document -X faulthandler command line option. + Patch by Marek ?uppa. + +- Additional comments and some style changes in the concurrent.futures URL + retrieval example + +- Issue #16115: Improve subprocess.Popen() documentation around args, shell, + and executable arguments. + +- Issue #13498: Clarify docs of os.makedirs()'s exist_ok argument. Done with + great native-speaker help from R. David Murray. + +- Issue #15533: Clarify docs and add tests for `subprocess.Popen()`'s cwd + argument. + +- Issue #15979: Improve timeit documentation. + +- Issue #16036: Improve documentation of built-in `int()`'s signature and + arguments. + +- Issue #15935: Clarification of `argparse` docs, re: add_argument() type and + default arguments. Patch contributed by Chris Jerdonek. + +- Issue #11964: Document a change in v3.2 to the behavior of the indent + parameter of json encoding operations. + +- Issue #15116: Remove references to appscript as it is no longer being + supported. + +Tools/Demos +----------- + +- Issue #18817: Fix a resource warning in Lib/aifc.py demo. Patch by + Vajrasky Kok. + +- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. + +- Issue #18448: Fix a typo in Tools/demo/eiffel.py. + +- Issue #18457: Fixed saving of formulas and complex numbers in + Tools/demo/ss1.py. + +- Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by + F?vry Thibault. + +- Issue #12990: The "Python Launcher" on OSX could not launch python scripts + that have paths that include wide characters. + +- Issue #15239: Make mkstringprep.py work again on Python 3. + +- Issue #17028: Allowed Python arguments to be supplied to the Windows + launcher. + +- Issue #17156: pygettext.py now detects the encoding of source files and + correctly writes and escapes non-ascii characters. + +- Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now + pindent.py works with a "with" statement. pindent.py no longer produces + improper indentation. pindent.py now works with continued lines broken after + "class" or "def" keywords and with continuations at the start of line. + +- Issue #11797: Add a 2to3 fixer that maps reload() to imp.reload(). + +- Issue #10966: Remove the concept of unexpected skipped tests. + +- Issue #9893: Removed the Misc/Vim directory. + +- Removed the Misc/TextMate directory. + +- Issue #16245: Add the Tools/scripts/parse_html5_entities.py script to parse + the list of HTML5 entities and update the html.entities.html5 dictionary. + +- Issue #15378: Fix Tools/unicode/comparecodecs.py. Patch by Serhiy Storchaka. + +- Issue #16549: Make json.tool work again on Python 3 and add tests. + Initial patch by Berker Peksag and Serhiy Storchaka. + +- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. + Patch by Serhiy Storchaka. + +Windows +------- + +- Issue #18569: The installer now adds .py to the PATHEXT variable when extensions + are registered. Patch by Paul Moore. + + What's New in Python 3.3.0? =========================== diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,8 +2,16 @@ Python News +++++++++++ -What's New in Python 3.6.0 release candidate 2 -============================================== +What's New in Python 3.6.0? +=========================== + +*Release date: 2016-12-23* + +- No changes since release candidate 2 + + +What's New in Python 3.6.0 release candidate 2? +=============================================== *Release date: 2016-12-16* @@ -33,8 +41,8 @@ - Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. -What's New in Python 3.6.0 release candidate 1 -============================================== +What's New in Python 3.6.0 release candidate 1? +=============================================== *Release date: 2016-12-06* @@ -91,8 +99,8 @@ - Issue #28023: Fix python-gdb.py didn't support new dict implementation. -What's New in Python 3.6.0 beta 4 -================================= +What's New in Python 3.6.0 beta 4? +================================== *Release date: 2016-11-21* @@ -211,8 +219,8 @@ Patch by Gareth Rees. -What's New in Python 3.6.0 beta 3 -================================= +What's New in Python 3.6.0 beta 3? +================================== *Release date: 2016-10-31* @@ -338,8 +346,8 @@ - Issue #28409: regrtest: fix the parser of command line arguments. -What's New in Python 3.6.0 beta 2 -================================= +What's New in Python 3.6.0 beta 2? +================================== *Release date: 2016-10-10* @@ -610,8 +618,8 @@ - Issue #28217: Adds _testconsole module to test console input. -What's New in Python 3.6.0 beta 1 -================================= +What's New in Python 3.6.0 beta 1? +================================== *Release date: 2016-09-12* @@ -1121,8 +1129,8 @@ - Issue #27883: Update sqlite to 3.14.1.0 on Windows. -What's New in Python 3.6.0 alpha 4 -================================== +What's New in Python 3.6.0 alpha 4? +=================================== *Release date: 2016-08-15* @@ -1358,8 +1366,8 @@ Also update FreedBSD version checks for the original ctype UTF-8 workaround. -What's New in Python 3.6.0 alpha 3 -================================== +What's New in Python 3.6.0 alpha 3? +=================================== *Release date: 2016-07-11* @@ -1566,8 +1574,8 @@ Android build. -What's New in Python 3.6.0 alpha 2 -================================== +What's New in Python 3.6.0 alpha 2? +=================================== *Release date: 2016-06-13* @@ -6723,4304 +6731,4 @@ ".cp35-win32.pyd") will now be loaded in preference to those without tags. -What's New in Python 3.4.0? -=========================== - -Release date: 2014-03-16 - -Library -------- - -- Issue #20939: Fix test_geturl failure in test_urllibnet due to - new redirect of http://www.python.org/ to https://www.python.org. - -Documentation -------------- - -- Merge in all documentation changes since branching 3.4.0rc1. - - -What's New in Python 3.4.0 release candidate 3? -=============================================== - -Release date: 2014-03-09 - -Core and Builtins ------------------ - -- Issue #20786: Fix signatures for dict.__delitem__ and - property.__delete__ builtins. - -Library -------- - -- Issue #20839: Don't trigger a DeprecationWarning in the still supported - pkgutil.get_loader() API when __loader__ isn't set on a module (nor - when pkgutil.find_loader() is called directly). - -Build ------ - -- Issue #14512: Launch pydoc -b instead of pydocgui.pyw on Windows. - -- Issue #20748: Uninstalling pip does not leave behind the pyc of - the uninstaller anymore. - -- Issue #20568: The Windows installer now installs the unversioned ``pip`` - command in addition to the versioned ``pip3`` and ``pip3.4`` commands. - -- Issue #20757: The ensurepip helper for the Windows uninstaller now skips - uninstalling pip (rather than failing) if the user has updated pip to a - different version from the one bundled with ensurepip. - -- Issue #20465: Update OS X and Windows installer builds to use - SQLite 3.8.3.1. - - -What's New in Python 3.4.0 release candidate 2? -=============================================== - -Release date: 2014-02-23 - -Core and Builtins ------------------ - -- Issue #20625: Parameter names in __annotations__ were not mangled properly. - Discovered by Jonas Wielicki, patch by Yury Selivanov. - -- Issue #20261: In pickle, lookup __getnewargs__ and __getnewargs_ex__ on the - type of the object. - -- Issue #20619: Give the AST nodes of keyword-only arguments a column and line - number. - -- Issue #20526: Revert changes of issue #19466 which introduces a regression: - don't clear anymore the state of Python threads early during the Python - shutdown. - -Library -------- - -- Issue #20710: The pydoc summary line no longer displays the "self" parameter - for bound methods. - -- Issue #20566: Change asyncio.as_completed() to use a Queue, to - avoid O(N**2) behavior. - -- Issue #20704: Implement new debug API in asyncio. Add new methods - BaseEventLoop.set_debug() and BaseEventLoop.get_debug(). - Add support for setting 'asyncio.tasks._DEBUG' variable with - 'PYTHONASYNCIODEBUG' environment variable. - -- asyncio: Refactoring and fixes: BaseEventLoop.sock_connect() raises an - error if the address is not resolved; use __slots__ in Handle and - TimerHandle; as_completed() and wait() raise TypeError if the passed - list of Futures is a single Future; call_soon() and other 'call_*()' - functions raise TypeError if the passed callback is a coroutine - function; _ProactorBasePipeTransport uses _FlowControlMixin; - WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol() - to consider pausing receiving if the watermark limits have changed; - fix _check_resolved_address() for IPv6 address; and other minor - improvements, along with multiple documentation updates. - -- Issue #20684: Fix inspect.getfullargspec() to not to follow __wrapped__ - chains. Make its behaviour consistent with bound methods first argument. - Patch by Nick Coghlan and Yury Selivanov. - -- Issue #20681: Add new error handling API in asyncio. New APIs: - loop.set_exception_handler(), loop.default_exception_handler(), and - loop.call_exception_handler(). - -- Issue #20673: Implement support for UNIX Domain Sockets in asyncio. - New APIs: loop.create_unix_connection(), loop.create_unix_server(), - streams.open_unix_connection(), and streams.start_unix_server(). - -- Issue #20616: Add a format() method to tracemalloc.Traceback. - -- Issue #19744: the ensurepip installation step now just prints a warning to - stderr rather than failing outright if SSL/TLS is unavailable. This allows - local installation of POSIX builds without SSL/TLS support. - -- Issue #20594: Avoid name clash with the libc function posix_close. - -Build ------ - -- Issue #20641: Run MSI custom actions (pip installation, pyc compilation) - with the NoImpersonate flag, to support elevated execution (UAC). - -- Issue #20221: Removed conflicting (or circular) hypot definition when - compiled with VS 2010 or above. Initial patch by Tabrez Mohammed. - -- Issue #20609: Restored the ability to build 64-bit Windows binaries on - 32-bit Windows, which was broken by the change in issue #19788. - - -What's New in Python 3.4.0 release candidate 1? -=============================================== - -Release date: 2014-02-10 - -Core and Builtins ------------------ - -- Issue #19255: The builtins module is restored to initial value before - cleaning other modules. The sys and builtins modules are cleaned last. - -- Issue #20588: Make Python-ast.c C89 compliant. - -- Issue #20437: Fixed 22 potential bugs when deleting object references. - -- Issue #20500: Displaying an exception at interpreter shutdown no longer - risks triggering an assertion failure in PyObject_Str. - -- Issue #20538: UTF-7 incremental decoder produced inconsistent string when - input was truncated in BASE64 section. - -- Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the - internal codec marking system added for issue #19619 to throw LookupError - for known non-text encodings at stream construction time. The existing - output type checks remain in place to deal with unmarked third party - codecs. - -- Issue #17162: Add PyType_GetSlot. - -- Issue #20162: Fix an alignment issue in the siphash24() hash function which - caused a crash on PowerPC 64-bit (ppc64). - -Library -------- - -- Issue #20530: The signatures for slot builtins have been updated - to reflect the fact that they only accept positional-only arguments. - -- Issue #20517: Functions in the os module that accept two filenames - now register both filenames in the exception on failure. - -- Issue #20563: The ipaddress module API is now considered stable. - -- Issue #14983: email.generator now always adds a line end after each MIME - boundary marker, instead of doing so only when there is an epilogue. This - fixes an RFC compliance bug and solves an issue with signed MIME parts. - -- Issue #20540: Fix a performance regression (vs. Python 3.2) when layering - a multiprocessing Connection over a TCP socket. For small payloads, Nagle's - algorithm would introduce idle delays before the entire transmission of a - message. - -- Issue #16983: the new email header parsing code will now decode encoded words - that are (incorrectly) surrounded by quotes, and register a defect. - -- Issue #19772: email.generator no longer mutates the message object when - doing a down-transform from 8bit to 7bit CTEs. - -- Issue #20536: the statistics module now correctly handle Decimal instances - with positive exponents - -- Issue #18805: the netmask/hostmask parsing in ipaddress now more reliably - filters out illegal values and correctly allows any valid prefix length. - -- Issue #20481: For at least Python 3.4, the statistics module will require - that all inputs for a single operation be of a single consistent type, or - else a mixed of ints and a single other consistent type. This avoids - some interoperability issues that arose with the previous approach of - coercing to a suitable common type. - -- Issue #20478: the statistics module now treats collections.Counter inputs - like any other iterable. - -- Issue #17369: get_filename was raising an exception if the filename - parameter's RFC2231 encoding was broken in certain ways. This was - a regression relative to python2. - -- Issue #20013: Some imap servers disconnect if the current mailbox is - deleted, and imaplib did not handle that case gracefully. Now it - handles the 'bye' correctly. - -- Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3 - version. That is, do *not* raise an error if unicode is passed to - email.message.Message.set_payload. - -- Issue #20476: If a non-compat32 policy is used with any of the email parsers, - EmailMessage is now used as the factory class. The factory class should - really come from the policy; that will get fixed in 3.5. - -- Issue #19920: TarFile.list() no longer fails when outputs a listing - containing non-encodable characters. Based on patch by Vajrasky Kok. - -- Issue #20515: Fix NULL pointer dereference introduced by issue #20368. - -- Issue #19186: Restore namespacing of expat symbols inside the pyexpat module. - -- Issue #20053: ensurepip (and hence venv) are no longer affected by the - settings in the default pip configuration file. - -- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the - debug output every time it is called, regardless of the compilation cache. - -- Issue #20368: The null character now correctly passed from Tcl to Python. - Improved error handling in variables-related commands. - -- Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline - translation settings. - -- tracemalloc: Fix slicing traces and fix slicing a traceback. - -- Issue #20354: Fix an alignment issue in the tracemalloc module on 64-bit - platforms. Bug seen on 64-bit Linux when using "make profile-opt". - -- Issue #17159: inspect.signature now accepts duck types of functions, - which adds support for Cython functions. Initial patch by Stefan Behnel. - -- Issue #18801: Fix inspect.classify_class_attrs to correctly classify - object.__new__ and object.__init__. - -- Fixed cmath.isinf's name in its argument parsing code. - -- Issue #20311, #20452: poll and epoll now round the timeout away from zero, - instead of rounding towards zero, in select and selectors modules: - select.epoll.poll(), selectors.PollSelector.poll() and - selectors.EpollSelector.poll(). For example, a timeout of one microsecond - (1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded to - zero. However, the granularity property and asyncio's resolution feature - were removed again. - -- asyncio: Some refactoring; various fixes; add write flow control to - unix pipes; Future.set_exception() instantiates the exception - argument if it is a class; improved proactor pipe transport; support - wait_for(f, None); don't log broken/disconnected pipes; use - ValueError instead of assert for forbidden subprocess_{shell,exec} - arguments; added a convenience API for subprocess management; added - StreamReader.at_eof(); properly handle duplicate coroutines/futures - in gather(), wait(), as_completed(); use a bytearray for buffering - in StreamReader; and more. - -- Issue #20288: fix handling of invalid numeric charrefs in HTMLParser. - -- Issue #20424: Python implementation of io.StringIO now supports lone surrogates. - -- Issue #20308: inspect.signature now works on classes without user-defined - __init__ or __new__ methods. - -- Issue #20372: inspect.getfile (and a bunch of other inspect functions that - use it) doesn't crash with unexpected AttributeError on classes defined in C - without __module__. - -- Issue #20356: inspect.signature formatting uses '/' to separate - positional-only parameters from others. - -- Issue #20223: inspect.signature now supports methods defined with - functools.partialmethods. - -- Issue #19456: ntpath.join() now joins relative paths correctly when a drive - is present. - -- Issue #19077: tempfile.TemporaryDirectory cleanup no longer fails when - called during shutdown. Emitting resource warning in __del__ no longer fails. - Original patch by Antoine Pitrou. - -- Issue #20394: Silence Coverity warning in audioop module. - -- Issue #20367: Fix behavior of concurrent.futures.as_completed() for - duplicate arguments. Patch by Glenn Langford. - -- Issue #8260: The read(), readline() and readlines() methods of - codecs.StreamReader returned incomplete data when were called after - readline() or read(size). Based on patch by Amaury Forgeot d'Arc. - -- Issue #20105: the codec exception chaining now correctly sets the - traceback of the original exception as its __traceback__ attribute. - -- Issue #17481: inspect.getfullargspec() now uses inspect.signature() API. - -- Issue #15304: concurrent.futures.wait() can block forever even if - Futures have completed. Patch by Glenn Langford. - -- Issue #14455: plistlib: fix serializing integers in the range - of an unsigned long long but outside of the range of signed long long for - binary plist files. - -IDLE ----- - -- Issue #20406: Use Python application icons for Idle window title bars. - Patch mostly by Serhiy Storchaka. - -- Update the python.gif icon for the Idle classbrowser and pathbowser - from the old green snake to the new blue and yellow snakes. - -- Issue #17721: Remove non-functional configuration dialog help button until we - make it actually gives some help when clicked. Patch by Guilherme Sim?es. - -Tests ------ - -- Issue #20532: Tests which use _testcapi now are marked as CPython only. - -- Issue #19920: Added tests for TarFile.list(). Based on patch by Vajrasky Kok. - -- Issue #19990: Added tests for the imghdr module. Based on patch by - Claudiu Popa. - -- Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+. - -Tools/Demos ------------ - -- Issue #20530: Argument Clinic's signature format has been revised again. - The new syntax is highly human readable while still preventing false - positives. The syntax also extends Python syntax to denote "self" and - positional-only parameters, allowing inspect.Signature objects to be - totally accurate for all supported builtins in Python 3.4. - -- Issue #20456: Argument Clinic now observes the C preprocessor conditional - compilation statements of the C files it parses. When a Clinic block is - inside a conditional code, it adjusts its output to match, including - automatically generating an empty methoddef macro. - -- Issue #20456: Cloned functions in Argument Clinic now use the correct - name, not the name of the function they were cloned from, for text - strings inside generated code. - -- Issue #20456: Fixed Argument Clinic's test suite and "--converters" feature. - -- Issue #20456: Argument Clinic now allows specifying different names - for a parameter in Python and C, using "as" on the parameter line. - -- Issue #20326: Argument Clinic now uses a simple, unique signature to - annotate text signatures in docstrings, resulting in fewer false - positives. "self" parameters are also explicitly marked, allowing - inspect.Signature() to authoritatively detect (and skip) said parameters. - -- Issue #20326: Argument Clinic now generates separate checksums for the - input and output sections of the block, allowing external tools to verify - that the input has not changed (and thus the output is not out-of-date). - -Build ------ - -- Issue #20465: Update SQLite shipped with OS X installer to 3.8.3. - -C-API ------ - -- Issue #20517: Added new functions allowing OSError exceptions to reference - two filenames instead of one: PyErr_SetFromErrnoWithFilenameObjects() and - PyErr_SetExcFromWindowsErrWithFilenameObjects(). - -Documentation -------------- - -- Issue #20488: Change wording to say importlib is *the* implementation of - import instead of just *an* implementation. - -- Issue #6386: Clarify in the tutorial that specifying a symlink to execute - means the directory containing the executed script and not the symlink is - added to sys.path. - - -What's New in Python 3.4.0 Beta 3? -================================== - -Release date: 2014-01-26 - -Core and Builtins ------------------ - -- Issue #20189: Four additional builtin types (PyTypeObject, - PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) - have been modified to provide introspection information for builtins. - -- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and - IndentationError. - -- Issue #2382: SyntaxError cursor "^" is now written at correct position in most - cases when multibyte characters are in line (before "^"). This still not - works correctly with wide East Asian characters. - -- Issue #18960: The first line of Python script could be executed twice when - the source encoding was specified on the second line. Now the source encoding - declaration on the second line isn't effective if the first line contains - anything except a comment. 'python -x' works now again with files with the - source encoding declarations, and can be used to make Python batch files - on Windows. - -Library -------- - -- asyncio: Various improvements and small changes not all covered by - issues listed below. E.g. wait_for() now cancels the inner task if - the timeout occcurs; tweaked the set of exported symbols; renamed - Empty/Full to QueueEmpty/QueueFull; "with (yield from lock)" now - uses a separate context manager; readexactly() raises if not enough - data was read; PTY support tweaks. - -- Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum - between the resolution of the BaseEventLoop.time() method and the resolution - of the selector. The granuarility is used in the scheduler to round time and - deadline. - -- Issue #20311: selectors: Add a resolution attribute to BaseSelector. - -- Issue #20189: unittest.mock now no longer assumes that any object for - which it could get an inspect.Signature is a callable written in Python. - Fix courtesy of Michael Foord. - -- Issue #20317: ExitStack.__exit__ could create a self-referential loop if an - exception raised by a cleanup operation already had its context set - correctly (for example, by the @contextmanager decorator). The infinite - loop this caused is now avoided by checking if the expected context is - already set before trying to fix it. - -- Issue #20374: Fix build with GNU readline >= 6.3. - -- Issue #20262: Warnings are raised now when duplicate names are added in the - ZIP file or too long ZIP file comment is truncated. - -- Issue #20165: The unittest module no longer considers tests marked with - @expectedFailure successful if they pass. - -- Issue #18574: Added missing newline in 100-Continue reply from - http.server.BaseHTTPRequestHandler. Patch by Nikolaus Rath. - -- Issue #20270: urllib.urlparse now supports empty ports. - -- Issue #20243: TarFile no longer raise ReadError when opened in write mode. - -- Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't - write complete output on close. - -- Issue #20245: The open functions in the tarfile module now correctly handle - empty mode. - -- Issue #20242: Fixed basicConfig() format strings for the alternative - formatting styles. Thanks to kespindler for the bug report and patch. - -- Issue #20246: Fix buffer overflow in socket.recvfrom_into. - -- Issues #20206 and #5803: Fix edge case in email.quoprimime.encode where it - truncated lines ending in a character needing encoding but no newline by - using a more efficient algorithm that doesn't have the bug. - -- Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in - modules and in documentation. Initial patch contributed by Vajrasky Kok. - -- Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri() - functions now conform to PEP 3333 when handle non-ASCII URLs. - -- Issue #19097: Raise the correct Exception when cgi.FieldStorage is given an - invalid fileobj. - -- Issue #20152: Ported Python/import.c over to Argument Clinic. - -- Issue #13107: argparse and optparse no longer raises an exception when output - a help on environment with too small COLUMNS. Based on patch by - Elazar Gershuni. - -- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly - asked for. - -- Issue #18960: The tokenize module now ignore the source encoding declaration - on the second line if the first line contains anything except a comment. - -- Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU - consumption. - -- Issue #20113: os.readv() and os.writev() now raise an OSError exception on - error instead of returning -1. - -- Issue #19719: Make importlib.abc.MetaPathFinder.find_module(), - PathEntryFinder.find_loader(), and Loader.load_module() use PEP 451 APIs to - help with backwards-compatibility. - -- Issue #20144: inspect.Signature now supports parsing simple symbolic - constants as parameter default values in __text_signature__. - -- Issue #20072: Fixed multiple errors in tkinter with wantobjects is False. - -- Issue #20229: Avoid plistlib deprecation warning in platform.mac_ver(). - -- Issue #14455: Fix some problems with the new binary plist support in plistlib. - -IDLE ----- - -- Issue #17390: Add Python version to Idle editor window title bar. - Original patches by Edmond Burnett and Kent Johnson. - -- Issue #18960: IDLE now ignores the source encoding declaration on the second - line if the first line contains anything except a comment. - -Tests ------ - -- Issue #20358: Tests for curses.window.overlay and curses.window.overwrite - no longer specify min{row,col} > max{row,col}. - -- Issue #19804: The test_find_mac test in test_uuid is now skipped if the - ifconfig executable is not available. - -- Issue #19886: Use better estimated memory requirements for bigmem tests. - -Tools/Demos ------------ - -- Issue #20390: Argument Clinic's "file" output preset now defaults to - "{dirname}/clinic/{basename}.h". - -- Issue #20390: Argument Clinic's "class" directive syntax has been extended - with two new required arguments: "typedef" and "type_object". - -- Issue #20390: Argument Clinic: If __new__ or __init__ functions didn't use - kwargs (or args), the PyArg_NoKeywords (or PyArg_NoPositional) calls - generated are only run when the type object is an exact match. - -- Issue #20390: Argument Clinic now fails if you have required parameters after - optional parameters. - -- Issue #20390: Argument Clinic converters now have a new template they can - inject code into: "modifiers". Code put there is run in the parsing - function after argument parsing but before the call to the impl. - -- Issue #20376: Argument Clinic now escapes backslashes in docstrings. - -- Issue #20381: Argument Clinic now sanity checks the default argument when - c_default is also specified, providing a nice failure message for - disallowed values. - -- Issue #20189: Argument Clinic now ensures that parser functions for - __new__ are always of type newfunc, the type of the tp_new slot. - Similarly, parser functions for __init__ are now always of type initproc, - the type of tp_init. - -- Issue #20189: Argument Clinic now suppresses the docstring for __new__ - and __init__ functions if no docstring is provided in the input. - -- Issue #20189: Argument Clinic now suppresses the "self" parameter in the - impl for @staticmethod functions. - -- Issue #20294: Argument Clinic now supports argument parsing for __new__ and - __init__ functions. - -- Issue #20299: Argument Clinic custom converters may now change the default - value of c_default and py_default with a class member. - -- Issue #20287: Argument Clinic's output is now configurable, allowing - delaying its output or even redirecting it to a separate file. - -- Issue #20226: Argument Clinic now permits simple expressions - (e.g. "sys.maxsize - 1") as default values for parameters. - -- Issue #19936: Added executable bits or shebang lines to Python scripts which - requires them. Disable executable bits and shebang lines in test and - benchmark files in order to prevent using a random system python, and in - source files of modules which don't provide command line interface. Fixed - shebang lines in the unittestgui and checkpip scripts. - -- Issue #20268: Argument Clinic now supports cloning the parameters and - return converter of existing functions. - -- Issue #20228: Argument Clinic now has special support for class special - methods. - -- Issue #20214: Fixed a number of small issues and documentation errors in - Argument Clinic (see issue for details). - -- Issue #20196: Fixed a bug where Argument Clinic did not generate correct - parsing code for functions with positional-only parameters where all arguments - are optional. - -- Issue #18960: 2to3 and the findnocoding.py script now ignore the source - encoding declaration on the second line if the first line contains anything - except a comment. - -- Issue #19723: The marker comments Argument Clinic uses have been changed - to improve readability. - -- Issue #20157: When Argument Clinic renames a parameter because its name - collides with a C keyword, it no longer exposes that rename to PyArg_Parse. - -- Issue #20141: Improved Argument Clinic's support for the PyArg_Parse "O!" - format unit. - -- Issue #20144: Argument Clinic now supports simple symbolic constants - as parameter default values. - -- Issue #20143: The line numbers reported in Argument Clinic errors are - now more accurate. - -- Issue #20142: Py_buffer variables generated by Argument Clinic are now - initialized with a default value. - -Build ------ - -- Issue #12837: Silence a tautological comparison warning on OS X under Clang in - socketmodule.c. - - -What's New in Python 3.4.0 Beta 2? -================================== - -Release date: 2014-01-05 - -Core and Builtins ------------------ - -- Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. - -- Issue #19526: Exclude all new API from the stable ABI. Exceptions can be - made if a need is demonstrated. - -- Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" - argument is not in range [0; 255]. - -- Issue #19995: %c, %o, %x, and %X now issue a DeprecationWarning on non-integer - input; reworded docs to clarify that an integer type should define both __int__ - and __index__. - -- Issue #19787: PyThread_set_key_value() now always set the value. In Python - 3.3, the function did nothing if the key already exists (if the current value - is a non-NULL pointer). - -- Issue #14432: Remove the thread state field from the frame structure. Fix a - crash when a generator is created in a C thread that is destroyed while the - generator is still used. The issue was that a generator contains a frame, and - the frame kept a reference to the Python state of the destroyed C thread. The - crash occurs when a trace function is setup. - -- Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python - has no concrete GIL. If PyGILState_Ensure() is called from a new thread for - the first time and PyEval_InitThreads() was not called yet, a GIL needs to be - created. - -- Issue #17576: Deprecation warning emitted now when __int__() or __index__() - return not int instance. - -- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes. - -- Issue #19736: Add module-level statvfs constants defined for GNU/glibc - based systems. - -- Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder. - -- Issue #19729: In str.format(), fix recursive expansion in format spec. - -- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2 - billion characters) input strings in _Py_dg_strtod. - -Library -------- - -- Issue #20154: Deadlock in asyncio.StreamReader.readexactly(). - -- Issue #16113: Remove sha3 module again. - -- Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix. - -- Fix breakage in TestSuite.countTestCases() introduced by issue #11798. - -- Issue #20108: Avoid parameter name clash in inspect.getcallargs(). - -- Issue #19918: Fix PurePath.relative_to() under Windows. - -- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl - module, rather than silently let them emit clear text data. - -- Issue #20046: Locale alias table no longer contains entities which can be - calculated. Generalized support of the euro modifier. - -- Issue #20027: Fixed locale aliases for devanagari locales. - -- Issue #20067: Tkinter variables now work when wantobjects is false. - -- Issue #19020: Tkinter now uses splitlist() instead of split() in configure - methods. - -- Issue #19744: ensurepip now provides a better error message when Python is - built without SSL/TLS support (pip currently requires that support to run, - even if only operating with local wheel files) - -- Issue #19734: ensurepip now ignores all pip environment variables to avoid - odd behaviour based on user configuration settings - -- Fix TypeError on "setup.py upload --show-response". - -- Issue #20045: Fix "setup.py register --list-classifiers". - -- Issue #18879: When a method is looked up on a temporary file, avoid closing - the file before the method is possibly called. - -- Issue #20037: Avoid crashes when opening a text file late at interpreter - shutdown. - -- Issue #19967: Thanks to the PEP 442, asyncio.Future now uses a - destructor to log uncaught exceptions, instead of the dedicated - _TracebackLogger class. - -- Added a Task.current_task() class method to asyncio. - -- Issue #19850: Set SA_RESTART in asyncio when registering a signal - handler to limit EINTR occurrences. - -- Implemented write flow control in asyncio for proactor event loop (Windows). - -- Change write buffer in asyncio use to avoid O(N**2) behavior. Make - write()/sendto() accept bytearray/memoryview. - -- Issue #20034: Updated alias mapping to most recent locale.alias file - from X.org distribution using makelocalealias.py. - -- Issue #5815: Fixed support for locales with modifiers. Fixed support for - locale encodings with hyphens. - -- Issue #20026: Fix the sqlite module to handle correctly invalid isolation - level (wrong type). - -- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and - quotechar fields. Original patch by Vajrasky Kok. - -- Issue #19855: uuid.getnode() on Unix now looks on the PATH for the - executables used to find the mac address, with /sbin and /usr/sbin as - fallbacks. - -- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection. - Original patch by Simon Sapin. - -- Issue #19946: multiprocessing now uses runpy to initialize __main__ in - child processes when necessary, allowing it to correctly handle scripts - without suffixes and submodules that use explicit relative imports or - otherwise rely on parent modules being correctly imported prior to - execution. - -- Issue #19921: When Path.mkdir() is called with parents=True, any missing - parent is created with the default permissions, ignoring the mode argument - (mimicking the POSIX "mkdir -p" command). - -- Issue #19887: Improve the Path.resolve() algorithm to support certain - symlink chains. - -- Issue #19912: Fixed numerous bugs in ntpath.splitunc(). - -- Issue #19911: ntpath.splitdrive() now correctly processes the '?' character - (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE). - -- Issue #19532: python -m compileall with no filename/directory arguments now - respects the -f and -q flags instead of ignoring them. - -- Issue #19623: Fixed writing to unseekable files in the aifc module. - -- Issue #19946: multiprocessing.spawn now raises ImportError when the module to - be used as the main module cannot be imported. - -- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX. - Fixed integer overflow in the eventmask parameter. - -- Issue #19063: if a Charset's body_encoding was set to None, the email - package would generate a message claiming the Content-Transfer-Encoding - was 7bit, and produce garbage output for the content. This now works. - A couple of other set_payload mishandlings of non-ASCII are also fixed. - In addition, calling set_payload with a string argument without - specifying a charset now raises an error (this is a new error in 3.4). - -- Issue #15475: Add __sizeof__ implementations for itertools objects. - -- Issue #19944: Fix importlib.find_spec() so it imports parents as needed - and move the function to importlib.util. - -- Issue #19880: Fix a reference leak in unittest.TestCase. Explicitly break - reference cycles between frames and the _Outcome instance. - -- Issue #17429: platform.linux_distribution() now decodes files from the UTF-8 - encoding with the surrogateescape error handler, instead of decoding from the - locale encoding in strict mode. It fixes the function on Fedora 19 which is - probably the first major distribution release with a non-ASCII name. Patch - written by Toshio Kuratomi. - -- Issue #19343: Expose FreeBSD-specific APIs in resource module. Original - patch by Koobs. - -- Issue #19929: Call os.read with 32768 within subprocess.Popen.communicate - rather than 4096 for efficiency. A microbenchmark shows Linux and OS X - both using ~50% less cpu time this way. - -- Issue #19506: Use a memoryview to avoid a data copy when piping data - to stdin within subprocess.Popen.communicate. 5-10% less cpu usage. - -- Issue #19876: selectors unregister() no longer raises ValueError or OSError - if the FD is closed (as long as it was registered). - -- Issue #19908: pathlib now joins relative Windows paths correctly when a drive - is present. Original patch by Antoine Pitrou. - -- Issue #19296: Silence compiler warning in dbm_open - -- Issue #6784: Strings from Python 2 can now be unpickled as bytes - objects by setting the encoding argument of Unpickler to be 'bytes'. - Initial patch by Merlijn van Deen. - -- Issue #19839: Fix regression in bz2 module's handling of non-bzip2 data at - EOF, and analogous bug in lzma module. - -- Issue #19881: Fix pickling bug where cpickle would emit bad pickle data for - large bytes string (i.e., with size greater than 2**32-1). - -- Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when - no exception detail exists (no colon following the exception's name, or - a colon does follow but no text follows the colon). - -- Issue #19927: Add __eq__ to path-based loaders in importlib. - -- Issue #19827: On UNIX, setblocking() and settimeout() methods of - socket.socket can now avoid a second syscall if the ioctl() function can be - used, or if the non-blocking flag of the socket is unchanged. - -- Issue #19785: smtplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19784: poplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19783: nntplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19782: imaplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #20123: Fix pydoc.synopsis() for "binary" modules. - -- Issue #19834: Support unpickling of exceptions pickled by Python 2. - -- Issue #19781: ftplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19509: Add SSLContext.check_hostname to match the peer's certificate - with server_hostname on handshake. - -- Issue #15798: Fixed subprocess.Popen() to no longer fail if file - descriptor 0, 1 or 2 is closed. - -- Issue #17897: Optimized unpickle prefetching. - -- Issue #3693: Make the error message more helpful when the array.array() - constructor is given a str. Move the array module typecode documentation to - the docstring of the constructor. - -- Issue #19088: Fixed incorrect caching of the copyreg module in - object.__reduce__() and object.__reduce_ex__(). - -- Issue #19698: Removed exec_module() methods from - importlib.machinery.BuiltinImporter and ExtensionFileLoader. - -- Issue #18864: Added a setter for ModuleSpec.has_location. - -- Fixed _pickle.Unpickler to not fail when loading empty strings as - persistent IDs. - -- Issue #11480: Fixed copy.copy to work with classes with custom metaclasses. - Patch by Daniel Urban. - -- Issue #6477: Added support for pickling the types of built-in singletons - (i.e., Ellipsis, NotImplemented, None). - -- Issue #19713: Add remaining PEP 451-related deprecations and move away - from using find_module/find_loaer/load_module. - -- Issue #19708: Update pkgutil to use the new importer APIs. - -- Issue #19703: Update pydoc to use the new importer APIs. - -- Issue #19851: Fixed a regression in reloading sub-modules. - -- ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME. - -- Issue #19802: Add socket.SO_PRIORITY. - -- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with - virtual interface. Original patch by Kent Frazier. - -- Issue #11489: JSON decoder now accepts lone surrogates. - -- Issue #19545: Avoid chained exceptions while passing stray % to - time.strptime(). Initial patch by Claudiu Popa. - -IDLE ----- - -- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. - -- Issue #19481: print() of string subclass instance in IDLE no longer hangs. - -- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial - shell window is present. - -Tests ------ - -- Issue #20055: Fix test_shutil under Windows with symlink privileges held. - Patch by Vajrasky Kok. - -- Issue #20070: Don't run test_urllib2net when network resources are not - enabled. - -- Issue #19938: Re-enabled test_bug_1333982 in test_dis, which had been - disabled since 3.0 due to the changes in listcomp handling. - -- Issue #19320: test_tcl no longer fails when wantobjects is false. - -- Issue #19919: Fix flaky SSL test. connect_ex() sometimes returns - EWOULDBLOCK on Windows or VMs hosted on Windows. - -- Issue #19912: Added tests for ntpath.splitunc(). - -- Issue #19828: Fixed test_site when the whole suite is run with -S. - -- Issue #19928: Implemented a test for repr() of cell objects. - -- Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and - test_statistics when python is run with -OO. - -- Issue #19926: Removed unneeded test_main from test_abstract_numbers. - Patch by Vajrasky Kok. - -- Issue #19572: More skipped tests explicitly marked as skipped. - -- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound. - -- Issue #19588: Fixed tests in test_random that were silently skipped most - of the time. Patch by Julian Gindi. - -Build ------ - -- Issue #19728: Enable pip installation by default on Windows. - -- Issue #16136: Remove VMS support - -- Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and - run Python's unit tests with multiple versions of OpenSSL. - -- Issue #19922: define _INCLUDE__STDC_A1_SOURCE in HP-UX to include mbstate_t - for mbrtowc(). - -- Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the - pythoncore sub-project. This should prevent build errors due a previous - build's python(_d).exe still running. - -Documentation -------------- - -- Issue #20265: Updated some parts of the Using Windows document. - -- Issue #20266: Updated some parts of the Windows FAQ. - -- Issue #20255: Updated the about and bugs pages. - -- Issue #20253: Fixed a typo in the ipaddress docs that advertised an - illegal attribute name. Found by INADA Naoki. - -- Issue #18840: Introduce the json module in the tutorial, and de-emphasize - the pickle module. - -- Issue #19845: Updated the Compiling Python on Windows section. - -- Issue #19795: Improved markup of True/False constants. - -Tools/Demos ------------ - -- Issue #19659: Added documentation for Argument Clinic. - -- Issue #19976: Argument Clinic METH_NOARGS functions now always - take two parameters. - - -What's New in Python 3.4.0 Beta 1? -================================== - -Release date: 2013-11-24 - -Core and Builtins ------------------ - -- Use the repr of a module name in more places in import, especially - exceptions. - -- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an - internal API to throw LookupError for known non-text encodings, rather - than attempting the encoding or decoding operation and then throwing a - TypeError for an unexpected output type. (The latter mechanism remains - in place for third party non-text encodings) - -- Issue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'. - Python now uses SipHash24 on all major platforms. - -- Issue #12892: The utf-16* and utf-32* encoders no longer allow surrogate code - points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer decode - byte sequences that correspond to surrogate code points. The surrogatepass - error handler now works with the utf-16* and utf-32* codecs. Based on - patches by Victor Stinner and Kang-Hao (Kenny) Lu. - -- Issue #17806: Added keyword-argument support for "tabsize" to - str/bytes.expandtabs(). - -- Issue #17828: Output type errors in str.encode(), bytes.decode() and - bytearray.decode() now direct users to codecs.encode() or codecs.decode() - as appropriate. - -- Issue #17828: The interpreter now attempts to chain errors that occur in - codec processing with a replacement exception of the same type that - includes the codec name in the error message. It ensures it only does this - when the creation of the replacement exception won't lose any information. - -- Issue #19466: Clear the frames of daemon threads earlier during the - Python shutdown to call object destructors. So "unclosed file" resource - warnings are now correctly emitted for daemon threads. - -- Issue #19514: Deduplicate some _Py_IDENTIFIER declarations. - Patch by Andrei Dorian Duma. - -- Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses - of a given type. - -- Issue #19428: zipimport now handles errors when reading truncated or invalid - ZIP archive. - -- Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle - exceptions when merging fast locals into f_locals of a frame. - PyEval_GetLocals() now raises an exception and return NULL on failure. - -- Issue #19369: Optimized the usage of __length_hint__(). - -- Issue #28026: Raise ImportError when exec_module() exists but - create_module() is missing. - -- Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the - Python executable and not removed by the linker's optimizer. - -- Issue #19306: Add extra hints to the faulthandler module's stack - dumps that these are "upside down". - -Library -------- - -- Issue #3158: doctest can now find doctests in functions and methods - written in C. - -- Issue #13477: Added command line interface to the tarfile module. - Original patch by Berker Peksag. - -- Issue #19674: inspect.signature() now produces a correct signature - for some builtins. - -- Issue #19722: Added opcode.stack_effect(), which - computes the stack effect of bytecode instructions. - -- Issue #19735: Implement private function ssl._create_stdlib_context() to - create SSLContext objects in Python's stdlib module. It provides a single - configuration point and makes use of SSLContext.load_default_certs(). - -- Issue #16203: Add re.fullmatch() function and regex.fullmatch() method, - which anchor the pattern at both ends of the string to match. - Original patch by Matthew Barnett. - -- Issue #13592: Improved the repr for regular expression pattern objects. - Based on patch by Hugo Lopes Tavares. - -- Issue #19641: Added the audioop.byteswap() function to convert big-endian - samples to little-endian and vice versa. - -- Issue #15204: Deprecated the 'U' mode in file-like objects. - -- Issue #17810: Implement PEP 3154, pickle protocol 4. - -- Issue #19668: Added support for the cp1125 encoding. - -- Issue #19689: Add ssl.create_default_context() factory function. It creates - a new SSLContext object with secure default settings. - -- Issue #19727: os.utime(..., None) is now potentially more precise - under Windows. - -- Issue #17201: ZIP64 extensions now are enabled by default. Patch by - William Mallard. - -- Issue #19292: Add SSLContext.load_default_certs() to load default root CA - certificates from default stores or system stores. By default the method - loads CA certs for authentication of server certs. - -- Issue #19673: Add pathlib to the stdlib as a provisional module (PEP 428). - -- Issue #16596: pdb in a generator now properly skips over yield and - yield from rather than stepping out of the generator into its - caller. (This is essential for stepping through asyncio coroutines.) - -- Issue #17916: Added dis.Bytecode.from_traceback() and - dis.Bytecode.current_offset to easily display "current instruction" - markers in the new disassembly API (Patch by Claudiu Popa). - -- Issue #19552: venv now supports bootstrapping pip into virtual environments - -- Issue #17134: Finalize interface to Windows' certificate store. Cert and - CRL enumeration are now two functions. enum_certificates() also returns - purpose flags as set of OIDs. - -- Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils - equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX. - -- Issue #8813: Add SSLContext.verify_flags to change the verification flags - of the context in order to enable certification revocation list (CRL) - checks or strict X509 rules. - -- Issue #18294: Fix the zlib module to make it 64-bit safe. - -- Issue #19682: Fix compatibility issue with old version of OpenSSL that - was introduced by Issue #18379. - -- Issue #14455: plistlib now supports binary plists and has an updated API. - -- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on - big-endian platforms. - -- Issue #18379: SSLSocket.getpeercert() returns CA issuer AIA fields, OCSP - and CRL distribution points. - -- Issue #18138: Implement cadata argument of SSLContext.load_verify_location() - to load CA certificates and CRL from memory. It supports PEM and DER - encoded strings. - -- Issue #18775: Add name and block_size attribute to HMAC object. They now - provide the same API elements as non-keyed cryptographic hash functions. - -- Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC - module supports digestmod names, e.g. hmac.HMAC('sha1'). - -- Issue #19449: in csv's writerow, handle non-string keys when generating the - error message that certain keys are not in the 'fieldnames' list. - -- Issue #13633: Added a new convert_charrefs keyword arg to HTMLParser that, - when True, automatically converts all character references. - -- Issue #2927: Added the unescape() function to the html module. - -- Issue #8402: Added the escape() function to the glob module. - -- Issue #17618: Add Base85 and Ascii85 encoding/decoding to the base64 module. - -- Issue #19634: time.strftime("%y") now raises a ValueError on AIX when given a - year before 1900. - -- Fix test.support.bind_port() to not cause an error when Python was compiled - on a system with SO_REUSEPORT defined in the headers but run on a system - with an OS kernel that does not support that reasonably new socket option. - -- Fix compilation error under gcc of the ctypes module bundled libffi for arm. - -- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID, - NID, short name and long name. - -- Issue #19282: dbm.open now supports the context management protocol. - (Initial patch by Claudiu Popa) - -- Issue #8311: Added support for writing any bytes-like objects in the aifc, - sunau, and wave modules. - -- Issue #5202: Added support for unseekable files in the wave module. - -- Issue #19544 and Issue #1180: Restore global option to ignore - ~/.pydistutils.cfg in Distutils, accidentally removed in backout of - distutils2 changes. - -- Issue #19523: Closed FileHandler leak which occurred when delay was set. - -- Issue #19544 and Issue #6516: Restore support for --user and --group - parameters to sdist command accidentally rolled back as part of the - distutils2 rollback. - -- Issue #13674: Prevented time.strftime from crashing on Windows when given - a year before 1900 and a format of %y. - -- Issue #19406: implementation of the ensurepip module (part of PEP 453). - Patch by Donald Stufft and Nick Coghlan. - -- Issue #19544 and Issue #6286: Restore use of urllib over http allowing use - of http_proxy for Distutils upload command, a feature accidentally lost - in the rollback of distutils2. - -- Issue #19544 and Issue #7457: Restore the read_pkg_file method to - distutils.dist.DistributionMetadata accidentally removed in the undo of - distutils2. - -- Issue #16685: Added support for any bytes-like objects in the audioop module. - Removed support for strings. - -- Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` - to socket module. Patch by Atsuo Ishimoto. - -- Issue #19261: Added support for writing 24-bit samples in the sunau module. - -- Issue #1097797: Added CP273 encoding, used on IBM mainframes in - Germany and Austria. Mapping provided by Michael Bierenfeld. - -- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms. - -- Issue #19378: Fixed a number of cases in the dis module where the new - "file" parameter was not being honoured correctly - -- Issue #19378: Removed the "dis.Bytecode.show_info" method - -- Issue #19378: Renamed the "dis.Bytecode.display_code" method to - "dis.Bytecode.dis" and converted it to returning a string rather than - printing output. - -- Issue #19378: the "line_offset" parameter in the new "dis.get_instructions" - API has been renamed to "first_line" (and the default value and usage - changed accordingly). This should reduce confusion with the more common use - of "offset" in the dis docs to refer to bytecode offsets. - -- Issue #18678: Corrected spwd struct member names in spwd module: - sp_nam->sp_namp, and sp_pwd->sp_pwdp. The old names are kept as extra - structseq members, for backward compatibility. - -- Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises - TypeError instead of TclError on wrong number of arguments. Original patch - by Guilherme Polo. - -- Issue #10197: Rework subprocess.get[status]output to use subprocess - functionality and thus to work on Windows. Patch by Nick Coghlan - -- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of - integers instead of a string. Based on patch by Guilherme Polo. - -- Issue #19403: contextlib.redirect_stdout is now reentrant - -- Issue #19286: Directories in ``package_data`` are no longer added to - the filelist, preventing failure outlined in the ticket. - -- Issue #19480: HTMLParser now accepts all valid start-tag names as defined - by the HTML5 standard. - -- Issue #15114: The html.parser module now raises a DeprecationWarning when the - strict argument of HTMLParser or the HTMLParser.error method are used. - -- Issue #19410: Undo the special-casing removal of '' for - importlib.machinery.FileFinder. - -- Issue #19424: Fix the warnings module to accept filename containing surrogate - characters. - -- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. - -- Issue #19227: Remove pthread_atfork() handler. The handler was added to - solve #18747 but has caused issues. - -- Issue #19420: Fix reference leak in module initialization code of - _hashopenssl.c - -- Issue #19329: Optimized compiling charsets in regular expressions. - -- Issue #19227: Try to fix deadlocks caused by re-seeding then OpenSSL - pseudo-random number generator on fork(). - -- Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more than - 100 headers are read. Adapted from patch by Jyrki Pulliainen. - -- Issue #16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to - prevent readline() calls from consuming too much memory. Patch by Jyrki - Pulliainen. - -- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to - prevent readline() calls from consuming too much memory. Patch by Jyrki - Pulliainen. - -- Issue #17997: Change behavior of ``ssl.match_hostname()`` to follow RFC 6125, - for security reasons. It now doesn't match multiple wildcards nor wildcards - inside IDN fragments. - -- Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit - line length. Patch by Emil Lind. - -- Issue #19330: the unnecessary wrapper functions have been removed from the - implementations of the new contextlib.redirect_stdout and - contextlib.suppress context managers, which also ensures they provide - reasonable help() output on instances - -- Issue #19393: Fix symtable.symtable function to not be confused when there are - functions or classes named "top". - -- Issue #18685: Restore re performance to pre-PEP 393 levels. - -- Issue #19339: telnetlib module is now using time.monotonic() when available - to compute timeout. - -- Issue #19399: fix sporadic test_subprocess failure. - -- Issue #13234: Fix os.listdir to work with extended paths on Windows. - Patch by Santoso Wijaya. - -- Issue #19375: The site module adding a "site-python" directory to sys.path, - if it exists, is now deprecated. - -- Issue #19379: Lazily import linecache in the warnings module, to make - startup with warnings faster until a warning gets printed. - -- Issue #19288: Fixed the "in" operator of dbm.gnu databases for string - argument. Original patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string - argument. Original patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #19327: Fixed the working of regular expressions with too big charset. - -- Issue #17400: New 'is_global' attribute for ipaddress to tell if an address - is allocated by IANA for global or private networks. - -- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin - Williams. - -- Issue #19365: Optimized the parsing of long replacement string in re.sub*() - functions. - -- Issue #19352: Fix unittest discovery when a module can be reached - through several paths (e.g. under Debian/Ubuntu with virtualenv). - -- Issue #15207: Fix mimetypes to read from correct part of Windows registry - Original patch by Dave Chambers - -- Issue #16595: Add prlimit() to resource module. - -- Issue #19324: Expose Linux-specific constants in resource module. - -- Load SSL's error strings in hashlib. - -- Issue #18527: Upgrade internal copy of zlib to 1.2.8. - -- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy. - -- Issue #8964: fix platform._sys_version to handle IronPython 2.6+. - Patch by Martin Matusiak. - -- Issue #19413: Restore pre-3.3 reload() semantics of re-finding modules. - -- Issue #18958: Improve error message for json.load(s) while passing a string - that starts with a UTF-8 BOM. - -- Issue #19307: Improve error message for json.load(s) while passing objects - of the wrong type. - -- Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by - limiting the call to readline(). Original patch by Micha? - Jastrz?bski and Giampaolo Rodola. - -- Issue #17087: Improved the repr for regular expression match objects. - -Tests ------ - -- Issue #19664: test_userdict's repr test no longer depends on the order - of dict elements. - -- Issue #19440: Clean up test_capi by removing an unnecessary __future__ - import, converting from test_main to unittest.main, and running the - _testcapi module tests as subTests of a unittest TestCase method. - -- Issue #19378: the main dis module tests are now run with both stdout - redirection *and* passing an explicit file parameter - -- Issue #19378: removed the not-actually-helpful assertInstructionMatches - and assertBytecodeExactlyMatches helpers from bytecode_helper - -- Issue #18702: All skipped tests now reported as skipped. - -- Issue #19439: interpreter embedding tests are now executed on Windows - (Patch by Zachary Ware) - -- Issue #19085: Added basic tests for all tkinter widget options. - -- Issue #19384: Fix test_py_compile for root user, patch by Claudiu Popa. - -Documentation -------------- - -- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also, - attempt to reduce confusion in the glossary by not saying there are - different "types" of arguments and parameters. - -Build ------ - -- Issue #19358: "make clinic" now runs the Argument Clinic preprocessor - over all CPython source files. - -- Update SQLite to 3.8.1, xz to 5.0.5, and Tcl/Tk to 8.6.1 on Windows. - -- Issue #16632: Enable DEP and ASLR on Windows. - -- Issue #17791: Drop PREFIX and EXEC_PREFIX definitions from PC/pyconfig.h - -- Add workaround for VS 2010 nmake clean issue. VS 2010 doesn't set up PATH - for nmake.exe correctly. - -- Issue #19550: Implement Windows installer changes of PEP 453 (ensurepip). - -- Issue #19520: Fix compiler warning in the _sha3 module on 32bit Windows. - -- Issue #19356: Avoid using a C variabled named "_self", it's a reserved - word in some C compilers. - -- Issue #15792: Correct build options on Win64. Patch by Jeremy Kloth. - -- Issue #19373: Apply upstream change to Tk 8.5.15 fixing OS X 10.9 - screen refresh problem for OS X installer build. - -- Issue #19649: On OS X, the same set of file names are now installed - in bin directories for all configurations: non-framework vs framework, - and single arch vs universal builds. pythonx.y-32 is now always - installed for 64-bit/32-bit universal builds. The obsolete and - undocumented pythonw* symlinks are no longer installed anywhere. - -- Issue #19553: PEP 453 - "make install" and "make altinstall" now install or - upgrade pip by default, using the bundled pip provided by the new ensurepip - module. A new configure option, --with-ensurepip[=upgrade|install|no], is - available to override the default ensurepip "--upgrade" option. The option - can also be set with "make [alt]install ENSUREPIP=[upgrade|install|no]". - -- Issue #19551: PEP 453 - the OS X installer now installs pip by default. - -- Update third-party libraries for OS X installers: xz 5.0.3 -> 5.0.5, - SQLite 3.7.13 -> 3.8.1 - -- Issue #15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1. - Some third-party projects, such as Matplotlib and PIL/Pillow, - depended on being able to build with Tcl and Tk frameworks in - /Library/Frameworks. - -Tools/Demos ------------ - -- Issue #19730: Argument Clinic now supports all the existing PyArg - "format units" as legacy converters, as well as two new features: - "self converters" and the "version" directive. - -- Issue #19552: pyvenv now bootstraps pip into virtual environments by - default (pass --without-pip to request the old behaviour) - -- Issue #19390: Argument Clinic no longer accepts malformed Python - and C ids. - - -What's New in Python 3.4.0 Alpha 4? -=================================== - -Release date: 2013-10-20 - -Core and Builtins ------------------ - -- Issue #19301: Give classes and functions that are explicitly marked global a - global qualname. - -- Issue #19279: UTF-7 decoder no longer produces illegal strings. - -- Issue #16612: Add "Argument Clinic", a compile-time preprocessor for - C files to generate argument parsing code. (See PEP 436.) - -- Issue #18810: Shift stat calls in importlib.machinery.FileFinder such that - the code is optimistic that if something exists in a directory named exactly - like the possible package being searched for that it's in actuality a - directory. - -- Issue #18416: importlib.machinery.PathFinder now treats '' as the cwd and - importlib.machinery.FileFinder no longer special-cases '' to '.'. This leads - to modules imported from cwd to now possess an absolute file path for - __file__ (this does not affect modules specified by path on the CLI but it - does affect -m/runpy). It also allows FileFinder to be more consistent by not - having an edge case. - -- Issue #4555: All exported C symbols are now prefixed with either - "Py" or "_Py". - -- Issue #19219: Speed up marshal.loads(), and make pyc files slightly - (5% to 10%) smaller. - -- Issue #19221: Upgrade Unicode database to version 6.3.0. - -- Issue #16742: The result of the C callback PyOS_ReadlineFunctionPointer must - now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL - if an error occurred), instead of a string allocated by PyMem_Malloc() or - PyMem_Realloc(). - -- Issue #19199: Remove ``PyThreadState.tick_counter`` field - -- Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at - least one place so as to avoid regressions. - -- Issue #19087: Improve bytearray allocation in order to allow cheap popping - of data at the front (slice deletion). - -- Issue #19014: memoryview.cast() is now allowed on zero-length views. - -- Issue #18690: memoryview is now automatically registered with - collections.abc.Sequence - -- Issue #19078: memoryview now correctly supports the reversed builtin - (Patch by Claudiu Popa) - -Library -------- - -- Issue #17457: unittest test discovery now works with namespace packages. - Patch by Claudiu Popa. - -- Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX. - Patch by David Edelsohn. - -- Issue #18606: Add the new "statistics" module (PEP 450). Contributed - by Steven D'Aprano. - -- Issue #12866: The audioop module now supports 24-bit samples. - -- Issue #19254: Provide an optimized Python implementation of pbkdf2_hmac. - -- Issues #19201, Issue #19222, Issue #19223: Add "x" mode (exclusive creation) - in opening file to bz2, gzip and lzma modules. Patches by Tim Heaney and - Vajrasky Kok. - -- Fix a reference count leak in _sre. - -- Issue #19262: Initial check in of the 'asyncio' package (a.k.a. Tulip, - a.k.a. PEP 3156). There are no docs yet, and the PEP is slightly - out of date with the code. This module will have *provisional* status - in Python 3.4. - -- Issue #19276: Fixed the wave module on 64-bit big-endian platforms. - -- Issue #19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager - to ``contextlib.suppress`` in order to be more consistent with existing - descriptions of that operation elsewhere in the language and standard - library documentation (Patch by Zero Piraeus). - -- Issue #18891: Completed the new email package (provisional) API additions - by adding new classes EmailMessage, MIMEPart, and ContentManager. - -- Issue #18281: Unused stat constants removed from `tarfile`. - -- Issue #18999: Multiprocessing now supports 'contexts' with the same API - as the module, but bound to specified start methods. - -- Issue #18468: The re.split, re.findall, and re.sub functions and the group() - and groups() methods of match object now always return a string or a bytes - object. - -- Issue #18725: The textwrap module now supports truncating multiline text. - -- Issue #18776: atexit callbacks now display their full traceback when they - raise an exception. - -- Issue #17827: Add the missing documentation for ``codecs.encode`` and - ``codecs.decode``. - -- Issue #19218: Rename collections.abc to _collections_abc in order to - speed up interpreter start. - -- Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5 - password-based key derivation functions with HMAC as pseudorandom function. - -- Issue #19131: The aifc module now correctly reads and writes sampwidth of - compressed streams. - -- Issue #19209: Remove import of copyreg from the os module to speed up - interpreter startup. stat_result and statvfs_result are now hard-coded to - reside in the os module. - -- Issue #19205: Don't import the 're' module in site and sysconfig module to - speed up interpreter start. - -- Issue #9548: Add a minimal "_bootlocale" module that is imported by the - _io module instead of the full locale module. - -- Issue #18764: Remove the 'print' alias for the PDB 'p' command so that it no - longer shadows the print function. - -- Issue #19158: A rare race in BoundedSemaphore could allow .release() too - often. - -- Issue #15805: Add contextlib.redirect_stdout(). - -- Issue #18716: Deprecate the formatter module. - -- Issue #10712: 2to3 has a new "asserts" fixer that replaces deprecated names - of unittest methods (e.g. failUnlessEqual -> assertEqual). - -- Issue #18037: 2to3 now escapes ``'\u'`` and ``'\U'`` in native strings. - -- Issue #17839: base64.decodebytes and base64.encodebytes now accept any - object that exports a 1 dimensional array of bytes (this means the same - is now also true for base64_codec) - -- Issue #19132: The pprint module now supports compact mode. - -- Issue #19137: The pprint module now correctly formats instances of set and - frozenset subclasses. - -- Issue #10042: functools.total_ordering now correctly handles - NotImplemented being returned by the underlying comparison function (Patch - by Katie Miller) - -- Issue #19092: contextlib.ExitStack now correctly reraises exceptions - from the __exit__ callbacks of inner context managers (Patch by Hrvoje - Nik?i?) - -- Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except - when necessary. Patch by Oscar Benjamin. - -- Issue #5845: In site.py, only load readline history from ~/.python_history - if no history has been read already. This avoids double writes to the - history file at shutdown. - -- Properly initialize all fields of a SSL object after allocation. - -- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the - SSL handshake hasn't been done. - -- Issue #4366: Fix building extensions on all platforms when --enable-shared - is used. - -- Issue #19030: Fixed `inspect.getmembers` and `inspect.classify_class_attrs` - to attempt activating descriptors before falling back to a __dict__ search - for faulty descriptors. `inspect.classify_class_attrs` no longer returns - Attributes whose home class is None. - -C API ------ - -- Issue #1772673: The type of `char*` arguments now changed to `const char*`. - -- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API - to allow embedding applications like Blender to force a particular - encoding and error handler for the standard IO streams (initial patch by - Bastien Montagne) - -Tests ------ - -- Issue #19275: Fix test_site on AMD64 Snow Leopard - -- Issue #14407: Fix unittest test discovery in test_concurrent_futures. - -- Issue #18919: Unified and extended tests for audio modules: aifc, sunau and - wave. - -- Issue #18714: Added tests for ``pdb.find_function()``. - -Documentation -------------- - -- Issue #18758: Fixed and improved cross-references. - -- Issue #18972: Modernize email examples and use the argparse module in them. - -Build ------ - -- Issue #19130: Correct PCbuild/readme.txt, Python 3.3 and 3.4 require VS 2010. - -- Issue #15663: Update OS X 10.6+ installer to use Tcl/Tk 8.5.15. - -- Issue #14499: Fix several problems with OS X universal build support: - 1. ppc arch detection for extension module builds broke with Xcode 5 - 2. ppc arch detection in configure did not work on OS X 10.4 - 3. -sysroot and -arch flags were unnecessarily duplicated - 4. there was no obvious way to configure an intel-32 only build. - -- Issue #19019: Change the OS X installer build script to use CFLAGS instead - of OPT for special build options. By setting OPT, some compiler-specific - options like -fwrapv were overridden and thus not used, which could result - in broken interpreters when building with clang. - - -What's New in Python 3.4.0 Alpha 3? -=================================== - -Release date: 2013-09-29 - -Core and Builtins ------------------ - -- Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional. - -- Issue #19098: Prevent overflow in the compiler when the recursion limit is set - absurdly high. - -Library -------- - -- Issue #18929: `inspect.classify_class_attrs()` now correctly finds class - attributes returned by `dir()` that are located in the metaclass. - -- Issue #18950: Fix miscellaneous bugs in the sunau module. - Au_read.readframes() now updates current file position and reads correct - number of frames from multichannel stream. Au_write.writeframesraw() now - correctly updates current file position. Au_read.getnframes() now returns an - integer (as in Python 2). Au_read and Au_write now correctly works with file - object if start file position is not a zero. - -- Issue #18594: The fast path for collections.Counter() was never taken - due to an over-restrictive type check. - -- Issue #19053: ZipExtFile.read1() with non-zero argument no more returns empty - bytes until end of data. - -- logging: added support for Unix domain sockets to SocketHandler and - DatagramHandler. - -- Issue #18996: TestCase.assertEqual() now more cleverly shorten differing - strings in error report. - -- Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. - -- Issue #18978: ``urllib.request.Request`` now allows the method to be - indicated on the class and no longer sets it to None in ``__init__``. - -- Issue #18626: the inspect module now offers a basic command line - introspection interface (Initial patch by Claudiu Popa) - -- Issue #3015: Fixed tkinter with wantobject=False. Any Tcl command call - returned empty string. - -- Issue #19037: The mailbox module now makes all changes to maildir files - before moving them into place, to avoid race conditions with other programs - that may be accessing the maildir directory. - -- Issue #14984: On POSIX systems, when netrc is called without a filename - argument (and therefore is reading the user's $HOME/.netrc file), it now - enforces the same security rules as typical ftp clients: the .netrc file must - be owned by the user that owns the process and must not be readable by any - other user. - -- Issue #18873: The tokenize module now detects Python source code encoding - only in comment lines. - -- Issue #17764: Enable http.server to bind to a user specified network - interface. Patch contributed by Malte Swart. - -- Issue #18937: Add an assertLogs() context manager to unittest.TestCase - to ensure that a block of code emits a message using the logging module. - -- Issue #17324: Fix http.server's request handling case on trailing '/'. Patch - contributed by Vajrasky Kok. - -- Issue #19018: The heapq.merge() function no longer suppresses IndexError - in the underlying iterables. - -- Issue #18784: The uuid module no longer attempts to load libc via ctypes.CDLL - if all the necessary functions have already been found in libuuid. Patch by - Evgeny Sologubov. - -- The :envvar:`PYTHONFAULTHANDLER` environment variable now only enables the - faulthandler module if the variable is non-empty. Same behaviour than other - variables like :envvar:`PYTHONDONTWRITEBYTECODE`. - -- Issue #1565525: New function ``traceback.clear_frames`` will clear - the local variables of all the stack frames referenced by a traceback - object. - -Tests ------ - -- Issue #18952: Fix regression in support data downloads introduced when - test.support was converted to a package. Regression noticed by Zachary - Ware. - -IDLE ----- - -- Issue #18873: IDLE now detects Python source code encoding only in comment - lines. - -- Issue #18988: The "Tab" key now works when a word is already autocompleted. - -Documentation -------------- - -- Issue #17003: Unified the size argument names in the io module with common - practice. - -Build ------ - -- Issue #18596: Support the use of address sanity checking in recent versions - of clang and GCC by appropriately marking known false alarms in the small - object allocator. Patch contributed by Dhiru Kholia. - -Tools/Demos ------------ - -- Issue #18873: 2to3 and the findnocoding.py script now detect Python source - code encoding only in comment lines. - - -What's New in Python 3.4.0 Alpha 2? -=================================== - -Release date: 2013-09-09 - -Core and Builtins ------------------ - -- Issue #18942: sys._debugmallocstats() output was damaged on Windows. - -- Issue #18571: Implementation of the PEP 446: file descriptors and file - handles are now created non-inheritable; add functions - os.get/set_inheritable(), os.get/set_handle_inheritable() and - socket.socket.get/set_inheritable(). - -- Issue #11619: The parser and the import machinery do not encode Unicode - filenames anymore on Windows. - -- Issue #18808: Non-daemon threads are now automatically joined when - a sub-interpreter is shutdown (it would previously dump a fatal error). - -- Remove support for compiling on systems without getcwd(). - -- Issue #18774: Remove last bits of GNU PTH thread code and thread_pth.h. - -- Issue #18771: Add optimization to set object lookups to reduce the cost - of hash collisions. The core idea is to inspect a second key/hash pair - for each cache line retrieved. - -- Issue #16105: When a signal handler fails to write to the file descriptor - registered with ``signal.set_wakeup_fd()``, report an exception instead - of ignoring the error. - -- Issue #18722: Remove uses of the "register" keyword in C code. - -- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. - -- Issue #16499: Add command line option for isolated mode. - -- Issue #15301: Parsing fd, uid, and gid parameters for builtins - in Modules/posixmodule.c is now far more robust. - -- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() - fail. - -- Issue #17934: Add a clear() method to frame objects, to help clean up - expensive details (local variables) and break reference cycles. - -- Issue #18780: %-formatting codes %d, %i, and %u now treat int-subclasses - as int (displays value of int-subclass instead of str(int-subclass) ). - -Library -------- - -- Issue #18808: Thread.join() now waits for the underlying thread state to - be destroyed before returning. This prevents unpredictable aborts in - Py_EndInterpreter() when some non-daemon threads are still running. - -- Issue #18458: Prevent crashes with newer versions of libedit. Its readline - emulation has changed from 0-based indexing to 1-based like gnu readline. - -- Issue #18852: Handle case of ``readline.__doc__`` being ``None`` in the new - readline activation code in ``site.py``. - -- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in - the _sre module. - -- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even - when input list contains duplicates. - -- Issue #18878: sunau.open now supports the context management protocol. Based on - patches by Claudiu Popa and R. David Murray. - -- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast - 64-bit pointer to long (32 bits). - -- Issue #18876: The FileIO.mode attribute now better reflects the actual mode - under which the file was opened. Patch by Erik Bray. - -- Issue #16853: Add new selectors module. - -- Issue #18882: Add threading.main_thread() function. - -- Issue #18901: The sunau getparams method now returns a namedtuple rather than - a plain tuple. Patch by Claudiu Popa. - -- Issue #17487: The result of the wave getparams method now is pickleable again. - Patch by Claudiu Popa. - -- Issue #18756: os.urandom() now uses a lazily-opened persistent file - descriptor, so as to avoid using many file descriptors when run in - parallel from multiple threads. - -- Issue #18418: After fork(), reinit all threads states, not only active ones. - Patch by A. Jesse Jiryu Davis. - -- Issue #17974: Switch unittest from using getopt to using argparse. - -- Issue #11798: TestSuite now drops references to own tests after execution. - -- Issue #16611: http.cookie now correctly parses the 'secure' and 'httponly' - cookie flags. - -- Issue #11973: Fix a problem in kevent. The flags and fflags fields are now - properly handled as unsigned. - -- Issue #18807: ``pyvenv`` now takes a --copies argument allowing copies - instead of symlinks even where symlinks are available and the default. - -- Issue #18538: ``python -m dis`` now uses argparse for argument processing. - Patch by Michele Orr?. - -- Issue #18394: Close cgi.FieldStorage's optional file. - -- Issue #17702: On error, os.environb now suppresses the exception context - when raising a new KeyError with the original key. - -- Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. - -- Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj - argument. - -- Issue #17211: Yield a namedtuple in pkgutil. - Patch by Ramchandra Apte. - -- Issue #18324: set_payload now correctly handles binary input. This also - supersedes the previous fixes for #14360, #1717, and #16564. - -- Issue #18794: Add a fileno() method and a closed attribute to select.devpoll - objects. - -- Issue #17119: Fixed integer overflows when processing large strings and tuples - in the tkinter module. - -- Issue #15352: Rebuild frozen modules when marshal.c is changed. - -- Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork. - A pthread_atfork() parent handler is used to seed the PRNG with pid, time - and some stack data. - -- Issue #8865: Concurrent invocation of select.poll.poll() now raises a - RuntimeError exception. Patch by Christian Schubert. - -- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of - OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. - -- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. - -- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke - malloc weak symbols. - -- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes - inside subjectAltName correctly. Formerly the module has used OpenSSL's - GENERAL_NAME_print() function to get the string representation of ASN.1 - strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and - ``uniformResourceIdentifier`` (URI). - -- Issue #18701: Remove support of old CPython versions (<3.0) from C code. - -- Issue #18756: Improve error reporting in os.urandom() when the failure - is due to something else than /dev/urandom not existing (for example, - exhausting the file descriptor limit). - -- Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel - 3.11 or newer. It's only defined on system with 3.11 uapi headers, too. - -- Issue #18532: Change the builtin hash algorithms' names to lower case names - as promised by hashlib's documentation. - -- Issue #8713: add new spwan and forkserver start methods, and new functions - get_all_start_methods, get_start_method, and set_start_method, to - multiprocessing. - -- Issue #18405: Improve the entropy of crypt.mksalt(). - -- Issue #12015: The tempfile module now uses a suffix of 8 random characters - instead of 6, to reduce the risk of filename collision. The entropy was - reduced when uppercase letters were removed from the charset used to generate - random characters. - -- Issue #18585: Add :func:`textwrap.shorten` to collapse and truncate a - piece of text to a given length. - -- Issue #18598: Tweak exception message for importlib.import_module() to - include the module name when a key argument is missing. - -- Issue #19151: Fix docstring and use of _get_supported_file_loaders() to - reflect 2-tuples. - -- Issue #19152: Add ExtensionFileLoader.get_filename(). - -- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get - docstrings and ValueError messages. Patch by Zhongyue Luo - -- Fix refcounting issue with extension types in tkinter. - -- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error - if methods have annotations; it now correctly displays the annotations. - -- Issue #18600: Added policy argument to email.message.Message.as_string, - and as_bytes and __bytes__ methods to Message. - -- Issue #18671: Output more information when logging exceptions occur. - -- Issue #18621: Prevent the site module's patched builtins from keeping - too many references alive for too long. - -- Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. - -- Issue #8860: Fixed rounding in timedelta constructor. - -- Issue #18849: Fixed a Windows-specific tempfile bug where collision with an - existing directory caused mkstemp and related APIs to fail instead of - retrying. Report and fix by Vlad Shcherbina. - -- Issue #18920: argparse's default destination for the version action (-v, - --version) has also been changed to stdout, to match the Python executable. - -Tests ------ - -- Issue #18623: Factor out the _SuppressCoreFiles context manager into - test.support. Patch by Valerie Lambert. - -- Issue #12037: Fix test_email for desktop Windows. - -- Issue #15507: test_subprocess's test_send_signal could fail if the test - runner were run in an environment where the process inherited an ignore - setting for SIGINT. Restore the SIGINT handler to the desired - KeyboardInterrupt raising one during that test. - -- Issue #16799: Switched from getopt to argparse style in regrtest's argument - parsing. Added more tests for regrtest's argument parsing. - -- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as - possible, since "localhost" goes through a DNS lookup under recent Windows - versions. - -IDLE ----- - -- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster. - -Documentation -------------- - -- Issue #18743: Fix references to non-existent "StringIO" module. - -- Issue #18783: Removed existing mentions of Python long type in docstrings, - error messages and comments. - -Build ------ - -- Issue #1584: Provide configure options to override default search paths for - Tcl and Tk when building _tkinter. - -- Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit - installer. It is no longer necessary to install a third-party version of - Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 - shipped in OS X 10.6 and later releases. - -Tools/Demos ------------ - -- Issue #18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write - their version strings to stdout, and not to sderr. - - -What's New in Python 3.4.0 Alpha 1? -=================================== - -Release date: 2013-08-03 - -Core and Builtins ------------------ - -- Issue #16741: Fix an error reporting in int(). - -- Issue #17899: Fix rare file descriptor leak in os.listdir(). - -- Issue #10241: Clear extension module dict copies at interpreter shutdown. - Patch by Neil Schemenauer, minimally modified. - -- Issue #9035: ismount now recognises volumes mounted below a drive root - on Windows. Original patch by Atsuo Ishimoto. - -- Issue #18214: Improve finalization of Python modules to avoid setting - their globals to None, in most cases. - -- Issue #18112: PEP 442 implementation (safe object finalization). - -- Issue #18552: Check return value of PyArena_AddPyObject() in - obj2ast_object(). - -- Issue #18560: Fix potential NULL pointer dereference in sum(). - -- Issue #18520: Add a new PyStructSequence_InitType2() function, same than - PyStructSequence_InitType() except that it has a return value (0 on success, - -1 on error). - -- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0], - prefix and exec_prefix if the operation system does not obey MAXPATHLEN. - -- Issue #18408: Fix many various bugs in code handling errors, especially - on memory allocation failure (MemoryError). - -- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all(). - -- Issue #18342: Use the repr of a module name when an import fails when using - ``from ... import ...``. - -- Issue #17872: Fix a segfault in marshal.load() when input stream returns - more bytes than requested. - -- Issue #18338: `python --version` now prints version string to stdout, and - not to stderr. Patch by Berker Peksag and Michael Dickens. - -- Issue #18426: Fix NULL pointer dereference in C extension import when - PyModule_GetDef() returns an error. - -- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix - a stack overflow in the marshal module (fix a crash in test_marshal). - Patch written by Jeremy Kloth. - -- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory - allocators. - -- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the - tstate is first removed from TLS and then deallocated. - -- Issue #13483: Use VirtualAlloc in obmalloc on Windows. - -- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise - OverflowError when an argument of %c format is out of range. - -- Issue #18111: The min() and max() functions now support a default argument - to be returned instead of raising a ValueError on an empty sequence. - (Contributed by Julian Berman.) - -- Issue #18137: Detect integer overflow on precision in float.__format__() - and complex.__format__(). - -- Issue #15767: Introduce ModuleNotFoundError which is raised when a module - could not be found. - -- Issue #18183: Fix various unicode operations on strings with large unicode - codepoints. - -- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). - -- Issue #18038: SyntaxError raised during compilation sources with illegal - encoding now always contains an encoding name. - -- Issue #17931: Resolve confusion on Windows between pids and process - handles. - -- Tweak the exception message when the magic number or size value in a bytecode - file is truncated. - -- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators: - change the C type of seqiterobject.it_index from long to Py_ssize_t. - -- Issue #18065: Don't set __path__ to the package name for frozen packages. - -- Issue #18088: When reloading a module, unconditionally reset all relevant - attributes on the module (e.g. __name__, __loader__, __package__, __file__, - __cached__). - -- Issue #17937: Try harder to collect cyclic garbage at shutdown. - -- Issue #12370: Prevent class bodies from interfering with the __class__ - closure. - -- Issue #17644: Fix a crash in str.format when curly braces are used in square - brackets. - -- Issue #17237: Fix crash in the ASCII decoder on m68k. - -- Issue #17927: Frame objects kept arguments alive if they had been - copied into a cell, even if the cell was cleared. - -- Issue #1545463: At shutdown, defer finalization of codec modules so - that stderr remains usable. - -- Issue #7330: Implement width and precision (ex: "%5.3s") for the format - string of PyUnicode_FromFormat() function, original patch written by Ysj Ray. - -- Issue #1545463: Global variables caught in reference cycles are now - garbage-collected at shutdown. - -- Issue #17094: Clear stale thread states after fork(). Note that this - is a potentially disruptive change since it may release some system - resources which would otherwise remain perpetually alive (e.g. database - connections kept in thread-local storage). - -- Issue #17408: Avoid using an obsolete instance of the copyreg module when - the interpreter is shutdown and then started again. - -- Issue #5845: Enable tab-completion in the interactive interpreter by - default, thanks to a new sys.__interactivehook__. - -- Issue #17115,17116: Module initialization now includes setting __package__ and - __loader__ attributes to None. - -- Issue #17853: Ensure locals of a class that shadow free variables always win - over the closures. - -- Issue #17863: In the interactive console, don't loop forever if the encoding - can't be fetched from stdin. - -- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__. - -- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules. - -- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3, - such as was shipped with Centos 5 and Mac OS X 10.4. - -- Issue #17413: sys.settrace callbacks were being passed a string instead of an - exception instance for the 'value' element of the arg tuple if the exception - originated from C code; now an exception instance is always provided. - -- Issue #17782: Fix undefined behaviour on platforms where - ``struct timespec``'s "tv_nsec" member is not a C long. - -- Issue #17722: When looking up __round__, resolve descriptors. - -- Issue #16061: Speed up str.replace() for replacing 1-character strings. - -- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__ - method. - -- Issue #17643: Add __callback__ attribute to weakref.ref. - -- Issue #16447: Fixed potential segmentation fault when setting __name__ on a - class. - -- Issue #17669: Fix crash involving finalization of generators using yield from. - -- Issue #14439: Python now prints the traceback on runpy failure at startup. - -- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() - when running on valgrind. - -- Issue #17619: Make input() check for Ctrl-C correctly on Windows. - -- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during - the importlib transition. - -- Issue #17610: Don't rely on non-standard behavior of the C qsort() function. - -- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been - disabled by default. It can be re-enabled with the `-X showrefcount` option. - -- Issue #17328: Fix possible refleak in dict.setdefault. - -- Issue #17275: Corrected class name in init error messages of the C version of - BufferedWriter and BufferedRandom. - -- Issue #7963: Fixed misleading error message that issued when object is - called without arguments. - -- Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. - -- Issue #5308: Raise ValueError when marshalling too large object (a sequence - with size >= 2**31), instead of producing illegal marshal data. - -- Issue #12983: Bytes literals with invalid ``\x`` escape now raise a SyntaxError - and a full traceback including line number. - -- Issue #16967: In function definition, evaluate positional defaults before - keyword-only defaults. - -- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) - in the interpreter. - -- Issue #17137: When a Unicode string is resized, the internal wide character - string (wstr) format is now cleared. - -- Issue #17043: The unicode-internal decoder no longer read past the end of - input buffer. - -- Issue #17098: All modules now have __loader__ set even if they pre-exist the - bootstrapping of importlib. - -- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. - -- Issue #16772: The base argument to the int constructor no longer accepts - floats, or other non-integer objects with an __int__ method. Objects - with an __index__ method are now accepted. - -- Issue #10156: In the interpreter's initialization phase, unicode globals - are now initialized dynamically as needed. - -- Issue #16980: Fix processing of escaped non-ascii bytes in the - unicode-escape-decode decoder. - -- Issue #16975: Fix error handling bug in the escape-decode bytes decoder. - -- Issue #14850: Now a charmap decoder treats U+FFFE as "undefined mapping" - in any mapping, not only in a string. - -- Issue #16613: Add *m* argument to ``collections.Chainmap.new_child`` to - allow the new child map to be specified explicitly. - -- Issue #16730: importlib.machinery.FileFinder now no longers raises an - exception when trying to populate its cache and it finds out the directory is - unreadable or has turned into a file. Reported and diagnosed by - David Pritchard. - -- Issue #16906: Fix a logic error that prevented most static strings from being - cleared. - -- Issue #11461: Fix the incremental UTF-16 decoder. Original patch by - Amaury Forgeot d'Arc. - -- Issue #16856: Fix a segmentation fault from calling repr() on a dict with - a key whose repr raise an exception. - -- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. - -- Issue #16761: Calling int() with base argument only now raises TypeError. - -- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py - when retrieving a REG_DWORD value. This corrects functions like - winreg.QueryValueEx that may have been returning truncated values. - -- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg - when passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx. - -- Issue #11939: Set the st_dev attribute of stat_result to allow Windows to - take advantage of the os.path.samefile/sameopenfile/samestat implementations - used by other platforms. - -- Issue #16772: The int() constructor's second argument (base) no longer - accepts non integer values. Consistent with the behavior in Python 2. - -- Issue #14470: Remove w9xpopen support per PEP 11. - -- Issue #9856: Replace deprecation warning with raising TypeError - in object.__format__. Patch by Florent Xicluna. - -- Issue #16597: In buffered and text IO, call close() on the underlying stream - if invoking flush() fails. - -- Issue #16722: In the bytes() constructor, try to call __bytes__ on the - argument before __index__. - -- Issue #16421: loading multiple modules from one shared object is now - handled correctly (previously, the first module loaded from that file - was silently returned). Patch by V?clav ?milauer. - -- Issue #16602: When a weakref's target was part of a long deallocation - chain, the object could remain reachable through its weakref even though - its refcount had dropped to zero. - -- Issue #16495: Remove extraneous NULL encoding check from bytes_decode(). - -- Issue #16619: Create NameConstant AST class to represent None, True, and False - literals. As a result, these constants are never loaded at runtime from - builtins. - -- Issue #16455: On FreeBSD and Solaris, if the locale is C, the - ASCII/surrogateescape codec is now used (instead of the locale encoding) to - decode the command line arguments. This change fixes inconsistencies with - os.fsencode() and os.fsdecode(), because these operating systems announce an - ASCII locale encoding, but actually use the ISO-8859-1 encoding in practice. - -- Issue #16562: Optimize dict equality testing. Patch by Serhiy Storchaka. - -- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread - -- Issue #16592: stringlib_bytes_join doesn't raise MemoryError on allocation - failure. - -- Issue #16546: Fix: ast.YieldFrom argument is now mandatory. - -- Issue #16514: Fix regression causing a traceback when sys.path[0] is None - (actually, any non-string or non-bytes type). - -- Issue #16306: Fix multiple error messages when unknown command line - parameters where passed to the interpreter. Patch by Hieu Nguyen. - -- Issue #16215: Fix potential double memory free in str.replace(). Patch - by Serhiy Storchaka. - -- Issue #16290: A float return value from the __complex__ special method is no - longer accepted in the complex() constructor. - -- Issue #16416: On Mac OS X, operating system data are now always - encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding - (which may be ASCII if no locale environment variable is set), to avoid - inconsistencies with os.fsencode() and os.fsdecode() functions which are - already using UTF-8/surrogateescape. - -- Issue #16453: Fix equality testing of dead weakref objects. - -- Issue #9535: Fix pending signals that have been received but not yet - handled by Python to not persist after os.fork() in the child process. - -- Issue #14794: Fix slice.indices to return correct results for huge values, - rather than raising OverflowError. - -- Issue #15001: fix segfault on "del sys.modules['__main__']". Patch by Victor - Stinner. - -- Issue #8271: the utf-8 decoder now outputs the correct number of U+FFFD - characters when used with the 'replace' error handler on invalid utf-8 - sequences. Patch by Serhiy Storchaka, tests by Ezio Melotti. - -- Issue #5765: Apply a hard recursion limit in the compiler instead of - blowing the stack and segfaulting. Initial patch by Andrea Griffini. - -- Issue #16402: When slicing a range, fix shadowing of exceptions from - __index__. - -- Issue #16336: fix input checking in the surrogatepass error handler. - Patch by Serhiy Storchaka. - -- Issue #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now - raises an error. - -- Issue #7317: Display full tracebacks when an error occurs asynchronously. - Patch by Alon Horev with update by Alexey Kachayev. - -- Issue #16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH - not set at all. - -- Issue #10189: Improve the error reporting of SyntaxErrors related to global - and nonlocal statements. - -- Fix segfaults on setting __qualname__ on builtin types and attempting to - delete it on any type. - -- Issue #14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch - written by Serhiy Storchaka. - -- Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass - received a nonempty dict from the constructor. - -- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a - class's __dict__ and on type. - -- Issue #12805: Make bytes.join and bytearray.join faster when the separator - is empty. Patch by Serhiy Storchaka. - -- Issue #6074: Ensure cached bytecode files can always be updated by the - user that created them, even when the source file is read-only. - -- Issue #15958: bytes.join and bytearray.join now accept arbitrary buffer - objects. - -- Issue #14783: Improve int() docstring and switch docstrings for str(), - range(), and slice() to use multi-line signatures. - -- Issue #16160: Subclass support now works for types.SimpleNamespace. - -- Issue #16148: Implement PEP 424, adding operator.length_hint and - PyObject_LengthHint. - -- Upgrade Unicode data (UCD) to version 6.2. - -- Issue #15379: Fix passing of non-BMP characters as integers for the charmap - decoder (already working as unicode strings). Patch by Serhiy Storchaka. - -- Issue #15144: Fix possible integer overflow when handling pointers as integer - values, by using `Py_uintptr_t` instead of `size_t`. Patch by Serhiy - Storchaka. - -- Issue #15965: Explicitly cast `AT_FDCWD` as (int). Required on Solaris 10 - (which defines `AT_FDCWD` as ``0xffd19553``), harmless on other platforms. - -- Issue #15839: Convert SystemErrors in `super()` to RuntimeErrors. - -- Issue #15448: Buffered IO now frees the buffer when closed, instead - of when deallocating. - -- Issue #15846: Fix SystemError which happened when using `ast.parse()` in an - exception handler on code with syntax errors. - -- Issue #15897: zipimport.c doesn't check return value of fseek(). - Patch by Felipe Cruz. - -- Issue #15801: Make sure mappings passed to '%' formatting are actually - subscriptable. - -- Issue #15111: __import__ should propagate ImportError when raised as a - side-effect of a module triggered from using fromlist. - -- Issue #15022: Add pickle and comparison support to types.SimpleNamespace. - -Library -------- - -- Issue #4331: Added functools.partialmethod (Initial patch by Alon Horev) - -- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit - platforms. Patch by Yogesh Chaudhari. - -- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li). - -- Issue #14323: Expanded the number of digits in the coefficients for the - RGB -- YIQ conversions so that they match the FCC NTSC versions. - -- Issue #17998: Fix an internal error in regular expression engine. - -- Issue #17557: Fix os.getgroups() to work with the modified behavior of - getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik. - -- Issue #18608: Avoid keeping a strong reference to the locale module - inside the _io module. - -- Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, - and make it GC-aware. - -- Issue #15699: The readline module now uses PEP 3121-style module - initialization, so as to reclaim allocated resources (Python callbacks) - at shutdown. Original patch by Robin Schreiber. - -- Issue #17616: wave.open now supports the context management protocol. - -- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns - 'SHA1' instead of 'SHA'. - -- Issue #13266: Added inspect.unwrap to easily unravel __wrapped__ chains - (initial patch by Daniel Urban and Aaron Iles) - -- Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL. - -- Issue #18559: Fix NULL pointer dereference error in _pickle module - -- Issue #18556: Check the return type of PyUnicode_AsWideChar() in ctype's - U_set(). - -- Issue #17818: aifc.getparams now returns a namedtuple. - -- Issue #18549: Eliminate dead code in socket_ntohl() - -- Issue #18530: Remove additional stat call from posixpath.ismount. - Patch by Alex Gaynor. - -- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() - -- Issue #9177: Calling read() or write() now raises ValueError, not - AttributeError, on a closed SSL socket. Patch by Senko Rasic. - -- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + - gcc. - -- Issue #18479: Changed venv Activate.ps1 to make deactivate a function, and - removed Deactivate.ps1. - -- Issue #18480: Add missing call to PyType_Ready to the _elementtree extension. - -- Issue #17778: Fix test discovery for test_multiprocessing. (Patch by - Zachary Ware.) - -- Issue #18393: The private module _gestalt and private functions - platform._mac_ver_gestalt, platform._mac_ver_lookup and - platform._bcd2str have been removed. This does not affect the public - interface of the platform module. - -- Issue #17482: functools.update_wrapper (and functools.wraps) now set the - __wrapped__ attribute correctly even if the underlying function has a - __wrapped__ attribute set. - -- Issue #18431: The new email header parser now decodes RFC2047 encoded words - in structured headers. - -- Issue #18432: The sched module's queue method was incorrectly returning - an iterator instead of a list. - -- Issue #18044: The new email header parser was mis-parsing encoded words where - an encoded character immediately followed the '?' that follows the CTE - character, resulting in a decoding failure. They are now decoded correctly. - -- Issue #18101: Tcl.split() now process strings nested in a tuple as it - do with byte strings. - -- Issue #18116: getpass was always getting an error when testing /dev/tty, - and thus was always falling back to stdin, and would then raise an exception - if stdin could not be used (such as /dev/null). It also leaked an open file. - All of these issues are now fixed. - -- Issue #17198: Fix a NameError in the dbm module. Patch by Valentina - Mukhamedzhanova. - -- Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form. - -- Issue #18020: improve html.escape speed by an order of magnitude. - Patch by Matt Bryant. - -- Issue #18347: ElementTree's html serializer now preserves the case of - closing tags. - -- Issue #17261: Ensure multiprocessing's proxies use proper address. - -- Issue #18343: faulthandler.register() now keeps the previous signal handler - when the function is called twice, so faulthandler.unregister() restores - correctly the original signal handler. - -- Issue #17097: Make multiprocessing ignore EINTR. - -- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a - segfault inside the _pickle C extension. - -- Issue #18240: The HMAC module is no longer restricted to bytes and accepts - any bytes-like object, e.g. memoryview. Original patch by Jonas Borgstr?m. - -- Issue #18224: Removed pydoc script from created venv, as it causes problems - on Windows and adds no value over and above python -m pydoc ... - -- Issue #18155: The csv module now correctly handles csv files that use - a delimiter character that has a special meaning in regexes, instead of - throwing an exception. - -- Issue #14360: encode_quopri can now be successfully used as an encoder - when constructing a MIMEApplication object. - -- Issue #11390: Add -o and -f command line options to the doctest CLI to - specify doctest options (and convert it to using argparse). - -- Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input - string in longer than 2 gigabytes, and ssl.SSLContext.load_cert_chain() - raises a ValueError if the password is longer than 2 gigabytes. The ssl - module does not support partial write. - -- Issue #11016: Add C implementation of the stat module as _stat. - -- Issue #18248: Fix libffi build on AIX. - -- Issue #18259: Declare sethostname in socketmodule.c for AIX - -- Issue #18147: Add diagnostic functions to ssl.SSLContext(). get_ca_list() - lists all loaded CA certificates and cert_store_stats() returns amount of - loaded X.509 certs, X.509 CA certs and CRLs. - -- Issue #18167: cgi.FieldStorage no longer fails to handle multipart/form-data - when ``\r\n`` appears at end of 65535 bytes without other newlines. - -- Issue #18076: Introduce importlib.util.decode_source(). - -- Issue #18357: add tests for dictview set difference. - Patch by Fraser Tweedale. - -- importlib.abc.SourceLoader.get_source() no longer changes SyntaxError or - UnicodeDecodeError into ImportError. - -- Issue #18058, 18057: Make the namespace package loader meet the - importlib.abc.InspectLoader ABC, allowing for namespace packages to work with - runpy. - -- Issue #17177: The imp module is pending deprecation. - -- subprocess: Prevent a possible double close of parent pipe fds when the - subprocess exec runs into an error. Prevent a regular multi-close of the - /dev/null fd when any of stdin, stdout and stderr was set to DEVNULL. - -- Issue #18194: Introduce importlib.util.cache_from_source() and - source_from_cache() while documenting the equivalent functions in imp as - deprecated. - -- Issue #17907: Document imp.new_module() as deprecated in favour of - types.ModuleType. - -- Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document as deprecated - imp.get_magic(). - -- Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache. - Patch by Mark Levitt - -- Issue #18193: Add importlib.reload(). - -- Issue #18157: Stop using imp.load_module() in pydoc. - -- Issue #16102: Make uuid._netbios_getnode() work again on Python 3. - -- Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. - -- Issue #18143: Implement ssl.get_default_verify_paths() in order to debug - the default locations for cafile and capath. - -- Issue #17314: Move multiprocessing.forking over to importlib. - -- Issue #11959: SMTPServer and SMTPChannel now take an optional map, use of - which avoids affecting global state. - -- Issue #18109: os.uname() now decodes fields from the locale encoding, and - socket.gethostname() now decodes the hostname from the locale encoding, - instead of using the UTF-8 encoding in strict mode. - -- Issue #18089: Implement importlib.abc.InspectLoader.load_module. - -- Issue #18088: Introduce importlib.abc.Loader.init_module_attrs for setting - module attributes. Leads to the pending deprecation of - importlib.util.module_for_loader. - -- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to - ruleline. This helps in handling certain types invalid urls in a conservative - manner. Patch contributed by Mher Movsisyan. - -- Issue #18070: Have importlib.util.module_for_loader() set attributes - unconditionally in order to properly support reloading. - -- Added importlib.util.module_to_load to return a context manager to provide the - proper module object to load. - -- Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw - stream's read() returns more bytes than requested. - -- Issue #18011: As was originally intended, base64.b32decode() now raises a - binascii.Error if there are non-b32-alphabet characters present in the input - string, instead of a TypeError. - -- Issue #18072: Implement importlib.abc.InspectLoader.get_code() and - importlib.abc.ExecutionLoader.get_code(). - -- Issue #8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL - sockets. - -- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X - with port None or "0" and flags AI_NUMERICSERV. - -- Issue #16986: ElementTree now correctly works with string input when the - internal XML encoding is not UTF-8 or US-ASCII. - -- Issue #17996: socket module now exposes AF_LINK constant on BSD and OSX. - -- Issue #17900: Allowed pickling of recursive OrderedDicts. Decreased pickled - size and pickling time. - -- Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an - initial patch by Trent Nelson. - -- Issue #17812: Fixed quadratic complexity of base64.b32encode(). - Optimize base64.b32encode() and base64.b32decode() (speed up to 3x). - -- Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of - service using certificates with many wildcards (CVE-2013-2099). - -- Issue #15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. - -- Issue #14596: The struct.Struct() objects now use a more compact - implementation. - -- Issue #17981: logging's SysLogHandler now closes the socket when it catches - socket OSErrors. - -- Issue #17964: Fix os.sysconf(): the return type of the C sysconf() function - is long, not int. - -- Fix typos in the multiprocessing module. - -- Issue #17754: Make ctypes.util.find_library() independent of the locale. - -- Issue #17968: Fix memory leak in os.listxattr(). - -- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator - characters() and ignorableWhitespace() methods. Original patch by Sebastian - Ortiz Vasquez. - -- Issue #17732: Ignore distutils.cfg options pertaining to install paths if a - virtual environment is active. - -- Issue #17915: Fix interoperability of xml.sax with file objects returned by - codecs.open(). - -- Issue #16601: Restarting iteration over tarfile really restarts rather - than continuing from where it left off. Patch by Michael Birtwell. - -- Issue #17289: The readline module now plays nicer with external modules - or applications changing the rl_completer_word_break_characters global - variable. Initial patch by Bradley Froehle. - -- Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit - platforms. Patch by Federico Schwindt. - -- Issue #11816: multiple improvements to the dis module: get_instructions - generator, ability to redirect output to a file, Bytecode and Instruction - abstractions. Patch by Nick Coghlan, Ryan Kelly and Thomas Kluyver. - -- Issue #13831: Embed stringification of remote traceback in local - traceback raised when pool task raises an exception. - -- Issue #15528: Add weakref.finalize to support finalization using - weakref callbacks. - -- Issue #14173: Avoid crashing when reading a signal handler during - interpreter shutdown. - -- Issue #15902: Fix imp.load_module() accepting None as a file when loading an - extension module. - -- Issue #13721: SSLSocket.getpeercert() and SSLSocket.do_handshake() now - raise an OSError with ENOTCONN, instead of an AttributeError, when the - SSLSocket is not connected. - -- Issue #14679: add an __all__ (that contains only HTMLParser) to html.parser. - -- Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by - Thomas Barlow. - -- Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by - extension load_module()) now have a better chance of working when reloaded. - -- Issue #17804: New function ``struct.iter_unpack`` allows for streaming - struct unpacking. - -- Issue #17830: When keyword.py is used to update a keyword file, it now - preserves the line endings of the original file. - -- Issue #17272: Making the urllib.request's Request.full_url a descriptor. - Fixes bugs with assignment to full_url. Patch by Demian Brecht. - -- Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures - -- Issue #11714: Use 'with' statements to assure a Semaphore releases a - condition variable. Original patch by Thomas Rachel. - -- Issue #16624: `subprocess.check_output` now accepts an `input` argument, - allowing the subprocess's stdin to be provided as a (byte) string. - Patch by Zack Weinberg. - -- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with - Unix domain sockets. - -- Issue #16694: Add a pure Python implementation of the operator module. - Patch by Zachary Ware. - -- Issue #11182: remove the unused and undocumented pydoc.Scanner class. - Patch by Martin Morrison. - -- Issue #17741: Add ElementTree.XMLPullParser, an event-driven parser for - non-blocking applications. - -- Issue #17555: Fix ForkAwareThreadLock so that size of after fork - registry does not grow exponentially with generation of process. - -- Issue #17707: fix regression in multiprocessing.Queue's get() method where - it did not block for short timeouts. - -- Issue #17720: Fix the Python implementation of pickle.Unpickler to correctly - process the APPENDS opcode when it is used on non-list objects. - -- Issue #17012: shutil.which() no longer falls back to the PATH environment - variable if an empty path argument is specified. Patch by Serhiy Storchaka. - -- Issue #17710: Fix pickle raising a SystemError on bogus input. - -- Issue #17341: Include the invalid name in the error messages from re about - invalid group names. - -- Issue #17702: os.environ now raises KeyError with the original environment - variable name (str on UNIX), instead of using the encoded name (bytes on - UNIX). - -- Issue #16163: Make the importlib based version of pkgutil.iter_importers - work for submodules. Initial patch by Berker Peksag. - -- Issue #16804: Fix a bug in the 'site' module that caused running - 'python -S -m site' to incorrectly throw an exception. - -- Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal. - Initial patch by Daniel Riti. - -- Issue #2118: SMTPException is now a subclass of OSError. - -- Issue #17016: Get rid of possible pointer wraparounds and integer overflows - in the re module. Patch by Nickolai Zeldovich. - -- Issue #16658: add missing return to HTTPConnection.send(). - Patch by Jeff Knupp. - -- Issue #9556: the logging package now allows specifying a time-of-day for a - TimedRotatingFileHandler to rotate. - -- Issue #14971: unittest test discovery no longer gets confused when a function - has a different __name__ than its name in the TestCase class dictionary. - -- Issue #17487: The wave getparams method now returns a namedtuple rather than - a plain tuple. - -- Issue #17675: socket repr() provides local and remote addresses (if any). - Patch by Giampaolo Rodola' - -- Issue #17093: Make the ABCs in importlib.abc provide default values or raise - reasonable exceptions for their methods to make them more amenable to super() - calls. - -- Issue #17566: Make importlib.abc.Loader.module_repr() optional instead of an - abstractmethod; now it raises NotImplementedError so as to be ignored by default. - -- Issue #17678: Remove the use of deprecated method in http/cookiejar.py by - changing the call to get_origin_req_host() to origin_req_host. - -- Issue #17666: Fix reading gzip files with an extra field. - -- Issue #16475: Support object instancing, recursion and interned strings - in marshal - -- Issue #17502: Process DEFAULT values in mock side_effect that returns iterator. - -- Issue #16795: On the ast.arguments object, unify vararg with varargannotation - and kwarg and kwargannotation. Change the column offset of ast.Attribute to be - at the attribute name. - -- Issue #17434: Properly raise a SyntaxError when a string occurs between future - imports. - -- Issue #17117: Import and @importlib.util.set_loader now set __loader__ when - it has a value of None or the attribute doesn't exist. - -- Issue #17032: The "global" in the "NameError: global name 'x' is not defined" - error message has been removed. Patch by Ram Rachum. - -- Issue #18080: When building a C extension module on OS X, if the compiler - is overridden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overridden. This restores - Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. - -- Issue #18113: Fixed a refcount leak in the curses.panel module's - set_userptr() method. Reported by Atsuo Ishimoto. - -- Implement PEP 443 "Single-dispatch generic functions". - -- Implement PEP 435 "Adding an Enum type to the Python standard library". - -- Issue #15596: Faster pickling of unicode strings. - -- Issue #17572: Avoid chained exceptions when passing bad directives to - time.strptime(). Initial patch by Claudiu Popa. - -- Issue #17435: threading.Timer's __init__ method no longer uses mutable - default values for the args and kwargs parameters. - -- Issue #17526: fix an IndexError raised while passing code without filename to - inspect.findsource(). Initial patch by Tyler Doyle. - -- Issue #17540: Added style parameter to logging formatter configuration by dict. - -- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial - patch by Michele Orr?. - -- Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. - -- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, - iceweasel, iceape. - -- Issue #17150: pprint now uses line continuations to wrap long string - literals. - -- Issue #17488: Change the subprocess.Popen bufsize parameter default value - from unbuffered (0) to buffering (-1) to match the behavior existing code - expects and match the behavior of the subprocess module in Python 2 to avoid - introducing hard to track down bugs. - -- Issue #17521: Corrected non-enabling of logger following two calls to - fileConfig(). - -- Issue #17508: Corrected logging MemoryHandler configuration in dictConfig() - where the target handler wasn't configured first. - -- Issue #17209: curses.window.get_wch() now correctly handles KeyboardInterrupt - (CTRL+c). - -- Issue #5713: smtplib now handles 421 (closing connection) error codes when - sending mail by closing the socket and reporting the 421 error code via the - exception appropriate to the command that received the error response. - -- Issue #16997: unittest.TestCase now provides a subTest() context manager - to procedurally generate, in an easy way, small test instances. - -- Issue #17485: Also delete the Request Content-Length header if the data - attribute is deleted. (Follow on to issue Issue #16464). - -- Issue #15927: CVS now correctly parses escaped newlines and carriage - when parsing with quoting turned off. - -- Issue #17467: add readline and readlines support to mock_open in - unittest.mock. - -- Issue #13248: removed deprecated and undocumented difflib.isbjunk, - isbpopular. - -- Issue #17192: Update the ctypes module's libffi to v3.0.13. This - specifically addresses a stack misalignment issue on x86 and issues on - some more recent platforms. - -- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. - -- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO - in subprocess, but the imap code assumes buffered IO. In Python2 this - worked by accident. IMAP4_stream now explicitly uses buffered IO. - -- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc - 'allmethods'; it was missing unbound methods on the class. - -- Issue #17474: Remove the deprecated methods of Request class. - -- Issue #16709: unittest discover order is no-longer filesystem specific. Patch - by Jeff Ramnani. - -- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. - -- Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files - rather than -1. - -- Issue #17460: Remove the strict argument of HTTPConnection and removing the - DeprecationWarning being issued from 3.2 onwards. - -- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - -- Issue #16389: Fixed a performance regression relative to Python 3.1 in the - caching of compiled regular expressions. - -- Added missing FeedParser and BytesFeedParser to email.parser.__all__. - -- Issue #17431: Fix missing import of BytesFeedParser in email.parser. - -- Issue #12921: http.server's send_error takes an explain argument to send more - information in response. Patch contributed by Karl. - -- Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. - -- Issue #1285086: Get rid of the refcounting hack and speed up - urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). - -- Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ - is not set, harmonizing with what happens when the attribute is set to None. - -- Expose the O_PATH constant in the os module if it is available. - -- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused - a failure while decoding empty object literals when object_pairs_hook was - specified. - -- Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO - queue now uses a deque instead of a list. - -- Issue #15806: Add contextlib.ignore(). This creates a context manager to - ignore specified exceptions, replacing the "except SomeException: pass" idiom. - -- Issue #14645: The email generator classes now produce output using the - specified linesep throughout. Previously if the prolog, epilog, or - body were stored with a different linesep, that linesep was used. This - fix corrects an RFC non-compliance issue with smtplib.send_message. - -- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when - the list is being resized concurrently. - -- Issue #16962: Use getdents64 instead of the obsolete getdents syscall - in the subprocess module on Linux. - -- Issue #16935: unittest now counts the module as skipped if it raises SkipTest, - instead of counting it as an error. Patch by Zachary Ware. - -- Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - -- Issue #17223: array module: Fix a crasher when converting an array containing - invalid characters (outside range [U+0000; U+10ffff]) to Unicode: - repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. - -- Issue #17197: profile/cProfile modules refactored so that code of run() and - runctx() utility functions is not duplicated in both modules. - -- Issue #14720: sqlite3: Convert datetime microseconds correctly. - Patch by Lowe Thiderman. - -- Issue #15132: Allow a list for the defaultTest argument of - unittest.TestProgram. Patch by Jyrki Pulliainen. - -- Issue #17225: JSON decoder now counts columns in the first line starting - with 1, as in other lines. - -- Issue #6623: Added explicit DeprecationWarning for ftplib.netrc, which has - been deprecated and undocumented for a long time. - -- Issue #13700: Fix byte/string handling in imaplib authentication when an - authobject is specified. - -- Issue #13153: Tkinter functions now raise TclError instead of ValueError when - a string argument contains non-BMP character. - -- Issue #9669: Protect re against infinite loops on zero-width matching in - non-greedy repeat. Patch by Matthew Barnett. - -- Issue #13169: The maximal repetition number in a regular expression has been - increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on - 64-bit). - -- Issue #17143: Fix a missing import in the trace module. Initial patch by - Berker Peksag. - -- Issue #15220: email.feedparser's line splitting algorithm is now simpler and - faster. - -- Issue #16743: Fix mmap overflow check on 32 bit Windows. - -- Issue #16996: webbrowser module now uses shutil.which() to find a - web-browser on the executable search path. - -- Issue #16800: tempfile.gettempdir() no longer left temporary files when - the disk is full. Original patch by Amir Szekely. - -- Issue #17192: Import libffi-3.0.12. - -- Issue #16564: Fixed regression relative to Python2 in the operation of - email.encoders.encode_7or8bit when used with binary data. - -- Issue #17052: unittest discovery should use self.testLoader. - -- Issue #4591: Uid and gid values larger than 2**31 are supported now. - -- Issue #17141: random.vonmisesvariate() no longer hangs for large kappas. - -- Issue #17149: Fix random.vonmisesvariate to always return results in - [0, 2*math.pi]. - -- Issue #1470548: XMLGenerator now works with binary output streams. - -- Issue #6975: os.path.realpath() now correctly resolves multiple nested - symlinks on POSIX platforms. - -- Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the - filename as a URI, allowing custom options to be passed. - -- Issue #16564: Fixed regression relative to Python2 in the operation of - email.encoders.encode_noop when used with binary data. - -- Issue #10355: The mode, name, encoding and newlines properties now work on - SpooledTemporaryFile objects even when they have not yet rolled over. - Obsolete method xreadline (which has never worked in Python 3) has been - removed. - -- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in - avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(), - and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for - 32-bit samples. max() and rms() no more returns a negative result and - various other functions now work correctly with 32-bit sample -0x80000000. - -- Issue #17073: Fix some integer overflows in sqlite3 module. - -- Issue #16723: httplib.HTTPResponse no longer marked closed when the connection - is automatically closed. - -- Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by - Brian Thorne. - -- Issue #16948: Fix quoted printable body encoding for non-latin1 character - sets in the email package. - -- Issue #16811: Fix folding of headers with no value in the provisional email - policies. - -- Issue #17132: Update symbol for "yield from" grammar changes. - -- Issue #17076: Make copying of xattrs more tolerant of missing FS support. - Patch by Thomas Wouters. - -- Issue #17089: Expat parser now correctly works with string input when the - internal XML encoding is not UTF-8 or US-ASCII. It also now accepts bytes - and strings larger than 2 GiB. - -- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple - parses nested mutating sequence. - -- Issue #5289: Fix ctypes.util.find_library on Solaris. - -- Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying - stream or a decoder produces data of an unexpected type (i.e. when - io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec). - -- Issue #17015: When it has a spec, a Mock object now inspects its signature - when matching calls, so that arguments can be matched positionally or - by name. - -- Issue #15633: httplib.HTTPResponse is now mark closed when the server - sends less than the advertised Content-Length. - -- Issue #12268: The io module file object write methods no longer abort early - when one of its write system calls is interrupted (EINTR). - -- Issue #6972: The zipfile module no longer overwrites files outside of - its destination path when extracting malicious zip files. - -- Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an - incomplete "End of Central Directory" record. Original patch by Guilherme - Polo and Alan McIntyre. - -- Issue #17071: Signature.bind() now works when one of the keyword arguments - is named ``self``. - -- Issue #12004: Fix an internal error in PyZipFile when writing an invalid - Python file. Patch by Ben Morgan. - -- Have py_compile use importlib as much as possible to avoid code duplication. - Code now raises FileExistsError if the file path to be used for the - byte-compiled file is a symlink or non-regular file as a warning that import - will not keep the file path type if it writes to that path. - -- Issue #16972: Have site.addpackage() consider already known paths even when - none are explicitly passed in. Bug report and fix by Kirill. - -- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``) - now fills the ``os.environ`` variable correctly. - -- Issue #15505: `unittest.installHandler` no longer assumes SIGINT handler is - set to a callable object. - -- Issue #13454: Fix a crash when deleting an iterator created by itertools.tee() - if all other iterators were very advanced before. - -- Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries - and bytes data. Patch by Jonas Wagner. - -- Issue #16957: shutil.which() no longer searches a bare file name in the - current directory on Unix and no longer searches a relative file path with - a directory part in PATH directories. Patch by Thomas Kluyver. - -- Issue #1159051: GzipFile now raises EOFError when reading a corrupted file - with truncated header or footer. - -- Issue #16993: shutil.which() now preserves the case of the path and extension - on Windows. - -- Issue #16992: On Windows in signal.set_wakeup_fd, validate the file - descriptor argument. - -- Issue #16422: For compatibility with the Python version, the C version of - decimal now uses strings instead of integers for rounding mode constants. - -- Issue #15861: tkinter now correctly works with lists and tuples containing - strings with whitespaces, backslashes or unbalanced braces. - -- Issue #9720: zipfile now writes correct local headers for files larger than - 4 GiB. - -- Issue #16955: Fix the poll() method for multiprocessing's socket - connections on Windows. - -- SSLContext.load_dh_params() now properly closes the input file. - -- Issue #15031: Refactor some .pyc management code to cut down on code - duplication. Thanks to Ronan Lamy for the report and taking an initial stab - at the problem. - -- Issue #16398: Optimize deque.rotate() so that it only moves pointers - and doesn't touch the underlying data with increfs and decrefs. - -- Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed. - -- Issue #13899: ``\A``, ``\Z``, and ``\B`` now correctly match the A, Z, - and B literals when used inside character classes (e.g. ``'[\A]'``). - Patch by Matthew Barnett. - -- Issue #15545: Fix regression in sqlite3's iterdump method where it was - failing if the connection used a row factory (such as sqlite3.Row) that - produced unsortable objects. (Regression was introduced by fix for 9750). - -- fcntl: add F_DUPFD_CLOEXEC constant, available on Linux 2.6.24+. - -- Issue #15972: Fix error messages when os functions expecting a file name or - file descriptor receive the incorrect type. - -- Issue #8109: The ssl module now has support for server-side SNI, thanks - to a :meth:`SSLContext.set_servername_callback` method. Patch by Daniel - Black. - -- Issue #16860: In tempfile, use O_CLOEXEC when available to set the - close-on-exec flag atomically. - -- Issue #16674: random.getrandbits() is now 20-40% faster for small integers. - -- Issue #16009: JSON error messages now provide more information. - -- Issue #16828: Fix error incorrectly raised by bz2.compress(b'') and - bz2.BZ2Compressor.compress(b''). Initial patch by Martin Packman. - -- Issue #16833: In http.client.HTTPConnection, do not concatenate the request - headers and body when the payload exceeds 16 KB, since it can consume more - memory for no benefit. Patch by Benno Leslie. - -- Issue #16541: tk_setPalette() now works with keyword arguments. - -- Issue #16820: In configparser, `parser.popitem()` no longer raises ValueError. - This makes `parser.clean()` work correctly. - -- Issue #16820: In configparser, ``parser['section'] = {}`` now preserves - section order within the parser. This makes `parser.update()` preserve section - order as well. - -- Issue #16820: In configparser, ``parser['DEFAULT'] = {}`` now correctly - clears previous values stored in the default section. Same goes for - ``parser.update({'DEFAULT': {}})``. - -- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. - -- Issue #16787: Increase asyncore and asynchat default output buffers size, to - decrease CPU usage and increase throughput. - -- Issue #10527: make multiprocessing use poll() instead of select() if available. - -- Issue #16688: Now regexes contained backreferences correctly work with - non-ASCII strings. Patch by Matthew Barnett. - -- Issue #16486: Make aifc files act as context managers. - -- Issue #16485: Now file descriptors are closed if file header patching failed - on closing an aifc file. - -- Issue #16640: Run less code under a lock in sched module. - -- Issue #16165: sched.scheduler.run() no longer blocks a scheduler for other - threads. - -- Issue #16641: Default values of sched.scheduler.enter() are no longer - modifiable. - -- Issue #16618: Make glob.glob match consistently across strings and bytes - regarding leading dots. Patch by Serhiy Storchaka. - -- Issue #16788: Add samestat to Lib/ntpath.py - -- Issue #16713: Parsing of 'tel' urls using urlparse separates params from - path. - -- Issue #16443: Add docstrings to regular expression match objects. - Patch by Anton Kasyanov. - -- Issue #15701: Fix HTTPError info method call to return the headers information. - -- Issue #16752: Add a missing import to modulefinder. Patch by Berker Peksag. - -- Issue #16646: ftplib.FTP.makeport() might lose socket error details. - (patch by Serhiy Storchaka) - -- Issue #16626: Fix infinite recursion in glob.glob() on Windows when the - pattern contains a wildcard in the drive or UNC path. Patch by Serhiy - Storchaka. - -- Issue #15783: Except for the number methods, the C version of decimal now - supports all None default values present in decimal.py. These values were - largely undocumented. - -- Issue #11175: argparse.FileType now accepts encoding and errors - arguments. Patch by Lucas Maystre. - -- Issue #16488: epoll() objects now support the `with` statement. Patch - by Serhiy Storchaka. - -- Issue #16298: In HTTPResponse.read(), close the socket when there is no - Content-Length and the incoming stream is finished. Patch by Eran - Rundstein. - -- Issue #16049: Add abc.ABC class to enable the use of inheritance to create - ABCs, rather than the more cumbersome metaclass=ABCMeta. Patch by Bruno - Dupuis. - -- Expose the TCP_FASTOPEN and MSG_FASTOPEN flags in socket when they're - available. - -- Issue #15701: Add a .headers attribute to urllib.error.HTTPError. Patch - contributed by Berker Peksag. - -- Issue #15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree - that caused it to not ignore certain errors when ignore_errors was set. - Patch by Alessandro Moura and Serhiy Storchaka. - -- Issue #16248: Disable code execution from the user's home directory by - tkinter when the -E flag is passed to Python. Patch by Zachary Ware. - -- Issue #13390: New function :func:`sys.getallocatedblocks()` returns the - number of memory blocks currently allocated. - -- Issue #16628: Fix a memory leak in ctypes.resize(). - -- Issue #13614: Fix setup.py register failure with invalid rst in description. - Patch by Julien Courteau and Pierre Paul Lefebvre. - -- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by - Philip Jenvey, tested by Mageia and Debian. - -- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later - on. Initial patch by SilentGhost and Jeff Ramnani. - -- Issue #13120: Allow calling pdb.set_trace() from thread. - Patch by Ilya Sandler. - -- Issue #16585: Make CJK encoders support error handlers that return bytes per - PEP 383. - -- Issue #10182: The re module doesn't truncate indices to 32 bits anymore. - Patch by Serhiy Storchaka. - -- Issue #16333: use (",", ": ") as default separator in json when indent is - specified, to avoid trailing whitespace. Patch by Serhiy Storchaka. - -- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous - list() calls aren't added to filter(), map(), and zip() which are directly - passed enumerate(). - -- Issue #16464: Reset the Content-Length header when a urllib Request is reused - with new data. - -- Issue #12848: The pure Python pickle implementation now treats object - lengths as unsigned 32-bit integers, like the C implementation does. - Patch by Serhiy Storchaka. - -- Issue #16423: urllib.request now has support for ``data:`` URLs. Patch by - Mathias Panzenb?ck. - -- Issue #4473: Add a POP3.stls() to switch a clear-text POP3 session into - an encrypted POP3 session, on supported servers. Patch by Lorenzo Catucci. - -- Issue #4473: Add a POP3.capa() method to query the capabilities advertised - by the POP3 server. Patch by Lorenzo Catucci. - -- Issue #4473: Ensure the socket is shutdown cleanly in POP3.close(). - Patch by Lorenzo Catucci. - -- Issue #16522: added FAIL_FAST flag to doctest. - -- Issue #15627: Add the importlib.abc.InspectLoader.source_to_code() method. - -- Issue #16408: Fix file descriptors not being closed in error conditions - in the zipfile module. Patch by Serhiy Storchaka. - -- Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak - references to bound methods. - -- Issue #16469: Fix exceptions from float -> Fraction and Decimal -> Fraction - conversions for special values to be consistent with those for float -> int - and Decimal -> int. Patch by Alexey Kachayev. - -- Issue #16481: multiprocessing no longer leaks process handles on Windows. - -- Issue #12428: Add a pure Python implementation of functools.partial(). - Patch by Brian Thorne. - -- Issue #16140: The subprocess module no longer double closes its child - subprocess.PIPE parent file descriptors on child error prior to exec(). - -- Remove a bare print to stdout from the subprocess module that could have - happened if the child process wrote garbage to its pre-exec error pipe. - -- The subprocess module now raises its own SubprocessError instead of a - RuntimeError in various error situations which should not normally happen. - -- Issue #16327: The subprocess module no longer leaks file descriptors - used for stdin/stdout/stderr pipes to the child when fork() fails. - -- Issue #14396: Handle the odd rare case of waitpid returning 0 when not - expected in subprocess.Popen.wait(). - -- Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access - previously-freed memory. Patch by Serhiy Storchaka. - -- Issue #16357: fix calling accept() on a SSLSocket created through - SSLContext.wrap_socket(). Original patch by Jeff McNeil. - -- Issue #16409: The reporthook callback made by the legacy - urllib.request.urlretrieve API now properly supplies a constant non-zero - block_size as it did in Python 3.2 and 2.7. This matches the behavior of - urllib.request.URLopener.retrieve. - -- Issue #16431: Use the type information when constructing a Decimal subtype - from a Decimal argument. - -- Issue #15641: Clean up deprecated classes from importlib. - Patch by Taras Lyapun. - -- Issue #16350: zlib.decompressobj().decompress() now accumulates data from - successive calls after EOF in unused_data, instead of only saving the argument - to the last call. decompressobj().flush() now correctly sets unused_data and - unconsumed_tail. A bug in the handling of MemoryError when setting the - unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. - -- Issue #12759: sre_parse now raises a proper error when the name of the group - is missing. Initial patch by Serhiy Storchaka. - -- Issue #16152: fix tokenize to ignore whitespace at the end of the code when - no newline is found. Patch by Ned Batchelder. - -- Issue #16284: Prevent keeping unnecessary references to worker functions - in concurrent.futures ThreadPoolExecutor. - -- Issue #16230: Fix a crash in select.select() when one of the lists changes - size while iterated on. Patch by Serhiy Storchaka. - -- Issue #16228: Fix a crash in the json module where a list changes size - while it is being encoded. Patch by Serhiy Storchaka. - -- Issue #16351: New function gc.get_stats() returns per-generation collection - statistics. - -- Issue #14897: Enhance error messages of struct.pack and - struct.pack_into. Patch by Matti M?ki. - -- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. - Patch by Serhiy Storchaka. - -- Issue #12890: cgitb no longer prints spurious

tags in text - mode when the logdir option is specified. - -- Issue #16307: Fix multiprocessing.Pool.map_async not calling its callbacks. - Patch by Janne Karila. - -- Issue #16305: Fix a segmentation fault occurring when interrupting - math.factorial. - -- Issue #16116: Fix include and library paths to be correct when building C - extensions in venvs. - -- Issue #16245: Fix the value of a few entities in html.entities.html5. - -- Issue #16301: Fix the localhost verification in urllib/request.py for ``file://`` - urls. - -- Issue #16250: Fix the invocations of URLError which had misplaced filename - attribute for exception. - -- Issue #10836: Fix exception raised when file not found in urlretrieve - Initial patch by Ezio Melotti. - -- Issue #14398: Fix size truncation and overflow bugs in the bz2 module. - -- Issue #12692: Fix resource leak in urllib.request when talking to an HTTP - server that does not include a ``Connection: close`` header in its responses. - -- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. - Patch by Atsuo Ishimoto. - -- Improve performance of `lzma.LZMAFile` (see also issue #16034). - -- Issue #16220: wsgiref now always calls close() on an iterable response. - Patch by Brent Tubbs. - -- Issue #16270: urllib may hang when used for retrieving files via FTP by using - a context manager. Patch by Giampaolo Rodola'. - -- Issue #16461: Wave library should be able to deal with 4GB wav files, - and sample rate of 44100 Hz. - -- Issue #16176: Properly identify Windows 8 via platform.platform() - -- Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in its response now. Patch by Antoine Pitrou. - -- Issue #16114: The subprocess module no longer provides a misleading error - message stating that args[0] did not exist when either the cwd or executable - keyword arguments specified a path that did not exist. - -- Issue #16169: Fix ctypes.WinError()'s confusion between errno and winerror. - -- Issue #16110: logging.fileConfig now accepts a pre-initialised ConfigParser - instance. - -- Issue #1492704: shutil.copyfile() raises a distinct SameFileError now if - source and destination are the same file. Patch by Atsuo Ishimoto. - -- Issue #13896: Make shelf instances work with 'with' as context managers. - Original patch by Filip Gruszczy?ski. - -- Issue #15417: Add support for csh and fish in venv activation scripts. - -- Issue #14377: ElementTree.write and some of the module-level functions have - a new parameter - *short_empty_elements*. It controls how elements with no - contents are emitted. - -- Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element - element_factory (fixes a regression in SimpleTAL). - -- Issue #9650: List commonly used format codes in time.strftime and - time.strptime docsttings. Original patch by Mike Hoy. - -- Issue #15452: logging configuration socket listener now has a verify option - that allows an application to apply a verification function to the - received configuration data before it is acted upon. - -- Issue #16034: Fix performance regressions in the new `bz2.BZ2File` - implementation. Initial patch by Serhiy Storchaka. - -- `pty.spawn()` now returns the child process status returned by `os.waitpid()`. - -- Issue #15756: `subprocess.poll()` now properly handles `errno.ECHILD` to - return a returncode of 0 when the child has already exited or cannot be waited - on. - -- Issue #15323: Improve failure message of `Mock.assert_called_once_with()`. - -- Issue #16064: ``unittest -m`` claims executable is "python", not "python3". - -- Issue #12376: Pass on parameters in `TextTestResult.__init__()` super call. - -- Issue #15222: Insert blank line after each message in mbox mailboxes. - -- Issue #16013: Fix `csv.Reader` parsing issue with ending quote characters. - Patch by Serhiy Storchaka. - -- Issue #15421: Fix an OverflowError in `Calendar.itermonthdates()` after - `datetime.MAXYEAR`. Patch by C?dric Krier. - -- Issue #16112: platform.architecture does not correctly escape argument to - /usr/bin/file. Patch by David Benjamin. - -- Issue #15970: `xml.etree.ElementTree` now serializes correctly the empty HTML - elements 'meta' and 'param'. - -- Issue #15842: The `SocketIO.{readable,writable,seekable}` methods now raise - ValueError when the file-like object is closed. Patch by Alessandro Moura. - -- Issue #15876: Fix a refleak in the `curses` module: window.encoding. - -- Issue #15881: Fix `atexit` hook in `multiprocessing`. Original patch by Chris - McDonough. - -- Issue #15841: The readable(), writable() and seekable() methods of - `io.BytesIO` and `io.StringIO` objects now raise ValueError when the object - has been closed. Patch by Alessandro Moura. - -- Issue #15447: Use `subprocess.DEVNULL` in webbrowser, instead of opening - `os.devnull` explicitly and leaving it open. - -- Issue #15509: `webbrowser.UnixBrowser` no longer passes empty arguments to - Popen when ``%action`` substitutions produce empty strings. - -- Issue #12776, issue #11839: Call `argparse` type function (specified by - add_argument) only once. Before, the type function was called twice in the - case where the default was specified and the argument was given as well. This - was especially problematic for the FileType type, as a default file would - always be opened, even if a file argument was specified on the command line. - -- Issue #15906: Fix a regression in argparse caused by the preceding change, - when ``action='append'``, ``type='str'`` and ``default=[]``. - -- Issue #16113: Added sha3 module based on the Keccak reference implementation - 3.2. The `hashlib` module has four additional hash algorithms: `sha3_224`, - `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common - code was moved from _hashopenssl.c to hashlib.h. - -- ctypes.call_commethod was removed, since its only usage was in the defunct - samples directory. - -- Issue #16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. - -- Issue #16832: add abc.get_cache_token() to expose cache validity checking - support in ABCMeta. - -IDLE ----- - -- Issue #18429: Format / Format Paragraph, now works when comment blocks - are selected. As with text blocks, this works best when the selection - only includes complete lines. - -- Issue #18226: Add docstrings and unittests for FormatParagraph.py. - Original patches by Todd Rovito and Phil Webster. - -- Issue #18279: Format - Strip trailing whitespace no longer marks a file as - changed when it has not been changed. This fix followed the addition of a - test file originally written by Phil Webster (the issue's main goal). - -- Issue #7136: In the Idle File menu, "New Window" is renamed "New File". - Patch by Tal Einat, Roget Serwy, and Todd Rovito. - -- Remove dead imports of imp. - -- Issue #18196: Avoid displaying spurious SystemExit tracebacks. - -- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition. - -- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". - Original patch by Sarah K. - -- Issue #18055: Move IDLE off of imp and on to importlib. - -- Issue #15392: Create a unittest framework for IDLE. - Initial patch by Rajagopalasarma Jayakrishnan. - See Lib/idlelib/idle_test/README.txt for how to run Idle tests. - -- Issue #14146: Highlight source line while debugging on Windows. - -- Issue #17838: Allow sys.stdin to be reassigned. - -- Issue #13495: Avoid loading the color delegator twice in IDLE. - -- Issue #17798: Allow IDLE to edit new files when specified on command line. - -- Issue #14735: Update IDLE docs to omit "Control-z on Windows". - -- Issue #17532: Always include Options menu for IDLE on OS X. - Patch by Guilherme Sim?es. - -- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit(). - -- Issue #17657: Show full Tk version in IDLE's about dialog. - Patch by Todd Rovito. - -- Issue #17613: Prevent traceback when removing syntax colorizer in IDLE. - -- Issue #1207589: Backwards-compatibility patch for right-click menu in IDLE. - -- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box. - -- Issue #17625: In IDLE, close the replace dialog after it is used. - -- Issue #14254: IDLE now handles readline correctly across shell restarts. - -- Issue #17614: IDLE no longer raises exception when quickly closing a file. - -- Issue #6698: IDLE now opens just an editor window when configured to do so. - -- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer - raises an exception. - -- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - -- Issue #17114: IDLE now uses non-strict config parser. - -- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase - interface and support all mandatory methods and properties. - -- Issue #5066: Update IDLE docs. Patch by Todd Rovito. - -- Issue #16829: IDLE printing no longer fails if there are spaces or other - special characters in the file path. - -- Issue #16491: IDLE now prints chained exception tracebacks. - -- Issue #16819: IDLE method completion now correctly works for bytes literals. - -- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by - Roger Serwy. - -- Issue #16511: Use default IDLE width and height if config param is not valid. - Patch Serhiy Storchaka. - -- Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. - Patch by Todd Rovito. - -- Issue #16123: IDLE - deprecate running without a subprocess. - Patch by Roger Serwy. - -Tests ------ - -- Issue #1666318: Add a test that shutil.copytree() retains directory - permissions. Patch by Catherine Devlin. - -- Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json - and make them discoverable by unittest. Patch by Zachary Ware. - -- Fix a fcntl test case on KFreeBSD, Debian #708653 (Petr Salinger). - -- Issue #18396: Fix spurious test failure in test_signal on Windows when - faulthandler is enabled (Patch by Jeremy Kloth) - -- Issue #17046: Fix broken test_executable_without_cwd in test_subprocess. - -- Issue #15415: Add new temp_dir() and change_cwd() context managers to - test.support, and refactor temp_cwd() to use them. Patch by Chris Jerdonek. - -- Issue #15494: test.support is now a package rather than a module (Initial - patch by Indra Talip) - -- Issue #17944: test_zipfile now discoverable and uses subclassing to - generate tests for different compression types. Fixed a bug with skipping - some tests due to use of exhausted iterators. - -- Issue #18266: test_largefile now works with unittest test discovery and - supports running only selected tests. Patch by Zachary Ware. - -- Issue #17767: test_locale now works with unittest test discovery. - Original patch by Zachary Ware. - -- Issue #18375: Assume --randomize when --randseed is used for running the - testsuite. - -- Issue #11185: Fix test_wait4 under AIX. Patch by S?bastien Sabl?. - -- Issue #18207: Fix test_ssl for some versions of OpenSSL that ignore seconds - in ASN1_TIME fields. - -- Issue #18094: test_uuid no longer reports skipped tests as passed. - -- Issue #17992: Add timeouts to asyncore and asynchat tests so that they won't - accidentally hang. - -- Issue #17833: Fix test_gdb failures seen on machines where debug symbols - for glibc are available (seen on PPC64 Linux). - -- Issue #7855: Add tests for ctypes/winreg for issues found in IronPython. - Initial patch by Dino Viehland. - -- Issue #11078: test___all__ now checks for duplicates in __all__. - Initial patch by R. David Murray. - -- Issue #17712: Fix test_gdb failures on Ubuntu 13.04. - -- Issue #17835: Fix test_io when the default OS pipe buffer size is larger - than one million bytes. - -- Issue #17065: Use process-unique key for winreg tests to avoid failures if - test is run multiple times in parallel (eg: on a buildbot host). - -- Issue #12820: add tests for the xml.dom.minicompat module. - Patch by John Chandler and Phil Connell. - -- Issue #17691: test_univnewlines now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17790: test_set now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17789: test_random now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17779: test_osx_env now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17766: test_iterlen now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17690: test_time now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17692: test_sqlite now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #11995: test_pydoc doesn't import all sys.path modules anymore. - -- Issue #17448: test_sax now skips if there are no xml parsers available - instead of raising an ImportError. - -- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. - Initial patch by Thomas Wouters. - -- Issue #10652: make tcl/tk tests run after __all__ test, patch by - Zachary Ware. - -- Issue #11963: remove human verification from test_parser and test_subprocess. - -- Issue #11732: add a new suppress_crash_popup() context manager to test.support - that disables crash popups on Windows and use it in test_faulthandler and - test_capi. - -- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. - -- Issue #17283: Share code between `__main__.py` and `regrtest.py` in - `Lib/test`. - -- Issue #17249: convert a test in test_capi to use unittest and reap threads. - -- Issue #17107: Test client-side SNI support in urllib.request thanks to - the new server-side SNI support in the ssl module. Initial patch by - Daniel Black. - -- Issue #17041: Fix testing when Python is configured with the - --without-doc-strings. - -- Issue #16923: Fix ResourceWarnings in test_ssl. - -- Issue #15539: Added regression tests for Tools/scripts/pindent.py. - -- Issue #17479: test_io now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17066: test_robotparser now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17334: test_index now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17333: test_imaplib now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17082: test_dbm* now work with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17079: test_ctypes now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17304: test_hash now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17303: test_future* now work with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17163: test_file now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16925: test_configparser now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16918: test_codecs now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16919: test_crypt now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16910: test_bytes, test_unicode, and test_userstring now work with - unittest test discovery. Patch by Zachary Ware. - -- Issue #16905: test_warnings now works with unittest test discovery. - Initial patch by Berker Peksag. - -- Issue #16898: test_bufio now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16888: test_array now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16896: test_asyncore now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16897: test_bisect now works with unittest test discovery. - Initial patch by Zachary Ware. - -- Issue #16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath - now work with unittest test discovery. Patch by Zachary Ware. - -- Issue #16748: test_heapq now works with unittest test discovery. - -- Issue #10646: Tests rearranged for os.samefile/samestat to check for not - just symlinks but also hard links. - -- Issue #15302: Switch regrtest from using getopt to using argparse. - -- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize - options. - -- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for - localhost tests. - -- Issue #16664: Add regression tests for glob's behaviour concerning entries - starting with a ".". Patch by Sebastian Kreft. - -- Issue #13390: The ``-R`` option to regrtest now also checks for memory - allocation leaks, using :func:`sys.getallocatedblocks()`. - -- Issue #16559: Add more tests for the json module, including some from the - official test suite at json.org. Patch by Serhiy Storchaka. - -- Issue #16661: Fix the `os.getgrouplist()` test by not assuming that it gives - the same output as :command:`id -G`. - -- Issue #16115: Add some tests for the executable argument to - subprocess.Popen(). Initial patch by Kushal Das. - -- Issue #16126: PyErr_Format format mismatch in _testcapimodule.c. - Patch by Serhiy Storchaka. - -- Issue #15304: Fix warning message when `os.chdir()` fails inside - `test.support.temp_cwd()`. Patch by Chris Jerdonek. - -- Issue #15802: Fix test logic in `TestMaildir.test_create_tmp()`. Patch by - Serhiy Storchaka. - -- Issue #15557: Added a test suite for the webbrowser module, thanks to Anton - Barkovsky. - -- Issue #16698: Skip posix test_getgroups when built with OS X - deployment target prior to 10.6. - -Build ------ - -- Issue #16067: Add description into MSI file to replace installer's - temporary name. - -- Issue #18257: Fix readlink usage in python-config. Install the python - version again on Darwin. - -- Issue #18481: Add C coverage reporting with gcov and lcov. A new make target - "coverage-report" creates an instrumented Python build, runs unit tests - and creates a HTML. The report can be updated with "make coverage-lcov". - -- Issue #17845: Clarified the message printed when some module are not built. - -- Issue #18256: Compilation fix for recent AIX releases. Patch by - David Edelsohn. - -- Issue #17547: In configure, explicitly pass -Wformat for the benefit for GCC - 4.8. - -- Issue #15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 - on Windows. - -- Issue #17591: Use lowercase filenames when including Windows header files. - Patch by Roumen Petrov. - -- Issue #17550: Fix the --enable-profiling configure switch. - -- Issue #17425: Build with openssl 1.0.1d on Windows. - -- Issue #16754: Fix the incorrect shared library extension on linux. Introduce - two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of - SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. - -- Issue #5033: Fix building of the sqlite3 extension module when the - SQLite library version has "beta" in it. Patch by Andreas Pelme. - -- Issue #17228: Fix building without pymalloc. - -- Issue #3718: Use AC_ARG_VAR to set MACHDEP in configure.ac. - -- Issue #16235: Implement python-config as a shell script. - -- Issue #16769: Remove outdated Visual Studio projects. - -- Issue #17031: Fix running regen in cross builds. - -- Issue #3754: fix typo in pthread AC_CACHE_VAL. - -- Issue #15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; - use _PYTHON_PROJECT_BASE in distutils/sysconfig.py. - -- Drop support for Windows 2000 (changeset e52df05b496a). - -- Issue #17029: Let h2py search the multiarch system include directory. - -- Issue #16953: Fix socket module compilation on platforms with - HAVE_BROKEN_POLL. Patch by Jeffrey Armstrong. - -- Issue #16320: Remove redundant Makefile dependencies for strings and bytes. - -- Cross compiling needs host and build settings. configure no longer - creates a broken PYTHON_FOR_BUILD variable when --build is missing. - -- Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs are - defined in cross compiling mode, too. - -- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. - -- Issue #16593: Have BSD 'make -s' do the right thing, thanks to Daniel Shahaf - -- Issue #16262: fix out-of-src-tree builds, if mercurial is not installed. - -- Issue #15298: ensure _sysconfigdata is generated in build directory, not - source directory. - -- Issue #15833: Fix a regression in 3.3 that resulted in exceptions being - raised if importlib failed to write byte-compiled files. This affected - attempts to build Python out-of-tree from a read-only source directory. - -- Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError - after 2801bf875a24 (see #15801). - -- Issue #16135: Remove OS/2 support. - -- Issue #15819: Make sure we can build Python out-of-tree from a read-only - source directory. (Somewhat related to issue #9860.) - -- Issue #15587: Enable Tk high-resolution text rendering on Macs with - Retina displays. Applies to Tkinter apps, such as IDLE, on OS X - framework builds linked with Cocoa Tk 8.5. - -- Issue #17161: make install now also installs a python3 man page. - -C-API ------ - -- Issue #18351: Fix various issues in a function in importlib provided to help - PyImport_ExecCodeModuleWithPathnames() (and thus by extension - PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx()). - -- Issue #15767: Added PyErr_SetImportErrorSubclass(). - -- PyErr_SetImportError() now sets TypeError when its msg argument is set. - -- Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and - PyObject_CallMethod() now changed to `const char*`. Based on patches by - J?rg M?ller and Lars Buitinck. - -- Issue #17206: Py_CLEAR(), Py_DECREF(), Py_XINCREF() and Py_XDECREF() now - expand their arguments once instead of multiple times. Patch written by Illia - Polosukhin. - -- Issue #17522: Add the PyGILState_Check() API. - -- Issue #17327: Add PyDict_SetDefault. - -- Issue #16881: Fix Py_ARRAY_LENGTH macro for GCC < 3.1. - -- Issue #16505: Remove unused Py_TPFLAGS_INT_SUBCLASS. - -- Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned - (unsigned long and unsigned int) to avoid an undefined behaviour with - Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is - now unsigned too (unsigned long, instead of long). - -- Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified - endianness detection and handling. - -Documentation -------------- - -- Issue #23006: Improve the documentation and indexing of dict.__missing__. - Add an entry in the language datamodel special methods section. - Revise and index its discussion in the stdtypes mapping/dict section. - -- Issue #17701: Improving strftime documentation. - -- Issue #18440: Clarify that `hash()` can truncate the value returned from an - object's custom `__hash__()` method. - -- Issue #17844: Add links to encoders and decoders for bytes-to-bytes codecs. - -- Issue #14097: improve the "introduction" page of the tutorial. - -- Issue #17977: The documentation for the cadefault argument's default value - in urllib.request.urlopen() is fixed to match the code. - -- Issue #6696: add documentation for the Profile objects, and improve - profile/cProfile docs. Patch by Tom Pinckney. - -- Issue #15940: Specify effect of locale on time functions. - -- Issue #17538: Document XML vulnerabilties - -- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. - Patch by Ramchandra Apte - -- Issue #17047: remove doubled words in docs and docstrings - reported by Serhiy Storchaka and Matthew Barnett. - -- Issue #15465: Document the versioning macros in the C API docs rather than - the standard library docs. Patch by Kushal Das. - -- Issue #16406: Combine the pages for uploading and registering to PyPI. - -- Issue #16403: Document how distutils uses the maintainer field in - PKG-INFO. Patch by Jyrki Pulliainen. - -- Issue #16695: Document how glob handles filenames starting with a - dot. Initial patch by Jyrki Pulliainen. - -- Issue #8890: Stop advertising an insecure practice by replacing uses - of the /tmp directory with better alternatives in the documentation. - Patch by Geoff Wilson. - -- Issue #17203: add long option names to unittest discovery docs. - -- Issue #13094: add "Why do lambdas defined in a loop with different values - all return the same result?" programming FAQ. - -- Issue #14901: Update portions of the Windows FAQ. - Patch by Ashish Nitin Patil. - -- Issue #16267: Better document the 3.3+ approach to combining - @abstractmethod with @staticmethod, @classmethod and @property - -- Issue #15209: Clarify exception chaining description in exceptions module - documentation - -- Issue #15990: Improve argument/parameter documentation. - -- Issue #16209: Move the documentation for the str built-in function to a new - str class entry in the "Text Sequence Type" section. - -- Issue #13538: Improve str() and object.__str__() documentation. - -- Issue #16489: Make it clearer that importlib.find_loader() needs parent - packages to be explicitly imported. - -- Issue #16400: Update the description of which versions of a given package - PyPI displays. - -- Issue #15677: Document that zlib and gzip accept a compression level of 0 to - mean 'no compression'. Patch by Brian Brazil. - -- Issue #16197: Update winreg docstrings and documentation to match code. - Patch by Zachary Ware. - -- Issue #8040: added a version switcher to the documentation. Patch by - Yury Selivanov. - -- Issue #16241: Document -X faulthandler command line option. - Patch by Marek ?uppa. - -- Additional comments and some style changes in the concurrent.futures URL - retrieval example - -- Issue #16115: Improve subprocess.Popen() documentation around args, shell, - and executable arguments. - -- Issue #13498: Clarify docs of os.makedirs()'s exist_ok argument. Done with - great native-speaker help from R. David Murray. - -- Issue #15533: Clarify docs and add tests for `subprocess.Popen()`'s cwd - argument. - -- Issue #15979: Improve timeit documentation. - -- Issue #16036: Improve documentation of built-in `int()`'s signature and - arguments. - -- Issue #15935: Clarification of `argparse` docs, re: add_argument() type and - default arguments. Patch contributed by Chris Jerdonek. - -- Issue #11964: Document a change in v3.2 to the behavior of the indent - parameter of json encoding operations. - -- Issue #15116: Remove references to appscript as it is no longer being - supported. - -Tools/Demos ------------ - -- Issue #18817: Fix a resource warning in Lib/aifc.py demo. Patch by - Vajrasky Kok. - -- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. - -- Issue #18448: Fix a typo in Tools/demo/eiffel.py. - -- Issue #18457: Fixed saving of formulas and complex numbers in - Tools/demo/ss1.py. - -- Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by - F?vry Thibault. - -- Issue #12990: The "Python Launcher" on OSX could not launch python scripts - that have paths that include wide characters. - -- Issue #15239: Make mkstringprep.py work again on Python 3. - -- Issue #17028: Allowed Python arguments to be supplied to the Windows - launcher. - -- Issue #17156: pygettext.py now detects the encoding of source files and - correctly writes and escapes non-ascii characters. - -- Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now - pindent.py works with a "with" statement. pindent.py no longer produces - improper indentation. pindent.py now works with continued lines broken after - "class" or "def" keywords and with continuations at the start of line. - -- Issue #11797: Add a 2to3 fixer that maps reload() to imp.reload(). - -- Issue #10966: Remove the concept of unexpected skipped tests. - -- Issue #9893: Removed the Misc/Vim directory. - -- Removed the Misc/TextMate directory. - -- Issue #16245: Add the Tools/scripts/parse_html5_entities.py script to parse - the list of HTML5 entities and update the html.entities.html5 dictionary. - -- Issue #15378: Fix Tools/unicode/comparecodecs.py. Patch by Serhiy Storchaka. - -- Issue #16549: Make json.tool work again on Python 3 and add tests. - Initial patch by Berker Peksag and Serhiy Storchaka. - -- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. - Patch by Serhiy Storchaka. - -Windows -------- - -- Issue #18569: The installer now adds .py to the PATHEXT variable when extensions - are registered. Patch by Paul Moore. - **(For information about older versions, consult the HISTORY file.)** diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.6.0 release candidate 2 -================================================ +This is Python version 3.6.0 +============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. @@ -170,8 +170,8 @@ Install that version using "make install". Install all other versions using "make altinstall". -For example, if you want to install Python 2.6, 2.7 and 3.6 with 2.7 being the -primary version, you would execute "make install" in your 2.7 build directory +For example, if you want to install Python 2.7, 3.5, and 3.6 with 3.6 being the +primary version, you would execute "make install" in your 3.6 build directory and "make altinstall" in the others. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 04:20:09 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 23 Dec 2016 09:20:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy42IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E6=2E0_release_engineering_head?= Message-ID: <20161223092009.3523.44936.AAB22661@psf.io> https://hg.python.org/cpython/rev/ae873d16d0c4 changeset: 105790:ae873d16d0c4 branch: 3.6 parent: 105784:20ef70c2b3d0 parent: 105789:a7844c655bad user: Ned Deily date: Thu Dec 22 19:50:19 2016 -0500 summary: Merge 3.6.0 release engineering head files: .hgtags | 1 + Doc/whatsnew/3.6.rst | 3 + Misc/HISTORY | 4301 +++++++++++++++++++++++++++++ Misc/NEWS | 4348 +----------------------------- README | 6 +- 5 files changed, 4336 insertions(+), 4323 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -176,3 +176,4 @@ 18496abdb3d5c2730a659b747a89261b2219fecf v3.6.0b4 29a273eee9a523ee178f6a66c4ac9d317c8fc84f v3.6.0rc1 800a67f7806de45a7abd5273359e704bf147c079 v3.6.0rc2 +41df79263a11f2429d1dd0cfe12553de3dcb5508 v3.6.0 diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -47,6 +47,9 @@ when researching a change. This article explains the new features in Python 3.6, compared to 3.5. +Python 3.6 was released on December 23, 2016. ?See the +`changelog `_ for a full +list of changes. .. seealso:: diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -8,6 +8,4307 @@ ====================================================================== +What's New in Python 3.4.0? +=========================== + +Release date: 2014-03-16 + +Library +------- + +- Issue #20939: Fix test_geturl failure in test_urllibnet due to + new redirect of http://www.python.org/ to https://www.python.org. + +Documentation +------------- + +- Merge in all documentation changes since branching 3.4.0rc1. + + +What's New in Python 3.4.0 release candidate 3? +=============================================== + +Release date: 2014-03-09 + +Core and Builtins +----------------- + +- Issue #20786: Fix signatures for dict.__delitem__ and + property.__delete__ builtins. + +Library +------- + +- Issue #20839: Don't trigger a DeprecationWarning in the still supported + pkgutil.get_loader() API when __loader__ isn't set on a module (nor + when pkgutil.find_loader() is called directly). + +Build +----- + +- Issue #14512: Launch pydoc -b instead of pydocgui.pyw on Windows. + +- Issue #20748: Uninstalling pip does not leave behind the pyc of + the uninstaller anymore. + +- Issue #20568: The Windows installer now installs the unversioned ``pip`` + command in addition to the versioned ``pip3`` and ``pip3.4`` commands. + +- Issue #20757: The ensurepip helper for the Windows uninstaller now skips + uninstalling pip (rather than failing) if the user has updated pip to a + different version from the one bundled with ensurepip. + +- Issue #20465: Update OS X and Windows installer builds to use + SQLite 3.8.3.1. + + +What's New in Python 3.4.0 release candidate 2? +=============================================== + +Release date: 2014-02-23 + +Core and Builtins +----------------- + +- Issue #20625: Parameter names in __annotations__ were not mangled properly. + Discovered by Jonas Wielicki, patch by Yury Selivanov. + +- Issue #20261: In pickle, lookup __getnewargs__ and __getnewargs_ex__ on the + type of the object. + +- Issue #20619: Give the AST nodes of keyword-only arguments a column and line + number. + +- Issue #20526: Revert changes of issue #19466 which introduces a regression: + don't clear anymore the state of Python threads early during the Python + shutdown. + +Library +------- + +- Issue #20710: The pydoc summary line no longer displays the "self" parameter + for bound methods. + +- Issue #20566: Change asyncio.as_completed() to use a Queue, to + avoid O(N**2) behavior. + +- Issue #20704: Implement new debug API in asyncio. Add new methods + BaseEventLoop.set_debug() and BaseEventLoop.get_debug(). + Add support for setting 'asyncio.tasks._DEBUG' variable with + 'PYTHONASYNCIODEBUG' environment variable. + +- asyncio: Refactoring and fixes: BaseEventLoop.sock_connect() raises an + error if the address is not resolved; use __slots__ in Handle and + TimerHandle; as_completed() and wait() raise TypeError if the passed + list of Futures is a single Future; call_soon() and other 'call_*()' + functions raise TypeError if the passed callback is a coroutine + function; _ProactorBasePipeTransport uses _FlowControlMixin; + WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol() + to consider pausing receiving if the watermark limits have changed; + fix _check_resolved_address() for IPv6 address; and other minor + improvements, along with multiple documentation updates. + +- Issue #20684: Fix inspect.getfullargspec() to not to follow __wrapped__ + chains. Make its behaviour consistent with bound methods first argument. + Patch by Nick Coghlan and Yury Selivanov. + +- Issue #20681: Add new error handling API in asyncio. New APIs: + loop.set_exception_handler(), loop.default_exception_handler(), and + loop.call_exception_handler(). + +- Issue #20673: Implement support for UNIX Domain Sockets in asyncio. + New APIs: loop.create_unix_connection(), loop.create_unix_server(), + streams.open_unix_connection(), and streams.start_unix_server(). + +- Issue #20616: Add a format() method to tracemalloc.Traceback. + +- Issue #19744: the ensurepip installation step now just prints a warning to + stderr rather than failing outright if SSL/TLS is unavailable. This allows + local installation of POSIX builds without SSL/TLS support. + +- Issue #20594: Avoid name clash with the libc function posix_close. + +Build +----- + +- Issue #20641: Run MSI custom actions (pip installation, pyc compilation) + with the NoImpersonate flag, to support elevated execution (UAC). + +- Issue #20221: Removed conflicting (or circular) hypot definition when + compiled with VS 2010 or above. Initial patch by Tabrez Mohammed. + +- Issue #20609: Restored the ability to build 64-bit Windows binaries on + 32-bit Windows, which was broken by the change in issue #19788. + + +What's New in Python 3.4.0 release candidate 1? +=============================================== + +Release date: 2014-02-10 + +Core and Builtins +----------------- + +- Issue #19255: The builtins module is restored to initial value before + cleaning other modules. The sys and builtins modules are cleaned last. + +- Issue #20588: Make Python-ast.c C89 compliant. + +- Issue #20437: Fixed 22 potential bugs when deleting object references. + +- Issue #20500: Displaying an exception at interpreter shutdown no longer + risks triggering an assertion failure in PyObject_Str. + +- Issue #20538: UTF-7 incremental decoder produced inconsistent string when + input was truncated in BASE64 section. + +- Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the + internal codec marking system added for issue #19619 to throw LookupError + for known non-text encodings at stream construction time. The existing + output type checks remain in place to deal with unmarked third party + codecs. + +- Issue #17162: Add PyType_GetSlot. + +- Issue #20162: Fix an alignment issue in the siphash24() hash function which + caused a crash on PowerPC 64-bit (ppc64). + +Library +------- + +- Issue #20530: The signatures for slot builtins have been updated + to reflect the fact that they only accept positional-only arguments. + +- Issue #20517: Functions in the os module that accept two filenames + now register both filenames in the exception on failure. + +- Issue #20563: The ipaddress module API is now considered stable. + +- Issue #14983: email.generator now always adds a line end after each MIME + boundary marker, instead of doing so only when there is an epilogue. This + fixes an RFC compliance bug and solves an issue with signed MIME parts. + +- Issue #20540: Fix a performance regression (vs. Python 3.2) when layering + a multiprocessing Connection over a TCP socket. For small payloads, Nagle's + algorithm would introduce idle delays before the entire transmission of a + message. + +- Issue #16983: the new email header parsing code will now decode encoded words + that are (incorrectly) surrounded by quotes, and register a defect. + +- Issue #19772: email.generator no longer mutates the message object when + doing a down-transform from 8bit to 7bit CTEs. + +- Issue #20536: the statistics module now correctly handle Decimal instances + with positive exponents + +- Issue #18805: the netmask/hostmask parsing in ipaddress now more reliably + filters out illegal values and correctly allows any valid prefix length. + +- Issue #20481: For at least Python 3.4, the statistics module will require + that all inputs for a single operation be of a single consistent type, or + else a mixed of ints and a single other consistent type. This avoids + some interoperability issues that arose with the previous approach of + coercing to a suitable common type. + +- Issue #20478: the statistics module now treats collections.Counter inputs + like any other iterable. + +- Issue #17369: get_filename was raising an exception if the filename + parameter's RFC2231 encoding was broken in certain ways. This was + a regression relative to python2. + +- Issue #20013: Some imap servers disconnect if the current mailbox is + deleted, and imaplib did not handle that case gracefully. Now it + handles the 'bye' correctly. + +- Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3 + version. That is, do *not* raise an error if unicode is passed to + email.message.Message.set_payload. + +- Issue #20476: If a non-compat32 policy is used with any of the email parsers, + EmailMessage is now used as the factory class. The factory class should + really come from the policy; that will get fixed in 3.5. + +- Issue #19920: TarFile.list() no longer fails when outputs a listing + containing non-encodable characters. Based on patch by Vajrasky Kok. + +- Issue #20515: Fix NULL pointer dereference introduced by issue #20368. + +- Issue #19186: Restore namespacing of expat symbols inside the pyexpat module. + +- Issue #20053: ensurepip (and hence venv) are no longer affected by the + settings in the default pip configuration file. + +- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the + debug output every time it is called, regardless of the compilation cache. + +- Issue #20368: The null character now correctly passed from Tcl to Python. + Improved error handling in variables-related commands. + +- Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline + translation settings. + +- tracemalloc: Fix slicing traces and fix slicing a traceback. + +- Issue #20354: Fix an alignment issue in the tracemalloc module on 64-bit + platforms. Bug seen on 64-bit Linux when using "make profile-opt". + +- Issue #17159: inspect.signature now accepts duck types of functions, + which adds support for Cython functions. Initial patch by Stefan Behnel. + +- Issue #18801: Fix inspect.classify_class_attrs to correctly classify + object.__new__ and object.__init__. + +- Fixed cmath.isinf's name in its argument parsing code. + +- Issue #20311, #20452: poll and epoll now round the timeout away from zero, + instead of rounding towards zero, in select and selectors modules: + select.epoll.poll(), selectors.PollSelector.poll() and + selectors.EpollSelector.poll(). For example, a timeout of one microsecond + (1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded to + zero. However, the granularity property and asyncio's resolution feature + were removed again. + +- asyncio: Some refactoring; various fixes; add write flow control to + unix pipes; Future.set_exception() instantiates the exception + argument if it is a class; improved proactor pipe transport; support + wait_for(f, None); don't log broken/disconnected pipes; use + ValueError instead of assert for forbidden subprocess_{shell,exec} + arguments; added a convenience API for subprocess management; added + StreamReader.at_eof(); properly handle duplicate coroutines/futures + in gather(), wait(), as_completed(); use a bytearray for buffering + in StreamReader; and more. + +- Issue #20288: fix handling of invalid numeric charrefs in HTMLParser. + +- Issue #20424: Python implementation of io.StringIO now supports lone surrogates. + +- Issue #20308: inspect.signature now works on classes without user-defined + __init__ or __new__ methods. + +- Issue #20372: inspect.getfile (and a bunch of other inspect functions that + use it) doesn't crash with unexpected AttributeError on classes defined in C + without __module__. + +- Issue #20356: inspect.signature formatting uses '/' to separate + positional-only parameters from others. + +- Issue #20223: inspect.signature now supports methods defined with + functools.partialmethods. + +- Issue #19456: ntpath.join() now joins relative paths correctly when a drive + is present. + +- Issue #19077: tempfile.TemporaryDirectory cleanup no longer fails when + called during shutdown. Emitting resource warning in __del__ no longer fails. + Original patch by Antoine Pitrou. + +- Issue #20394: Silence Coverity warning in audioop module. + +- Issue #20367: Fix behavior of concurrent.futures.as_completed() for + duplicate arguments. Patch by Glenn Langford. + +- Issue #8260: The read(), readline() and readlines() methods of + codecs.StreamReader returned incomplete data when were called after + readline() or read(size). Based on patch by Amaury Forgeot d'Arc. + +- Issue #20105: the codec exception chaining now correctly sets the + traceback of the original exception as its __traceback__ attribute. + +- Issue #17481: inspect.getfullargspec() now uses inspect.signature() API. + +- Issue #15304: concurrent.futures.wait() can block forever even if + Futures have completed. Patch by Glenn Langford. + +- Issue #14455: plistlib: fix serializing integers in the range + of an unsigned long long but outside of the range of signed long long for + binary plist files. + +IDLE +---- + +- Issue #20406: Use Python application icons for Idle window title bars. + Patch mostly by Serhiy Storchaka. + +- Update the python.gif icon for the Idle classbrowser and pathbowser + from the old green snake to the new blue and yellow snakes. + +- Issue #17721: Remove non-functional configuration dialog help button until we + make it actually gives some help when clicked. Patch by Guilherme Sim?es. + +Tests +----- + +- Issue #20532: Tests which use _testcapi now are marked as CPython only. + +- Issue #19920: Added tests for TarFile.list(). Based on patch by Vajrasky Kok. + +- Issue #19990: Added tests for the imghdr module. Based on patch by + Claudiu Popa. + +- Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+. + +Tools/Demos +----------- + +- Issue #20530: Argument Clinic's signature format has been revised again. + The new syntax is highly human readable while still preventing false + positives. The syntax also extends Python syntax to denote "self" and + positional-only parameters, allowing inspect.Signature objects to be + totally accurate for all supported builtins in Python 3.4. + +- Issue #20456: Argument Clinic now observes the C preprocessor conditional + compilation statements of the C files it parses. When a Clinic block is + inside a conditional code, it adjusts its output to match, including + automatically generating an empty methoddef macro. + +- Issue #20456: Cloned functions in Argument Clinic now use the correct + name, not the name of the function they were cloned from, for text + strings inside generated code. + +- Issue #20456: Fixed Argument Clinic's test suite and "--converters" feature. + +- Issue #20456: Argument Clinic now allows specifying different names + for a parameter in Python and C, using "as" on the parameter line. + +- Issue #20326: Argument Clinic now uses a simple, unique signature to + annotate text signatures in docstrings, resulting in fewer false + positives. "self" parameters are also explicitly marked, allowing + inspect.Signature() to authoritatively detect (and skip) said parameters. + +- Issue #20326: Argument Clinic now generates separate checksums for the + input and output sections of the block, allowing external tools to verify + that the input has not changed (and thus the output is not out-of-date). + +Build +----- + +- Issue #20465: Update SQLite shipped with OS X installer to 3.8.3. + +C-API +----- + +- Issue #20517: Added new functions allowing OSError exceptions to reference + two filenames instead of one: PyErr_SetFromErrnoWithFilenameObjects() and + PyErr_SetExcFromWindowsErrWithFilenameObjects(). + +Documentation +------------- + +- Issue #20488: Change wording to say importlib is *the* implementation of + import instead of just *an* implementation. + +- Issue #6386: Clarify in the tutorial that specifying a symlink to execute + means the directory containing the executed script and not the symlink is + added to sys.path. + + +What's New in Python 3.4.0 Beta 3? +================================== + +Release date: 2014-01-26 + +Core and Builtins +----------------- + +- Issue #20189: Four additional builtin types (PyTypeObject, + PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) + have been modified to provide introspection information for builtins. + +- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and + IndentationError. + +- Issue #2382: SyntaxError cursor "^" is now written at correct position in most + cases when multibyte characters are in line (before "^"). This still not + works correctly with wide East Asian characters. + +- Issue #18960: The first line of Python script could be executed twice when + the source encoding was specified on the second line. Now the source encoding + declaration on the second line isn't effective if the first line contains + anything except a comment. 'python -x' works now again with files with the + source encoding declarations, and can be used to make Python batch files + on Windows. + +Library +------- + +- asyncio: Various improvements and small changes not all covered by + issues listed below. E.g. wait_for() now cancels the inner task if + the timeout occcurs; tweaked the set of exported symbols; renamed + Empty/Full to QueueEmpty/QueueFull; "with (yield from lock)" now + uses a separate context manager; readexactly() raises if not enough + data was read; PTY support tweaks. + +- Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum + between the resolution of the BaseEventLoop.time() method and the resolution + of the selector. The granuarility is used in the scheduler to round time and + deadline. + +- Issue #20311: selectors: Add a resolution attribute to BaseSelector. + +- Issue #20189: unittest.mock now no longer assumes that any object for + which it could get an inspect.Signature is a callable written in Python. + Fix courtesy of Michael Foord. + +- Issue #20317: ExitStack.__exit__ could create a self-referential loop if an + exception raised by a cleanup operation already had its context set + correctly (for example, by the @contextmanager decorator). The infinite + loop this caused is now avoided by checking if the expected context is + already set before trying to fix it. + +- Issue #20374: Fix build with GNU readline >= 6.3. + +- Issue #20262: Warnings are raised now when duplicate names are added in the + ZIP file or too long ZIP file comment is truncated. + +- Issue #20165: The unittest module no longer considers tests marked with + @expectedFailure successful if they pass. + +- Issue #18574: Added missing newline in 100-Continue reply from + http.server.BaseHTTPRequestHandler. Patch by Nikolaus Rath. + +- Issue #20270: urllib.urlparse now supports empty ports. + +- Issue #20243: TarFile no longer raise ReadError when opened in write mode. + +- Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't + write complete output on close. + +- Issue #20245: The open functions in the tarfile module now correctly handle + empty mode. + +- Issue #20242: Fixed basicConfig() format strings for the alternative + formatting styles. Thanks to kespindler for the bug report and patch. + +- Issue #20246: Fix buffer overflow in socket.recvfrom_into. + +- Issues #20206 and #5803: Fix edge case in email.quoprimime.encode where it + truncated lines ending in a character needing encoding but no newline by + using a more efficient algorithm that doesn't have the bug. + +- Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in + modules and in documentation. Initial patch contributed by Vajrasky Kok. + +- Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri() + functions now conform to PEP 3333 when handle non-ASCII URLs. + +- Issue #19097: Raise the correct Exception when cgi.FieldStorage is given an + invalid fileobj. + +- Issue #20152: Ported Python/import.c over to Argument Clinic. + +- Issue #13107: argparse and optparse no longer raises an exception when output + a help on environment with too small COLUMNS. Based on patch by + Elazar Gershuni. + +- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly + asked for. + +- Issue #18960: The tokenize module now ignore the source encoding declaration + on the second line if the first line contains anything except a comment. + +- Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU + consumption. + +- Issue #20113: os.readv() and os.writev() now raise an OSError exception on + error instead of returning -1. + +- Issue #19719: Make importlib.abc.MetaPathFinder.find_module(), + PathEntryFinder.find_loader(), and Loader.load_module() use PEP 451 APIs to + help with backwards-compatibility. + +- Issue #20144: inspect.Signature now supports parsing simple symbolic + constants as parameter default values in __text_signature__. + +- Issue #20072: Fixed multiple errors in tkinter with wantobjects is False. + +- Issue #20229: Avoid plistlib deprecation warning in platform.mac_ver(). + +- Issue #14455: Fix some problems with the new binary plist support in plistlib. + +IDLE +---- + +- Issue #17390: Add Python version to Idle editor window title bar. + Original patches by Edmond Burnett and Kent Johnson. + +- Issue #18960: IDLE now ignores the source encoding declaration on the second + line if the first line contains anything except a comment. + +Tests +----- + +- Issue #20358: Tests for curses.window.overlay and curses.window.overwrite + no longer specify min{row,col} > max{row,col}. + +- Issue #19804: The test_find_mac test in test_uuid is now skipped if the + ifconfig executable is not available. + +- Issue #19886: Use better estimated memory requirements for bigmem tests. + +Tools/Demos +----------- + +- Issue #20390: Argument Clinic's "file" output preset now defaults to + "{dirname}/clinic/{basename}.h". + +- Issue #20390: Argument Clinic's "class" directive syntax has been extended + with two new required arguments: "typedef" and "type_object". + +- Issue #20390: Argument Clinic: If __new__ or __init__ functions didn't use + kwargs (or args), the PyArg_NoKeywords (or PyArg_NoPositional) calls + generated are only run when the type object is an exact match. + +- Issue #20390: Argument Clinic now fails if you have required parameters after + optional parameters. + +- Issue #20390: Argument Clinic converters now have a new template they can + inject code into: "modifiers". Code put there is run in the parsing + function after argument parsing but before the call to the impl. + +- Issue #20376: Argument Clinic now escapes backslashes in docstrings. + +- Issue #20381: Argument Clinic now sanity checks the default argument when + c_default is also specified, providing a nice failure message for + disallowed values. + +- Issue #20189: Argument Clinic now ensures that parser functions for + __new__ are always of type newfunc, the type of the tp_new slot. + Similarly, parser functions for __init__ are now always of type initproc, + the type of tp_init. + +- Issue #20189: Argument Clinic now suppresses the docstring for __new__ + and __init__ functions if no docstring is provided in the input. + +- Issue #20189: Argument Clinic now suppresses the "self" parameter in the + impl for @staticmethod functions. + +- Issue #20294: Argument Clinic now supports argument parsing for __new__ and + __init__ functions. + +- Issue #20299: Argument Clinic custom converters may now change the default + value of c_default and py_default with a class member. + +- Issue #20287: Argument Clinic's output is now configurable, allowing + delaying its output or even redirecting it to a separate file. + +- Issue #20226: Argument Clinic now permits simple expressions + (e.g. "sys.maxsize - 1") as default values for parameters. + +- Issue #19936: Added executable bits or shebang lines to Python scripts which + requires them. Disable executable bits and shebang lines in test and + benchmark files in order to prevent using a random system python, and in + source files of modules which don't provide command line interface. Fixed + shebang lines in the unittestgui and checkpip scripts. + +- Issue #20268: Argument Clinic now supports cloning the parameters and + return converter of existing functions. + +- Issue #20228: Argument Clinic now has special support for class special + methods. + +- Issue #20214: Fixed a number of small issues and documentation errors in + Argument Clinic (see issue for details). + +- Issue #20196: Fixed a bug where Argument Clinic did not generate correct + parsing code for functions with positional-only parameters where all arguments + are optional. + +- Issue #18960: 2to3 and the findnocoding.py script now ignore the source + encoding declaration on the second line if the first line contains anything + except a comment. + +- Issue #19723: The marker comments Argument Clinic uses have been changed + to improve readability. + +- Issue #20157: When Argument Clinic renames a parameter because its name + collides with a C keyword, it no longer exposes that rename to PyArg_Parse. + +- Issue #20141: Improved Argument Clinic's support for the PyArg_Parse "O!" + format unit. + +- Issue #20144: Argument Clinic now supports simple symbolic constants + as parameter default values. + +- Issue #20143: The line numbers reported in Argument Clinic errors are + now more accurate. + +- Issue #20142: Py_buffer variables generated by Argument Clinic are now + initialized with a default value. + +Build +----- + +- Issue #12837: Silence a tautological comparison warning on OS X under Clang in + socketmodule.c. + + +What's New in Python 3.4.0 Beta 2? +================================== + +Release date: 2014-01-05 + +Core and Builtins +----------------- + +- Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. + +- Issue #19526: Exclude all new API from the stable ABI. Exceptions can be + made if a need is demonstrated. + +- Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" + argument is not in range [0; 255]. + +- Issue #19995: %c, %o, %x, and %X now issue a DeprecationWarning on non-integer + input; reworded docs to clarify that an integer type should define both __int__ + and __index__. + +- Issue #19787: PyThread_set_key_value() now always set the value. In Python + 3.3, the function did nothing if the key already exists (if the current value + is a non-NULL pointer). + +- Issue #14432: Remove the thread state field from the frame structure. Fix a + crash when a generator is created in a C thread that is destroyed while the + generator is still used. The issue was that a generator contains a frame, and + the frame kept a reference to the Python state of the destroyed C thread. The + crash occurs when a trace function is setup. + +- Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python + has no concrete GIL. If PyGILState_Ensure() is called from a new thread for + the first time and PyEval_InitThreads() was not called yet, a GIL needs to be + created. + +- Issue #17576: Deprecation warning emitted now when __int__() or __index__() + return not int instance. + +- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes. + +- Issue #19736: Add module-level statvfs constants defined for GNU/glibc + based systems. + +- Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder. + +- Issue #19729: In str.format(), fix recursive expansion in format spec. + +- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2 + billion characters) input strings in _Py_dg_strtod. + +Library +------- + +- Issue #20154: Deadlock in asyncio.StreamReader.readexactly(). + +- Issue #16113: Remove sha3 module again. + +- Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix. + +- Fix breakage in TestSuite.countTestCases() introduced by issue #11798. + +- Issue #20108: Avoid parameter name clash in inspect.getcallargs(). + +- Issue #19918: Fix PurePath.relative_to() under Windows. + +- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl + module, rather than silently let them emit clear text data. + +- Issue #20046: Locale alias table no longer contains entities which can be + calculated. Generalized support of the euro modifier. + +- Issue #20027: Fixed locale aliases for devanagari locales. + +- Issue #20067: Tkinter variables now work when wantobjects is false. + +- Issue #19020: Tkinter now uses splitlist() instead of split() in configure + methods. + +- Issue #19744: ensurepip now provides a better error message when Python is + built without SSL/TLS support (pip currently requires that support to run, + even if only operating with local wheel files) + +- Issue #19734: ensurepip now ignores all pip environment variables to avoid + odd behaviour based on user configuration settings + +- Fix TypeError on "setup.py upload --show-response". + +- Issue #20045: Fix "setup.py register --list-classifiers". + +- Issue #18879: When a method is looked up on a temporary file, avoid closing + the file before the method is possibly called. + +- Issue #20037: Avoid crashes when opening a text file late at interpreter + shutdown. + +- Issue #19967: Thanks to the PEP 442, asyncio.Future now uses a + destructor to log uncaught exceptions, instead of the dedicated + _TracebackLogger class. + +- Added a Task.current_task() class method to asyncio. + +- Issue #19850: Set SA_RESTART in asyncio when registering a signal + handler to limit EINTR occurrences. + +- Implemented write flow control in asyncio for proactor event loop (Windows). + +- Change write buffer in asyncio use to avoid O(N**2) behavior. Make + write()/sendto() accept bytearray/memoryview. + +- Issue #20034: Updated alias mapping to most recent locale.alias file + from X.org distribution using makelocalealias.py. + +- Issue #5815: Fixed support for locales with modifiers. Fixed support for + locale encodings with hyphens. + +- Issue #20026: Fix the sqlite module to handle correctly invalid isolation + level (wrong type). + +- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and + quotechar fields. Original patch by Vajrasky Kok. + +- Issue #19855: uuid.getnode() on Unix now looks on the PATH for the + executables used to find the mac address, with /sbin and /usr/sbin as + fallbacks. + +- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection. + Original patch by Simon Sapin. + +- Issue #19946: multiprocessing now uses runpy to initialize __main__ in + child processes when necessary, allowing it to correctly handle scripts + without suffixes and submodules that use explicit relative imports or + otherwise rely on parent modules being correctly imported prior to + execution. + +- Issue #19921: When Path.mkdir() is called with parents=True, any missing + parent is created with the default permissions, ignoring the mode argument + (mimicking the POSIX "mkdir -p" command). + +- Issue #19887: Improve the Path.resolve() algorithm to support certain + symlink chains. + +- Issue #19912: Fixed numerous bugs in ntpath.splitunc(). + +- Issue #19911: ntpath.splitdrive() now correctly processes the '?' character + (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE). + +- Issue #19532: python -m compileall with no filename/directory arguments now + respects the -f and -q flags instead of ignoring them. + +- Issue #19623: Fixed writing to unseekable files in the aifc module. + +- Issue #19946: multiprocessing.spawn now raises ImportError when the module to + be used as the main module cannot be imported. + +- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX. + Fixed integer overflow in the eventmask parameter. + +- Issue #19063: if a Charset's body_encoding was set to None, the email + package would generate a message claiming the Content-Transfer-Encoding + was 7bit, and produce garbage output for the content. This now works. + A couple of other set_payload mishandlings of non-ASCII are also fixed. + In addition, calling set_payload with a string argument without + specifying a charset now raises an error (this is a new error in 3.4). + +- Issue #15475: Add __sizeof__ implementations for itertools objects. + +- Issue #19944: Fix importlib.find_spec() so it imports parents as needed + and move the function to importlib.util. + +- Issue #19880: Fix a reference leak in unittest.TestCase. Explicitly break + reference cycles between frames and the _Outcome instance. + +- Issue #17429: platform.linux_distribution() now decodes files from the UTF-8 + encoding with the surrogateescape error handler, instead of decoding from the + locale encoding in strict mode. It fixes the function on Fedora 19 which is + probably the first major distribution release with a non-ASCII name. Patch + written by Toshio Kuratomi. + +- Issue #19343: Expose FreeBSD-specific APIs in resource module. Original + patch by Koobs. + +- Issue #19929: Call os.read with 32768 within subprocess.Popen.communicate + rather than 4096 for efficiency. A microbenchmark shows Linux and OS X + both using ~50% less cpu time this way. + +- Issue #19506: Use a memoryview to avoid a data copy when piping data + to stdin within subprocess.Popen.communicate. 5-10% less cpu usage. + +- Issue #19876: selectors unregister() no longer raises ValueError or OSError + if the FD is closed (as long as it was registered). + +- Issue #19908: pathlib now joins relative Windows paths correctly when a drive + is present. Original patch by Antoine Pitrou. + +- Issue #19296: Silence compiler warning in dbm_open + +- Issue #6784: Strings from Python 2 can now be unpickled as bytes + objects by setting the encoding argument of Unpickler to be 'bytes'. + Initial patch by Merlijn van Deen. + +- Issue #19839: Fix regression in bz2 module's handling of non-bzip2 data at + EOF, and analogous bug in lzma module. + +- Issue #19881: Fix pickling bug where cpickle would emit bad pickle data for + large bytes string (i.e., with size greater than 2**32-1). + +- Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when + no exception detail exists (no colon following the exception's name, or + a colon does follow but no text follows the colon). + +- Issue #19927: Add __eq__ to path-based loaders in importlib. + +- Issue #19827: On UNIX, setblocking() and settimeout() methods of + socket.socket can now avoid a second syscall if the ioctl() function can be + used, or if the non-blocking flag of the socket is unchanged. + +- Issue #19785: smtplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19784: poplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19783: nntplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19782: imaplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #20123: Fix pydoc.synopsis() for "binary" modules. + +- Issue #19834: Support unpickling of exceptions pickled by Python 2. + +- Issue #19781: ftplib now supports SSLContext.check_hostname and server name + indication for TLS/SSL connections. + +- Issue #19509: Add SSLContext.check_hostname to match the peer's certificate + with server_hostname on handshake. + +- Issue #15798: Fixed subprocess.Popen() to no longer fail if file + descriptor 0, 1 or 2 is closed. + +- Issue #17897: Optimized unpickle prefetching. + +- Issue #3693: Make the error message more helpful when the array.array() + constructor is given a str. Move the array module typecode documentation to + the docstring of the constructor. + +- Issue #19088: Fixed incorrect caching of the copyreg module in + object.__reduce__() and object.__reduce_ex__(). + +- Issue #19698: Removed exec_module() methods from + importlib.machinery.BuiltinImporter and ExtensionFileLoader. + +- Issue #18864: Added a setter for ModuleSpec.has_location. + +- Fixed _pickle.Unpickler to not fail when loading empty strings as + persistent IDs. + +- Issue #11480: Fixed copy.copy to work with classes with custom metaclasses. + Patch by Daniel Urban. + +- Issue #6477: Added support for pickling the types of built-in singletons + (i.e., Ellipsis, NotImplemented, None). + +- Issue #19713: Add remaining PEP 451-related deprecations and move away + from using find_module/find_loaer/load_module. + +- Issue #19708: Update pkgutil to use the new importer APIs. + +- Issue #19703: Update pydoc to use the new importer APIs. + +- Issue #19851: Fixed a regression in reloading sub-modules. + +- ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME. + +- Issue #19802: Add socket.SO_PRIORITY. + +- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with + virtual interface. Original patch by Kent Frazier. + +- Issue #11489: JSON decoder now accepts lone surrogates. + +- Issue #19545: Avoid chained exceptions while passing stray % to + time.strptime(). Initial patch by Claudiu Popa. + +IDLE +---- + +- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. + +- Issue #19481: print() of string subclass instance in IDLE no longer hangs. + +- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial + shell window is present. + +Tests +----- + +- Issue #20055: Fix test_shutil under Windows with symlink privileges held. + Patch by Vajrasky Kok. + +- Issue #20070: Don't run test_urllib2net when network resources are not + enabled. + +- Issue #19938: Re-enabled test_bug_1333982 in test_dis, which had been + disabled since 3.0 due to the changes in listcomp handling. + +- Issue #19320: test_tcl no longer fails when wantobjects is false. + +- Issue #19919: Fix flaky SSL test. connect_ex() sometimes returns + EWOULDBLOCK on Windows or VMs hosted on Windows. + +- Issue #19912: Added tests for ntpath.splitunc(). + +- Issue #19828: Fixed test_site when the whole suite is run with -S. + +- Issue #19928: Implemented a test for repr() of cell objects. + +- Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and + test_statistics when python is run with -OO. + +- Issue #19926: Removed unneeded test_main from test_abstract_numbers. + Patch by Vajrasky Kok. + +- Issue #19572: More skipped tests explicitly marked as skipped. + +- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound. + +- Issue #19588: Fixed tests in test_random that were silently skipped most + of the time. Patch by Julian Gindi. + +Build +----- + +- Issue #19728: Enable pip installation by default on Windows. + +- Issue #16136: Remove VMS support + +- Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and + run Python's unit tests with multiple versions of OpenSSL. + +- Issue #19922: define _INCLUDE__STDC_A1_SOURCE in HP-UX to include mbstate_t + for mbrtowc(). + +- Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the + pythoncore sub-project. This should prevent build errors due a previous + build's python(_d).exe still running. + +Documentation +------------- + +- Issue #20265: Updated some parts of the Using Windows document. + +- Issue #20266: Updated some parts of the Windows FAQ. + +- Issue #20255: Updated the about and bugs pages. + +- Issue #20253: Fixed a typo in the ipaddress docs that advertised an + illegal attribute name. Found by INADA Naoki. + +- Issue #18840: Introduce the json module in the tutorial, and de-emphasize + the pickle module. + +- Issue #19845: Updated the Compiling Python on Windows section. + +- Issue #19795: Improved markup of True/False constants. + +Tools/Demos +----------- + +- Issue #19659: Added documentation for Argument Clinic. + +- Issue #19976: Argument Clinic METH_NOARGS functions now always + take two parameters. + + +What's New in Python 3.4.0 Beta 1? +================================== + +Release date: 2013-11-24 + +Core and Builtins +----------------- + +- Use the repr of a module name in more places in import, especially + exceptions. + +- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an + internal API to throw LookupError for known non-text encodings, rather + than attempting the encoding or decoding operation and then throwing a + TypeError for an unexpected output type. (The latter mechanism remains + in place for third party non-text encodings) + +- Issue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'. + Python now uses SipHash24 on all major platforms. + +- Issue #12892: The utf-16* and utf-32* encoders no longer allow surrogate code + points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer decode + byte sequences that correspond to surrogate code points. The surrogatepass + error handler now works with the utf-16* and utf-32* codecs. Based on + patches by Victor Stinner and Kang-Hao (Kenny) Lu. + +- Issue #17806: Added keyword-argument support for "tabsize" to + str/bytes.expandtabs(). + +- Issue #17828: Output type errors in str.encode(), bytes.decode() and + bytearray.decode() now direct users to codecs.encode() or codecs.decode() + as appropriate. + +- Issue #17828: The interpreter now attempts to chain errors that occur in + codec processing with a replacement exception of the same type that + includes the codec name in the error message. It ensures it only does this + when the creation of the replacement exception won't lose any information. + +- Issue #19466: Clear the frames of daemon threads earlier during the + Python shutdown to call object destructors. So "unclosed file" resource + warnings are now correctly emitted for daemon threads. + +- Issue #19514: Deduplicate some _Py_IDENTIFIER declarations. + Patch by Andrei Dorian Duma. + +- Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses + of a given type. + +- Issue #19428: zipimport now handles errors when reading truncated or invalid + ZIP archive. + +- Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle + exceptions when merging fast locals into f_locals of a frame. + PyEval_GetLocals() now raises an exception and return NULL on failure. + +- Issue #19369: Optimized the usage of __length_hint__(). + +- Issue #28026: Raise ImportError when exec_module() exists but + create_module() is missing. + +- Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the + Python executable and not removed by the linker's optimizer. + +- Issue #19306: Add extra hints to the faulthandler module's stack + dumps that these are "upside down". + +Library +------- + +- Issue #3158: doctest can now find doctests in functions and methods + written in C. + +- Issue #13477: Added command line interface to the tarfile module. + Original patch by Berker Peksag. + +- Issue #19674: inspect.signature() now produces a correct signature + for some builtins. + +- Issue #19722: Added opcode.stack_effect(), which + computes the stack effect of bytecode instructions. + +- Issue #19735: Implement private function ssl._create_stdlib_context() to + create SSLContext objects in Python's stdlib module. It provides a single + configuration point and makes use of SSLContext.load_default_certs(). + +- Issue #16203: Add re.fullmatch() function and regex.fullmatch() method, + which anchor the pattern at both ends of the string to match. + Original patch by Matthew Barnett. + +- Issue #13592: Improved the repr for regular expression pattern objects. + Based on patch by Hugo Lopes Tavares. + +- Issue #19641: Added the audioop.byteswap() function to convert big-endian + samples to little-endian and vice versa. + +- Issue #15204: Deprecated the 'U' mode in file-like objects. + +- Issue #17810: Implement PEP 3154, pickle protocol 4. + +- Issue #19668: Added support for the cp1125 encoding. + +- Issue #19689: Add ssl.create_default_context() factory function. It creates + a new SSLContext object with secure default settings. + +- Issue #19727: os.utime(..., None) is now potentially more precise + under Windows. + +- Issue #17201: ZIP64 extensions now are enabled by default. Patch by + William Mallard. + +- Issue #19292: Add SSLContext.load_default_certs() to load default root CA + certificates from default stores or system stores. By default the method + loads CA certs for authentication of server certs. + +- Issue #19673: Add pathlib to the stdlib as a provisional module (PEP 428). + +- Issue #16596: pdb in a generator now properly skips over yield and + yield from rather than stepping out of the generator into its + caller. (This is essential for stepping through asyncio coroutines.) + +- Issue #17916: Added dis.Bytecode.from_traceback() and + dis.Bytecode.current_offset to easily display "current instruction" + markers in the new disassembly API (Patch by Claudiu Popa). + +- Issue #19552: venv now supports bootstrapping pip into virtual environments + +- Issue #17134: Finalize interface to Windows' certificate store. Cert and + CRL enumeration are now two functions. enum_certificates() also returns + purpose flags as set of OIDs. + +- Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils + equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX. + +- Issue #8813: Add SSLContext.verify_flags to change the verification flags + of the context in order to enable certification revocation list (CRL) + checks or strict X509 rules. + +- Issue #18294: Fix the zlib module to make it 64-bit safe. + +- Issue #19682: Fix compatibility issue with old version of OpenSSL that + was introduced by Issue #18379. + +- Issue #14455: plistlib now supports binary plists and has an updated API. + +- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on + big-endian platforms. + +- Issue #18379: SSLSocket.getpeercert() returns CA issuer AIA fields, OCSP + and CRL distribution points. + +- Issue #18138: Implement cadata argument of SSLContext.load_verify_location() + to load CA certificates and CRL from memory. It supports PEM and DER + encoded strings. + +- Issue #18775: Add name and block_size attribute to HMAC object. They now + provide the same API elements as non-keyed cryptographic hash functions. + +- Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC + module supports digestmod names, e.g. hmac.HMAC('sha1'). + +- Issue #19449: in csv's writerow, handle non-string keys when generating the + error message that certain keys are not in the 'fieldnames' list. + +- Issue #13633: Added a new convert_charrefs keyword arg to HTMLParser that, + when True, automatically converts all character references. + +- Issue #2927: Added the unescape() function to the html module. + +- Issue #8402: Added the escape() function to the glob module. + +- Issue #17618: Add Base85 and Ascii85 encoding/decoding to the base64 module. + +- Issue #19634: time.strftime("%y") now raises a ValueError on AIX when given a + year before 1900. + +- Fix test.support.bind_port() to not cause an error when Python was compiled + on a system with SO_REUSEPORT defined in the headers but run on a system + with an OS kernel that does not support that reasonably new socket option. + +- Fix compilation error under gcc of the ctypes module bundled libffi for arm. + +- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID, + NID, short name and long name. + +- Issue #19282: dbm.open now supports the context management protocol. + (Initial patch by Claudiu Popa) + +- Issue #8311: Added support for writing any bytes-like objects in the aifc, + sunau, and wave modules. + +- Issue #5202: Added support for unseekable files in the wave module. + +- Issue #19544 and Issue #1180: Restore global option to ignore + ~/.pydistutils.cfg in Distutils, accidentally removed in backout of + distutils2 changes. + +- Issue #19523: Closed FileHandler leak which occurred when delay was set. + +- Issue #19544 and Issue #6516: Restore support for --user and --group + parameters to sdist command accidentally rolled back as part of the + distutils2 rollback. + +- Issue #13674: Prevented time.strftime from crashing on Windows when given + a year before 1900 and a format of %y. + +- Issue #19406: implementation of the ensurepip module (part of PEP 453). + Patch by Donald Stufft and Nick Coghlan. + +- Issue #19544 and Issue #6286: Restore use of urllib over http allowing use + of http_proxy for Distutils upload command, a feature accidentally lost + in the rollback of distutils2. + +- Issue #19544 and Issue #7457: Restore the read_pkg_file method to + distutils.dist.DistributionMetadata accidentally removed in the undo of + distutils2. + +- Issue #16685: Added support for any bytes-like objects in the audioop module. + Removed support for strings. + +- Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` + to socket module. Patch by Atsuo Ishimoto. + +- Issue #19261: Added support for writing 24-bit samples in the sunau module. + +- Issue #1097797: Added CP273 encoding, used on IBM mainframes in + Germany and Austria. Mapping provided by Michael Bierenfeld. + +- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms. + +- Issue #19378: Fixed a number of cases in the dis module where the new + "file" parameter was not being honoured correctly + +- Issue #19378: Removed the "dis.Bytecode.show_info" method + +- Issue #19378: Renamed the "dis.Bytecode.display_code" method to + "dis.Bytecode.dis" and converted it to returning a string rather than + printing output. + +- Issue #19378: the "line_offset" parameter in the new "dis.get_instructions" + API has been renamed to "first_line" (and the default value and usage + changed accordingly). This should reduce confusion with the more common use + of "offset" in the dis docs to refer to bytecode offsets. + +- Issue #18678: Corrected spwd struct member names in spwd module: + sp_nam->sp_namp, and sp_pwd->sp_pwdp. The old names are kept as extra + structseq members, for backward compatibility. + +- Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises + TypeError instead of TclError on wrong number of arguments. Original patch + by Guilherme Polo. + +- Issue #10197: Rework subprocess.get[status]output to use subprocess + functionality and thus to work on Windows. Patch by Nick Coghlan + +- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of + integers instead of a string. Based on patch by Guilherme Polo. + +- Issue #19403: contextlib.redirect_stdout is now reentrant + +- Issue #19286: Directories in ``package_data`` are no longer added to + the filelist, preventing failure outlined in the ticket. + +- Issue #19480: HTMLParser now accepts all valid start-tag names as defined + by the HTML5 standard. + +- Issue #15114: The html.parser module now raises a DeprecationWarning when the + strict argument of HTMLParser or the HTMLParser.error method are used. + +- Issue #19410: Undo the special-casing removal of '' for + importlib.machinery.FileFinder. + +- Issue #19424: Fix the warnings module to accept filename containing surrogate + characters. + +- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. + +- Issue #19227: Remove pthread_atfork() handler. The handler was added to + solve #18747 but has caused issues. + +- Issue #19420: Fix reference leak in module initialization code of + _hashopenssl.c + +- Issue #19329: Optimized compiling charsets in regular expressions. + +- Issue #19227: Try to fix deadlocks caused by re-seeding then OpenSSL + pseudo-random number generator on fork(). + +- Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more than + 100 headers are read. Adapted from patch by Jyrki Pulliainen. + +- Issue #16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to + prevent readline() calls from consuming too much memory. Patch by Jyrki + Pulliainen. + +- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to + prevent readline() calls from consuming too much memory. Patch by Jyrki + Pulliainen. + +- Issue #17997: Change behavior of ``ssl.match_hostname()`` to follow RFC 6125, + for security reasons. It now doesn't match multiple wildcards nor wildcards + inside IDN fragments. + +- Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit + line length. Patch by Emil Lind. + +- Issue #19330: the unnecessary wrapper functions have been removed from the + implementations of the new contextlib.redirect_stdout and + contextlib.suppress context managers, which also ensures they provide + reasonable help() output on instances + +- Issue #19393: Fix symtable.symtable function to not be confused when there are + functions or classes named "top". + +- Issue #18685: Restore re performance to pre-PEP 393 levels. + +- Issue #19339: telnetlib module is now using time.monotonic() when available + to compute timeout. + +- Issue #19399: fix sporadic test_subprocess failure. + +- Issue #13234: Fix os.listdir to work with extended paths on Windows. + Patch by Santoso Wijaya. + +- Issue #19375: The site module adding a "site-python" directory to sys.path, + if it exists, is now deprecated. + +- Issue #19379: Lazily import linecache in the warnings module, to make + startup with warnings faster until a warning gets printed. + +- Issue #19288: Fixed the "in" operator of dbm.gnu databases for string + argument. Original patch by Arfrever Frehtes Taifersar Arahesis. + +- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string + argument. Original patch by Arfrever Frehtes Taifersar Arahesis. + +- Issue #19327: Fixed the working of regular expressions with too big charset. + +- Issue #17400: New 'is_global' attribute for ipaddress to tell if an address + is allocated by IANA for global or private networks. + +- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin + Williams. + +- Issue #19365: Optimized the parsing of long replacement string in re.sub*() + functions. + +- Issue #19352: Fix unittest discovery when a module can be reached + through several paths (e.g. under Debian/Ubuntu with virtualenv). + +- Issue #15207: Fix mimetypes to read from correct part of Windows registry + Original patch by Dave Chambers + +- Issue #16595: Add prlimit() to resource module. + +- Issue #19324: Expose Linux-specific constants in resource module. + +- Load SSL's error strings in hashlib. + +- Issue #18527: Upgrade internal copy of zlib to 1.2.8. + +- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy. + +- Issue #8964: fix platform._sys_version to handle IronPython 2.6+. + Patch by Martin Matusiak. + +- Issue #19413: Restore pre-3.3 reload() semantics of re-finding modules. + +- Issue #18958: Improve error message for json.load(s) while passing a string + that starts with a UTF-8 BOM. + +- Issue #19307: Improve error message for json.load(s) while passing objects + of the wrong type. + +- Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by + limiting the call to readline(). Original patch by Micha? + Jastrz?bski and Giampaolo Rodola. + +- Issue #17087: Improved the repr for regular expression match objects. + +Tests +----- + +- Issue #19664: test_userdict's repr test no longer depends on the order + of dict elements. + +- Issue #19440: Clean up test_capi by removing an unnecessary __future__ + import, converting from test_main to unittest.main, and running the + _testcapi module tests as subTests of a unittest TestCase method. + +- Issue #19378: the main dis module tests are now run with both stdout + redirection *and* passing an explicit file parameter + +- Issue #19378: removed the not-actually-helpful assertInstructionMatches + and assertBytecodeExactlyMatches helpers from bytecode_helper + +- Issue #18702: All skipped tests now reported as skipped. + +- Issue #19439: interpreter embedding tests are now executed on Windows + (Patch by Zachary Ware) + +- Issue #19085: Added basic tests for all tkinter widget options. + +- Issue #19384: Fix test_py_compile for root user, patch by Claudiu Popa. + +Documentation +------------- + +- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also, + attempt to reduce confusion in the glossary by not saying there are + different "types" of arguments and parameters. + +Build +----- + +- Issue #19358: "make clinic" now runs the Argument Clinic preprocessor + over all CPython source files. + +- Update SQLite to 3.8.1, xz to 5.0.5, and Tcl/Tk to 8.6.1 on Windows. + +- Issue #16632: Enable DEP and ASLR on Windows. + +- Issue #17791: Drop PREFIX and EXEC_PREFIX definitions from PC/pyconfig.h + +- Add workaround for VS 2010 nmake clean issue. VS 2010 doesn't set up PATH + for nmake.exe correctly. + +- Issue #19550: Implement Windows installer changes of PEP 453 (ensurepip). + +- Issue #19520: Fix compiler warning in the _sha3 module on 32bit Windows. + +- Issue #19356: Avoid using a C variabled named "_self", it's a reserved + word in some C compilers. + +- Issue #15792: Correct build options on Win64. Patch by Jeremy Kloth. + +- Issue #19373: Apply upstream change to Tk 8.5.15 fixing OS X 10.9 + screen refresh problem for OS X installer build. + +- Issue #19649: On OS X, the same set of file names are now installed + in bin directories for all configurations: non-framework vs framework, + and single arch vs universal builds. pythonx.y-32 is now always + installed for 64-bit/32-bit universal builds. The obsolete and + undocumented pythonw* symlinks are no longer installed anywhere. + +- Issue #19553: PEP 453 - "make install" and "make altinstall" now install or + upgrade pip by default, using the bundled pip provided by the new ensurepip + module. A new configure option, --with-ensurepip[=upgrade|install|no], is + available to override the default ensurepip "--upgrade" option. The option + can also be set with "make [alt]install ENSUREPIP=[upgrade|install|no]". + +- Issue #19551: PEP 453 - the OS X installer now installs pip by default. + +- Update third-party libraries for OS X installers: xz 5.0.3 -> 5.0.5, + SQLite 3.7.13 -> 3.8.1 + +- Issue #15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1. + Some third-party projects, such as Matplotlib and PIL/Pillow, + depended on being able to build with Tcl and Tk frameworks in + /Library/Frameworks. + +Tools/Demos +----------- + +- Issue #19730: Argument Clinic now supports all the existing PyArg + "format units" as legacy converters, as well as two new features: + "self converters" and the "version" directive. + +- Issue #19552: pyvenv now bootstraps pip into virtual environments by + default (pass --without-pip to request the old behaviour) + +- Issue #19390: Argument Clinic no longer accepts malformed Python + and C ids. + + +What's New in Python 3.4.0 Alpha 4? +=================================== + +Release date: 2013-10-20 + +Core and Builtins +----------------- + +- Issue #19301: Give classes and functions that are explicitly marked global a + global qualname. + +- Issue #19279: UTF-7 decoder no longer produces illegal strings. + +- Issue #16612: Add "Argument Clinic", a compile-time preprocessor for + C files to generate argument parsing code. (See PEP 436.) + +- Issue #18810: Shift stat calls in importlib.machinery.FileFinder such that + the code is optimistic that if something exists in a directory named exactly + like the possible package being searched for that it's in actuality a + directory. + +- Issue #18416: importlib.machinery.PathFinder now treats '' as the cwd and + importlib.machinery.FileFinder no longer special-cases '' to '.'. This leads + to modules imported from cwd to now possess an absolute file path for + __file__ (this does not affect modules specified by path on the CLI but it + does affect -m/runpy). It also allows FileFinder to be more consistent by not + having an edge case. + +- Issue #4555: All exported C symbols are now prefixed with either + "Py" or "_Py". + +- Issue #19219: Speed up marshal.loads(), and make pyc files slightly + (5% to 10%) smaller. + +- Issue #19221: Upgrade Unicode database to version 6.3.0. + +- Issue #16742: The result of the C callback PyOS_ReadlineFunctionPointer must + now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL + if an error occurred), instead of a string allocated by PyMem_Malloc() or + PyMem_Realloc(). + +- Issue #19199: Remove ``PyThreadState.tick_counter`` field + +- Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at + least one place so as to avoid regressions. + +- Issue #19087: Improve bytearray allocation in order to allow cheap popping + of data at the front (slice deletion). + +- Issue #19014: memoryview.cast() is now allowed on zero-length views. + +- Issue #18690: memoryview is now automatically registered with + collections.abc.Sequence + +- Issue #19078: memoryview now correctly supports the reversed builtin + (Patch by Claudiu Popa) + +Library +------- + +- Issue #17457: unittest test discovery now works with namespace packages. + Patch by Claudiu Popa. + +- Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX. + Patch by David Edelsohn. + +- Issue #18606: Add the new "statistics" module (PEP 450). Contributed + by Steven D'Aprano. + +- Issue #12866: The audioop module now supports 24-bit samples. + +- Issue #19254: Provide an optimized Python implementation of pbkdf2_hmac. + +- Issues #19201, Issue #19222, Issue #19223: Add "x" mode (exclusive creation) + in opening file to bz2, gzip and lzma modules. Patches by Tim Heaney and + Vajrasky Kok. + +- Fix a reference count leak in _sre. + +- Issue #19262: Initial check in of the 'asyncio' package (a.k.a. Tulip, + a.k.a. PEP 3156). There are no docs yet, and the PEP is slightly + out of date with the code. This module will have *provisional* status + in Python 3.4. + +- Issue #19276: Fixed the wave module on 64-bit big-endian platforms. + +- Issue #19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager + to ``contextlib.suppress`` in order to be more consistent with existing + descriptions of that operation elsewhere in the language and standard + library documentation (Patch by Zero Piraeus). + +- Issue #18891: Completed the new email package (provisional) API additions + by adding new classes EmailMessage, MIMEPart, and ContentManager. + +- Issue #18281: Unused stat constants removed from `tarfile`. + +- Issue #18999: Multiprocessing now supports 'contexts' with the same API + as the module, but bound to specified start methods. + +- Issue #18468: The re.split, re.findall, and re.sub functions and the group() + and groups() methods of match object now always return a string or a bytes + object. + +- Issue #18725: The textwrap module now supports truncating multiline text. + +- Issue #18776: atexit callbacks now display their full traceback when they + raise an exception. + +- Issue #17827: Add the missing documentation for ``codecs.encode`` and + ``codecs.decode``. + +- Issue #19218: Rename collections.abc to _collections_abc in order to + speed up interpreter start. + +- Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5 + password-based key derivation functions with HMAC as pseudorandom function. + +- Issue #19131: The aifc module now correctly reads and writes sampwidth of + compressed streams. + +- Issue #19209: Remove import of copyreg from the os module to speed up + interpreter startup. stat_result and statvfs_result are now hard-coded to + reside in the os module. + +- Issue #19205: Don't import the 're' module in site and sysconfig module to + speed up interpreter start. + +- Issue #9548: Add a minimal "_bootlocale" module that is imported by the + _io module instead of the full locale module. + +- Issue #18764: Remove the 'print' alias for the PDB 'p' command so that it no + longer shadows the print function. + +- Issue #19158: A rare race in BoundedSemaphore could allow .release() too + often. + +- Issue #15805: Add contextlib.redirect_stdout(). + +- Issue #18716: Deprecate the formatter module. + +- Issue #10712: 2to3 has a new "asserts" fixer that replaces deprecated names + of unittest methods (e.g. failUnlessEqual -> assertEqual). + +- Issue #18037: 2to3 now escapes ``'\u'`` and ``'\U'`` in native strings. + +- Issue #17839: base64.decodebytes and base64.encodebytes now accept any + object that exports a 1 dimensional array of bytes (this means the same + is now also true for base64_codec) + +- Issue #19132: The pprint module now supports compact mode. + +- Issue #19137: The pprint module now correctly formats instances of set and + frozenset subclasses. + +- Issue #10042: functools.total_ordering now correctly handles + NotImplemented being returned by the underlying comparison function (Patch + by Katie Miller) + +- Issue #19092: contextlib.ExitStack now correctly reraises exceptions + from the __exit__ callbacks of inner context managers (Patch by Hrvoje + Nik?i?) + +- Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except + when necessary. Patch by Oscar Benjamin. + +- Issue #5845: In site.py, only load readline history from ~/.python_history + if no history has been read already. This avoids double writes to the + history file at shutdown. + +- Properly initialize all fields of a SSL object after allocation. + +- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the + SSL handshake hasn't been done. + +- Issue #4366: Fix building extensions on all platforms when --enable-shared + is used. + +- Issue #19030: Fixed `inspect.getmembers` and `inspect.classify_class_attrs` + to attempt activating descriptors before falling back to a __dict__ search + for faulty descriptors. `inspect.classify_class_attrs` no longer returns + Attributes whose home class is None. + +C API +----- + +- Issue #1772673: The type of `char*` arguments now changed to `const char*`. + +- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API + to allow embedding applications like Blender to force a particular + encoding and error handler for the standard IO streams (initial patch by + Bastien Montagne) + +Tests +----- + +- Issue #19275: Fix test_site on AMD64 Snow Leopard + +- Issue #14407: Fix unittest test discovery in test_concurrent_futures. + +- Issue #18919: Unified and extended tests for audio modules: aifc, sunau and + wave. + +- Issue #18714: Added tests for ``pdb.find_function()``. + +Documentation +------------- + +- Issue #18758: Fixed and improved cross-references. + +- Issue #18972: Modernize email examples and use the argparse module in them. + +Build +----- + +- Issue #19130: Correct PCbuild/readme.txt, Python 3.3 and 3.4 require VS 2010. + +- Issue #15663: Update OS X 10.6+ installer to use Tcl/Tk 8.5.15. + +- Issue #14499: Fix several problems with OS X universal build support: + 1. ppc arch detection for extension module builds broke with Xcode 5 + 2. ppc arch detection in configure did not work on OS X 10.4 + 3. -sysroot and -arch flags were unnecessarily duplicated + 4. there was no obvious way to configure an intel-32 only build. + +- Issue #19019: Change the OS X installer build script to use CFLAGS instead + of OPT for special build options. By setting OPT, some compiler-specific + options like -fwrapv were overridden and thus not used, which could result + in broken interpreters when building with clang. + + +What's New in Python 3.4.0 Alpha 3? +=================================== + +Release date: 2013-09-29 + +Core and Builtins +----------------- + +- Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional. + +- Issue #19098: Prevent overflow in the compiler when the recursion limit is set + absurdly high. + +Library +------- + +- Issue #18929: `inspect.classify_class_attrs()` now correctly finds class + attributes returned by `dir()` that are located in the metaclass. + +- Issue #18950: Fix miscellaneous bugs in the sunau module. + Au_read.readframes() now updates current file position and reads correct + number of frames from multichannel stream. Au_write.writeframesraw() now + correctly updates current file position. Au_read.getnframes() now returns an + integer (as in Python 2). Au_read and Au_write now correctly works with file + object if start file position is not a zero. + +- Issue #18594: The fast path for collections.Counter() was never taken + due to an over-restrictive type check. + +- Issue #19053: ZipExtFile.read1() with non-zero argument no more returns empty + bytes until end of data. + +- logging: added support for Unix domain sockets to SocketHandler and + DatagramHandler. + +- Issue #18996: TestCase.assertEqual() now more cleverly shorten differing + strings in error report. + +- Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. + +- Issue #18978: ``urllib.request.Request`` now allows the method to be + indicated on the class and no longer sets it to None in ``__init__``. + +- Issue #18626: the inspect module now offers a basic command line + introspection interface (Initial patch by Claudiu Popa) + +- Issue #3015: Fixed tkinter with wantobject=False. Any Tcl command call + returned empty string. + +- Issue #19037: The mailbox module now makes all changes to maildir files + before moving them into place, to avoid race conditions with other programs + that may be accessing the maildir directory. + +- Issue #14984: On POSIX systems, when netrc is called without a filename + argument (and therefore is reading the user's $HOME/.netrc file), it now + enforces the same security rules as typical ftp clients: the .netrc file must + be owned by the user that owns the process and must not be readable by any + other user. + +- Issue #18873: The tokenize module now detects Python source code encoding + only in comment lines. + +- Issue #17764: Enable http.server to bind to a user specified network + interface. Patch contributed by Malte Swart. + +- Issue #18937: Add an assertLogs() context manager to unittest.TestCase + to ensure that a block of code emits a message using the logging module. + +- Issue #17324: Fix http.server's request handling case on trailing '/'. Patch + contributed by Vajrasky Kok. + +- Issue #19018: The heapq.merge() function no longer suppresses IndexError + in the underlying iterables. + +- Issue #18784: The uuid module no longer attempts to load libc via ctypes.CDLL + if all the necessary functions have already been found in libuuid. Patch by + Evgeny Sologubov. + +- The :envvar:`PYTHONFAULTHANDLER` environment variable now only enables the + faulthandler module if the variable is non-empty. Same behaviour than other + variables like :envvar:`PYTHONDONTWRITEBYTECODE`. + +- Issue #1565525: New function ``traceback.clear_frames`` will clear + the local variables of all the stack frames referenced by a traceback + object. + +Tests +----- + +- Issue #18952: Fix regression in support data downloads introduced when + test.support was converted to a package. Regression noticed by Zachary + Ware. + +IDLE +---- + +- Issue #18873: IDLE now detects Python source code encoding only in comment + lines. + +- Issue #18988: The "Tab" key now works when a word is already autocompleted. + +Documentation +------------- + +- Issue #17003: Unified the size argument names in the io module with common + practice. + +Build +----- + +- Issue #18596: Support the use of address sanity checking in recent versions + of clang and GCC by appropriately marking known false alarms in the small + object allocator. Patch contributed by Dhiru Kholia. + +Tools/Demos +----------- + +- Issue #18873: 2to3 and the findnocoding.py script now detect Python source + code encoding only in comment lines. + + +What's New in Python 3.4.0 Alpha 2? +=================================== + +Release date: 2013-09-09 + +Core and Builtins +----------------- + +- Issue #18942: sys._debugmallocstats() output was damaged on Windows. + +- Issue #18571: Implementation of the PEP 446: file descriptors and file + handles are now created non-inheritable; add functions + os.get/set_inheritable(), os.get/set_handle_inheritable() and + socket.socket.get/set_inheritable(). + +- Issue #11619: The parser and the import machinery do not encode Unicode + filenames anymore on Windows. + +- Issue #18808: Non-daemon threads are now automatically joined when + a sub-interpreter is shutdown (it would previously dump a fatal error). + +- Remove support for compiling on systems without getcwd(). + +- Issue #18774: Remove last bits of GNU PTH thread code and thread_pth.h. + +- Issue #18771: Add optimization to set object lookups to reduce the cost + of hash collisions. The core idea is to inspect a second key/hash pair + for each cache line retrieved. + +- Issue #16105: When a signal handler fails to write to the file descriptor + registered with ``signal.set_wakeup_fd()``, report an exception instead + of ignoring the error. + +- Issue #18722: Remove uses of the "register" keyword in C code. + +- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. + +- Issue #16499: Add command line option for isolated mode. + +- Issue #15301: Parsing fd, uid, and gid parameters for builtins + in Modules/posixmodule.c is now far more robust. + +- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() + fail. + +- Issue #17934: Add a clear() method to frame objects, to help clean up + expensive details (local variables) and break reference cycles. + +- Issue #18780: %-formatting codes %d, %i, and %u now treat int-subclasses + as int (displays value of int-subclass instead of str(int-subclass) ). + +Library +------- + +- Issue #18808: Thread.join() now waits for the underlying thread state to + be destroyed before returning. This prevents unpredictable aborts in + Py_EndInterpreter() when some non-daemon threads are still running. + +- Issue #18458: Prevent crashes with newer versions of libedit. Its readline + emulation has changed from 0-based indexing to 1-based like gnu readline. + +- Issue #18852: Handle case of ``readline.__doc__`` being ``None`` in the new + readline activation code in ``site.py``. + +- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in + the _sre module. + +- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even + when input list contains duplicates. + +- Issue #18878: sunau.open now supports the context management protocol. Based on + patches by Claudiu Popa and R. David Murray. + +- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast + 64-bit pointer to long (32 bits). + +- Issue #18876: The FileIO.mode attribute now better reflects the actual mode + under which the file was opened. Patch by Erik Bray. + +- Issue #16853: Add new selectors module. + +- Issue #18882: Add threading.main_thread() function. + +- Issue #18901: The sunau getparams method now returns a namedtuple rather than + a plain tuple. Patch by Claudiu Popa. + +- Issue #17487: The result of the wave getparams method now is pickleable again. + Patch by Claudiu Popa. + +- Issue #18756: os.urandom() now uses a lazily-opened persistent file + descriptor, so as to avoid using many file descriptors when run in + parallel from multiple threads. + +- Issue #18418: After fork(), reinit all threads states, not only active ones. + Patch by A. Jesse Jiryu Davis. + +- Issue #17974: Switch unittest from using getopt to using argparse. + +- Issue #11798: TestSuite now drops references to own tests after execution. + +- Issue #16611: http.cookie now correctly parses the 'secure' and 'httponly' + cookie flags. + +- Issue #11973: Fix a problem in kevent. The flags and fflags fields are now + properly handled as unsigned. + +- Issue #18807: ``pyvenv`` now takes a --copies argument allowing copies + instead of symlinks even where symlinks are available and the default. + +- Issue #18538: ``python -m dis`` now uses argparse for argument processing. + Patch by Michele Orr?. + +- Issue #18394: Close cgi.FieldStorage's optional file. + +- Issue #17702: On error, os.environb now suppresses the exception context + when raising a new KeyError with the original key. + +- Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. + +- Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj + argument. + +- Issue #17211: Yield a namedtuple in pkgutil. + Patch by Ramchandra Apte. + +- Issue #18324: set_payload now correctly handles binary input. This also + supersedes the previous fixes for #14360, #1717, and #16564. + +- Issue #18794: Add a fileno() method and a closed attribute to select.devpoll + objects. + +- Issue #17119: Fixed integer overflows when processing large strings and tuples + in the tkinter module. + +- Issue #15352: Rebuild frozen modules when marshal.c is changed. + +- Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork. + A pthread_atfork() parent handler is used to seed the PRNG with pid, time + and some stack data. + +- Issue #8865: Concurrent invocation of select.poll.poll() now raises a + RuntimeError exception. Patch by Christian Schubert. + +- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of + OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. + +- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. + +- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke + malloc weak symbols. + +- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes + inside subjectAltName correctly. Formerly the module has used OpenSSL's + GENERAL_NAME_print() function to get the string representation of ASN.1 + strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and + ``uniformResourceIdentifier`` (URI). + +- Issue #18701: Remove support of old CPython versions (<3.0) from C code. + +- Issue #18756: Improve error reporting in os.urandom() when the failure + is due to something else than /dev/urandom not existing (for example, + exhausting the file descriptor limit). + +- Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel + 3.11 or newer. It's only defined on system with 3.11 uapi headers, too. + +- Issue #18532: Change the builtin hash algorithms' names to lower case names + as promised by hashlib's documentation. + +- Issue #8713: add new spwan and forkserver start methods, and new functions + get_all_start_methods, get_start_method, and set_start_method, to + multiprocessing. + +- Issue #18405: Improve the entropy of crypt.mksalt(). + +- Issue #12015: The tempfile module now uses a suffix of 8 random characters + instead of 6, to reduce the risk of filename collision. The entropy was + reduced when uppercase letters were removed from the charset used to generate + random characters. + +- Issue #18585: Add :func:`textwrap.shorten` to collapse and truncate a + piece of text to a given length. + +- Issue #18598: Tweak exception message for importlib.import_module() to + include the module name when a key argument is missing. + +- Issue #19151: Fix docstring and use of _get_supported_file_loaders() to + reflect 2-tuples. + +- Issue #19152: Add ExtensionFileLoader.get_filename(). + +- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get + docstrings and ValueError messages. Patch by Zhongyue Luo + +- Fix refcounting issue with extension types in tkinter. + +- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error + if methods have annotations; it now correctly displays the annotations. + +- Issue #18600: Added policy argument to email.message.Message.as_string, + and as_bytes and __bytes__ methods to Message. + +- Issue #18671: Output more information when logging exceptions occur. + +- Issue #18621: Prevent the site module's patched builtins from keeping + too many references alive for too long. + +- Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. + +- Issue #8860: Fixed rounding in timedelta constructor. + +- Issue #18849: Fixed a Windows-specific tempfile bug where collision with an + existing directory caused mkstemp and related APIs to fail instead of + retrying. Report and fix by Vlad Shcherbina. + +- Issue #18920: argparse's default destination for the version action (-v, + --version) has also been changed to stdout, to match the Python executable. + +Tests +----- + +- Issue #18623: Factor out the _SuppressCoreFiles context manager into + test.support. Patch by Valerie Lambert. + +- Issue #12037: Fix test_email for desktop Windows. + +- Issue #15507: test_subprocess's test_send_signal could fail if the test + runner were run in an environment where the process inherited an ignore + setting for SIGINT. Restore the SIGINT handler to the desired + KeyboardInterrupt raising one during that test. + +- Issue #16799: Switched from getopt to argparse style in regrtest's argument + parsing. Added more tests for regrtest's argument parsing. + +- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as + possible, since "localhost" goes through a DNS lookup under recent Windows + versions. + +IDLE +---- + +- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster. + +Documentation +------------- + +- Issue #18743: Fix references to non-existent "StringIO" module. + +- Issue #18783: Removed existing mentions of Python long type in docstrings, + error messages and comments. + +Build +----- + +- Issue #1584: Provide configure options to override default search paths for + Tcl and Tk when building _tkinter. + +- Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit + installer. It is no longer necessary to install a third-party version of + Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 + shipped in OS X 10.6 and later releases. + +Tools/Demos +----------- + +- Issue #18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write + their version strings to stdout, and not to sderr. + + +What's New in Python 3.4.0 Alpha 1? +=================================== + +Release date: 2013-08-03 + +Core and Builtins +----------------- + +- Issue #16741: Fix an error reporting in int(). + +- Issue #17899: Fix rare file descriptor leak in os.listdir(). + +- Issue #10241: Clear extension module dict copies at interpreter shutdown. + Patch by Neil Schemenauer, minimally modified. + +- Issue #9035: ismount now recognises volumes mounted below a drive root + on Windows. Original patch by Atsuo Ishimoto. + +- Issue #18214: Improve finalization of Python modules to avoid setting + their globals to None, in most cases. + +- Issue #18112: PEP 442 implementation (safe object finalization). + +- Issue #18552: Check return value of PyArena_AddPyObject() in + obj2ast_object(). + +- Issue #18560: Fix potential NULL pointer dereference in sum(). + +- Issue #18520: Add a new PyStructSequence_InitType2() function, same than + PyStructSequence_InitType() except that it has a return value (0 on success, + -1 on error). + +- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0], + prefix and exec_prefix if the operation system does not obey MAXPATHLEN. + +- Issue #18408: Fix many various bugs in code handling errors, especially + on memory allocation failure (MemoryError). + +- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all(). + +- Issue #18342: Use the repr of a module name when an import fails when using + ``from ... import ...``. + +- Issue #17872: Fix a segfault in marshal.load() when input stream returns + more bytes than requested. + +- Issue #18338: `python --version` now prints version string to stdout, and + not to stderr. Patch by Berker Peksag and Michael Dickens. + +- Issue #18426: Fix NULL pointer dereference in C extension import when + PyModule_GetDef() returns an error. + +- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix + a stack overflow in the marshal module (fix a crash in test_marshal). + Patch written by Jeremy Kloth. + +- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory + allocators. + +- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the + tstate is first removed from TLS and then deallocated. + +- Issue #13483: Use VirtualAlloc in obmalloc on Windows. + +- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise + OverflowError when an argument of %c format is out of range. + +- Issue #18111: The min() and max() functions now support a default argument + to be returned instead of raising a ValueError on an empty sequence. + (Contributed by Julian Berman.) + +- Issue #18137: Detect integer overflow on precision in float.__format__() + and complex.__format__(). + +- Issue #15767: Introduce ModuleNotFoundError which is raised when a module + could not be found. + +- Issue #18183: Fix various unicode operations on strings with large unicode + codepoints. + +- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). + +- Issue #18038: SyntaxError raised during compilation sources with illegal + encoding now always contains an encoding name. + +- Issue #17931: Resolve confusion on Windows between pids and process + handles. + +- Tweak the exception message when the magic number or size value in a bytecode + file is truncated. + +- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators: + change the C type of seqiterobject.it_index from long to Py_ssize_t. + +- Issue #18065: Don't set __path__ to the package name for frozen packages. + +- Issue #18088: When reloading a module, unconditionally reset all relevant + attributes on the module (e.g. __name__, __loader__, __package__, __file__, + __cached__). + +- Issue #17937: Try harder to collect cyclic garbage at shutdown. + +- Issue #12370: Prevent class bodies from interfering with the __class__ + closure. + +- Issue #17644: Fix a crash in str.format when curly braces are used in square + brackets. + +- Issue #17237: Fix crash in the ASCII decoder on m68k. + +- Issue #17927: Frame objects kept arguments alive if they had been + copied into a cell, even if the cell was cleared. + +- Issue #1545463: At shutdown, defer finalization of codec modules so + that stderr remains usable. + +- Issue #7330: Implement width and precision (ex: "%5.3s") for the format + string of PyUnicode_FromFormat() function, original patch written by Ysj Ray. + +- Issue #1545463: Global variables caught in reference cycles are now + garbage-collected at shutdown. + +- Issue #17094: Clear stale thread states after fork(). Note that this + is a potentially disruptive change since it may release some system + resources which would otherwise remain perpetually alive (e.g. database + connections kept in thread-local storage). + +- Issue #17408: Avoid using an obsolete instance of the copyreg module when + the interpreter is shutdown and then started again. + +- Issue #5845: Enable tab-completion in the interactive interpreter by + default, thanks to a new sys.__interactivehook__. + +- Issue #17115,17116: Module initialization now includes setting __package__ and + __loader__ attributes to None. + +- Issue #17853: Ensure locals of a class that shadow free variables always win + over the closures. + +- Issue #17863: In the interactive console, don't loop forever if the encoding + can't be fetched from stdin. + +- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__. + +- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules. + +- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3, + such as was shipped with Centos 5 and Mac OS X 10.4. + +- Issue #17413: sys.settrace callbacks were being passed a string instead of an + exception instance for the 'value' element of the arg tuple if the exception + originated from C code; now an exception instance is always provided. + +- Issue #17782: Fix undefined behaviour on platforms where + ``struct timespec``'s "tv_nsec" member is not a C long. + +- Issue #17722: When looking up __round__, resolve descriptors. + +- Issue #16061: Speed up str.replace() for replacing 1-character strings. + +- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__ + method. + +- Issue #17643: Add __callback__ attribute to weakref.ref. + +- Issue #16447: Fixed potential segmentation fault when setting __name__ on a + class. + +- Issue #17669: Fix crash involving finalization of generators using yield from. + +- Issue #14439: Python now prints the traceback on runpy failure at startup. + +- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() + when running on valgrind. + +- Issue #17619: Make input() check for Ctrl-C correctly on Windows. + +- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during + the importlib transition. + +- Issue #17610: Don't rely on non-standard behavior of the C qsort() function. + +- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been + disabled by default. It can be re-enabled with the `-X showrefcount` option. + +- Issue #17328: Fix possible refleak in dict.setdefault. + +- Issue #17275: Corrected class name in init error messages of the C version of + BufferedWriter and BufferedRandom. + +- Issue #7963: Fixed misleading error message that issued when object is + called without arguments. + +- Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. + +- Issue #5308: Raise ValueError when marshalling too large object (a sequence + with size >= 2**31), instead of producing illegal marshal data. + +- Issue #12983: Bytes literals with invalid ``\x`` escape now raise a SyntaxError + and a full traceback including line number. + +- Issue #16967: In function definition, evaluate positional defaults before + keyword-only defaults. + +- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) + in the interpreter. + +- Issue #17137: When a Unicode string is resized, the internal wide character + string (wstr) format is now cleared. + +- Issue #17043: The unicode-internal decoder no longer read past the end of + input buffer. + +- Issue #17098: All modules now have __loader__ set even if they pre-exist the + bootstrapping of importlib. + +- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. + +- Issue #16772: The base argument to the int constructor no longer accepts + floats, or other non-integer objects with an __int__ method. Objects + with an __index__ method are now accepted. + +- Issue #10156: In the interpreter's initialization phase, unicode globals + are now initialized dynamically as needed. + +- Issue #16980: Fix processing of escaped non-ascii bytes in the + unicode-escape-decode decoder. + +- Issue #16975: Fix error handling bug in the escape-decode bytes decoder. + +- Issue #14850: Now a charmap decoder treats U+FFFE as "undefined mapping" + in any mapping, not only in a string. + +- Issue #16613: Add *m* argument to ``collections.Chainmap.new_child`` to + allow the new child map to be specified explicitly. + +- Issue #16730: importlib.machinery.FileFinder now no longers raises an + exception when trying to populate its cache and it finds out the directory is + unreadable or has turned into a file. Reported and diagnosed by + David Pritchard. + +- Issue #16906: Fix a logic error that prevented most static strings from being + cleared. + +- Issue #11461: Fix the incremental UTF-16 decoder. Original patch by + Amaury Forgeot d'Arc. + +- Issue #16856: Fix a segmentation fault from calling repr() on a dict with + a key whose repr raise an exception. + +- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. + +- Issue #16761: Calling int() with base argument only now raises TypeError. + +- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py + when retrieving a REG_DWORD value. This corrects functions like + winreg.QueryValueEx that may have been returning truncated values. + +- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg + when passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx. + +- Issue #11939: Set the st_dev attribute of stat_result to allow Windows to + take advantage of the os.path.samefile/sameopenfile/samestat implementations + used by other platforms. + +- Issue #16772: The int() constructor's second argument (base) no longer + accepts non integer values. Consistent with the behavior in Python 2. + +- Issue #14470: Remove w9xpopen support per PEP 11. + +- Issue #9856: Replace deprecation warning with raising TypeError + in object.__format__. Patch by Florent Xicluna. + +- Issue #16597: In buffered and text IO, call close() on the underlying stream + if invoking flush() fails. + +- Issue #16722: In the bytes() constructor, try to call __bytes__ on the + argument before __index__. + +- Issue #16421: loading multiple modules from one shared object is now + handled correctly (previously, the first module loaded from that file + was silently returned). Patch by V?clav ?milauer. + +- Issue #16602: When a weakref's target was part of a long deallocation + chain, the object could remain reachable through its weakref even though + its refcount had dropped to zero. + +- Issue #16495: Remove extraneous NULL encoding check from bytes_decode(). + +- Issue #16619: Create NameConstant AST class to represent None, True, and False + literals. As a result, these constants are never loaded at runtime from + builtins. + +- Issue #16455: On FreeBSD and Solaris, if the locale is C, the + ASCII/surrogateescape codec is now used (instead of the locale encoding) to + decode the command line arguments. This change fixes inconsistencies with + os.fsencode() and os.fsdecode(), because these operating systems announce an + ASCII locale encoding, but actually use the ISO-8859-1 encoding in practice. + +- Issue #16562: Optimize dict equality testing. Patch by Serhiy Storchaka. + +- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread + +- Issue #16592: stringlib_bytes_join doesn't raise MemoryError on allocation + failure. + +- Issue #16546: Fix: ast.YieldFrom argument is now mandatory. + +- Issue #16514: Fix regression causing a traceback when sys.path[0] is None + (actually, any non-string or non-bytes type). + +- Issue #16306: Fix multiple error messages when unknown command line + parameters where passed to the interpreter. Patch by Hieu Nguyen. + +- Issue #16215: Fix potential double memory free in str.replace(). Patch + by Serhiy Storchaka. + +- Issue #16290: A float return value from the __complex__ special method is no + longer accepted in the complex() constructor. + +- Issue #16416: On Mac OS X, operating system data are now always + encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding + (which may be ASCII if no locale environment variable is set), to avoid + inconsistencies with os.fsencode() and os.fsdecode() functions which are + already using UTF-8/surrogateescape. + +- Issue #16453: Fix equality testing of dead weakref objects. + +- Issue #9535: Fix pending signals that have been received but not yet + handled by Python to not persist after os.fork() in the child process. + +- Issue #14794: Fix slice.indices to return correct results for huge values, + rather than raising OverflowError. + +- Issue #15001: fix segfault on "del sys.modules['__main__']". Patch by Victor + Stinner. + +- Issue #8271: the utf-8 decoder now outputs the correct number of U+FFFD + characters when used with the 'replace' error handler on invalid utf-8 + sequences. Patch by Serhiy Storchaka, tests by Ezio Melotti. + +- Issue #5765: Apply a hard recursion limit in the compiler instead of + blowing the stack and segfaulting. Initial patch by Andrea Griffini. + +- Issue #16402: When slicing a range, fix shadowing of exceptions from + __index__. + +- Issue #16336: fix input checking in the surrogatepass error handler. + Patch by Serhiy Storchaka. + +- Issue #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now + raises an error. + +- Issue #7317: Display full tracebacks when an error occurs asynchronously. + Patch by Alon Horev with update by Alexey Kachayev. + +- Issue #16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH + not set at all. + +- Issue #10189: Improve the error reporting of SyntaxErrors related to global + and nonlocal statements. + +- Fix segfaults on setting __qualname__ on builtin types and attempting to + delete it on any type. + +- Issue #14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch + written by Serhiy Storchaka. + +- Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass + received a nonempty dict from the constructor. + +- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a + class's __dict__ and on type. + +- Issue #12805: Make bytes.join and bytearray.join faster when the separator + is empty. Patch by Serhiy Storchaka. + +- Issue #6074: Ensure cached bytecode files can always be updated by the + user that created them, even when the source file is read-only. + +- Issue #15958: bytes.join and bytearray.join now accept arbitrary buffer + objects. + +- Issue #14783: Improve int() docstring and switch docstrings for str(), + range(), and slice() to use multi-line signatures. + +- Issue #16160: Subclass support now works for types.SimpleNamespace. + +- Issue #16148: Implement PEP 424, adding operator.length_hint and + PyObject_LengthHint. + +- Upgrade Unicode data (UCD) to version 6.2. + +- Issue #15379: Fix passing of non-BMP characters as integers for the charmap + decoder (already working as unicode strings). Patch by Serhiy Storchaka. + +- Issue #15144: Fix possible integer overflow when handling pointers as integer + values, by using `Py_uintptr_t` instead of `size_t`. Patch by Serhiy + Storchaka. + +- Issue #15965: Explicitly cast `AT_FDCWD` as (int). Required on Solaris 10 + (which defines `AT_FDCWD` as ``0xffd19553``), harmless on other platforms. + +- Issue #15839: Convert SystemErrors in `super()` to RuntimeErrors. + +- Issue #15448: Buffered IO now frees the buffer when closed, instead + of when deallocating. + +- Issue #15846: Fix SystemError which happened when using `ast.parse()` in an + exception handler on code with syntax errors. + +- Issue #15897: zipimport.c doesn't check return value of fseek(). + Patch by Felipe Cruz. + +- Issue #15801: Make sure mappings passed to '%' formatting are actually + subscriptable. + +- Issue #15111: __import__ should propagate ImportError when raised as a + side-effect of a module triggered from using fromlist. + +- Issue #15022: Add pickle and comparison support to types.SimpleNamespace. + +Library +------- + +- Issue #4331: Added functools.partialmethod (Initial patch by Alon Horev) + +- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit + platforms. Patch by Yogesh Chaudhari. + +- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li). + +- Issue #14323: Expanded the number of digits in the coefficients for the + RGB -- YIQ conversions so that they match the FCC NTSC versions. + +- Issue #17998: Fix an internal error in regular expression engine. + +- Issue #17557: Fix os.getgroups() to work with the modified behavior of + getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik. + +- Issue #18608: Avoid keeping a strong reference to the locale module + inside the _io module. + +- Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, + and make it GC-aware. + +- Issue #15699: The readline module now uses PEP 3121-style module + initialization, so as to reclaim allocated resources (Python callbacks) + at shutdown. Original patch by Robin Schreiber. + +- Issue #17616: wave.open now supports the context management protocol. + +- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns + 'SHA1' instead of 'SHA'. + +- Issue #13266: Added inspect.unwrap to easily unravel __wrapped__ chains + (initial patch by Daniel Urban and Aaron Iles) + +- Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL. + +- Issue #18559: Fix NULL pointer dereference error in _pickle module + +- Issue #18556: Check the return type of PyUnicode_AsWideChar() in ctype's + U_set(). + +- Issue #17818: aifc.getparams now returns a namedtuple. + +- Issue #18549: Eliminate dead code in socket_ntohl() + +- Issue #18530: Remove additional stat call from posixpath.ismount. + Patch by Alex Gaynor. + +- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() + +- Issue #9177: Calling read() or write() now raises ValueError, not + AttributeError, on a closed SSL socket. Patch by Senko Rasic. + +- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + + gcc. + +- Issue #18479: Changed venv Activate.ps1 to make deactivate a function, and + removed Deactivate.ps1. + +- Issue #18480: Add missing call to PyType_Ready to the _elementtree extension. + +- Issue #17778: Fix test discovery for test_multiprocessing. (Patch by + Zachary Ware.) + +- Issue #18393: The private module _gestalt and private functions + platform._mac_ver_gestalt, platform._mac_ver_lookup and + platform._bcd2str have been removed. This does not affect the public + interface of the platform module. + +- Issue #17482: functools.update_wrapper (and functools.wraps) now set the + __wrapped__ attribute correctly even if the underlying function has a + __wrapped__ attribute set. + +- Issue #18431: The new email header parser now decodes RFC2047 encoded words + in structured headers. + +- Issue #18432: The sched module's queue method was incorrectly returning + an iterator instead of a list. + +- Issue #18044: The new email header parser was mis-parsing encoded words where + an encoded character immediately followed the '?' that follows the CTE + character, resulting in a decoding failure. They are now decoded correctly. + +- Issue #18101: Tcl.split() now process strings nested in a tuple as it + do with byte strings. + +- Issue #18116: getpass was always getting an error when testing /dev/tty, + and thus was always falling back to stdin, and would then raise an exception + if stdin could not be used (such as /dev/null). It also leaked an open file. + All of these issues are now fixed. + +- Issue #17198: Fix a NameError in the dbm module. Patch by Valentina + Mukhamedzhanova. + +- Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form. + +- Issue #18020: improve html.escape speed by an order of magnitude. + Patch by Matt Bryant. + +- Issue #18347: ElementTree's html serializer now preserves the case of + closing tags. + +- Issue #17261: Ensure multiprocessing's proxies use proper address. + +- Issue #18343: faulthandler.register() now keeps the previous signal handler + when the function is called twice, so faulthandler.unregister() restores + correctly the original signal handler. + +- Issue #17097: Make multiprocessing ignore EINTR. + +- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a + segfault inside the _pickle C extension. + +- Issue #18240: The HMAC module is no longer restricted to bytes and accepts + any bytes-like object, e.g. memoryview. Original patch by Jonas Borgstr?m. + +- Issue #18224: Removed pydoc script from created venv, as it causes problems + on Windows and adds no value over and above python -m pydoc ... + +- Issue #18155: The csv module now correctly handles csv files that use + a delimiter character that has a special meaning in regexes, instead of + throwing an exception. + +- Issue #14360: encode_quopri can now be successfully used as an encoder + when constructing a MIMEApplication object. + +- Issue #11390: Add -o and -f command line options to the doctest CLI to + specify doctest options (and convert it to using argparse). + +- Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input + string in longer than 2 gigabytes, and ssl.SSLContext.load_cert_chain() + raises a ValueError if the password is longer than 2 gigabytes. The ssl + module does not support partial write. + +- Issue #11016: Add C implementation of the stat module as _stat. + +- Issue #18248: Fix libffi build on AIX. + +- Issue #18259: Declare sethostname in socketmodule.c for AIX + +- Issue #18147: Add diagnostic functions to ssl.SSLContext(). get_ca_list() + lists all loaded CA certificates and cert_store_stats() returns amount of + loaded X.509 certs, X.509 CA certs and CRLs. + +- Issue #18167: cgi.FieldStorage no longer fails to handle multipart/form-data + when ``\r\n`` appears at end of 65535 bytes without other newlines. + +- Issue #18076: Introduce importlib.util.decode_source(). + +- Issue #18357: add tests for dictview set difference. + Patch by Fraser Tweedale. + +- importlib.abc.SourceLoader.get_source() no longer changes SyntaxError or + UnicodeDecodeError into ImportError. + +- Issue #18058, 18057: Make the namespace package loader meet the + importlib.abc.InspectLoader ABC, allowing for namespace packages to work with + runpy. + +- Issue #17177: The imp module is pending deprecation. + +- subprocess: Prevent a possible double close of parent pipe fds when the + subprocess exec runs into an error. Prevent a regular multi-close of the + /dev/null fd when any of stdin, stdout and stderr was set to DEVNULL. + +- Issue #18194: Introduce importlib.util.cache_from_source() and + source_from_cache() while documenting the equivalent functions in imp as + deprecated. + +- Issue #17907: Document imp.new_module() as deprecated in favour of + types.ModuleType. + +- Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document as deprecated + imp.get_magic(). + +- Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache. + Patch by Mark Levitt + +- Issue #18193: Add importlib.reload(). + +- Issue #18157: Stop using imp.load_module() in pydoc. + +- Issue #16102: Make uuid._netbios_getnode() work again on Python 3. + +- Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. + +- Issue #18143: Implement ssl.get_default_verify_paths() in order to debug + the default locations for cafile and capath. + +- Issue #17314: Move multiprocessing.forking over to importlib. + +- Issue #11959: SMTPServer and SMTPChannel now take an optional map, use of + which avoids affecting global state. + +- Issue #18109: os.uname() now decodes fields from the locale encoding, and + socket.gethostname() now decodes the hostname from the locale encoding, + instead of using the UTF-8 encoding in strict mode. + +- Issue #18089: Implement importlib.abc.InspectLoader.load_module. + +- Issue #18088: Introduce importlib.abc.Loader.init_module_attrs for setting + module attributes. Leads to the pending deprecation of + importlib.util.module_for_loader. + +- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to + ruleline. This helps in handling certain types invalid urls in a conservative + manner. Patch contributed by Mher Movsisyan. + +- Issue #18070: Have importlib.util.module_for_loader() set attributes + unconditionally in order to properly support reloading. + +- Added importlib.util.module_to_load to return a context manager to provide the + proper module object to load. + +- Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw + stream's read() returns more bytes than requested. + +- Issue #18011: As was originally intended, base64.b32decode() now raises a + binascii.Error if there are non-b32-alphabet characters present in the input + string, instead of a TypeError. + +- Issue #18072: Implement importlib.abc.InspectLoader.get_code() and + importlib.abc.ExecutionLoader.get_code(). + +- Issue #8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL + sockets. + +- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X + with port None or "0" and flags AI_NUMERICSERV. + +- Issue #16986: ElementTree now correctly works with string input when the + internal XML encoding is not UTF-8 or US-ASCII. + +- Issue #17996: socket module now exposes AF_LINK constant on BSD and OSX. + +- Issue #17900: Allowed pickling of recursive OrderedDicts. Decreased pickled + size and pickling time. + +- Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an + initial patch by Trent Nelson. + +- Issue #17812: Fixed quadratic complexity of base64.b32encode(). + Optimize base64.b32encode() and base64.b32decode() (speed up to 3x). + +- Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of + service using certificates with many wildcards (CVE-2013-2099). + +- Issue #15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. + +- Issue #14596: The struct.Struct() objects now use a more compact + implementation. + +- Issue #17981: logging's SysLogHandler now closes the socket when it catches + socket OSErrors. + +- Issue #17964: Fix os.sysconf(): the return type of the C sysconf() function + is long, not int. + +- Fix typos in the multiprocessing module. + +- Issue #17754: Make ctypes.util.find_library() independent of the locale. + +- Issue #17968: Fix memory leak in os.listxattr(). + +- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator + characters() and ignorableWhitespace() methods. Original patch by Sebastian + Ortiz Vasquez. + +- Issue #17732: Ignore distutils.cfg options pertaining to install paths if a + virtual environment is active. + +- Issue #17915: Fix interoperability of xml.sax with file objects returned by + codecs.open(). + +- Issue #16601: Restarting iteration over tarfile really restarts rather + than continuing from where it left off. Patch by Michael Birtwell. + +- Issue #17289: The readline module now plays nicer with external modules + or applications changing the rl_completer_word_break_characters global + variable. Initial patch by Bradley Froehle. + +- Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit + platforms. Patch by Federico Schwindt. + +- Issue #11816: multiple improvements to the dis module: get_instructions + generator, ability to redirect output to a file, Bytecode and Instruction + abstractions. Patch by Nick Coghlan, Ryan Kelly and Thomas Kluyver. + +- Issue #13831: Embed stringification of remote traceback in local + traceback raised when pool task raises an exception. + +- Issue #15528: Add weakref.finalize to support finalization using + weakref callbacks. + +- Issue #14173: Avoid crashing when reading a signal handler during + interpreter shutdown. + +- Issue #15902: Fix imp.load_module() accepting None as a file when loading an + extension module. + +- Issue #13721: SSLSocket.getpeercert() and SSLSocket.do_handshake() now + raise an OSError with ENOTCONN, instead of an AttributeError, when the + SSLSocket is not connected. + +- Issue #14679: add an __all__ (that contains only HTMLParser) to html.parser. + +- Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by + Thomas Barlow. + +- Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by + extension load_module()) now have a better chance of working when reloaded. + +- Issue #17804: New function ``struct.iter_unpack`` allows for streaming + struct unpacking. + +- Issue #17830: When keyword.py is used to update a keyword file, it now + preserves the line endings of the original file. + +- Issue #17272: Making the urllib.request's Request.full_url a descriptor. + Fixes bugs with assignment to full_url. Patch by Demian Brecht. + +- Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures + +- Issue #11714: Use 'with' statements to assure a Semaphore releases a + condition variable. Original patch by Thomas Rachel. + +- Issue #16624: `subprocess.check_output` now accepts an `input` argument, + allowing the subprocess's stdin to be provided as a (byte) string. + Patch by Zack Weinberg. + +- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with + Unix domain sockets. + +- Issue #16694: Add a pure Python implementation of the operator module. + Patch by Zachary Ware. + +- Issue #11182: remove the unused and undocumented pydoc.Scanner class. + Patch by Martin Morrison. + +- Issue #17741: Add ElementTree.XMLPullParser, an event-driven parser for + non-blocking applications. + +- Issue #17555: Fix ForkAwareThreadLock so that size of after fork + registry does not grow exponentially with generation of process. + +- Issue #17707: fix regression in multiprocessing.Queue's get() method where + it did not block for short timeouts. + +- Issue #17720: Fix the Python implementation of pickle.Unpickler to correctly + process the APPENDS opcode when it is used on non-list objects. + +- Issue #17012: shutil.which() no longer falls back to the PATH environment + variable if an empty path argument is specified. Patch by Serhiy Storchaka. + +- Issue #17710: Fix pickle raising a SystemError on bogus input. + +- Issue #17341: Include the invalid name in the error messages from re about + invalid group names. + +- Issue #17702: os.environ now raises KeyError with the original environment + variable name (str on UNIX), instead of using the encoded name (bytes on + UNIX). + +- Issue #16163: Make the importlib based version of pkgutil.iter_importers + work for submodules. Initial patch by Berker Peksag. + +- Issue #16804: Fix a bug in the 'site' module that caused running + 'python -S -m site' to incorrectly throw an exception. + +- Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal. + Initial patch by Daniel Riti. + +- Issue #2118: SMTPException is now a subclass of OSError. + +- Issue #17016: Get rid of possible pointer wraparounds and integer overflows + in the re module. Patch by Nickolai Zeldovich. + +- Issue #16658: add missing return to HTTPConnection.send(). + Patch by Jeff Knupp. + +- Issue #9556: the logging package now allows specifying a time-of-day for a + TimedRotatingFileHandler to rotate. + +- Issue #14971: unittest test discovery no longer gets confused when a function + has a different __name__ than its name in the TestCase class dictionary. + +- Issue #17487: The wave getparams method now returns a namedtuple rather than + a plain tuple. + +- Issue #17675: socket repr() provides local and remote addresses (if any). + Patch by Giampaolo Rodola' + +- Issue #17093: Make the ABCs in importlib.abc provide default values or raise + reasonable exceptions for their methods to make them more amenable to super() + calls. + +- Issue #17566: Make importlib.abc.Loader.module_repr() optional instead of an + abstractmethod; now it raises NotImplementedError so as to be ignored by default. + +- Issue #17678: Remove the use of deprecated method in http/cookiejar.py by + changing the call to get_origin_req_host() to origin_req_host. + +- Issue #17666: Fix reading gzip files with an extra field. + +- Issue #16475: Support object instancing, recursion and interned strings + in marshal + +- Issue #17502: Process DEFAULT values in mock side_effect that returns iterator. + +- Issue #16795: On the ast.arguments object, unify vararg with varargannotation + and kwarg and kwargannotation. Change the column offset of ast.Attribute to be + at the attribute name. + +- Issue #17434: Properly raise a SyntaxError when a string occurs between future + imports. + +- Issue #17117: Import and @importlib.util.set_loader now set __loader__ when + it has a value of None or the attribute doesn't exist. + +- Issue #17032: The "global" in the "NameError: global name 'x' is not defined" + error message has been removed. Patch by Ram Rachum. + +- Issue #18080: When building a C extension module on OS X, if the compiler + is overridden with the CC environment variable, use the new compiler as + the default for linking if LDSHARED is not also overridden. This restores + Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. + +- Issue #18113: Fixed a refcount leak in the curses.panel module's + set_userptr() method. Reported by Atsuo Ishimoto. + +- Implement PEP 443 "Single-dispatch generic functions". + +- Implement PEP 435 "Adding an Enum type to the Python standard library". + +- Issue #15596: Faster pickling of unicode strings. + +- Issue #17572: Avoid chained exceptions when passing bad directives to + time.strptime(). Initial patch by Claudiu Popa. + +- Issue #17435: threading.Timer's __init__ method no longer uses mutable + default values for the args and kwargs parameters. + +- Issue #17526: fix an IndexError raised while passing code without filename to + inspect.findsource(). Initial patch by Tyler Doyle. + +- Issue #17540: Added style parameter to logging formatter configuration by dict. + +- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial + patch by Michele Orr?. + +- Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. + +- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, + iceweasel, iceape. + +- Issue #17150: pprint now uses line continuations to wrap long string + literals. + +- Issue #17488: Change the subprocess.Popen bufsize parameter default value + from unbuffered (0) to buffering (-1) to match the behavior existing code + expects and match the behavior of the subprocess module in Python 2 to avoid + introducing hard to track down bugs. + +- Issue #17521: Corrected non-enabling of logger following two calls to + fileConfig(). + +- Issue #17508: Corrected logging MemoryHandler configuration in dictConfig() + where the target handler wasn't configured first. + +- Issue #17209: curses.window.get_wch() now correctly handles KeyboardInterrupt + (CTRL+c). + +- Issue #5713: smtplib now handles 421 (closing connection) error codes when + sending mail by closing the socket and reporting the 421 error code via the + exception appropriate to the command that received the error response. + +- Issue #16997: unittest.TestCase now provides a subTest() context manager + to procedurally generate, in an easy way, small test instances. + +- Issue #17485: Also delete the Request Content-Length header if the data + attribute is deleted. (Follow on to issue Issue #16464). + +- Issue #15927: CVS now correctly parses escaped newlines and carriage + when parsing with quoting turned off. + +- Issue #17467: add readline and readlines support to mock_open in + unittest.mock. + +- Issue #13248: removed deprecated and undocumented difflib.isbjunk, + isbpopular. + +- Issue #17192: Update the ctypes module's libffi to v3.0.13. This + specifically addresses a stack misalignment issue on x86 and issues on + some more recent platforms. + +- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. + +- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO + in subprocess, but the imap code assumes buffered IO. In Python2 this + worked by accident. IMAP4_stream now explicitly uses buffered IO. + +- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc + 'allmethods'; it was missing unbound methods on the class. + +- Issue #17474: Remove the deprecated methods of Request class. + +- Issue #16709: unittest discover order is no-longer filesystem specific. Patch + by Jeff Ramnani. + +- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. + +- Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files + rather than -1. + +- Issue #17460: Remove the strict argument of HTTPConnection and removing the + DeprecationWarning being issued from 3.2 onwards. + +- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. + +- Issue #16389: Fixed a performance regression relative to Python 3.1 in the + caching of compiled regular expressions. + +- Added missing FeedParser and BytesFeedParser to email.parser.__all__. + +- Issue #17431: Fix missing import of BytesFeedParser in email.parser. + +- Issue #12921: http.server's send_error takes an explain argument to send more + information in response. Patch contributed by Karl. + +- Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. + +- Issue #1285086: Get rid of the refcounting hack and speed up + urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). + +- Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ + is not set, harmonizing with what happens when the attribute is set to None. + +- Expose the O_PATH constant in the os module if it is available. + +- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused + a failure while decoding empty object literals when object_pairs_hook was + specified. + +- Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO + queue now uses a deque instead of a list. + +- Issue #15806: Add contextlib.ignore(). This creates a context manager to + ignore specified exceptions, replacing the "except SomeException: pass" idiom. + +- Issue #14645: The email generator classes now produce output using the + specified linesep throughout. Previously if the prolog, epilog, or + body were stored with a different linesep, that linesep was used. This + fix corrects an RFC non-compliance issue with smtplib.send_message. + +- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when + the list is being resized concurrently. + +- Issue #16962: Use getdents64 instead of the obsolete getdents syscall + in the subprocess module on Linux. + +- Issue #16935: unittest now counts the module as skipped if it raises SkipTest, + instead of counting it as an error. Patch by Zachary Ware. + +- Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. + +- Issue #17223: array module: Fix a crasher when converting an array containing + invalid characters (outside range [U+0000; U+10ffff]) to Unicode: + repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. + +- Issue #17197: profile/cProfile modules refactored so that code of run() and + runctx() utility functions is not duplicated in both modules. + +- Issue #14720: sqlite3: Convert datetime microseconds correctly. + Patch by Lowe Thiderman. + +- Issue #15132: Allow a list for the defaultTest argument of + unittest.TestProgram. Patch by Jyrki Pulliainen. + +- Issue #17225: JSON decoder now counts columns in the first line starting + with 1, as in other lines. + +- Issue #6623: Added explicit DeprecationWarning for ftplib.netrc, which has + been deprecated and undocumented for a long time. + +- Issue #13700: Fix byte/string handling in imaplib authentication when an + authobject is specified. + +- Issue #13153: Tkinter functions now raise TclError instead of ValueError when + a string argument contains non-BMP character. + +- Issue #9669: Protect re against infinite loops on zero-width matching in + non-greedy repeat. Patch by Matthew Barnett. + +- Issue #13169: The maximal repetition number in a regular expression has been + increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on + 64-bit). + +- Issue #17143: Fix a missing import in the trace module. Initial patch by + Berker Peksag. + +- Issue #15220: email.feedparser's line splitting algorithm is now simpler and + faster. + +- Issue #16743: Fix mmap overflow check on 32 bit Windows. + +- Issue #16996: webbrowser module now uses shutil.which() to find a + web-browser on the executable search path. + +- Issue #16800: tempfile.gettempdir() no longer left temporary files when + the disk is full. Original patch by Amir Szekely. + +- Issue #17192: Import libffi-3.0.12. + +- Issue #16564: Fixed regression relative to Python2 in the operation of + email.encoders.encode_7or8bit when used with binary data. + +- Issue #17052: unittest discovery should use self.testLoader. + +- Issue #4591: Uid and gid values larger than 2**31 are supported now. + +- Issue #17141: random.vonmisesvariate() no longer hangs for large kappas. + +- Issue #17149: Fix random.vonmisesvariate to always return results in + [0, 2*math.pi]. + +- Issue #1470548: XMLGenerator now works with binary output streams. + +- Issue #6975: os.path.realpath() now correctly resolves multiple nested + symlinks on POSIX platforms. + +- Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the + filename as a URI, allowing custom options to be passed. + +- Issue #16564: Fixed regression relative to Python2 in the operation of + email.encoders.encode_noop when used with binary data. + +- Issue #10355: The mode, name, encoding and newlines properties now work on + SpooledTemporaryFile objects even when they have not yet rolled over. + Obsolete method xreadline (which has never worked in Python 3) has been + removed. + +- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in + avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(), + and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for + 32-bit samples. max() and rms() no more returns a negative result and + various other functions now work correctly with 32-bit sample -0x80000000. + +- Issue #17073: Fix some integer overflows in sqlite3 module. + +- Issue #16723: httplib.HTTPResponse no longer marked closed when the connection + is automatically closed. + +- Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by + Brian Thorne. + +- Issue #16948: Fix quoted printable body encoding for non-latin1 character + sets in the email package. + +- Issue #16811: Fix folding of headers with no value in the provisional email + policies. + +- Issue #17132: Update symbol for "yield from" grammar changes. + +- Issue #17076: Make copying of xattrs more tolerant of missing FS support. + Patch by Thomas Wouters. + +- Issue #17089: Expat parser now correctly works with string input when the + internal XML encoding is not UTF-8 or US-ASCII. It also now accepts bytes + and strings larger than 2 GiB. + +- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple + parses nested mutating sequence. + +- Issue #5289: Fix ctypes.util.find_library on Solaris. + +- Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying + stream or a decoder produces data of an unexpected type (i.e. when + io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec). + +- Issue #17015: When it has a spec, a Mock object now inspects its signature + when matching calls, so that arguments can be matched positionally or + by name. + +- Issue #15633: httplib.HTTPResponse is now mark closed when the server + sends less than the advertised Content-Length. + +- Issue #12268: The io module file object write methods no longer abort early + when one of its write system calls is interrupted (EINTR). + +- Issue #6972: The zipfile module no longer overwrites files outside of + its destination path when extracting malicious zip files. + +- Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an + incomplete "End of Central Directory" record. Original patch by Guilherme + Polo and Alan McIntyre. + +- Issue #17071: Signature.bind() now works when one of the keyword arguments + is named ``self``. + +- Issue #12004: Fix an internal error in PyZipFile when writing an invalid + Python file. Patch by Ben Morgan. + +- Have py_compile use importlib as much as possible to avoid code duplication. + Code now raises FileExistsError if the file path to be used for the + byte-compiled file is a symlink or non-regular file as a warning that import + will not keep the file path type if it writes to that path. + +- Issue #16972: Have site.addpackage() consider already known paths even when + none are explicitly passed in. Bug report and fix by Kirill. + +- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``) + now fills the ``os.environ`` variable correctly. + +- Issue #15505: `unittest.installHandler` no longer assumes SIGINT handler is + set to a callable object. + +- Issue #13454: Fix a crash when deleting an iterator created by itertools.tee() + if all other iterators were very advanced before. + +- Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries + and bytes data. Patch by Jonas Wagner. + +- Issue #16957: shutil.which() no longer searches a bare file name in the + current directory on Unix and no longer searches a relative file path with + a directory part in PATH directories. Patch by Thomas Kluyver. + +- Issue #1159051: GzipFile now raises EOFError when reading a corrupted file + with truncated header or footer. + +- Issue #16993: shutil.which() now preserves the case of the path and extension + on Windows. + +- Issue #16992: On Windows in signal.set_wakeup_fd, validate the file + descriptor argument. + +- Issue #16422: For compatibility with the Python version, the C version of + decimal now uses strings instead of integers for rounding mode constants. + +- Issue #15861: tkinter now correctly works with lists and tuples containing + strings with whitespaces, backslashes or unbalanced braces. + +- Issue #9720: zipfile now writes correct local headers for files larger than + 4 GiB. + +- Issue #16955: Fix the poll() method for multiprocessing's socket + connections on Windows. + +- SSLContext.load_dh_params() now properly closes the input file. + +- Issue #15031: Refactor some .pyc management code to cut down on code + duplication. Thanks to Ronan Lamy for the report and taking an initial stab + at the problem. + +- Issue #16398: Optimize deque.rotate() so that it only moves pointers + and doesn't touch the underlying data with increfs and decrefs. + +- Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed. + +- Issue #13899: ``\A``, ``\Z``, and ``\B`` now correctly match the A, Z, + and B literals when used inside character classes (e.g. ``'[\A]'``). + Patch by Matthew Barnett. + +- Issue #15545: Fix regression in sqlite3's iterdump method where it was + failing if the connection used a row factory (such as sqlite3.Row) that + produced unsortable objects. (Regression was introduced by fix for 9750). + +- fcntl: add F_DUPFD_CLOEXEC constant, available on Linux 2.6.24+. + +- Issue #15972: Fix error messages when os functions expecting a file name or + file descriptor receive the incorrect type. + +- Issue #8109: The ssl module now has support for server-side SNI, thanks + to a :meth:`SSLContext.set_servername_callback` method. Patch by Daniel + Black. + +- Issue #16860: In tempfile, use O_CLOEXEC when available to set the + close-on-exec flag atomically. + +- Issue #16674: random.getrandbits() is now 20-40% faster for small integers. + +- Issue #16009: JSON error messages now provide more information. + +- Issue #16828: Fix error incorrectly raised by bz2.compress(b'') and + bz2.BZ2Compressor.compress(b''). Initial patch by Martin Packman. + +- Issue #16833: In http.client.HTTPConnection, do not concatenate the request + headers and body when the payload exceeds 16 KB, since it can consume more + memory for no benefit. Patch by Benno Leslie. + +- Issue #16541: tk_setPalette() now works with keyword arguments. + +- Issue #16820: In configparser, `parser.popitem()` no longer raises ValueError. + This makes `parser.clean()` work correctly. + +- Issue #16820: In configparser, ``parser['section'] = {}`` now preserves + section order within the parser. This makes `parser.update()` preserve section + order as well. + +- Issue #16820: In configparser, ``parser['DEFAULT'] = {}`` now correctly + clears previous values stored in the default section. Same goes for + ``parser.update({'DEFAULT': {}})``. + +- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. + +- Issue #16787: Increase asyncore and asynchat default output buffers size, to + decrease CPU usage and increase throughput. + +- Issue #10527: make multiprocessing use poll() instead of select() if available. + +- Issue #16688: Now regexes contained backreferences correctly work with + non-ASCII strings. Patch by Matthew Barnett. + +- Issue #16486: Make aifc files act as context managers. + +- Issue #16485: Now file descriptors are closed if file header patching failed + on closing an aifc file. + +- Issue #16640: Run less code under a lock in sched module. + +- Issue #16165: sched.scheduler.run() no longer blocks a scheduler for other + threads. + +- Issue #16641: Default values of sched.scheduler.enter() are no longer + modifiable. + +- Issue #16618: Make glob.glob match consistently across strings and bytes + regarding leading dots. Patch by Serhiy Storchaka. + +- Issue #16788: Add samestat to Lib/ntpath.py + +- Issue #16713: Parsing of 'tel' urls using urlparse separates params from + path. + +- Issue #16443: Add docstrings to regular expression match objects. + Patch by Anton Kasyanov. + +- Issue #15701: Fix HTTPError info method call to return the headers information. + +- Issue #16752: Add a missing import to modulefinder. Patch by Berker Peksag. + +- Issue #16646: ftplib.FTP.makeport() might lose socket error details. + (patch by Serhiy Storchaka) + +- Issue #16626: Fix infinite recursion in glob.glob() on Windows when the + pattern contains a wildcard in the drive or UNC path. Patch by Serhiy + Storchaka. + +- Issue #15783: Except for the number methods, the C version of decimal now + supports all None default values present in decimal.py. These values were + largely undocumented. + +- Issue #11175: argparse.FileType now accepts encoding and errors + arguments. Patch by Lucas Maystre. + +- Issue #16488: epoll() objects now support the `with` statement. Patch + by Serhiy Storchaka. + +- Issue #16298: In HTTPResponse.read(), close the socket when there is no + Content-Length and the incoming stream is finished. Patch by Eran + Rundstein. + +- Issue #16049: Add abc.ABC class to enable the use of inheritance to create + ABCs, rather than the more cumbersome metaclass=ABCMeta. Patch by Bruno + Dupuis. + +- Expose the TCP_FASTOPEN and MSG_FASTOPEN flags in socket when they're + available. + +- Issue #15701: Add a .headers attribute to urllib.error.HTTPError. Patch + contributed by Berker Peksag. + +- Issue #15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree + that caused it to not ignore certain errors when ignore_errors was set. + Patch by Alessandro Moura and Serhiy Storchaka. + +- Issue #16248: Disable code execution from the user's home directory by + tkinter when the -E flag is passed to Python. Patch by Zachary Ware. + +- Issue #13390: New function :func:`sys.getallocatedblocks()` returns the + number of memory blocks currently allocated. + +- Issue #16628: Fix a memory leak in ctypes.resize(). + +- Issue #13614: Fix setup.py register failure with invalid rst in description. + Patch by Julien Courteau and Pierre Paul Lefebvre. + +- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by + Philip Jenvey, tested by Mageia and Debian. + +- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later + on. Initial patch by SilentGhost and Jeff Ramnani. + +- Issue #13120: Allow calling pdb.set_trace() from thread. + Patch by Ilya Sandler. + +- Issue #16585: Make CJK encoders support error handlers that return bytes per + PEP 383. + +- Issue #10182: The re module doesn't truncate indices to 32 bits anymore. + Patch by Serhiy Storchaka. + +- Issue #16333: use (",", ": ") as default separator in json when indent is + specified, to avoid trailing whitespace. Patch by Serhiy Storchaka. + +- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous + list() calls aren't added to filter(), map(), and zip() which are directly + passed enumerate(). + +- Issue #16464: Reset the Content-Length header when a urllib Request is reused + with new data. + +- Issue #12848: The pure Python pickle implementation now treats object + lengths as unsigned 32-bit integers, like the C implementation does. + Patch by Serhiy Storchaka. + +- Issue #16423: urllib.request now has support for ``data:`` URLs. Patch by + Mathias Panzenb?ck. + +- Issue #4473: Add a POP3.stls() to switch a clear-text POP3 session into + an encrypted POP3 session, on supported servers. Patch by Lorenzo Catucci. + +- Issue #4473: Add a POP3.capa() method to query the capabilities advertised + by the POP3 server. Patch by Lorenzo Catucci. + +- Issue #4473: Ensure the socket is shutdown cleanly in POP3.close(). + Patch by Lorenzo Catucci. + +- Issue #16522: added FAIL_FAST flag to doctest. + +- Issue #15627: Add the importlib.abc.InspectLoader.source_to_code() method. + +- Issue #16408: Fix file descriptors not being closed in error conditions + in the zipfile module. Patch by Serhiy Storchaka. + +- Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak + references to bound methods. + +- Issue #16469: Fix exceptions from float -> Fraction and Decimal -> Fraction + conversions for special values to be consistent with those for float -> int + and Decimal -> int. Patch by Alexey Kachayev. + +- Issue #16481: multiprocessing no longer leaks process handles on Windows. + +- Issue #12428: Add a pure Python implementation of functools.partial(). + Patch by Brian Thorne. + +- Issue #16140: The subprocess module no longer double closes its child + subprocess.PIPE parent file descriptors on child error prior to exec(). + +- Remove a bare print to stdout from the subprocess module that could have + happened if the child process wrote garbage to its pre-exec error pipe. + +- The subprocess module now raises its own SubprocessError instead of a + RuntimeError in various error situations which should not normally happen. + +- Issue #16327: The subprocess module no longer leaks file descriptors + used for stdin/stdout/stderr pipes to the child when fork() fails. + +- Issue #14396: Handle the odd rare case of waitpid returning 0 when not + expected in subprocess.Popen.wait(). + +- Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access + previously-freed memory. Patch by Serhiy Storchaka. + +- Issue #16357: fix calling accept() on a SSLSocket created through + SSLContext.wrap_socket(). Original patch by Jeff McNeil. + +- Issue #16409: The reporthook callback made by the legacy + urllib.request.urlretrieve API now properly supplies a constant non-zero + block_size as it did in Python 3.2 and 2.7. This matches the behavior of + urllib.request.URLopener.retrieve. + +- Issue #16431: Use the type information when constructing a Decimal subtype + from a Decimal argument. + +- Issue #15641: Clean up deprecated classes from importlib. + Patch by Taras Lyapun. + +- Issue #16350: zlib.decompressobj().decompress() now accumulates data from + successive calls after EOF in unused_data, instead of only saving the argument + to the last call. decompressobj().flush() now correctly sets unused_data and + unconsumed_tail. A bug in the handling of MemoryError when setting the + unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. + +- Issue #12759: sre_parse now raises a proper error when the name of the group + is missing. Initial patch by Serhiy Storchaka. + +- Issue #16152: fix tokenize to ignore whitespace at the end of the code when + no newline is found. Patch by Ned Batchelder. + +- Issue #16284: Prevent keeping unnecessary references to worker functions + in concurrent.futures ThreadPoolExecutor. + +- Issue #16230: Fix a crash in select.select() when one of the lists changes + size while iterated on. Patch by Serhiy Storchaka. + +- Issue #16228: Fix a crash in the json module where a list changes size + while it is being encoded. Patch by Serhiy Storchaka. + +- Issue #16351: New function gc.get_stats() returns per-generation collection + statistics. + +- Issue #14897: Enhance error messages of struct.pack and + struct.pack_into. Patch by Matti M?ki. + +- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. + Patch by Serhiy Storchaka. + +- Issue #12890: cgitb no longer prints spurious

tags in text + mode when the logdir option is specified. + +- Issue #16307: Fix multiprocessing.Pool.map_async not calling its callbacks. + Patch by Janne Karila. + +- Issue #16305: Fix a segmentation fault occurring when interrupting + math.factorial. + +- Issue #16116: Fix include and library paths to be correct when building C + extensions in venvs. + +- Issue #16245: Fix the value of a few entities in html.entities.html5. + +- Issue #16301: Fix the localhost verification in urllib/request.py for ``file://`` + urls. + +- Issue #16250: Fix the invocations of URLError which had misplaced filename + attribute for exception. + +- Issue #10836: Fix exception raised when file not found in urlretrieve + Initial patch by Ezio Melotti. + +- Issue #14398: Fix size truncation and overflow bugs in the bz2 module. + +- Issue #12692: Fix resource leak in urllib.request when talking to an HTTP + server that does not include a ``Connection: close`` header in its responses. + +- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. + Patch by Atsuo Ishimoto. + +- Improve performance of `lzma.LZMAFile` (see also issue #16034). + +- Issue #16220: wsgiref now always calls close() on an iterable response. + Patch by Brent Tubbs. + +- Issue #16270: urllib may hang when used for retrieving files via FTP by using + a context manager. Patch by Giampaolo Rodola'. + +- Issue #16461: Wave library should be able to deal with 4GB wav files, + and sample rate of 44100 Hz. + +- Issue #16176: Properly identify Windows 8 via platform.platform() + +- Issue #16088: BaseHTTPRequestHandler's send_error method includes a + Content-Length header in its response now. Patch by Antoine Pitrou. + +- Issue #16114: The subprocess module no longer provides a misleading error + message stating that args[0] did not exist when either the cwd or executable + keyword arguments specified a path that did not exist. + +- Issue #16169: Fix ctypes.WinError()'s confusion between errno and winerror. + +- Issue #16110: logging.fileConfig now accepts a pre-initialised ConfigParser + instance. + +- Issue #1492704: shutil.copyfile() raises a distinct SameFileError now if + source and destination are the same file. Patch by Atsuo Ishimoto. + +- Issue #13896: Make shelf instances work with 'with' as context managers. + Original patch by Filip Gruszczy?ski. + +- Issue #15417: Add support for csh and fish in venv activation scripts. + +- Issue #14377: ElementTree.write and some of the module-level functions have + a new parameter - *short_empty_elements*. It controls how elements with no + contents are emitted. + +- Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element + element_factory (fixes a regression in SimpleTAL). + +- Issue #9650: List commonly used format codes in time.strftime and + time.strptime docsttings. Original patch by Mike Hoy. + +- Issue #15452: logging configuration socket listener now has a verify option + that allows an application to apply a verification function to the + received configuration data before it is acted upon. + +- Issue #16034: Fix performance regressions in the new `bz2.BZ2File` + implementation. Initial patch by Serhiy Storchaka. + +- `pty.spawn()` now returns the child process status returned by `os.waitpid()`. + +- Issue #15756: `subprocess.poll()` now properly handles `errno.ECHILD` to + return a returncode of 0 when the child has already exited or cannot be waited + on. + +- Issue #15323: Improve failure message of `Mock.assert_called_once_with()`. + +- Issue #16064: ``unittest -m`` claims executable is "python", not "python3". + +- Issue #12376: Pass on parameters in `TextTestResult.__init__()` super call. + +- Issue #15222: Insert blank line after each message in mbox mailboxes. + +- Issue #16013: Fix `csv.Reader` parsing issue with ending quote characters. + Patch by Serhiy Storchaka. + +- Issue #15421: Fix an OverflowError in `Calendar.itermonthdates()` after + `datetime.MAXYEAR`. Patch by C?dric Krier. + +- Issue #16112: platform.architecture does not correctly escape argument to + /usr/bin/file. Patch by David Benjamin. + +- Issue #15970: `xml.etree.ElementTree` now serializes correctly the empty HTML + elements 'meta' and 'param'. + +- Issue #15842: The `SocketIO.{readable,writable,seekable}` methods now raise + ValueError when the file-like object is closed. Patch by Alessandro Moura. + +- Issue #15876: Fix a refleak in the `curses` module: window.encoding. + +- Issue #15881: Fix `atexit` hook in `multiprocessing`. Original patch by Chris + McDonough. + +- Issue #15841: The readable(), writable() and seekable() methods of + `io.BytesIO` and `io.StringIO` objects now raise ValueError when the object + has been closed. Patch by Alessandro Moura. + +- Issue #15447: Use `subprocess.DEVNULL` in webbrowser, instead of opening + `os.devnull` explicitly and leaving it open. + +- Issue #15509: `webbrowser.UnixBrowser` no longer passes empty arguments to + Popen when ``%action`` substitutions produce empty strings. + +- Issue #12776, issue #11839: Call `argparse` type function (specified by + add_argument) only once. Before, the type function was called twice in the + case where the default was specified and the argument was given as well. This + was especially problematic for the FileType type, as a default file would + always be opened, even if a file argument was specified on the command line. + +- Issue #15906: Fix a regression in argparse caused by the preceding change, + when ``action='append'``, ``type='str'`` and ``default=[]``. + +- Issue #16113: Added sha3 module based on the Keccak reference implementation + 3.2. The `hashlib` module has four additional hash algorithms: `sha3_224`, + `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common + code was moved from _hashopenssl.c to hashlib.h. + +- ctypes.call_commethod was removed, since its only usage was in the defunct + samples directory. + +- Issue #16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. + +- Issue #16832: add abc.get_cache_token() to expose cache validity checking + support in ABCMeta. + +IDLE +---- + +- Issue #18429: Format / Format Paragraph, now works when comment blocks + are selected. As with text blocks, this works best when the selection + only includes complete lines. + +- Issue #18226: Add docstrings and unittests for FormatParagraph.py. + Original patches by Todd Rovito and Phil Webster. + +- Issue #18279: Format - Strip trailing whitespace no longer marks a file as + changed when it has not been changed. This fix followed the addition of a + test file originally written by Phil Webster (the issue's main goal). + +- Issue #7136: In the Idle File menu, "New Window" is renamed "New File". + Patch by Tal Einat, Roget Serwy, and Todd Rovito. + +- Remove dead imports of imp. + +- Issue #18196: Avoid displaying spurious SystemExit tracebacks. + +- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition. + +- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". + Original patch by Sarah K. + +- Issue #18055: Move IDLE off of imp and on to importlib. + +- Issue #15392: Create a unittest framework for IDLE. + Initial patch by Rajagopalasarma Jayakrishnan. + See Lib/idlelib/idle_test/README.txt for how to run Idle tests. + +- Issue #14146: Highlight source line while debugging on Windows. + +- Issue #17838: Allow sys.stdin to be reassigned. + +- Issue #13495: Avoid loading the color delegator twice in IDLE. + +- Issue #17798: Allow IDLE to edit new files when specified on command line. + +- Issue #14735: Update IDLE docs to omit "Control-z on Windows". + +- Issue #17532: Always include Options menu for IDLE on OS X. + Patch by Guilherme Sim?es. + +- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit(). + +- Issue #17657: Show full Tk version in IDLE's about dialog. + Patch by Todd Rovito. + +- Issue #17613: Prevent traceback when removing syntax colorizer in IDLE. + +- Issue #1207589: Backwards-compatibility patch for right-click menu in IDLE. + +- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box. + +- Issue #17625: In IDLE, close the replace dialog after it is used. + +- Issue #14254: IDLE now handles readline correctly across shell restarts. + +- Issue #17614: IDLE no longer raises exception when quickly closing a file. + +- Issue #6698: IDLE now opens just an editor window when configured to do so. + +- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer + raises an exception. + +- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. + +- Issue #17114: IDLE now uses non-strict config parser. + +- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase + interface and support all mandatory methods and properties. + +- Issue #5066: Update IDLE docs. Patch by Todd Rovito. + +- Issue #16829: IDLE printing no longer fails if there are spaces or other + special characters in the file path. + +- Issue #16491: IDLE now prints chained exception tracebacks. + +- Issue #16819: IDLE method completion now correctly works for bytes literals. + +- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by + Roger Serwy. + +- Issue #16511: Use default IDLE width and height if config param is not valid. + Patch Serhiy Storchaka. + +- Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. + Patch by Todd Rovito. + +- Issue #16123: IDLE - deprecate running without a subprocess. + Patch by Roger Serwy. + +Tests +----- + +- Issue #1666318: Add a test that shutil.copytree() retains directory + permissions. Patch by Catherine Devlin. + +- Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json + and make them discoverable by unittest. Patch by Zachary Ware. + +- Fix a fcntl test case on KFreeBSD, Debian #708653 (Petr Salinger). + +- Issue #18396: Fix spurious test failure in test_signal on Windows when + faulthandler is enabled (Patch by Jeremy Kloth) + +- Issue #17046: Fix broken test_executable_without_cwd in test_subprocess. + +- Issue #15415: Add new temp_dir() and change_cwd() context managers to + test.support, and refactor temp_cwd() to use them. Patch by Chris Jerdonek. + +- Issue #15494: test.support is now a package rather than a module (Initial + patch by Indra Talip) + +- Issue #17944: test_zipfile now discoverable and uses subclassing to + generate tests for different compression types. Fixed a bug with skipping + some tests due to use of exhausted iterators. + +- Issue #18266: test_largefile now works with unittest test discovery and + supports running only selected tests. Patch by Zachary Ware. + +- Issue #17767: test_locale now works with unittest test discovery. + Original patch by Zachary Ware. + +- Issue #18375: Assume --randomize when --randseed is used for running the + testsuite. + +- Issue #11185: Fix test_wait4 under AIX. Patch by S?bastien Sabl?. + +- Issue #18207: Fix test_ssl for some versions of OpenSSL that ignore seconds + in ASN1_TIME fields. + +- Issue #18094: test_uuid no longer reports skipped tests as passed. + +- Issue #17992: Add timeouts to asyncore and asynchat tests so that they won't + accidentally hang. + +- Issue #17833: Fix test_gdb failures seen on machines where debug symbols + for glibc are available (seen on PPC64 Linux). + +- Issue #7855: Add tests for ctypes/winreg for issues found in IronPython. + Initial patch by Dino Viehland. + +- Issue #11078: test___all__ now checks for duplicates in __all__. + Initial patch by R. David Murray. + +- Issue #17712: Fix test_gdb failures on Ubuntu 13.04. + +- Issue #17835: Fix test_io when the default OS pipe buffer size is larger + than one million bytes. + +- Issue #17065: Use process-unique key for winreg tests to avoid failures if + test is run multiple times in parallel (eg: on a buildbot host). + +- Issue #12820: add tests for the xml.dom.minicompat module. + Patch by John Chandler and Phil Connell. + +- Issue #17691: test_univnewlines now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17790: test_set now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17789: test_random now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17779: test_osx_env now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17766: test_iterlen now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17690: test_time now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17692: test_sqlite now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #11995: test_pydoc doesn't import all sys.path modules anymore. + +- Issue #17448: test_sax now skips if there are no xml parsers available + instead of raising an ImportError. + +- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. + Initial patch by Thomas Wouters. + +- Issue #10652: make tcl/tk tests run after __all__ test, patch by + Zachary Ware. + +- Issue #11963: remove human verification from test_parser and test_subprocess. + +- Issue #11732: add a new suppress_crash_popup() context manager to test.support + that disables crash popups on Windows and use it in test_faulthandler and + test_capi. + +- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. + +- Issue #17283: Share code between `__main__.py` and `regrtest.py` in + `Lib/test`. + +- Issue #17249: convert a test in test_capi to use unittest and reap threads. + +- Issue #17107: Test client-side SNI support in urllib.request thanks to + the new server-side SNI support in the ssl module. Initial patch by + Daniel Black. + +- Issue #17041: Fix testing when Python is configured with the + --without-doc-strings. + +- Issue #16923: Fix ResourceWarnings in test_ssl. + +- Issue #15539: Added regression tests for Tools/scripts/pindent.py. + +- Issue #17479: test_io now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17066: test_robotparser now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17334: test_index now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17333: test_imaplib now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17082: test_dbm* now work with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17079: test_ctypes now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17304: test_hash now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17303: test_future* now work with unittest test discovery. + Patch by Zachary Ware. + +- Issue #17163: test_file now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16925: test_configparser now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16918: test_codecs now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16919: test_crypt now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16910: test_bytes, test_unicode, and test_userstring now work with + unittest test discovery. Patch by Zachary Ware. + +- Issue #16905: test_warnings now works with unittest test discovery. + Initial patch by Berker Peksag. + +- Issue #16898: test_bufio now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16888: test_array now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16896: test_asyncore now works with unittest test discovery. + Patch by Zachary Ware. + +- Issue #16897: test_bisect now works with unittest test discovery. + Initial patch by Zachary Ware. + +- Issue #16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath + now work with unittest test discovery. Patch by Zachary Ware. + +- Issue #16748: test_heapq now works with unittest test discovery. + +- Issue #10646: Tests rearranged for os.samefile/samestat to check for not + just symlinks but also hard links. + +- Issue #15302: Switch regrtest from using getopt to using argparse. + +- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize + options. + +- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for + localhost tests. + +- Issue #16664: Add regression tests for glob's behaviour concerning entries + starting with a ".". Patch by Sebastian Kreft. + +- Issue #13390: The ``-R`` option to regrtest now also checks for memory + allocation leaks, using :func:`sys.getallocatedblocks()`. + +- Issue #16559: Add more tests for the json module, including some from the + official test suite at json.org. Patch by Serhiy Storchaka. + +- Issue #16661: Fix the `os.getgrouplist()` test by not assuming that it gives + the same output as :command:`id -G`. + +- Issue #16115: Add some tests for the executable argument to + subprocess.Popen(). Initial patch by Kushal Das. + +- Issue #16126: PyErr_Format format mismatch in _testcapimodule.c. + Patch by Serhiy Storchaka. + +- Issue #15304: Fix warning message when `os.chdir()` fails inside + `test.support.temp_cwd()`. Patch by Chris Jerdonek. + +- Issue #15802: Fix test logic in `TestMaildir.test_create_tmp()`. Patch by + Serhiy Storchaka. + +- Issue #15557: Added a test suite for the webbrowser module, thanks to Anton + Barkovsky. + +- Issue #16698: Skip posix test_getgroups when built with OS X + deployment target prior to 10.6. + +Build +----- + +- Issue #16067: Add description into MSI file to replace installer's + temporary name. + +- Issue #18257: Fix readlink usage in python-config. Install the python + version again on Darwin. + +- Issue #18481: Add C coverage reporting with gcov and lcov. A new make target + "coverage-report" creates an instrumented Python build, runs unit tests + and creates a HTML. The report can be updated with "make coverage-lcov". + +- Issue #17845: Clarified the message printed when some module are not built. + +- Issue #18256: Compilation fix for recent AIX releases. Patch by + David Edelsohn. + +- Issue #17547: In configure, explicitly pass -Wformat for the benefit for GCC + 4.8. + +- Issue #15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 + on Windows. + +- Issue #17591: Use lowercase filenames when including Windows header files. + Patch by Roumen Petrov. + +- Issue #17550: Fix the --enable-profiling configure switch. + +- Issue #17425: Build with openssl 1.0.1d on Windows. + +- Issue #16754: Fix the incorrect shared library extension on linux. Introduce + two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of + SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. + +- Issue #5033: Fix building of the sqlite3 extension module when the + SQLite library version has "beta" in it. Patch by Andreas Pelme. + +- Issue #17228: Fix building without pymalloc. + +- Issue #3718: Use AC_ARG_VAR to set MACHDEP in configure.ac. + +- Issue #16235: Implement python-config as a shell script. + +- Issue #16769: Remove outdated Visual Studio projects. + +- Issue #17031: Fix running regen in cross builds. + +- Issue #3754: fix typo in pthread AC_CACHE_VAL. + +- Issue #15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; + use _PYTHON_PROJECT_BASE in distutils/sysconfig.py. + +- Drop support for Windows 2000 (changeset e52df05b496a). + +- Issue #17029: Let h2py search the multiarch system include directory. + +- Issue #16953: Fix socket module compilation on platforms with + HAVE_BROKEN_POLL. Patch by Jeffrey Armstrong. + +- Issue #16320: Remove redundant Makefile dependencies for strings and bytes. + +- Cross compiling needs host and build settings. configure no longer + creates a broken PYTHON_FOR_BUILD variable when --build is missing. + +- Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs are + defined in cross compiling mode, too. + +- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. + +- Issue #16593: Have BSD 'make -s' do the right thing, thanks to Daniel Shahaf + +- Issue #16262: fix out-of-src-tree builds, if mercurial is not installed. + +- Issue #15298: ensure _sysconfigdata is generated in build directory, not + source directory. + +- Issue #15833: Fix a regression in 3.3 that resulted in exceptions being + raised if importlib failed to write byte-compiled files. This affected + attempts to build Python out-of-tree from a read-only source directory. + +- Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError + after 2801bf875a24 (see #15801). + +- Issue #16135: Remove OS/2 support. + +- Issue #15819: Make sure we can build Python out-of-tree from a read-only + source directory. (Somewhat related to issue #9860.) + +- Issue #15587: Enable Tk high-resolution text rendering on Macs with + Retina displays. Applies to Tkinter apps, such as IDLE, on OS X + framework builds linked with Cocoa Tk 8.5. + +- Issue #17161: make install now also installs a python3 man page. + +C-API +----- + +- Issue #18351: Fix various issues in a function in importlib provided to help + PyImport_ExecCodeModuleWithPathnames() (and thus by extension + PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx()). + +- Issue #15767: Added PyErr_SetImportErrorSubclass(). + +- PyErr_SetImportError() now sets TypeError when its msg argument is set. + +- Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and + PyObject_CallMethod() now changed to `const char*`. Based on patches by + J?rg M?ller and Lars Buitinck. + +- Issue #17206: Py_CLEAR(), Py_DECREF(), Py_XINCREF() and Py_XDECREF() now + expand their arguments once instead of multiple times. Patch written by Illia + Polosukhin. + +- Issue #17522: Add the PyGILState_Check() API. + +- Issue #17327: Add PyDict_SetDefault. + +- Issue #16881: Fix Py_ARRAY_LENGTH macro for GCC < 3.1. + +- Issue #16505: Remove unused Py_TPFLAGS_INT_SUBCLASS. + +- Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned + (unsigned long and unsigned int) to avoid an undefined behaviour with + Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is + now unsigned too (unsigned long, instead of long). + +- Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified + endianness detection and handling. + +Documentation +------------- + +- Issue #23006: Improve the documentation and indexing of dict.__missing__. + Add an entry in the language datamodel special methods section. + Revise and index its discussion in the stdtypes mapping/dict section. + +- Issue #17701: Improving strftime documentation. + +- Issue #18440: Clarify that `hash()` can truncate the value returned from an + object's custom `__hash__()` method. + +- Issue #17844: Add links to encoders and decoders for bytes-to-bytes codecs. + +- Issue #14097: improve the "introduction" page of the tutorial. + +- Issue #17977: The documentation for the cadefault argument's default value + in urllib.request.urlopen() is fixed to match the code. + +- Issue #6696: add documentation for the Profile objects, and improve + profile/cProfile docs. Patch by Tom Pinckney. + +- Issue #15940: Specify effect of locale on time functions. + +- Issue #17538: Document XML vulnerabilties + +- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. + Patch by Ramchandra Apte + +- Issue #17047: remove doubled words in docs and docstrings + reported by Serhiy Storchaka and Matthew Barnett. + +- Issue #15465: Document the versioning macros in the C API docs rather than + the standard library docs. Patch by Kushal Das. + +- Issue #16406: Combine the pages for uploading and registering to PyPI. + +- Issue #16403: Document how distutils uses the maintainer field in + PKG-INFO. Patch by Jyrki Pulliainen. + +- Issue #16695: Document how glob handles filenames starting with a + dot. Initial patch by Jyrki Pulliainen. + +- Issue #8890: Stop advertising an insecure practice by replacing uses + of the /tmp directory with better alternatives in the documentation. + Patch by Geoff Wilson. + +- Issue #17203: add long option names to unittest discovery docs. + +- Issue #13094: add "Why do lambdas defined in a loop with different values + all return the same result?" programming FAQ. + +- Issue #14901: Update portions of the Windows FAQ. + Patch by Ashish Nitin Patil. + +- Issue #16267: Better document the 3.3+ approach to combining + @abstractmethod with @staticmethod, @classmethod and @property + +- Issue #15209: Clarify exception chaining description in exceptions module + documentation + +- Issue #15990: Improve argument/parameter documentation. + +- Issue #16209: Move the documentation for the str built-in function to a new + str class entry in the "Text Sequence Type" section. + +- Issue #13538: Improve str() and object.__str__() documentation. + +- Issue #16489: Make it clearer that importlib.find_loader() needs parent + packages to be explicitly imported. + +- Issue #16400: Update the description of which versions of a given package + PyPI displays. + +- Issue #15677: Document that zlib and gzip accept a compression level of 0 to + mean 'no compression'. Patch by Brian Brazil. + +- Issue #16197: Update winreg docstrings and documentation to match code. + Patch by Zachary Ware. + +- Issue #8040: added a version switcher to the documentation. Patch by + Yury Selivanov. + +- Issue #16241: Document -X faulthandler command line option. + Patch by Marek ?uppa. + +- Additional comments and some style changes in the concurrent.futures URL + retrieval example + +- Issue #16115: Improve subprocess.Popen() documentation around args, shell, + and executable arguments. + +- Issue #13498: Clarify docs of os.makedirs()'s exist_ok argument. Done with + great native-speaker help from R. David Murray. + +- Issue #15533: Clarify docs and add tests for `subprocess.Popen()`'s cwd + argument. + +- Issue #15979: Improve timeit documentation. + +- Issue #16036: Improve documentation of built-in `int()`'s signature and + arguments. + +- Issue #15935: Clarification of `argparse` docs, re: add_argument() type and + default arguments. Patch contributed by Chris Jerdonek. + +- Issue #11964: Document a change in v3.2 to the behavior of the indent + parameter of json encoding operations. + +- Issue #15116: Remove references to appscript as it is no longer being + supported. + +Tools/Demos +----------- + +- Issue #18817: Fix a resource warning in Lib/aifc.py demo. Patch by + Vajrasky Kok. + +- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. + +- Issue #18448: Fix a typo in Tools/demo/eiffel.py. + +- Issue #18457: Fixed saving of formulas and complex numbers in + Tools/demo/ss1.py. + +- Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by + F?vry Thibault. + +- Issue #12990: The "Python Launcher" on OSX could not launch python scripts + that have paths that include wide characters. + +- Issue #15239: Make mkstringprep.py work again on Python 3. + +- Issue #17028: Allowed Python arguments to be supplied to the Windows + launcher. + +- Issue #17156: pygettext.py now detects the encoding of source files and + correctly writes and escapes non-ascii characters. + +- Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now + pindent.py works with a "with" statement. pindent.py no longer produces + improper indentation. pindent.py now works with continued lines broken after + "class" or "def" keywords and with continuations at the start of line. + +- Issue #11797: Add a 2to3 fixer that maps reload() to imp.reload(). + +- Issue #10966: Remove the concept of unexpected skipped tests. + +- Issue #9893: Removed the Misc/Vim directory. + +- Removed the Misc/TextMate directory. + +- Issue #16245: Add the Tools/scripts/parse_html5_entities.py script to parse + the list of HTML5 entities and update the html.entities.html5 dictionary. + +- Issue #15378: Fix Tools/unicode/comparecodecs.py. Patch by Serhiy Storchaka. + +- Issue #16549: Make json.tool work again on Python 3 and add tests. + Initial patch by Berker Peksag and Serhiy Storchaka. + +- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. + Patch by Serhiy Storchaka. + +Windows +------- + +- Issue #18569: The installer now adds .py to the PATHEXT variable when extensions + are registered. Patch by Paul Moore. + + What's New in Python 3.3.0? =========================== diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,8 +2,8 @@ Python News +++++++++++ -What's New in Python 3.6.1 release candidate 1 -============================================== +What's New in Python 3.6.1 release candidate 1? +=============================================== *Release date: XXXX-XX-XX* @@ -98,8 +98,16 @@ - Issue #28849: Do not define sys.implementation._multiarch on Android. -What's New in Python 3.6.0 release candidate 2 -============================================== +What's New in Python 3.6.0? +=========================== + +*Release date: 2016-12-23* + +- No changes since release candidate 2 + + +What's New in Python 3.6.0 release candidate 2? +=============================================== *Release date: 2016-12-16* @@ -129,8 +137,8 @@ - Issue #28898: Prevent gdb build errors due to HAVE_LONG_LONG redefinition. -What's New in Python 3.6.0 release candidate 1 -============================================== +What's New in Python 3.6.0 release candidate 1? +=============================================== *Release date: 2016-12-06* @@ -187,8 +195,8 @@ - Issue #28023: Fix python-gdb.py didn't support new dict implementation. -What's New in Python 3.6.0 beta 4 -================================= +What's New in Python 3.6.0 beta 4? +================================== *Release date: 2016-11-21* @@ -307,8 +315,8 @@ Patch by Gareth Rees. -What's New in Python 3.6.0 beta 3 -================================= +What's New in Python 3.6.0 beta 3? +================================== *Release date: 2016-10-31* @@ -434,8 +442,8 @@ - Issue #28409: regrtest: fix the parser of command line arguments. -What's New in Python 3.6.0 beta 2 -================================= +What's New in Python 3.6.0 beta 2? +================================== *Release date: 2016-10-10* @@ -706,8 +714,8 @@ - Issue #28217: Adds _testconsole module to test console input. -What's New in Python 3.6.0 beta 1 -================================= +What's New in Python 3.6.0 beta 1? +================================== *Release date: 2016-09-12* @@ -1217,8 +1225,8 @@ - Issue #27883: Update sqlite to 3.14.1.0 on Windows. -What's New in Python 3.6.0 alpha 4 -================================== +What's New in Python 3.6.0 alpha 4? +=================================== *Release date: 2016-08-15* @@ -1454,8 +1462,8 @@ Also update FreedBSD version checks for the original ctype UTF-8 workaround. -What's New in Python 3.6.0 alpha 3 -================================== +What's New in Python 3.6.0 alpha 3? +=================================== *Release date: 2016-07-11* @@ -1662,8 +1670,8 @@ Android build. -What's New in Python 3.6.0 alpha 2 -================================== +What's New in Python 3.6.0 alpha 2? +=================================== *Release date: 2016-06-13* @@ -6819,4304 +6827,4 @@ ".cp35-win32.pyd") will now be loaded in preference to those without tags. -What's New in Python 3.4.0? -=========================== - -Release date: 2014-03-16 - -Library -------- - -- Issue #20939: Fix test_geturl failure in test_urllibnet due to - new redirect of http://www.python.org/ to https://www.python.org. - -Documentation -------------- - -- Merge in all documentation changes since branching 3.4.0rc1. - - -What's New in Python 3.4.0 release candidate 3? -=============================================== - -Release date: 2014-03-09 - -Core and Builtins ------------------ - -- Issue #20786: Fix signatures for dict.__delitem__ and - property.__delete__ builtins. - -Library -------- - -- Issue #20839: Don't trigger a DeprecationWarning in the still supported - pkgutil.get_loader() API when __loader__ isn't set on a module (nor - when pkgutil.find_loader() is called directly). - -Build ------ - -- Issue #14512: Launch pydoc -b instead of pydocgui.pyw on Windows. - -- Issue #20748: Uninstalling pip does not leave behind the pyc of - the uninstaller anymore. - -- Issue #20568: The Windows installer now installs the unversioned ``pip`` - command in addition to the versioned ``pip3`` and ``pip3.4`` commands. - -- Issue #20757: The ensurepip helper for the Windows uninstaller now skips - uninstalling pip (rather than failing) if the user has updated pip to a - different version from the one bundled with ensurepip. - -- Issue #20465: Update OS X and Windows installer builds to use - SQLite 3.8.3.1. - - -What's New in Python 3.4.0 release candidate 2? -=============================================== - -Release date: 2014-02-23 - -Core and Builtins ------------------ - -- Issue #20625: Parameter names in __annotations__ were not mangled properly. - Discovered by Jonas Wielicki, patch by Yury Selivanov. - -- Issue #20261: In pickle, lookup __getnewargs__ and __getnewargs_ex__ on the - type of the object. - -- Issue #20619: Give the AST nodes of keyword-only arguments a column and line - number. - -- Issue #20526: Revert changes of issue #19466 which introduces a regression: - don't clear anymore the state of Python threads early during the Python - shutdown. - -Library -------- - -- Issue #20710: The pydoc summary line no longer displays the "self" parameter - for bound methods. - -- Issue #20566: Change asyncio.as_completed() to use a Queue, to - avoid O(N**2) behavior. - -- Issue #20704: Implement new debug API in asyncio. Add new methods - BaseEventLoop.set_debug() and BaseEventLoop.get_debug(). - Add support for setting 'asyncio.tasks._DEBUG' variable with - 'PYTHONASYNCIODEBUG' environment variable. - -- asyncio: Refactoring and fixes: BaseEventLoop.sock_connect() raises an - error if the address is not resolved; use __slots__ in Handle and - TimerHandle; as_completed() and wait() raise TypeError if the passed - list of Futures is a single Future; call_soon() and other 'call_*()' - functions raise TypeError if the passed callback is a coroutine - function; _ProactorBasePipeTransport uses _FlowControlMixin; - WriteTransport.set_write_buffer_size() calls _maybe_pause_protocol() - to consider pausing receiving if the watermark limits have changed; - fix _check_resolved_address() for IPv6 address; and other minor - improvements, along with multiple documentation updates. - -- Issue #20684: Fix inspect.getfullargspec() to not to follow __wrapped__ - chains. Make its behaviour consistent with bound methods first argument. - Patch by Nick Coghlan and Yury Selivanov. - -- Issue #20681: Add new error handling API in asyncio. New APIs: - loop.set_exception_handler(), loop.default_exception_handler(), and - loop.call_exception_handler(). - -- Issue #20673: Implement support for UNIX Domain Sockets in asyncio. - New APIs: loop.create_unix_connection(), loop.create_unix_server(), - streams.open_unix_connection(), and streams.start_unix_server(). - -- Issue #20616: Add a format() method to tracemalloc.Traceback. - -- Issue #19744: the ensurepip installation step now just prints a warning to - stderr rather than failing outright if SSL/TLS is unavailable. This allows - local installation of POSIX builds without SSL/TLS support. - -- Issue #20594: Avoid name clash with the libc function posix_close. - -Build ------ - -- Issue #20641: Run MSI custom actions (pip installation, pyc compilation) - with the NoImpersonate flag, to support elevated execution (UAC). - -- Issue #20221: Removed conflicting (or circular) hypot definition when - compiled with VS 2010 or above. Initial patch by Tabrez Mohammed. - -- Issue #20609: Restored the ability to build 64-bit Windows binaries on - 32-bit Windows, which was broken by the change in issue #19788. - - -What's New in Python 3.4.0 release candidate 1? -=============================================== - -Release date: 2014-02-10 - -Core and Builtins ------------------ - -- Issue #19255: The builtins module is restored to initial value before - cleaning other modules. The sys and builtins modules are cleaned last. - -- Issue #20588: Make Python-ast.c C89 compliant. - -- Issue #20437: Fixed 22 potential bugs when deleting object references. - -- Issue #20500: Displaying an exception at interpreter shutdown no longer - risks triggering an assertion failure in PyObject_Str. - -- Issue #20538: UTF-7 incremental decoder produced inconsistent string when - input was truncated in BASE64 section. - -- Issue #20404: io.TextIOWrapper (and hence the open() builtin) now uses the - internal codec marking system added for issue #19619 to throw LookupError - for known non-text encodings at stream construction time. The existing - output type checks remain in place to deal with unmarked third party - codecs. - -- Issue #17162: Add PyType_GetSlot. - -- Issue #20162: Fix an alignment issue in the siphash24() hash function which - caused a crash on PowerPC 64-bit (ppc64). - -Library -------- - -- Issue #20530: The signatures for slot builtins have been updated - to reflect the fact that they only accept positional-only arguments. - -- Issue #20517: Functions in the os module that accept two filenames - now register both filenames in the exception on failure. - -- Issue #20563: The ipaddress module API is now considered stable. - -- Issue #14983: email.generator now always adds a line end after each MIME - boundary marker, instead of doing so only when there is an epilogue. This - fixes an RFC compliance bug and solves an issue with signed MIME parts. - -- Issue #20540: Fix a performance regression (vs. Python 3.2) when layering - a multiprocessing Connection over a TCP socket. For small payloads, Nagle's - algorithm would introduce idle delays before the entire transmission of a - message. - -- Issue #16983: the new email header parsing code will now decode encoded words - that are (incorrectly) surrounded by quotes, and register a defect. - -- Issue #19772: email.generator no longer mutates the message object when - doing a down-transform from 8bit to 7bit CTEs. - -- Issue #20536: the statistics module now correctly handle Decimal instances - with positive exponents - -- Issue #18805: the netmask/hostmask parsing in ipaddress now more reliably - filters out illegal values and correctly allows any valid prefix length. - -- Issue #20481: For at least Python 3.4, the statistics module will require - that all inputs for a single operation be of a single consistent type, or - else a mixed of ints and a single other consistent type. This avoids - some interoperability issues that arose with the previous approach of - coercing to a suitable common type. - -- Issue #20478: the statistics module now treats collections.Counter inputs - like any other iterable. - -- Issue #17369: get_filename was raising an exception if the filename - parameter's RFC2231 encoding was broken in certain ways. This was - a regression relative to python2. - -- Issue #20013: Some imap servers disconnect if the current mailbox is - deleted, and imaplib did not handle that case gracefully. Now it - handles the 'bye' correctly. - -- Issue #20531: Revert 3.4 version of fix for #19063, and apply the 3.3 - version. That is, do *not* raise an error if unicode is passed to - email.message.Message.set_payload. - -- Issue #20476: If a non-compat32 policy is used with any of the email parsers, - EmailMessage is now used as the factory class. The factory class should - really come from the policy; that will get fixed in 3.5. - -- Issue #19920: TarFile.list() no longer fails when outputs a listing - containing non-encodable characters. Based on patch by Vajrasky Kok. - -- Issue #20515: Fix NULL pointer dereference introduced by issue #20368. - -- Issue #19186: Restore namespacing of expat symbols inside the pyexpat module. - -- Issue #20053: ensurepip (and hence venv) are no longer affected by the - settings in the default pip configuration file. - -- Issue #20426: When passing the re.DEBUG flag, re.compile() displays the - debug output every time it is called, regardless of the compilation cache. - -- Issue #20368: The null character now correctly passed from Tcl to Python. - Improved error handling in variables-related commands. - -- Issue #20435: Fix _pyio.StringIO.getvalue() to take into account newline - translation settings. - -- tracemalloc: Fix slicing traces and fix slicing a traceback. - -- Issue #20354: Fix an alignment issue in the tracemalloc module on 64-bit - platforms. Bug seen on 64-bit Linux when using "make profile-opt". - -- Issue #17159: inspect.signature now accepts duck types of functions, - which adds support for Cython functions. Initial patch by Stefan Behnel. - -- Issue #18801: Fix inspect.classify_class_attrs to correctly classify - object.__new__ and object.__init__. - -- Fixed cmath.isinf's name in its argument parsing code. - -- Issue #20311, #20452: poll and epoll now round the timeout away from zero, - instead of rounding towards zero, in select and selectors modules: - select.epoll.poll(), selectors.PollSelector.poll() and - selectors.EpollSelector.poll(). For example, a timeout of one microsecond - (1e-6) is now rounded to one millisecondi (1e-3), instead of being rounded to - zero. However, the granularity property and asyncio's resolution feature - were removed again. - -- asyncio: Some refactoring; various fixes; add write flow control to - unix pipes; Future.set_exception() instantiates the exception - argument if it is a class; improved proactor pipe transport; support - wait_for(f, None); don't log broken/disconnected pipes; use - ValueError instead of assert for forbidden subprocess_{shell,exec} - arguments; added a convenience API for subprocess management; added - StreamReader.at_eof(); properly handle duplicate coroutines/futures - in gather(), wait(), as_completed(); use a bytearray for buffering - in StreamReader; and more. - -- Issue #20288: fix handling of invalid numeric charrefs in HTMLParser. - -- Issue #20424: Python implementation of io.StringIO now supports lone surrogates. - -- Issue #20308: inspect.signature now works on classes without user-defined - __init__ or __new__ methods. - -- Issue #20372: inspect.getfile (and a bunch of other inspect functions that - use it) doesn't crash with unexpected AttributeError on classes defined in C - without __module__. - -- Issue #20356: inspect.signature formatting uses '/' to separate - positional-only parameters from others. - -- Issue #20223: inspect.signature now supports methods defined with - functools.partialmethods. - -- Issue #19456: ntpath.join() now joins relative paths correctly when a drive - is present. - -- Issue #19077: tempfile.TemporaryDirectory cleanup no longer fails when - called during shutdown. Emitting resource warning in __del__ no longer fails. - Original patch by Antoine Pitrou. - -- Issue #20394: Silence Coverity warning in audioop module. - -- Issue #20367: Fix behavior of concurrent.futures.as_completed() for - duplicate arguments. Patch by Glenn Langford. - -- Issue #8260: The read(), readline() and readlines() methods of - codecs.StreamReader returned incomplete data when were called after - readline() or read(size). Based on patch by Amaury Forgeot d'Arc. - -- Issue #20105: the codec exception chaining now correctly sets the - traceback of the original exception as its __traceback__ attribute. - -- Issue #17481: inspect.getfullargspec() now uses inspect.signature() API. - -- Issue #15304: concurrent.futures.wait() can block forever even if - Futures have completed. Patch by Glenn Langford. - -- Issue #14455: plistlib: fix serializing integers in the range - of an unsigned long long but outside of the range of signed long long for - binary plist files. - -IDLE ----- - -- Issue #20406: Use Python application icons for Idle window title bars. - Patch mostly by Serhiy Storchaka. - -- Update the python.gif icon for the Idle classbrowser and pathbowser - from the old green snake to the new blue and yellow snakes. - -- Issue #17721: Remove non-functional configuration dialog help button until we - make it actually gives some help when clicked. Patch by Guilherme Sim?es. - -Tests ------ - -- Issue #20532: Tests which use _testcapi now are marked as CPython only. - -- Issue #19920: Added tests for TarFile.list(). Based on patch by Vajrasky Kok. - -- Issue #19990: Added tests for the imghdr module. Based on patch by - Claudiu Popa. - -- Issue #20474: Fix test_socket "unexpected success" failures on OS X 10.7+. - -Tools/Demos ------------ - -- Issue #20530: Argument Clinic's signature format has been revised again. - The new syntax is highly human readable while still preventing false - positives. The syntax also extends Python syntax to denote "self" and - positional-only parameters, allowing inspect.Signature objects to be - totally accurate for all supported builtins in Python 3.4. - -- Issue #20456: Argument Clinic now observes the C preprocessor conditional - compilation statements of the C files it parses. When a Clinic block is - inside a conditional code, it adjusts its output to match, including - automatically generating an empty methoddef macro. - -- Issue #20456: Cloned functions in Argument Clinic now use the correct - name, not the name of the function they were cloned from, for text - strings inside generated code. - -- Issue #20456: Fixed Argument Clinic's test suite and "--converters" feature. - -- Issue #20456: Argument Clinic now allows specifying different names - for a parameter in Python and C, using "as" on the parameter line. - -- Issue #20326: Argument Clinic now uses a simple, unique signature to - annotate text signatures in docstrings, resulting in fewer false - positives. "self" parameters are also explicitly marked, allowing - inspect.Signature() to authoritatively detect (and skip) said parameters. - -- Issue #20326: Argument Clinic now generates separate checksums for the - input and output sections of the block, allowing external tools to verify - that the input has not changed (and thus the output is not out-of-date). - -Build ------ - -- Issue #20465: Update SQLite shipped with OS X installer to 3.8.3. - -C-API ------ - -- Issue #20517: Added new functions allowing OSError exceptions to reference - two filenames instead of one: PyErr_SetFromErrnoWithFilenameObjects() and - PyErr_SetExcFromWindowsErrWithFilenameObjects(). - -Documentation -------------- - -- Issue #20488: Change wording to say importlib is *the* implementation of - import instead of just *an* implementation. - -- Issue #6386: Clarify in the tutorial that specifying a symlink to execute - means the directory containing the executed script and not the symlink is - added to sys.path. - - -What's New in Python 3.4.0 Beta 3? -================================== - -Release date: 2014-01-26 - -Core and Builtins ------------------ - -- Issue #20189: Four additional builtin types (PyTypeObject, - PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type) - have been modified to provide introspection information for builtins. - -- Issue #17825: Cursor "^" is correctly positioned for SyntaxError and - IndentationError. - -- Issue #2382: SyntaxError cursor "^" is now written at correct position in most - cases when multibyte characters are in line (before "^"). This still not - works correctly with wide East Asian characters. - -- Issue #18960: The first line of Python script could be executed twice when - the source encoding was specified on the second line. Now the source encoding - declaration on the second line isn't effective if the first line contains - anything except a comment. 'python -x' works now again with files with the - source encoding declarations, and can be used to make Python batch files - on Windows. - -Library -------- - -- asyncio: Various improvements and small changes not all covered by - issues listed below. E.g. wait_for() now cancels the inner task if - the timeout occcurs; tweaked the set of exported symbols; renamed - Empty/Full to QueueEmpty/QueueFull; "with (yield from lock)" now - uses a separate context manager; readexactly() raises if not enough - data was read; PTY support tweaks. - -- Issue #20311: asyncio: Add a granularity attribute to BaseEventLoop: maximum - between the resolution of the BaseEventLoop.time() method and the resolution - of the selector. The granuarility is used in the scheduler to round time and - deadline. - -- Issue #20311: selectors: Add a resolution attribute to BaseSelector. - -- Issue #20189: unittest.mock now no longer assumes that any object for - which it could get an inspect.Signature is a callable written in Python. - Fix courtesy of Michael Foord. - -- Issue #20317: ExitStack.__exit__ could create a self-referential loop if an - exception raised by a cleanup operation already had its context set - correctly (for example, by the @contextmanager decorator). The infinite - loop this caused is now avoided by checking if the expected context is - already set before trying to fix it. - -- Issue #20374: Fix build with GNU readline >= 6.3. - -- Issue #20262: Warnings are raised now when duplicate names are added in the - ZIP file or too long ZIP file comment is truncated. - -- Issue #20165: The unittest module no longer considers tests marked with - @expectedFailure successful if they pass. - -- Issue #18574: Added missing newline in 100-Continue reply from - http.server.BaseHTTPRequestHandler. Patch by Nikolaus Rath. - -- Issue #20270: urllib.urlparse now supports empty ports. - -- Issue #20243: TarFile no longer raise ReadError when opened in write mode. - -- Issue #20238: TarFile opened with external fileobj and "w:gz" mode didn't - write complete output on close. - -- Issue #20245: The open functions in the tarfile module now correctly handle - empty mode. - -- Issue #20242: Fixed basicConfig() format strings for the alternative - formatting styles. Thanks to kespindler for the bug report and patch. - -- Issue #20246: Fix buffer overflow in socket.recvfrom_into. - -- Issues #20206 and #5803: Fix edge case in email.quoprimime.encode where it - truncated lines ending in a character needing encoding but no newline by - using a more efficient algorithm that doesn't have the bug. - -- Issue #19082: Working xmlrpc.server and xmlrpc.client examples. Both in - modules and in documentation. Initial patch contributed by Vajrasky Kok. - -- Issue #20138: The wsgiref.application_uri() and wsgiref.request_uri() - functions now conform to PEP 3333 when handle non-ASCII URLs. - -- Issue #19097: Raise the correct Exception when cgi.FieldStorage is given an - invalid fileobj. - -- Issue #20152: Ported Python/import.c over to Argument Clinic. - -- Issue #13107: argparse and optparse no longer raises an exception when output - a help on environment with too small COLUMNS. Based on patch by - Elazar Gershuni. - -- Issue #20207: Always disable SSLv2 except when PROTOCOL_SSLv2 is explicitly - asked for. - -- Issue #18960: The tokenize module now ignore the source encoding declaration - on the second line if the first line contains anything except a comment. - -- Issue #20078: Reading malformed zipfiles no longer hangs with 100% CPU - consumption. - -- Issue #20113: os.readv() and os.writev() now raise an OSError exception on - error instead of returning -1. - -- Issue #19719: Make importlib.abc.MetaPathFinder.find_module(), - PathEntryFinder.find_loader(), and Loader.load_module() use PEP 451 APIs to - help with backwards-compatibility. - -- Issue #20144: inspect.Signature now supports parsing simple symbolic - constants as parameter default values in __text_signature__. - -- Issue #20072: Fixed multiple errors in tkinter with wantobjects is False. - -- Issue #20229: Avoid plistlib deprecation warning in platform.mac_ver(). - -- Issue #14455: Fix some problems with the new binary plist support in plistlib. - -IDLE ----- - -- Issue #17390: Add Python version to Idle editor window title bar. - Original patches by Edmond Burnett and Kent Johnson. - -- Issue #18960: IDLE now ignores the source encoding declaration on the second - line if the first line contains anything except a comment. - -Tests ------ - -- Issue #20358: Tests for curses.window.overlay and curses.window.overwrite - no longer specify min{row,col} > max{row,col}. - -- Issue #19804: The test_find_mac test in test_uuid is now skipped if the - ifconfig executable is not available. - -- Issue #19886: Use better estimated memory requirements for bigmem tests. - -Tools/Demos ------------ - -- Issue #20390: Argument Clinic's "file" output preset now defaults to - "{dirname}/clinic/{basename}.h". - -- Issue #20390: Argument Clinic's "class" directive syntax has been extended - with two new required arguments: "typedef" and "type_object". - -- Issue #20390: Argument Clinic: If __new__ or __init__ functions didn't use - kwargs (or args), the PyArg_NoKeywords (or PyArg_NoPositional) calls - generated are only run when the type object is an exact match. - -- Issue #20390: Argument Clinic now fails if you have required parameters after - optional parameters. - -- Issue #20390: Argument Clinic converters now have a new template they can - inject code into: "modifiers". Code put there is run in the parsing - function after argument parsing but before the call to the impl. - -- Issue #20376: Argument Clinic now escapes backslashes in docstrings. - -- Issue #20381: Argument Clinic now sanity checks the default argument when - c_default is also specified, providing a nice failure message for - disallowed values. - -- Issue #20189: Argument Clinic now ensures that parser functions for - __new__ are always of type newfunc, the type of the tp_new slot. - Similarly, parser functions for __init__ are now always of type initproc, - the type of tp_init. - -- Issue #20189: Argument Clinic now suppresses the docstring for __new__ - and __init__ functions if no docstring is provided in the input. - -- Issue #20189: Argument Clinic now suppresses the "self" parameter in the - impl for @staticmethod functions. - -- Issue #20294: Argument Clinic now supports argument parsing for __new__ and - __init__ functions. - -- Issue #20299: Argument Clinic custom converters may now change the default - value of c_default and py_default with a class member. - -- Issue #20287: Argument Clinic's output is now configurable, allowing - delaying its output or even redirecting it to a separate file. - -- Issue #20226: Argument Clinic now permits simple expressions - (e.g. "sys.maxsize - 1") as default values for parameters. - -- Issue #19936: Added executable bits or shebang lines to Python scripts which - requires them. Disable executable bits and shebang lines in test and - benchmark files in order to prevent using a random system python, and in - source files of modules which don't provide command line interface. Fixed - shebang lines in the unittestgui and checkpip scripts. - -- Issue #20268: Argument Clinic now supports cloning the parameters and - return converter of existing functions. - -- Issue #20228: Argument Clinic now has special support for class special - methods. - -- Issue #20214: Fixed a number of small issues and documentation errors in - Argument Clinic (see issue for details). - -- Issue #20196: Fixed a bug where Argument Clinic did not generate correct - parsing code for functions with positional-only parameters where all arguments - are optional. - -- Issue #18960: 2to3 and the findnocoding.py script now ignore the source - encoding declaration on the second line if the first line contains anything - except a comment. - -- Issue #19723: The marker comments Argument Clinic uses have been changed - to improve readability. - -- Issue #20157: When Argument Clinic renames a parameter because its name - collides with a C keyword, it no longer exposes that rename to PyArg_Parse. - -- Issue #20141: Improved Argument Clinic's support for the PyArg_Parse "O!" - format unit. - -- Issue #20144: Argument Clinic now supports simple symbolic constants - as parameter default values. - -- Issue #20143: The line numbers reported in Argument Clinic errors are - now more accurate. - -- Issue #20142: Py_buffer variables generated by Argument Clinic are now - initialized with a default value. - -Build ------ - -- Issue #12837: Silence a tautological comparison warning on OS X under Clang in - socketmodule.c. - - -What's New in Python 3.4.0 Beta 2? -================================== - -Release date: 2014-01-05 - -Core and Builtins ------------------ - -- Issue #17432: Drop UCS2 from names of Unicode functions in python3.def. - -- Issue #19526: Exclude all new API from the stable ABI. Exceptions can be - made if a need is demonstrated. - -- Issue #19969: PyBytes_FromFormatV() now raises an OverflowError if "%c" - argument is not in range [0; 255]. - -- Issue #19995: %c, %o, %x, and %X now issue a DeprecationWarning on non-integer - input; reworded docs to clarify that an integer type should define both __int__ - and __index__. - -- Issue #19787: PyThread_set_key_value() now always set the value. In Python - 3.3, the function did nothing if the key already exists (if the current value - is a non-NULL pointer). - -- Issue #14432: Remove the thread state field from the frame structure. Fix a - crash when a generator is created in a C thread that is destroyed while the - generator is still used. The issue was that a generator contains a frame, and - the frame kept a reference to the Python state of the destroyed C thread. The - crash occurs when a trace function is setup. - -- Issue #19576: PyGILState_Ensure() now initializes threads. At startup, Python - has no concrete GIL. If PyGILState_Ensure() is called from a new thread for - the first time and PyEval_InitThreads() was not called yet, a GIL needs to be - created. - -- Issue #17576: Deprecation warning emitted now when __int__() or __index__() - return not int instance. - -- Issue #19932: Fix typo in import.h, missing whitespaces in function prototypes. - -- Issue #19736: Add module-level statvfs constants defined for GNU/glibc - based systems. - -- Issue #20097: Fix bad use of "self" in importlib's WindowsRegistryFinder. - -- Issue #19729: In str.format(), fix recursive expansion in format spec. - -- Issue #19638: Fix possible crash / undefined behaviour from huge (more than 2 - billion characters) input strings in _Py_dg_strtod. - -Library -------- - -- Issue #20154: Deadlock in asyncio.StreamReader.readexactly(). - -- Issue #16113: Remove sha3 module again. - -- Issue #20111: pathlib.Path.with_suffix() now sanity checks the given suffix. - -- Fix breakage in TestSuite.countTestCases() introduced by issue #11798. - -- Issue #20108: Avoid parameter name clash in inspect.getcallargs(). - -- Issue #19918: Fix PurePath.relative_to() under Windows. - -- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl - module, rather than silently let them emit clear text data. - -- Issue #20046: Locale alias table no longer contains entities which can be - calculated. Generalized support of the euro modifier. - -- Issue #20027: Fixed locale aliases for devanagari locales. - -- Issue #20067: Tkinter variables now work when wantobjects is false. - -- Issue #19020: Tkinter now uses splitlist() instead of split() in configure - methods. - -- Issue #19744: ensurepip now provides a better error message when Python is - built without SSL/TLS support (pip currently requires that support to run, - even if only operating with local wheel files) - -- Issue #19734: ensurepip now ignores all pip environment variables to avoid - odd behaviour based on user configuration settings - -- Fix TypeError on "setup.py upload --show-response". - -- Issue #20045: Fix "setup.py register --list-classifiers". - -- Issue #18879: When a method is looked up on a temporary file, avoid closing - the file before the method is possibly called. - -- Issue #20037: Avoid crashes when opening a text file late at interpreter - shutdown. - -- Issue #19967: Thanks to the PEP 442, asyncio.Future now uses a - destructor to log uncaught exceptions, instead of the dedicated - _TracebackLogger class. - -- Added a Task.current_task() class method to asyncio. - -- Issue #19850: Set SA_RESTART in asyncio when registering a signal - handler to limit EINTR occurrences. - -- Implemented write flow control in asyncio for proactor event loop (Windows). - -- Change write buffer in asyncio use to avoid O(N**2) behavior. Make - write()/sendto() accept bytearray/memoryview. - -- Issue #20034: Updated alias mapping to most recent locale.alias file - from X.org distribution using makelocalealias.py. - -- Issue #5815: Fixed support for locales with modifiers. Fixed support for - locale encodings with hyphens. - -- Issue #20026: Fix the sqlite module to handle correctly invalid isolation - level (wrong type). - -- Issue #18829: csv.Dialect() now checks type for delimiter, escapechar and - quotechar fields. Original patch by Vajrasky Kok. - -- Issue #19855: uuid.getnode() on Unix now looks on the PATH for the - executables used to find the mac address, with /sbin and /usr/sbin as - fallbacks. - -- Issue #20007: HTTPResponse.read(0) no more prematurely closes connection. - Original patch by Simon Sapin. - -- Issue #19946: multiprocessing now uses runpy to initialize __main__ in - child processes when necessary, allowing it to correctly handle scripts - without suffixes and submodules that use explicit relative imports or - otherwise rely on parent modules being correctly imported prior to - execution. - -- Issue #19921: When Path.mkdir() is called with parents=True, any missing - parent is created with the default permissions, ignoring the mode argument - (mimicking the POSIX "mkdir -p" command). - -- Issue #19887: Improve the Path.resolve() algorithm to support certain - symlink chains. - -- Issue #19912: Fixed numerous bugs in ntpath.splitunc(). - -- Issue #19911: ntpath.splitdrive() now correctly processes the '?' character - (U+0130, LATIN CAPITAL LETTER I WITH DOT ABOVE). - -- Issue #19532: python -m compileall with no filename/directory arguments now - respects the -f and -q flags instead of ignoring them. - -- Issue #19623: Fixed writing to unseekable files in the aifc module. - -- Issue #19946: multiprocessing.spawn now raises ImportError when the module to - be used as the main module cannot be imported. - -- Issue #17919: select.poll.register() again works with poll.POLLNVAL on AIX. - Fixed integer overflow in the eventmask parameter. - -- Issue #19063: if a Charset's body_encoding was set to None, the email - package would generate a message claiming the Content-Transfer-Encoding - was 7bit, and produce garbage output for the content. This now works. - A couple of other set_payload mishandlings of non-ASCII are also fixed. - In addition, calling set_payload with a string argument without - specifying a charset now raises an error (this is a new error in 3.4). - -- Issue #15475: Add __sizeof__ implementations for itertools objects. - -- Issue #19944: Fix importlib.find_spec() so it imports parents as needed - and move the function to importlib.util. - -- Issue #19880: Fix a reference leak in unittest.TestCase. Explicitly break - reference cycles between frames and the _Outcome instance. - -- Issue #17429: platform.linux_distribution() now decodes files from the UTF-8 - encoding with the surrogateescape error handler, instead of decoding from the - locale encoding in strict mode. It fixes the function on Fedora 19 which is - probably the first major distribution release with a non-ASCII name. Patch - written by Toshio Kuratomi. - -- Issue #19343: Expose FreeBSD-specific APIs in resource module. Original - patch by Koobs. - -- Issue #19929: Call os.read with 32768 within subprocess.Popen.communicate - rather than 4096 for efficiency. A microbenchmark shows Linux and OS X - both using ~50% less cpu time this way. - -- Issue #19506: Use a memoryview to avoid a data copy when piping data - to stdin within subprocess.Popen.communicate. 5-10% less cpu usage. - -- Issue #19876: selectors unregister() no longer raises ValueError or OSError - if the FD is closed (as long as it was registered). - -- Issue #19908: pathlib now joins relative Windows paths correctly when a drive - is present. Original patch by Antoine Pitrou. - -- Issue #19296: Silence compiler warning in dbm_open - -- Issue #6784: Strings from Python 2 can now be unpickled as bytes - objects by setting the encoding argument of Unpickler to be 'bytes'. - Initial patch by Merlijn van Deen. - -- Issue #19839: Fix regression in bz2 module's handling of non-bzip2 data at - EOF, and analogous bug in lzma module. - -- Issue #19881: Fix pickling bug where cpickle would emit bad pickle data for - large bytes string (i.e., with size greater than 2**32-1). - -- Issue #19138: doctest's IGNORE_EXCEPTION_DETAIL now allows a match when - no exception detail exists (no colon following the exception's name, or - a colon does follow but no text follows the colon). - -- Issue #19927: Add __eq__ to path-based loaders in importlib. - -- Issue #19827: On UNIX, setblocking() and settimeout() methods of - socket.socket can now avoid a second syscall if the ioctl() function can be - used, or if the non-blocking flag of the socket is unchanged. - -- Issue #19785: smtplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19784: poplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19783: nntplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19782: imaplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #20123: Fix pydoc.synopsis() for "binary" modules. - -- Issue #19834: Support unpickling of exceptions pickled by Python 2. - -- Issue #19781: ftplib now supports SSLContext.check_hostname and server name - indication for TLS/SSL connections. - -- Issue #19509: Add SSLContext.check_hostname to match the peer's certificate - with server_hostname on handshake. - -- Issue #15798: Fixed subprocess.Popen() to no longer fail if file - descriptor 0, 1 or 2 is closed. - -- Issue #17897: Optimized unpickle prefetching. - -- Issue #3693: Make the error message more helpful when the array.array() - constructor is given a str. Move the array module typecode documentation to - the docstring of the constructor. - -- Issue #19088: Fixed incorrect caching of the copyreg module in - object.__reduce__() and object.__reduce_ex__(). - -- Issue #19698: Removed exec_module() methods from - importlib.machinery.BuiltinImporter and ExtensionFileLoader. - -- Issue #18864: Added a setter for ModuleSpec.has_location. - -- Fixed _pickle.Unpickler to not fail when loading empty strings as - persistent IDs. - -- Issue #11480: Fixed copy.copy to work with classes with custom metaclasses. - Patch by Daniel Urban. - -- Issue #6477: Added support for pickling the types of built-in singletons - (i.e., Ellipsis, NotImplemented, None). - -- Issue #19713: Add remaining PEP 451-related deprecations and move away - from using find_module/find_loaer/load_module. - -- Issue #19708: Update pkgutil to use the new importer APIs. - -- Issue #19703: Update pydoc to use the new importer APIs. - -- Issue #19851: Fixed a regression in reloading sub-modules. - -- ssl.create_default_context() sets OP_NO_COMPRESSION to prevent CRIME. - -- Issue #19802: Add socket.SO_PRIORITY. - -- Issue #11508: Fixed uuid.getnode() and uuid.uuid1() on environment with - virtual interface. Original patch by Kent Frazier. - -- Issue #11489: JSON decoder now accepts lone surrogates. - -- Issue #19545: Avoid chained exceptions while passing stray % to - time.strptime(). Initial patch by Claudiu Popa. - -IDLE ----- - -- Issue #20058: sys.stdin.readline() in IDLE now always returns only one line. - -- Issue #19481: print() of string subclass instance in IDLE no longer hangs. - -- Issue #18270: Prevent possible IDLE AttributeError on OS X when no initial - shell window is present. - -Tests ------ - -- Issue #20055: Fix test_shutil under Windows with symlink privileges held. - Patch by Vajrasky Kok. - -- Issue #20070: Don't run test_urllib2net when network resources are not - enabled. - -- Issue #19938: Re-enabled test_bug_1333982 in test_dis, which had been - disabled since 3.0 due to the changes in listcomp handling. - -- Issue #19320: test_tcl no longer fails when wantobjects is false. - -- Issue #19919: Fix flaky SSL test. connect_ex() sometimes returns - EWOULDBLOCK on Windows or VMs hosted on Windows. - -- Issue #19912: Added tests for ntpath.splitunc(). - -- Issue #19828: Fixed test_site when the whole suite is run with -S. - -- Issue #19928: Implemented a test for repr() of cell objects. - -- Issue #19535: Fixed test_docxmlrpc, test_functools, test_inspect, and - test_statistics when python is run with -OO. - -- Issue #19926: Removed unneeded test_main from test_abstract_numbers. - Patch by Vajrasky Kok. - -- Issue #19572: More skipped tests explicitly marked as skipped. - -- Issue #19595, #19987: Re-enabled a long-disabled test in test_winsound. - -- Issue #19588: Fixed tests in test_random that were silently skipped most - of the time. Patch by Julian Gindi. - -Build ------ - -- Issue #19728: Enable pip installation by default on Windows. - -- Issue #16136: Remove VMS support - -- Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and - run Python's unit tests with multiple versions of OpenSSL. - -- Issue #19922: define _INCLUDE__STDC_A1_SOURCE in HP-UX to include mbstate_t - for mbrtowc(). - -- Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the - pythoncore sub-project. This should prevent build errors due a previous - build's python(_d).exe still running. - -Documentation -------------- - -- Issue #20265: Updated some parts of the Using Windows document. - -- Issue #20266: Updated some parts of the Windows FAQ. - -- Issue #20255: Updated the about and bugs pages. - -- Issue #20253: Fixed a typo in the ipaddress docs that advertised an - illegal attribute name. Found by INADA Naoki. - -- Issue #18840: Introduce the json module in the tutorial, and de-emphasize - the pickle module. - -- Issue #19845: Updated the Compiling Python on Windows section. - -- Issue #19795: Improved markup of True/False constants. - -Tools/Demos ------------ - -- Issue #19659: Added documentation for Argument Clinic. - -- Issue #19976: Argument Clinic METH_NOARGS functions now always - take two parameters. - - -What's New in Python 3.4.0 Beta 1? -================================== - -Release date: 2013-11-24 - -Core and Builtins ------------------ - -- Use the repr of a module name in more places in import, especially - exceptions. - -- Issue #19619: str.encode, bytes.decode and bytearray.decode now use an - internal API to throw LookupError for known non-text encodings, rather - than attempting the encoding or decoding operation and then throwing a - TypeError for an unexpected output type. (The latter mechanism remains - in place for third party non-text encodings) - -- Issue #19183: Implement PEP 456 'secure and interchangeable hash algorithm'. - Python now uses SipHash24 on all major platforms. - -- Issue #12892: The utf-16* and utf-32* encoders no longer allow surrogate code - points (U+D800-U+DFFF) to be encoded. The utf-32* decoders no longer decode - byte sequences that correspond to surrogate code points. The surrogatepass - error handler now works with the utf-16* and utf-32* codecs. Based on - patches by Victor Stinner and Kang-Hao (Kenny) Lu. - -- Issue #17806: Added keyword-argument support for "tabsize" to - str/bytes.expandtabs(). - -- Issue #17828: Output type errors in str.encode(), bytes.decode() and - bytearray.decode() now direct users to codecs.encode() or codecs.decode() - as appropriate. - -- Issue #17828: The interpreter now attempts to chain errors that occur in - codec processing with a replacement exception of the same type that - includes the codec name in the error message. It ensures it only does this - when the creation of the replacement exception won't lose any information. - -- Issue #19466: Clear the frames of daemon threads earlier during the - Python shutdown to call object destructors. So "unclosed file" resource - warnings are now correctly emitted for daemon threads. - -- Issue #19514: Deduplicate some _Py_IDENTIFIER declarations. - Patch by Andrei Dorian Duma. - -- Issue #17936: Fix O(n**2) behaviour when adding or removing many subclasses - of a given type. - -- Issue #19428: zipimport now handles errors when reading truncated or invalid - ZIP archive. - -- Issue #18408: Add a new PyFrame_FastToLocalsWithError() function to handle - exceptions when merging fast locals into f_locals of a frame. - PyEval_GetLocals() now raises an exception and return NULL on failure. - -- Issue #19369: Optimized the usage of __length_hint__(). - -- Issue #28026: Raise ImportError when exec_module() exists but - create_module() is missing. - -- Issue #18603: Ensure that PyOS_mystricmp and PyOS_mystrnicmp are in the - Python executable and not removed by the linker's optimizer. - -- Issue #19306: Add extra hints to the faulthandler module's stack - dumps that these are "upside down". - -Library -------- - -- Issue #3158: doctest can now find doctests in functions and methods - written in C. - -- Issue #13477: Added command line interface to the tarfile module. - Original patch by Berker Peksag. - -- Issue #19674: inspect.signature() now produces a correct signature - for some builtins. - -- Issue #19722: Added opcode.stack_effect(), which - computes the stack effect of bytecode instructions. - -- Issue #19735: Implement private function ssl._create_stdlib_context() to - create SSLContext objects in Python's stdlib module. It provides a single - configuration point and makes use of SSLContext.load_default_certs(). - -- Issue #16203: Add re.fullmatch() function and regex.fullmatch() method, - which anchor the pattern at both ends of the string to match. - Original patch by Matthew Barnett. - -- Issue #13592: Improved the repr for regular expression pattern objects. - Based on patch by Hugo Lopes Tavares. - -- Issue #19641: Added the audioop.byteswap() function to convert big-endian - samples to little-endian and vice versa. - -- Issue #15204: Deprecated the 'U' mode in file-like objects. - -- Issue #17810: Implement PEP 3154, pickle protocol 4. - -- Issue #19668: Added support for the cp1125 encoding. - -- Issue #19689: Add ssl.create_default_context() factory function. It creates - a new SSLContext object with secure default settings. - -- Issue #19727: os.utime(..., None) is now potentially more precise - under Windows. - -- Issue #17201: ZIP64 extensions now are enabled by default. Patch by - William Mallard. - -- Issue #19292: Add SSLContext.load_default_certs() to load default root CA - certificates from default stores or system stores. By default the method - loads CA certs for authentication of server certs. - -- Issue #19673: Add pathlib to the stdlib as a provisional module (PEP 428). - -- Issue #16596: pdb in a generator now properly skips over yield and - yield from rather than stepping out of the generator into its - caller. (This is essential for stepping through asyncio coroutines.) - -- Issue #17916: Added dis.Bytecode.from_traceback() and - dis.Bytecode.current_offset to easily display "current instruction" - markers in the new disassembly API (Patch by Claudiu Popa). - -- Issue #19552: venv now supports bootstrapping pip into virtual environments - -- Issue #17134: Finalize interface to Windows' certificate store. Cert and - CRL enumeration are now two functions. enum_certificates() also returns - purpose flags as set of OIDs. - -- Issue #19555: Restore sysconfig.get_config_var('SO'), (and the distutils - equivalent) with a DeprecationWarning pointing people at $EXT_SUFFIX. - -- Issue #8813: Add SSLContext.verify_flags to change the verification flags - of the context in order to enable certification revocation list (CRL) - checks or strict X509 rules. - -- Issue #18294: Fix the zlib module to make it 64-bit safe. - -- Issue #19682: Fix compatibility issue with old version of OpenSSL that - was introduced by Issue #18379. - -- Issue #14455: plistlib now supports binary plists and has an updated API. - -- Issue #19633: Fixed writing not compressed 16- and 32-bit wave files on - big-endian platforms. - -- Issue #18379: SSLSocket.getpeercert() returns CA issuer AIA fields, OCSP - and CRL distribution points. - -- Issue #18138: Implement cadata argument of SSLContext.load_verify_location() - to load CA certificates and CRL from memory. It supports PEM and DER - encoded strings. - -- Issue #18775: Add name and block_size attribute to HMAC object. They now - provide the same API elements as non-keyed cryptographic hash functions. - -- Issue #17276: MD5 as default digestmod for HMAC is deprecated. The HMAC - module supports digestmod names, e.g. hmac.HMAC('sha1'). - -- Issue #19449: in csv's writerow, handle non-string keys when generating the - error message that certain keys are not in the 'fieldnames' list. - -- Issue #13633: Added a new convert_charrefs keyword arg to HTMLParser that, - when True, automatically converts all character references. - -- Issue #2927: Added the unescape() function to the html module. - -- Issue #8402: Added the escape() function to the glob module. - -- Issue #17618: Add Base85 and Ascii85 encoding/decoding to the base64 module. - -- Issue #19634: time.strftime("%y") now raises a ValueError on AIX when given a - year before 1900. - -- Fix test.support.bind_port() to not cause an error when Python was compiled - on a system with SO_REUSEPORT defined in the headers but run on a system - with an OS kernel that does not support that reasonably new socket option. - -- Fix compilation error under gcc of the ctypes module bundled libffi for arm. - -- Issue #19448: Add private API to SSL module to lookup ASN.1 objects by OID, - NID, short name and long name. - -- Issue #19282: dbm.open now supports the context management protocol. - (Initial patch by Claudiu Popa) - -- Issue #8311: Added support for writing any bytes-like objects in the aifc, - sunau, and wave modules. - -- Issue #5202: Added support for unseekable files in the wave module. - -- Issue #19544 and Issue #1180: Restore global option to ignore - ~/.pydistutils.cfg in Distutils, accidentally removed in backout of - distutils2 changes. - -- Issue #19523: Closed FileHandler leak which occurred when delay was set. - -- Issue #19544 and Issue #6516: Restore support for --user and --group - parameters to sdist command accidentally rolled back as part of the - distutils2 rollback. - -- Issue #13674: Prevented time.strftime from crashing on Windows when given - a year before 1900 and a format of %y. - -- Issue #19406: implementation of the ensurepip module (part of PEP 453). - Patch by Donald Stufft and Nick Coghlan. - -- Issue #19544 and Issue #6286: Restore use of urllib over http allowing use - of http_proxy for Distutils upload command, a feature accidentally lost - in the rollback of distutils2. - -- Issue #19544 and Issue #7457: Restore the read_pkg_file method to - distutils.dist.DistributionMetadata accidentally removed in the undo of - distutils2. - -- Issue #16685: Added support for any bytes-like objects in the audioop module. - Removed support for strings. - -- Issue #7171: Add Windows implementation of ``inet_ntop`` and ``inet_pton`` - to socket module. Patch by Atsuo Ishimoto. - -- Issue #19261: Added support for writing 24-bit samples in the sunau module. - -- Issue #1097797: Added CP273 encoding, used on IBM mainframes in - Germany and Austria. Mapping provided by Michael Bierenfeld. - -- Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms. - -- Issue #19378: Fixed a number of cases in the dis module where the new - "file" parameter was not being honoured correctly - -- Issue #19378: Removed the "dis.Bytecode.show_info" method - -- Issue #19378: Renamed the "dis.Bytecode.display_code" method to - "dis.Bytecode.dis" and converted it to returning a string rather than - printing output. - -- Issue #19378: the "line_offset" parameter in the new "dis.get_instructions" - API has been renamed to "first_line" (and the default value and usage - changed accordingly). This should reduce confusion with the more common use - of "offset" in the dis docs to refer to bytecode offsets. - -- Issue #18678: Corrected spwd struct member names in spwd module: - sp_nam->sp_namp, and sp_pwd->sp_pwdp. The old names are kept as extra - structseq members, for backward compatibility. - -- Issue #6157: Fixed tkinter.Text.debug(). tkinter.Text.bbox() now raises - TypeError instead of TclError on wrong number of arguments. Original patch - by Guilherme Polo. - -- Issue #10197: Rework subprocess.get[status]output to use subprocess - functionality and thus to work on Windows. Patch by Nick Coghlan - -- Issue #6160: The bbox() method of tkinter.Spinbox now returns a tuple of - integers instead of a string. Based on patch by Guilherme Polo. - -- Issue #19403: contextlib.redirect_stdout is now reentrant - -- Issue #19286: Directories in ``package_data`` are no longer added to - the filelist, preventing failure outlined in the ticket. - -- Issue #19480: HTMLParser now accepts all valid start-tag names as defined - by the HTML5 standard. - -- Issue #15114: The html.parser module now raises a DeprecationWarning when the - strict argument of HTMLParser or the HTMLParser.error method are used. - -- Issue #19410: Undo the special-casing removal of '' for - importlib.machinery.FileFinder. - -- Issue #19424: Fix the warnings module to accept filename containing surrogate - characters. - -- Issue #19435: Fix directory traversal attack on CGIHttpRequestHandler. - -- Issue #19227: Remove pthread_atfork() handler. The handler was added to - solve #18747 but has caused issues. - -- Issue #19420: Fix reference leak in module initialization code of - _hashopenssl.c - -- Issue #19329: Optimized compiling charsets in regular expressions. - -- Issue #19227: Try to fix deadlocks caused by re-seeding then OpenSSL - pseudo-random number generator on fork(). - -- Issue #16037: HTTPMessage.readheaders() raises an HTTPException when more than - 100 headers are read. Adapted from patch by Jyrki Pulliainen. - -- Issue #16040: CVE-2013-1752: nntplib: Limit maximum line lengths to 2048 to - prevent readline() calls from consuming too much memory. Patch by Jyrki - Pulliainen. - -- Issue #16041: CVE-2013-1752: poplib: Limit maximum line lengths to 2048 to - prevent readline() calls from consuming too much memory. Patch by Jyrki - Pulliainen. - -- Issue #17997: Change behavior of ``ssl.match_hostname()`` to follow RFC 6125, - for security reasons. It now doesn't match multiple wildcards nor wildcards - inside IDN fragments. - -- Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit - line length. Patch by Emil Lind. - -- Issue #19330: the unnecessary wrapper functions have been removed from the - implementations of the new contextlib.redirect_stdout and - contextlib.suppress context managers, which also ensures they provide - reasonable help() output on instances - -- Issue #19393: Fix symtable.symtable function to not be confused when there are - functions or classes named "top". - -- Issue #18685: Restore re performance to pre-PEP 393 levels. - -- Issue #19339: telnetlib module is now using time.monotonic() when available - to compute timeout. - -- Issue #19399: fix sporadic test_subprocess failure. - -- Issue #13234: Fix os.listdir to work with extended paths on Windows. - Patch by Santoso Wijaya. - -- Issue #19375: The site module adding a "site-python" directory to sys.path, - if it exists, is now deprecated. - -- Issue #19379: Lazily import linecache in the warnings module, to make - startup with warnings faster until a warning gets printed. - -- Issue #19288: Fixed the "in" operator of dbm.gnu databases for string - argument. Original patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #19287: Fixed the "in" operator of dbm.ndbm databases for string - argument. Original patch by Arfrever Frehtes Taifersar Arahesis. - -- Issue #19327: Fixed the working of regular expressions with too big charset. - -- Issue #17400: New 'is_global' attribute for ipaddress to tell if an address - is allocated by IANA for global or private networks. - -- Issue #19350: Increasing the test coverage of macurl2path. Patch by Colin - Williams. - -- Issue #19365: Optimized the parsing of long replacement string in re.sub*() - functions. - -- Issue #19352: Fix unittest discovery when a module can be reached - through several paths (e.g. under Debian/Ubuntu with virtualenv). - -- Issue #15207: Fix mimetypes to read from correct part of Windows registry - Original patch by Dave Chambers - -- Issue #16595: Add prlimit() to resource module. - -- Issue #19324: Expose Linux-specific constants in resource module. - -- Load SSL's error strings in hashlib. - -- Issue #18527: Upgrade internal copy of zlib to 1.2.8. - -- Issue #19274: Add a filterfunc parameter to PyZipFile.writepy. - -- Issue #8964: fix platform._sys_version to handle IronPython 2.6+. - Patch by Martin Matusiak. - -- Issue #19413: Restore pre-3.3 reload() semantics of re-finding modules. - -- Issue #18958: Improve error message for json.load(s) while passing a string - that starts with a UTF-8 BOM. - -- Issue #19307: Improve error message for json.load(s) while passing objects - of the wrong type. - -- Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by - limiting the call to readline(). Original patch by Micha? - Jastrz?bski and Giampaolo Rodola. - -- Issue #17087: Improved the repr for regular expression match objects. - -Tests ------ - -- Issue #19664: test_userdict's repr test no longer depends on the order - of dict elements. - -- Issue #19440: Clean up test_capi by removing an unnecessary __future__ - import, converting from test_main to unittest.main, and running the - _testcapi module tests as subTests of a unittest TestCase method. - -- Issue #19378: the main dis module tests are now run with both stdout - redirection *and* passing an explicit file parameter - -- Issue #19378: removed the not-actually-helpful assertInstructionMatches - and assertBytecodeExactlyMatches helpers from bytecode_helper - -- Issue #18702: All skipped tests now reported as skipped. - -- Issue #19439: interpreter embedding tests are now executed on Windows - (Patch by Zachary Ware) - -- Issue #19085: Added basic tests for all tkinter widget options. - -- Issue #19384: Fix test_py_compile for root user, patch by Claudiu Popa. - -Documentation -------------- - -- Issue #18326: Clarify that list.sort's arguments are keyword-only. Also, - attempt to reduce confusion in the glossary by not saying there are - different "types" of arguments and parameters. - -Build ------ - -- Issue #19358: "make clinic" now runs the Argument Clinic preprocessor - over all CPython source files. - -- Update SQLite to 3.8.1, xz to 5.0.5, and Tcl/Tk to 8.6.1 on Windows. - -- Issue #16632: Enable DEP and ASLR on Windows. - -- Issue #17791: Drop PREFIX and EXEC_PREFIX definitions from PC/pyconfig.h - -- Add workaround for VS 2010 nmake clean issue. VS 2010 doesn't set up PATH - for nmake.exe correctly. - -- Issue #19550: Implement Windows installer changes of PEP 453 (ensurepip). - -- Issue #19520: Fix compiler warning in the _sha3 module on 32bit Windows. - -- Issue #19356: Avoid using a C variabled named "_self", it's a reserved - word in some C compilers. - -- Issue #15792: Correct build options on Win64. Patch by Jeremy Kloth. - -- Issue #19373: Apply upstream change to Tk 8.5.15 fixing OS X 10.9 - screen refresh problem for OS X installer build. - -- Issue #19649: On OS X, the same set of file names are now installed - in bin directories for all configurations: non-framework vs framework, - and single arch vs universal builds. pythonx.y-32 is now always - installed for 64-bit/32-bit universal builds. The obsolete and - undocumented pythonw* symlinks are no longer installed anywhere. - -- Issue #19553: PEP 453 - "make install" and "make altinstall" now install or - upgrade pip by default, using the bundled pip provided by the new ensurepip - module. A new configure option, --with-ensurepip[=upgrade|install|no], is - available to override the default ensurepip "--upgrade" option. The option - can also be set with "make [alt]install ENSUREPIP=[upgrade|install|no]". - -- Issue #19551: PEP 453 - the OS X installer now installs pip by default. - -- Update third-party libraries for OS X installers: xz 5.0.3 -> 5.0.5, - SQLite 3.7.13 -> 3.8.1 - -- Issue #15663: Revert OS X installer built-in Tcl/Tk support for 3.4.0b1. - Some third-party projects, such as Matplotlib and PIL/Pillow, - depended on being able to build with Tcl and Tk frameworks in - /Library/Frameworks. - -Tools/Demos ------------ - -- Issue #19730: Argument Clinic now supports all the existing PyArg - "format units" as legacy converters, as well as two new features: - "self converters" and the "version" directive. - -- Issue #19552: pyvenv now bootstraps pip into virtual environments by - default (pass --without-pip to request the old behaviour) - -- Issue #19390: Argument Clinic no longer accepts malformed Python - and C ids. - - -What's New in Python 3.4.0 Alpha 4? -=================================== - -Release date: 2013-10-20 - -Core and Builtins ------------------ - -- Issue #19301: Give classes and functions that are explicitly marked global a - global qualname. - -- Issue #19279: UTF-7 decoder no longer produces illegal strings. - -- Issue #16612: Add "Argument Clinic", a compile-time preprocessor for - C files to generate argument parsing code. (See PEP 436.) - -- Issue #18810: Shift stat calls in importlib.machinery.FileFinder such that - the code is optimistic that if something exists in a directory named exactly - like the possible package being searched for that it's in actuality a - directory. - -- Issue #18416: importlib.machinery.PathFinder now treats '' as the cwd and - importlib.machinery.FileFinder no longer special-cases '' to '.'. This leads - to modules imported from cwd to now possess an absolute file path for - __file__ (this does not affect modules specified by path on the CLI but it - does affect -m/runpy). It also allows FileFinder to be more consistent by not - having an edge case. - -- Issue #4555: All exported C symbols are now prefixed with either - "Py" or "_Py". - -- Issue #19219: Speed up marshal.loads(), and make pyc files slightly - (5% to 10%) smaller. - -- Issue #19221: Upgrade Unicode database to version 6.3.0. - -- Issue #16742: The result of the C callback PyOS_ReadlineFunctionPointer must - now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL - if an error occurred), instead of a string allocated by PyMem_Malloc() or - PyMem_Realloc(). - -- Issue #19199: Remove ``PyThreadState.tick_counter`` field - -- Fix macro expansion of _PyErr_OCCURRED(), and make sure to use it in at - least one place so as to avoid regressions. - -- Issue #19087: Improve bytearray allocation in order to allow cheap popping - of data at the front (slice deletion). - -- Issue #19014: memoryview.cast() is now allowed on zero-length views. - -- Issue #18690: memoryview is now automatically registered with - collections.abc.Sequence - -- Issue #19078: memoryview now correctly supports the reversed builtin - (Patch by Claudiu Popa) - -Library -------- - -- Issue #17457: unittest test discovery now works with namespace packages. - Patch by Claudiu Popa. - -- Issue #18235: Fix the sysconfig variables LDSHARED and BLDSHARED under AIX. - Patch by David Edelsohn. - -- Issue #18606: Add the new "statistics" module (PEP 450). Contributed - by Steven D'Aprano. - -- Issue #12866: The audioop module now supports 24-bit samples. - -- Issue #19254: Provide an optimized Python implementation of pbkdf2_hmac. - -- Issues #19201, Issue #19222, Issue #19223: Add "x" mode (exclusive creation) - in opening file to bz2, gzip and lzma modules. Patches by Tim Heaney and - Vajrasky Kok. - -- Fix a reference count leak in _sre. - -- Issue #19262: Initial check in of the 'asyncio' package (a.k.a. Tulip, - a.k.a. PEP 3156). There are no docs yet, and the PEP is slightly - out of date with the code. This module will have *provisional* status - in Python 3.4. - -- Issue #19276: Fixed the wave module on 64-bit big-endian platforms. - -- Issue #19266: Rename the new-in-3.4 ``contextlib.ignore`` context manager - to ``contextlib.suppress`` in order to be more consistent with existing - descriptions of that operation elsewhere in the language and standard - library documentation (Patch by Zero Piraeus). - -- Issue #18891: Completed the new email package (provisional) API additions - by adding new classes EmailMessage, MIMEPart, and ContentManager. - -- Issue #18281: Unused stat constants removed from `tarfile`. - -- Issue #18999: Multiprocessing now supports 'contexts' with the same API - as the module, but bound to specified start methods. - -- Issue #18468: The re.split, re.findall, and re.sub functions and the group() - and groups() methods of match object now always return a string or a bytes - object. - -- Issue #18725: The textwrap module now supports truncating multiline text. - -- Issue #18776: atexit callbacks now display their full traceback when they - raise an exception. - -- Issue #17827: Add the missing documentation for ``codecs.encode`` and - ``codecs.decode``. - -- Issue #19218: Rename collections.abc to _collections_abc in order to - speed up interpreter start. - -- Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5 - password-based key derivation functions with HMAC as pseudorandom function. - -- Issue #19131: The aifc module now correctly reads and writes sampwidth of - compressed streams. - -- Issue #19209: Remove import of copyreg from the os module to speed up - interpreter startup. stat_result and statvfs_result are now hard-coded to - reside in the os module. - -- Issue #19205: Don't import the 're' module in site and sysconfig module to - speed up interpreter start. - -- Issue #9548: Add a minimal "_bootlocale" module that is imported by the - _io module instead of the full locale module. - -- Issue #18764: Remove the 'print' alias for the PDB 'p' command so that it no - longer shadows the print function. - -- Issue #19158: A rare race in BoundedSemaphore could allow .release() too - often. - -- Issue #15805: Add contextlib.redirect_stdout(). - -- Issue #18716: Deprecate the formatter module. - -- Issue #10712: 2to3 has a new "asserts" fixer that replaces deprecated names - of unittest methods (e.g. failUnlessEqual -> assertEqual). - -- Issue #18037: 2to3 now escapes ``'\u'`` and ``'\U'`` in native strings. - -- Issue #17839: base64.decodebytes and base64.encodebytes now accept any - object that exports a 1 dimensional array of bytes (this means the same - is now also true for base64_codec) - -- Issue #19132: The pprint module now supports compact mode. - -- Issue #19137: The pprint module now correctly formats instances of set and - frozenset subclasses. - -- Issue #10042: functools.total_ordering now correctly handles - NotImplemented being returned by the underlying comparison function (Patch - by Katie Miller) - -- Issue #19092: contextlib.ExitStack now correctly reraises exceptions - from the __exit__ callbacks of inner context managers (Patch by Hrvoje - Nik?i?) - -- Issue #12641: Avoid passing "-mno-cygwin" to the mingw32 compiler, except - when necessary. Patch by Oscar Benjamin. - -- Issue #5845: In site.py, only load readline history from ~/.python_history - if no history has been read already. This avoids double writes to the - history file at shutdown. - -- Properly initialize all fields of a SSL object after allocation. - -- Issue #19095: SSLSocket.getpeercert() now raises ValueError when the - SSL handshake hasn't been done. - -- Issue #4366: Fix building extensions on all platforms when --enable-shared - is used. - -- Issue #19030: Fixed `inspect.getmembers` and `inspect.classify_class_attrs` - to attempt activating descriptors before falling back to a __dict__ search - for faulty descriptors. `inspect.classify_class_attrs` no longer returns - Attributes whose home class is None. - -C API ------ - -- Issue #1772673: The type of `char*` arguments now changed to `const char*`. - -- Issue #16129: Added a `Py_SetStandardStreamEncoding` pre-initialization API - to allow embedding applications like Blender to force a particular - encoding and error handler for the standard IO streams (initial patch by - Bastien Montagne) - -Tests ------ - -- Issue #19275: Fix test_site on AMD64 Snow Leopard - -- Issue #14407: Fix unittest test discovery in test_concurrent_futures. - -- Issue #18919: Unified and extended tests for audio modules: aifc, sunau and - wave. - -- Issue #18714: Added tests for ``pdb.find_function()``. - -Documentation -------------- - -- Issue #18758: Fixed and improved cross-references. - -- Issue #18972: Modernize email examples and use the argparse module in them. - -Build ------ - -- Issue #19130: Correct PCbuild/readme.txt, Python 3.3 and 3.4 require VS 2010. - -- Issue #15663: Update OS X 10.6+ installer to use Tcl/Tk 8.5.15. - -- Issue #14499: Fix several problems with OS X universal build support: - 1. ppc arch detection for extension module builds broke with Xcode 5 - 2. ppc arch detection in configure did not work on OS X 10.4 - 3. -sysroot and -arch flags were unnecessarily duplicated - 4. there was no obvious way to configure an intel-32 only build. - -- Issue #19019: Change the OS X installer build script to use CFLAGS instead - of OPT for special build options. By setting OPT, some compiler-specific - options like -fwrapv were overridden and thus not used, which could result - in broken interpreters when building with clang. - - -What's New in Python 3.4.0 Alpha 3? -=================================== - -Release date: 2013-09-29 - -Core and Builtins ------------------ - -- Issue #18818: The "encodingname" part of PYTHONIOENCODING is now optional. - -- Issue #19098: Prevent overflow in the compiler when the recursion limit is set - absurdly high. - -Library -------- - -- Issue #18929: `inspect.classify_class_attrs()` now correctly finds class - attributes returned by `dir()` that are located in the metaclass. - -- Issue #18950: Fix miscellaneous bugs in the sunau module. - Au_read.readframes() now updates current file position and reads correct - number of frames from multichannel stream. Au_write.writeframesraw() now - correctly updates current file position. Au_read.getnframes() now returns an - integer (as in Python 2). Au_read and Au_write now correctly works with file - object if start file position is not a zero. - -- Issue #18594: The fast path for collections.Counter() was never taken - due to an over-restrictive type check. - -- Issue #19053: ZipExtFile.read1() with non-zero argument no more returns empty - bytes until end of data. - -- logging: added support for Unix domain sockets to SocketHandler and - DatagramHandler. - -- Issue #18996: TestCase.assertEqual() now more cleverly shorten differing - strings in error report. - -- Issue #19034: repr() for tkinter.Tcl_Obj now exposes string reperesentation. - -- Issue #18978: ``urllib.request.Request`` now allows the method to be - indicated on the class and no longer sets it to None in ``__init__``. - -- Issue #18626: the inspect module now offers a basic command line - introspection interface (Initial patch by Claudiu Popa) - -- Issue #3015: Fixed tkinter with wantobject=False. Any Tcl command call - returned empty string. - -- Issue #19037: The mailbox module now makes all changes to maildir files - before moving them into place, to avoid race conditions with other programs - that may be accessing the maildir directory. - -- Issue #14984: On POSIX systems, when netrc is called without a filename - argument (and therefore is reading the user's $HOME/.netrc file), it now - enforces the same security rules as typical ftp clients: the .netrc file must - be owned by the user that owns the process and must not be readable by any - other user. - -- Issue #18873: The tokenize module now detects Python source code encoding - only in comment lines. - -- Issue #17764: Enable http.server to bind to a user specified network - interface. Patch contributed by Malte Swart. - -- Issue #18937: Add an assertLogs() context manager to unittest.TestCase - to ensure that a block of code emits a message using the logging module. - -- Issue #17324: Fix http.server's request handling case on trailing '/'. Patch - contributed by Vajrasky Kok. - -- Issue #19018: The heapq.merge() function no longer suppresses IndexError - in the underlying iterables. - -- Issue #18784: The uuid module no longer attempts to load libc via ctypes.CDLL - if all the necessary functions have already been found in libuuid. Patch by - Evgeny Sologubov. - -- The :envvar:`PYTHONFAULTHANDLER` environment variable now only enables the - faulthandler module if the variable is non-empty. Same behaviour than other - variables like :envvar:`PYTHONDONTWRITEBYTECODE`. - -- Issue #1565525: New function ``traceback.clear_frames`` will clear - the local variables of all the stack frames referenced by a traceback - object. - -Tests ------ - -- Issue #18952: Fix regression in support data downloads introduced when - test.support was converted to a package. Regression noticed by Zachary - Ware. - -IDLE ----- - -- Issue #18873: IDLE now detects Python source code encoding only in comment - lines. - -- Issue #18988: The "Tab" key now works when a word is already autocompleted. - -Documentation -------------- - -- Issue #17003: Unified the size argument names in the io module with common - practice. - -Build ------ - -- Issue #18596: Support the use of address sanity checking in recent versions - of clang and GCC by appropriately marking known false alarms in the small - object allocator. Patch contributed by Dhiru Kholia. - -Tools/Demos ------------ - -- Issue #18873: 2to3 and the findnocoding.py script now detect Python source - code encoding only in comment lines. - - -What's New in Python 3.4.0 Alpha 2? -=================================== - -Release date: 2013-09-09 - -Core and Builtins ------------------ - -- Issue #18942: sys._debugmallocstats() output was damaged on Windows. - -- Issue #18571: Implementation of the PEP 446: file descriptors and file - handles are now created non-inheritable; add functions - os.get/set_inheritable(), os.get/set_handle_inheritable() and - socket.socket.get/set_inheritable(). - -- Issue #11619: The parser and the import machinery do not encode Unicode - filenames anymore on Windows. - -- Issue #18808: Non-daemon threads are now automatically joined when - a sub-interpreter is shutdown (it would previously dump a fatal error). - -- Remove support for compiling on systems without getcwd(). - -- Issue #18774: Remove last bits of GNU PTH thread code and thread_pth.h. - -- Issue #18771: Add optimization to set object lookups to reduce the cost - of hash collisions. The core idea is to inspect a second key/hash pair - for each cache line retrieved. - -- Issue #16105: When a signal handler fails to write to the file descriptor - registered with ``signal.set_wakeup_fd()``, report an exception instead - of ignoring the error. - -- Issue #18722: Remove uses of the "register" keyword in C code. - -- Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions. - -- Issue #16499: Add command line option for isolated mode. - -- Issue #15301: Parsing fd, uid, and gid parameters for builtins - in Modules/posixmodule.c is now far more robust. - -- Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() - fail. - -- Issue #17934: Add a clear() method to frame objects, to help clean up - expensive details (local variables) and break reference cycles. - -- Issue #18780: %-formatting codes %d, %i, and %u now treat int-subclasses - as int (displays value of int-subclass instead of str(int-subclass) ). - -Library -------- - -- Issue #18808: Thread.join() now waits for the underlying thread state to - be destroyed before returning. This prevents unpredictable aborts in - Py_EndInterpreter() when some non-daemon threads are still running. - -- Issue #18458: Prevent crashes with newer versions of libedit. Its readline - emulation has changed from 0-based indexing to 1-based like gnu readline. - -- Issue #18852: Handle case of ``readline.__doc__`` being ``None`` in the new - readline activation code in ``site.py``. - -- Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in - the _sre module. - -- Issue #18830: inspect.getclasstree() no longer produces duplicate entries even - when input list contains duplicates. - -- Issue #18878: sunau.open now supports the context management protocol. Based on - patches by Claudiu Popa and R. David Murray. - -- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don't cast - 64-bit pointer to long (32 bits). - -- Issue #18876: The FileIO.mode attribute now better reflects the actual mode - under which the file was opened. Patch by Erik Bray. - -- Issue #16853: Add new selectors module. - -- Issue #18882: Add threading.main_thread() function. - -- Issue #18901: The sunau getparams method now returns a namedtuple rather than - a plain tuple. Patch by Claudiu Popa. - -- Issue #17487: The result of the wave getparams method now is pickleable again. - Patch by Claudiu Popa. - -- Issue #18756: os.urandom() now uses a lazily-opened persistent file - descriptor, so as to avoid using many file descriptors when run in - parallel from multiple threads. - -- Issue #18418: After fork(), reinit all threads states, not only active ones. - Patch by A. Jesse Jiryu Davis. - -- Issue #17974: Switch unittest from using getopt to using argparse. - -- Issue #11798: TestSuite now drops references to own tests after execution. - -- Issue #16611: http.cookie now correctly parses the 'secure' and 'httponly' - cookie flags. - -- Issue #11973: Fix a problem in kevent. The flags and fflags fields are now - properly handled as unsigned. - -- Issue #18807: ``pyvenv`` now takes a --copies argument allowing copies - instead of symlinks even where symlinks are available and the default. - -- Issue #18538: ``python -m dis`` now uses argparse for argument processing. - Patch by Michele Orr?. - -- Issue #18394: Close cgi.FieldStorage's optional file. - -- Issue #17702: On error, os.environb now suppresses the exception context - when raising a new KeyError with the original key. - -- Issue #16809: Fixed some tkinter incompabilities with Tcl/Tk 8.6. - -- Issue #16809: Tkinter's splitlist() and split() methods now accept Tcl_Obj - argument. - -- Issue #17211: Yield a namedtuple in pkgutil. - Patch by Ramchandra Apte. - -- Issue #18324: set_payload now correctly handles binary input. This also - supersedes the previous fixes for #14360, #1717, and #16564. - -- Issue #18794: Add a fileno() method and a closed attribute to select.devpoll - objects. - -- Issue #17119: Fixed integer overflows when processing large strings and tuples - in the tkinter module. - -- Issue #15352: Rebuild frozen modules when marshal.c is changed. - -- Issue #18747: Re-seed OpenSSL's pseudo-random number generator after fork. - A pthread_atfork() parent handler is used to seed the PRNG with pid, time - and some stack data. - -- Issue #8865: Concurrent invocation of select.poll.poll() now raises a - RuntimeError exception. Patch by Christian Schubert. - -- Issue #18777: The ssl module now uses the new CRYPTO_THREADID API of - OpenSSL 1.0.0+ instead of the deprecated CRYPTO id callback function. - -- Issue #18768: Correct doc string of RAND_edg(). Patch by Vajrasky Kok. - -- Issue #18178: Fix ctypes on BSD. dlmalloc.c was compiled twice which broke - malloc weak symbols. - -- Issue #18709: Fix CVE-2013-4238. The SSL module now handles NULL bytes - inside subjectAltName correctly. Formerly the module has used OpenSSL's - GENERAL_NAME_print() function to get the string representation of ASN.1 - strings for ``rfc822Name`` (email), ``dNSName`` (DNS) and - ``uniformResourceIdentifier`` (URI). - -- Issue #18701: Remove support of old CPython versions (<3.0) from C code. - -- Issue #18756: Improve error reporting in os.urandom() when the failure - is due to something else than /dev/urandom not existing (for example, - exhausting the file descriptor limit). - -- Issue #18673: Add O_TMPFILE to os module. O_TMPFILE requires Linux kernel - 3.11 or newer. It's only defined on system with 3.11 uapi headers, too. - -- Issue #18532: Change the builtin hash algorithms' names to lower case names - as promised by hashlib's documentation. - -- Issue #8713: add new spwan and forkserver start methods, and new functions - get_all_start_methods, get_start_method, and set_start_method, to - multiprocessing. - -- Issue #18405: Improve the entropy of crypt.mksalt(). - -- Issue #12015: The tempfile module now uses a suffix of 8 random characters - instead of 6, to reduce the risk of filename collision. The entropy was - reduced when uppercase letters were removed from the charset used to generate - random characters. - -- Issue #18585: Add :func:`textwrap.shorten` to collapse and truncate a - piece of text to a given length. - -- Issue #18598: Tweak exception message for importlib.import_module() to - include the module name when a key argument is missing. - -- Issue #19151: Fix docstring and use of _get_supported_file_loaders() to - reflect 2-tuples. - -- Issue #19152: Add ExtensionFileLoader.get_filename(). - -- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get - docstrings and ValueError messages. Patch by Zhongyue Luo - -- Fix refcounting issue with extension types in tkinter. - -- Issue #8112: xlmrpc.server's DocXMLRPCServer server no longer raises an error - if methods have annotations; it now correctly displays the annotations. - -- Issue #18600: Added policy argument to email.message.Message.as_string, - and as_bytes and __bytes__ methods to Message. - -- Issue #18671: Output more information when logging exceptions occur. - -- Issue #18621: Prevent the site module's patched builtins from keeping - too many references alive for too long. - -- Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. - -- Issue #8860: Fixed rounding in timedelta constructor. - -- Issue #18849: Fixed a Windows-specific tempfile bug where collision with an - existing directory caused mkstemp and related APIs to fail instead of - retrying. Report and fix by Vlad Shcherbina. - -- Issue #18920: argparse's default destination for the version action (-v, - --version) has also been changed to stdout, to match the Python executable. - -Tests ------ - -- Issue #18623: Factor out the _SuppressCoreFiles context manager into - test.support. Patch by Valerie Lambert. - -- Issue #12037: Fix test_email for desktop Windows. - -- Issue #15507: test_subprocess's test_send_signal could fail if the test - runner were run in an environment where the process inherited an ignore - setting for SIGINT. Restore the SIGINT handler to the desired - KeyboardInterrupt raising one during that test. - -- Issue #16799: Switched from getopt to argparse style in regrtest's argument - parsing. Added more tests for regrtest's argument parsing. - -- Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as - possible, since "localhost" goes through a DNS lookup under recent Windows - versions. - -IDLE ----- - -- Issue #18489: Add tests for SearchEngine. Original patch by Phil Webster. - -Documentation -------------- - -- Issue #18743: Fix references to non-existent "StringIO" module. - -- Issue #18783: Removed existing mentions of Python long type in docstrings, - error messages and comments. - -Build ------ - -- Issue #1584: Provide configure options to override default search paths for - Tcl and Tk when building _tkinter. - -- Issue #15663: Tcl/Tk 8.5.14 is now included with the OS X 10.6+ 64-/32-bit - installer. It is no longer necessary to install a third-party version of - Tcl/Tk 8.5 to work around the problems in the Apple-supplied Tcl/Tk 8.5 - shipped in OS X 10.6 and later releases. - -Tools/Demos ------------ - -- Issue #18922: Now The Lib/smtpd.py and Tools/i18n/msgfmt.py scripts write - their version strings to stdout, and not to sderr. - - -What's New in Python 3.4.0 Alpha 1? -=================================== - -Release date: 2013-08-03 - -Core and Builtins ------------------ - -- Issue #16741: Fix an error reporting in int(). - -- Issue #17899: Fix rare file descriptor leak in os.listdir(). - -- Issue #10241: Clear extension module dict copies at interpreter shutdown. - Patch by Neil Schemenauer, minimally modified. - -- Issue #9035: ismount now recognises volumes mounted below a drive root - on Windows. Original patch by Atsuo Ishimoto. - -- Issue #18214: Improve finalization of Python modules to avoid setting - their globals to None, in most cases. - -- Issue #18112: PEP 442 implementation (safe object finalization). - -- Issue #18552: Check return value of PyArena_AddPyObject() in - obj2ast_object(). - -- Issue #18560: Fix potential NULL pointer dereference in sum(). - -- Issue #18520: Add a new PyStructSequence_InitType2() function, same than - PyStructSequence_InitType() except that it has a return value (0 on success, - -1 on error). - -- Issue #15905: Fix theoretical buffer overflow in handling of sys.argv[0], - prefix and exec_prefix if the operation system does not obey MAXPATHLEN. - -- Issue #18408: Fix many various bugs in code handling errors, especially - on memory allocation failure (MemoryError). - -- Issue #18344: Fix potential ref-leaks in _bufferedreader_read_all(). - -- Issue #18342: Use the repr of a module name when an import fails when using - ``from ... import ...``. - -- Issue #17872: Fix a segfault in marshal.load() when input stream returns - more bytes than requested. - -- Issue #18338: `python --version` now prints version string to stdout, and - not to stderr. Patch by Berker Peksag and Michael Dickens. - -- Issue #18426: Fix NULL pointer dereference in C extension import when - PyModule_GetDef() returns an error. - -- Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix - a stack overflow in the marshal module (fix a crash in test_marshal). - Patch written by Jeremy Kloth. - -- Issue #3329: Implement the PEP 445: Add new APIs to customize Python memory - allocators. - -- Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the - tstate is first removed from TLS and then deallocated. - -- Issue #13483: Use VirtualAlloc in obmalloc on Windows. - -- Issue #18184: PyUnicode_FromFormat() and PyUnicode_FromFormatV() now raise - OverflowError when an argument of %c format is out of range. - -- Issue #18111: The min() and max() functions now support a default argument - to be returned instead of raising a ValueError on an empty sequence. - (Contributed by Julian Berman.) - -- Issue #18137: Detect integer overflow on precision in float.__format__() - and complex.__format__(). - -- Issue #15767: Introduce ModuleNotFoundError which is raised when a module - could not be found. - -- Issue #18183: Fix various unicode operations on strings with large unicode - codepoints. - -- Issue #18180: Fix ref leak in _PyImport_GetDynLoadWindows(). - -- Issue #18038: SyntaxError raised during compilation sources with illegal - encoding now always contains an encoding name. - -- Issue #17931: Resolve confusion on Windows between pids and process - handles. - -- Tweak the exception message when the magic number or size value in a bytecode - file is truncated. - -- Issue #17932: Fix an integer overflow issue on Windows 64-bit in iterators: - change the C type of seqiterobject.it_index from long to Py_ssize_t. - -- Issue #18065: Don't set __path__ to the package name for frozen packages. - -- Issue #18088: When reloading a module, unconditionally reset all relevant - attributes on the module (e.g. __name__, __loader__, __package__, __file__, - __cached__). - -- Issue #17937: Try harder to collect cyclic garbage at shutdown. - -- Issue #12370: Prevent class bodies from interfering with the __class__ - closure. - -- Issue #17644: Fix a crash in str.format when curly braces are used in square - brackets. - -- Issue #17237: Fix crash in the ASCII decoder on m68k. - -- Issue #17927: Frame objects kept arguments alive if they had been - copied into a cell, even if the cell was cleared. - -- Issue #1545463: At shutdown, defer finalization of codec modules so - that stderr remains usable. - -- Issue #7330: Implement width and precision (ex: "%5.3s") for the format - string of PyUnicode_FromFormat() function, original patch written by Ysj Ray. - -- Issue #1545463: Global variables caught in reference cycles are now - garbage-collected at shutdown. - -- Issue #17094: Clear stale thread states after fork(). Note that this - is a potentially disruptive change since it may release some system - resources which would otherwise remain perpetually alive (e.g. database - connections kept in thread-local storage). - -- Issue #17408: Avoid using an obsolete instance of the copyreg module when - the interpreter is shutdown and then started again. - -- Issue #5845: Enable tab-completion in the interactive interpreter by - default, thanks to a new sys.__interactivehook__. - -- Issue #17115,17116: Module initialization now includes setting __package__ and - __loader__ attributes to None. - -- Issue #17853: Ensure locals of a class that shadow free variables always win - over the closures. - -- Issue #17863: In the interactive console, don't loop forever if the encoding - can't be fetched from stdin. - -- Issue #17867: Raise an ImportError if __import__ is not found in __builtins__. - -- Issue #18698: Ensure importlib.reload() returns the module out of sys.modules. - -- Issue #17857: Prevent build failures with pre-3.5.0 versions of sqlite3, - such as was shipped with Centos 5 and Mac OS X 10.4. - -- Issue #17413: sys.settrace callbacks were being passed a string instead of an - exception instance for the 'value' element of the arg tuple if the exception - originated from C code; now an exception instance is always provided. - -- Issue #17782: Fix undefined behaviour on platforms where - ``struct timespec``'s "tv_nsec" member is not a C long. - -- Issue #17722: When looking up __round__, resolve descriptors. - -- Issue #16061: Speed up str.replace() for replacing 1-character strings. - -- Issue #17715: Fix segmentation fault from raising an exception in a __trunc__ - method. - -- Issue #17643: Add __callback__ attribute to weakref.ref. - -- Issue #16447: Fixed potential segmentation fault when setting __name__ on a - class. - -- Issue #17669: Fix crash involving finalization of generators using yield from. - -- Issue #14439: Python now prints the traceback on runpy failure at startup. - -- Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() - when running on valgrind. - -- Issue #17619: Make input() check for Ctrl-C correctly on Windows. - -- Issue #17357: Add missing verbosity messages for -v/-vv that were lost during - the importlib transition. - -- Issue #17610: Don't rely on non-standard behavior of the C qsort() function. - -- Issue #17323: The "[X refs, Y blocks]" printed by debug builds has been - disabled by default. It can be re-enabled with the `-X showrefcount` option. - -- Issue #17328: Fix possible refleak in dict.setdefault. - -- Issue #17275: Corrected class name in init error messages of the C version of - BufferedWriter and BufferedRandom. - -- Issue #7963: Fixed misleading error message that issued when object is - called without arguments. - -- Issue #8745: Small speed up zipimport on Windows. Patch by Catalin Iacob. - -- Issue #5308: Raise ValueError when marshalling too large object (a sequence - with size >= 2**31), instead of producing illegal marshal data. - -- Issue #12983: Bytes literals with invalid ``\x`` escape now raise a SyntaxError - and a full traceback including line number. - -- Issue #16967: In function definition, evaluate positional defaults before - keyword-only defaults. - -- Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) - in the interpreter. - -- Issue #17137: When a Unicode string is resized, the internal wide character - string (wstr) format is now cleared. - -- Issue #17043: The unicode-internal decoder no longer read past the end of - input buffer. - -- Issue #17098: All modules now have __loader__ set even if they pre-exist the - bootstrapping of importlib. - -- Issue #16979: Fix error handling bugs in the unicode-escape-decode decoder. - -- Issue #16772: The base argument to the int constructor no longer accepts - floats, or other non-integer objects with an __int__ method. Objects - with an __index__ method are now accepted. - -- Issue #10156: In the interpreter's initialization phase, unicode globals - are now initialized dynamically as needed. - -- Issue #16980: Fix processing of escaped non-ascii bytes in the - unicode-escape-decode decoder. - -- Issue #16975: Fix error handling bug in the escape-decode bytes decoder. - -- Issue #14850: Now a charmap decoder treats U+FFFE as "undefined mapping" - in any mapping, not only in a string. - -- Issue #16613: Add *m* argument to ``collections.Chainmap.new_child`` to - allow the new child map to be specified explicitly. - -- Issue #16730: importlib.machinery.FileFinder now no longers raises an - exception when trying to populate its cache and it finds out the directory is - unreadable or has turned into a file. Reported and diagnosed by - David Pritchard. - -- Issue #16906: Fix a logic error that prevented most static strings from being - cleared. - -- Issue #11461: Fix the incremental UTF-16 decoder. Original patch by - Amaury Forgeot d'Arc. - -- Issue #16856: Fix a segmentation fault from calling repr() on a dict with - a key whose repr raise an exception. - -- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. - -- Issue #16761: Calling int() with base argument only now raises TypeError. - -- Issue #16759: Support the full DWORD (unsigned long) range in Reg2Py - when retrieving a REG_DWORD value. This corrects functions like - winreg.QueryValueEx that may have been returning truncated values. - -- Issue #14420: Support the full DWORD (unsigned long) range in Py2Reg - when passed a REG_DWORD value. Fixes OverflowError in winreg.SetValueEx. - -- Issue #11939: Set the st_dev attribute of stat_result to allow Windows to - take advantage of the os.path.samefile/sameopenfile/samestat implementations - used by other platforms. - -- Issue #16772: The int() constructor's second argument (base) no longer - accepts non integer values. Consistent with the behavior in Python 2. - -- Issue #14470: Remove w9xpopen support per PEP 11. - -- Issue #9856: Replace deprecation warning with raising TypeError - in object.__format__. Patch by Florent Xicluna. - -- Issue #16597: In buffered and text IO, call close() on the underlying stream - if invoking flush() fails. - -- Issue #16722: In the bytes() constructor, try to call __bytes__ on the - argument before __index__. - -- Issue #16421: loading multiple modules from one shared object is now - handled correctly (previously, the first module loaded from that file - was silently returned). Patch by V?clav ?milauer. - -- Issue #16602: When a weakref's target was part of a long deallocation - chain, the object could remain reachable through its weakref even though - its refcount had dropped to zero. - -- Issue #16495: Remove extraneous NULL encoding check from bytes_decode(). - -- Issue #16619: Create NameConstant AST class to represent None, True, and False - literals. As a result, these constants are never loaded at runtime from - builtins. - -- Issue #16455: On FreeBSD and Solaris, if the locale is C, the - ASCII/surrogateescape codec is now used (instead of the locale encoding) to - decode the command line arguments. This change fixes inconsistencies with - os.fsencode() and os.fsdecode(), because these operating systems announce an - ASCII locale encoding, but actually use the ISO-8859-1 encoding in practice. - -- Issue #16562: Optimize dict equality testing. Patch by Serhiy Storchaka. - -- Issue #16588: Silence unused-but-set warnings in Python/thread_pthread - -- Issue #16592: stringlib_bytes_join doesn't raise MemoryError on allocation - failure. - -- Issue #16546: Fix: ast.YieldFrom argument is now mandatory. - -- Issue #16514: Fix regression causing a traceback when sys.path[0] is None - (actually, any non-string or non-bytes type). - -- Issue #16306: Fix multiple error messages when unknown command line - parameters where passed to the interpreter. Patch by Hieu Nguyen. - -- Issue #16215: Fix potential double memory free in str.replace(). Patch - by Serhiy Storchaka. - -- Issue #16290: A float return value from the __complex__ special method is no - longer accepted in the complex() constructor. - -- Issue #16416: On Mac OS X, operating system data are now always - encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding - (which may be ASCII if no locale environment variable is set), to avoid - inconsistencies with os.fsencode() and os.fsdecode() functions which are - already using UTF-8/surrogateescape. - -- Issue #16453: Fix equality testing of dead weakref objects. - -- Issue #9535: Fix pending signals that have been received but not yet - handled by Python to not persist after os.fork() in the child process. - -- Issue #14794: Fix slice.indices to return correct results for huge values, - rather than raising OverflowError. - -- Issue #15001: fix segfault on "del sys.modules['__main__']". Patch by Victor - Stinner. - -- Issue #8271: the utf-8 decoder now outputs the correct number of U+FFFD - characters when used with the 'replace' error handler on invalid utf-8 - sequences. Patch by Serhiy Storchaka, tests by Ezio Melotti. - -- Issue #5765: Apply a hard recursion limit in the compiler instead of - blowing the stack and segfaulting. Initial patch by Andrea Griffini. - -- Issue #16402: When slicing a range, fix shadowing of exceptions from - __index__. - -- Issue #16336: fix input checking in the surrogatepass error handler. - Patch by Serhiy Storchaka. - -- Issue #8401: assigning an int to a bytearray slice (e.g. b[3:4] = 5) now - raises an error. - -- Issue #7317: Display full tracebacks when an error occurs asynchronously. - Patch by Alon Horev with update by Alexey Kachayev. - -- Issue #16309: Make PYTHONPATH="" behavior the same as if PYTHONPATH - not set at all. - -- Issue #10189: Improve the error reporting of SyntaxErrors related to global - and nonlocal statements. - -- Fix segfaults on setting __qualname__ on builtin types and attempting to - delete it on any type. - -- Issue #14625: Rewrite the UTF-32 decoder. It is now 3x to 4x faster. Patch - written by Serhiy Storchaka. - -- Issue #16345: Fix an infinite loop when ``fromkeys`` on a dict subclass - received a nonempty dict from the constructor. - -- Issue #16271: Fix strange bugs that resulted from __qualname__ appearing in a - class's __dict__ and on type. - -- Issue #12805: Make bytes.join and bytearray.join faster when the separator - is empty. Patch by Serhiy Storchaka. - -- Issue #6074: Ensure cached bytecode files can always be updated by the - user that created them, even when the source file is read-only. - -- Issue #15958: bytes.join and bytearray.join now accept arbitrary buffer - objects. - -- Issue #14783: Improve int() docstring and switch docstrings for str(), - range(), and slice() to use multi-line signatures. - -- Issue #16160: Subclass support now works for types.SimpleNamespace. - -- Issue #16148: Implement PEP 424, adding operator.length_hint and - PyObject_LengthHint. - -- Upgrade Unicode data (UCD) to version 6.2. - -- Issue #15379: Fix passing of non-BMP characters as integers for the charmap - decoder (already working as unicode strings). Patch by Serhiy Storchaka. - -- Issue #15144: Fix possible integer overflow when handling pointers as integer - values, by using `Py_uintptr_t` instead of `size_t`. Patch by Serhiy - Storchaka. - -- Issue #15965: Explicitly cast `AT_FDCWD` as (int). Required on Solaris 10 - (which defines `AT_FDCWD` as ``0xffd19553``), harmless on other platforms. - -- Issue #15839: Convert SystemErrors in `super()` to RuntimeErrors. - -- Issue #15448: Buffered IO now frees the buffer when closed, instead - of when deallocating. - -- Issue #15846: Fix SystemError which happened when using `ast.parse()` in an - exception handler on code with syntax errors. - -- Issue #15897: zipimport.c doesn't check return value of fseek(). - Patch by Felipe Cruz. - -- Issue #15801: Make sure mappings passed to '%' formatting are actually - subscriptable. - -- Issue #15111: __import__ should propagate ImportError when raised as a - side-effect of a module triggered from using fromlist. - -- Issue #15022: Add pickle and comparison support to types.SimpleNamespace. - -Library -------- - -- Issue #4331: Added functools.partialmethod (Initial patch by Alon Horev) - -- Issue #13461: Fix a crash in the TextIOWrapper.tell method on 64-bit - platforms. Patch by Yogesh Chaudhari. - -- Issue #18681: Fix a NameError in importlib.reload() (noticed by Weizhao Li). - -- Issue #14323: Expanded the number of digits in the coefficients for the - RGB -- YIQ conversions so that they match the FCC NTSC versions. - -- Issue #17998: Fix an internal error in regular expression engine. - -- Issue #17557: Fix os.getgroups() to work with the modified behavior of - getgroups(2) on OS X 10.8. Original patch by Mateusz Lenik. - -- Issue #18608: Avoid keeping a strong reference to the locale module - inside the _io module. - -- Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, - and make it GC-aware. - -- Issue #15699: The readline module now uses PEP 3121-style module - initialization, so as to reclaim allocated resources (Python callbacks) - at shutdown. Original patch by Robin Schreiber. - -- Issue #17616: wave.open now supports the context management protocol. - -- Issue #18599: Fix name attribute of _sha1.sha1() object. It now returns - 'SHA1' instead of 'SHA'. - -- Issue #13266: Added inspect.unwrap to easily unravel __wrapped__ chains - (initial patch by Daniel Urban and Aaron Iles) - -- Issue #18561: Skip name in ctypes' _build_callargs() if name is NULL. - -- Issue #18559: Fix NULL pointer dereference error in _pickle module - -- Issue #18556: Check the return type of PyUnicode_AsWideChar() in ctype's - U_set(). - -- Issue #17818: aifc.getparams now returns a namedtuple. - -- Issue #18549: Eliminate dead code in socket_ntohl() - -- Issue #18530: Remove additional stat call from posixpath.ismount. - Patch by Alex Gaynor. - -- Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj() - -- Issue #9177: Calling read() or write() now raises ValueError, not - AttributeError, on a closed SSL socket. Patch by Senko Rasic. - -- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 + - gcc. - -- Issue #18479: Changed venv Activate.ps1 to make deactivate a function, and - removed Deactivate.ps1. - -- Issue #18480: Add missing call to PyType_Ready to the _elementtree extension. - -- Issue #17778: Fix test discovery for test_multiprocessing. (Patch by - Zachary Ware.) - -- Issue #18393: The private module _gestalt and private functions - platform._mac_ver_gestalt, platform._mac_ver_lookup and - platform._bcd2str have been removed. This does not affect the public - interface of the platform module. - -- Issue #17482: functools.update_wrapper (and functools.wraps) now set the - __wrapped__ attribute correctly even if the underlying function has a - __wrapped__ attribute set. - -- Issue #18431: The new email header parser now decodes RFC2047 encoded words - in structured headers. - -- Issue #18432: The sched module's queue method was incorrectly returning - an iterator instead of a list. - -- Issue #18044: The new email header parser was mis-parsing encoded words where - an encoded character immediately followed the '?' that follows the CTE - character, resulting in a decoding failure. They are now decoded correctly. - -- Issue #18101: Tcl.split() now process strings nested in a tuple as it - do with byte strings. - -- Issue #18116: getpass was always getting an error when testing /dev/tty, - and thus was always falling back to stdin, and would then raise an exception - if stdin could not be used (such as /dev/null). It also leaked an open file. - All of these issues are now fixed. - -- Issue #17198: Fix a NameError in the dbm module. Patch by Valentina - Mukhamedzhanova. - -- Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form. - -- Issue #18020: improve html.escape speed by an order of magnitude. - Patch by Matt Bryant. - -- Issue #18347: ElementTree's html serializer now preserves the case of - closing tags. - -- Issue #17261: Ensure multiprocessing's proxies use proper address. - -- Issue #18343: faulthandler.register() now keeps the previous signal handler - when the function is called twice, so faulthandler.unregister() restores - correctly the original signal handler. - -- Issue #17097: Make multiprocessing ignore EINTR. - -- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a - segfault inside the _pickle C extension. - -- Issue #18240: The HMAC module is no longer restricted to bytes and accepts - any bytes-like object, e.g. memoryview. Original patch by Jonas Borgstr?m. - -- Issue #18224: Removed pydoc script from created venv, as it causes problems - on Windows and adds no value over and above python -m pydoc ... - -- Issue #18155: The csv module now correctly handles csv files that use - a delimiter character that has a special meaning in regexes, instead of - throwing an exception. - -- Issue #14360: encode_quopri can now be successfully used as an encoder - when constructing a MIMEApplication object. - -- Issue #11390: Add -o and -f command line options to the doctest CLI to - specify doctest options (and convert it to using argparse). - -- Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input - string in longer than 2 gigabytes, and ssl.SSLContext.load_cert_chain() - raises a ValueError if the password is longer than 2 gigabytes. The ssl - module does not support partial write. - -- Issue #11016: Add C implementation of the stat module as _stat. - -- Issue #18248: Fix libffi build on AIX. - -- Issue #18259: Declare sethostname in socketmodule.c for AIX - -- Issue #18147: Add diagnostic functions to ssl.SSLContext(). get_ca_list() - lists all loaded CA certificates and cert_store_stats() returns amount of - loaded X.509 certs, X.509 CA certs and CRLs. - -- Issue #18167: cgi.FieldStorage no longer fails to handle multipart/form-data - when ``\r\n`` appears at end of 65535 bytes without other newlines. - -- Issue #18076: Introduce importlib.util.decode_source(). - -- Issue #18357: add tests for dictview set difference. - Patch by Fraser Tweedale. - -- importlib.abc.SourceLoader.get_source() no longer changes SyntaxError or - UnicodeDecodeError into ImportError. - -- Issue #18058, 18057: Make the namespace package loader meet the - importlib.abc.InspectLoader ABC, allowing for namespace packages to work with - runpy. - -- Issue #17177: The imp module is pending deprecation. - -- subprocess: Prevent a possible double close of parent pipe fds when the - subprocess exec runs into an error. Prevent a regular multi-close of the - /dev/null fd when any of stdin, stdout and stderr was set to DEVNULL. - -- Issue #18194: Introduce importlib.util.cache_from_source() and - source_from_cache() while documenting the equivalent functions in imp as - deprecated. - -- Issue #17907: Document imp.new_module() as deprecated in favour of - types.ModuleType. - -- Issue #18192: Introduce importlib.util.MAGIC_NUMBER and document as deprecated - imp.get_magic(). - -- Issue #18149: Add filecmp.clear_cache() to manually clear the filecmp cache. - Patch by Mark Levitt - -- Issue #18193: Add importlib.reload(). - -- Issue #18157: Stop using imp.load_module() in pydoc. - -- Issue #16102: Make uuid._netbios_getnode() work again on Python 3. - -- Issue #17134: Add ssl.enum_cert_store() as interface to Windows' cert store. - -- Issue #18143: Implement ssl.get_default_verify_paths() in order to debug - the default locations for cafile and capath. - -- Issue #17314: Move multiprocessing.forking over to importlib. - -- Issue #11959: SMTPServer and SMTPChannel now take an optional map, use of - which avoids affecting global state. - -- Issue #18109: os.uname() now decodes fields from the locale encoding, and - socket.gethostname() now decodes the hostname from the locale encoding, - instead of using the UTF-8 encoding in strict mode. - -- Issue #18089: Implement importlib.abc.InspectLoader.load_module. - -- Issue #18088: Introduce importlib.abc.Loader.init_module_attrs for setting - module attributes. Leads to the pending deprecation of - importlib.util.module_for_loader. - -- Issue #17403: urllib.parse.robotparser normalizes the urls before adding to - ruleline. This helps in handling certain types invalid urls in a conservative - manner. Patch contributed by Mher Movsisyan. - -- Issue #18070: Have importlib.util.module_for_loader() set attributes - unconditionally in order to properly support reloading. - -- Added importlib.util.module_to_load to return a context manager to provide the - proper module object to load. - -- Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw - stream's read() returns more bytes than requested. - -- Issue #18011: As was originally intended, base64.b32decode() now raises a - binascii.Error if there are non-b32-alphabet characters present in the input - string, instead of a TypeError. - -- Issue #18072: Implement importlib.abc.InspectLoader.get_code() and - importlib.abc.ExecutionLoader.get_code(). - -- Issue #8240: Set the SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER flag on SSL - sockets. - -- Issue #17269: Workaround for socket.getaddrinfo crash on MacOS X - with port None or "0" and flags AI_NUMERICSERV. - -- Issue #16986: ElementTree now correctly works with string input when the - internal XML encoding is not UTF-8 or US-ASCII. - -- Issue #17996: socket module now exposes AF_LINK constant on BSD and OSX. - -- Issue #17900: Allowed pickling of recursive OrderedDicts. Decreased pickled - size and pickling time. - -- Issue #17914: Add os.cpu_count(). Patch by Yogesh Chaudhari, based on an - initial patch by Trent Nelson. - -- Issue #17812: Fixed quadratic complexity of base64.b32encode(). - Optimize base64.b32encode() and base64.b32decode() (speed up to 3x). - -- Issue #17980: Fix possible abuse of ssl.match_hostname() for denial of - service using certificates with many wildcards (CVE-2013-2099). - -- Issue #15758: Fix FileIO.readall() so it no longer has O(n**2) complexity. - -- Issue #14596: The struct.Struct() objects now use a more compact - implementation. - -- Issue #17981: logging's SysLogHandler now closes the socket when it catches - socket OSErrors. - -- Issue #17964: Fix os.sysconf(): the return type of the C sysconf() function - is long, not int. - -- Fix typos in the multiprocessing module. - -- Issue #17754: Make ctypes.util.find_library() independent of the locale. - -- Issue #17968: Fix memory leak in os.listxattr(). - -- Issue #17606: Fixed support of encoded byte strings in the XMLGenerator - characters() and ignorableWhitespace() methods. Original patch by Sebastian - Ortiz Vasquez. - -- Issue #17732: Ignore distutils.cfg options pertaining to install paths if a - virtual environment is active. - -- Issue #17915: Fix interoperability of xml.sax with file objects returned by - codecs.open(). - -- Issue #16601: Restarting iteration over tarfile really restarts rather - than continuing from where it left off. Patch by Michael Birtwell. - -- Issue #17289: The readline module now plays nicer with external modules - or applications changing the rl_completer_word_break_characters global - variable. Initial patch by Bradley Froehle. - -- Issue #12181: select module: Fix struct kevent definition on OpenBSD 64-bit - platforms. Patch by Federico Schwindt. - -- Issue #11816: multiple improvements to the dis module: get_instructions - generator, ability to redirect output to a file, Bytecode and Instruction - abstractions. Patch by Nick Coghlan, Ryan Kelly and Thomas Kluyver. - -- Issue #13831: Embed stringification of remote traceback in local - traceback raised when pool task raises an exception. - -- Issue #15528: Add weakref.finalize to support finalization using - weakref callbacks. - -- Issue #14173: Avoid crashing when reading a signal handler during - interpreter shutdown. - -- Issue #15902: Fix imp.load_module() accepting None as a file when loading an - extension module. - -- Issue #13721: SSLSocket.getpeercert() and SSLSocket.do_handshake() now - raise an OSError with ENOTCONN, instead of an AttributeError, when the - SSLSocket is not connected. - -- Issue #14679: add an __all__ (that contains only HTMLParser) to html.parser. - -- Issue #17802: Fix an UnboundLocalError in html.parser. Initial tests by - Thomas Barlow. - -- Issue #17358: Modules loaded by imp.load_source() and load_compiled() (and by - extension load_module()) now have a better chance of working when reloaded. - -- Issue #17804: New function ``struct.iter_unpack`` allows for streaming - struct unpacking. - -- Issue #17830: When keyword.py is used to update a keyword file, it now - preserves the line endings of the original file. - -- Issue #17272: Making the urllib.request's Request.full_url a descriptor. - Fixes bugs with assignment to full_url. Patch by Demian Brecht. - -- Issue #17353: Plistlib emitted empty data tags with deeply nested datastructures - -- Issue #11714: Use 'with' statements to assure a Semaphore releases a - condition variable. Original patch by Thomas Rachel. - -- Issue #16624: `subprocess.check_output` now accepts an `input` argument, - allowing the subprocess's stdin to be provided as a (byte) string. - Patch by Zack Weinberg. - -- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with - Unix domain sockets. - -- Issue #16694: Add a pure Python implementation of the operator module. - Patch by Zachary Ware. - -- Issue #11182: remove the unused and undocumented pydoc.Scanner class. - Patch by Martin Morrison. - -- Issue #17741: Add ElementTree.XMLPullParser, an event-driven parser for - non-blocking applications. - -- Issue #17555: Fix ForkAwareThreadLock so that size of after fork - registry does not grow exponentially with generation of process. - -- Issue #17707: fix regression in multiprocessing.Queue's get() method where - it did not block for short timeouts. - -- Issue #17720: Fix the Python implementation of pickle.Unpickler to correctly - process the APPENDS opcode when it is used on non-list objects. - -- Issue #17012: shutil.which() no longer falls back to the PATH environment - variable if an empty path argument is specified. Patch by Serhiy Storchaka. - -- Issue #17710: Fix pickle raising a SystemError on bogus input. - -- Issue #17341: Include the invalid name in the error messages from re about - invalid group names. - -- Issue #17702: os.environ now raises KeyError with the original environment - variable name (str on UNIX), instead of using the encoded name (bytes on - UNIX). - -- Issue #16163: Make the importlib based version of pkgutil.iter_importers - work for submodules. Initial patch by Berker Peksag. - -- Issue #16804: Fix a bug in the 'site' module that caused running - 'python -S -m site' to incorrectly throw an exception. - -- Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal. - Initial patch by Daniel Riti. - -- Issue #2118: SMTPException is now a subclass of OSError. - -- Issue #17016: Get rid of possible pointer wraparounds and integer overflows - in the re module. Patch by Nickolai Zeldovich. - -- Issue #16658: add missing return to HTTPConnection.send(). - Patch by Jeff Knupp. - -- Issue #9556: the logging package now allows specifying a time-of-day for a - TimedRotatingFileHandler to rotate. - -- Issue #14971: unittest test discovery no longer gets confused when a function - has a different __name__ than its name in the TestCase class dictionary. - -- Issue #17487: The wave getparams method now returns a namedtuple rather than - a plain tuple. - -- Issue #17675: socket repr() provides local and remote addresses (if any). - Patch by Giampaolo Rodola' - -- Issue #17093: Make the ABCs in importlib.abc provide default values or raise - reasonable exceptions for their methods to make them more amenable to super() - calls. - -- Issue #17566: Make importlib.abc.Loader.module_repr() optional instead of an - abstractmethod; now it raises NotImplementedError so as to be ignored by default. - -- Issue #17678: Remove the use of deprecated method in http/cookiejar.py by - changing the call to get_origin_req_host() to origin_req_host. - -- Issue #17666: Fix reading gzip files with an extra field. - -- Issue #16475: Support object instancing, recursion and interned strings - in marshal - -- Issue #17502: Process DEFAULT values in mock side_effect that returns iterator. - -- Issue #16795: On the ast.arguments object, unify vararg with varargannotation - and kwarg and kwargannotation. Change the column offset of ast.Attribute to be - at the attribute name. - -- Issue #17434: Properly raise a SyntaxError when a string occurs between future - imports. - -- Issue #17117: Import and @importlib.util.set_loader now set __loader__ when - it has a value of None or the attribute doesn't exist. - -- Issue #17032: The "global" in the "NameError: global name 'x' is not defined" - error message has been removed. Patch by Ram Rachum. - -- Issue #18080: When building a C extension module on OS X, if the compiler - is overridden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overridden. This restores - Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. - -- Issue #18113: Fixed a refcount leak in the curses.panel module's - set_userptr() method. Reported by Atsuo Ishimoto. - -- Implement PEP 443 "Single-dispatch generic functions". - -- Implement PEP 435 "Adding an Enum type to the Python standard library". - -- Issue #15596: Faster pickling of unicode strings. - -- Issue #17572: Avoid chained exceptions when passing bad directives to - time.strptime(). Initial patch by Claudiu Popa. - -- Issue #17435: threading.Timer's __init__ method no longer uses mutable - default values for the args and kwargs parameters. - -- Issue #17526: fix an IndexError raised while passing code without filename to - inspect.findsource(). Initial patch by Tyler Doyle. - -- Issue #17540: Added style parameter to logging formatter configuration by dict. - -- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial - patch by Michele Orr?. - -- Issue #17025: multiprocessing: Reduce Queue and SimpleQueue contention. - -- Issue #17536: Add to webbrowser's browser list: www-browser, x-www-browser, - iceweasel, iceape. - -- Issue #17150: pprint now uses line continuations to wrap long string - literals. - -- Issue #17488: Change the subprocess.Popen bufsize parameter default value - from unbuffered (0) to buffering (-1) to match the behavior existing code - expects and match the behavior of the subprocess module in Python 2 to avoid - introducing hard to track down bugs. - -- Issue #17521: Corrected non-enabling of logger following two calls to - fileConfig(). - -- Issue #17508: Corrected logging MemoryHandler configuration in dictConfig() - where the target handler wasn't configured first. - -- Issue #17209: curses.window.get_wch() now correctly handles KeyboardInterrupt - (CTRL+c). - -- Issue #5713: smtplib now handles 421 (closing connection) error codes when - sending mail by closing the socket and reporting the 421 error code via the - exception appropriate to the command that received the error response. - -- Issue #16997: unittest.TestCase now provides a subTest() context manager - to procedurally generate, in an easy way, small test instances. - -- Issue #17485: Also delete the Request Content-Length header if the data - attribute is deleted. (Follow on to issue Issue #16464). - -- Issue #15927: CVS now correctly parses escaped newlines and carriage - when parsing with quoting turned off. - -- Issue #17467: add readline and readlines support to mock_open in - unittest.mock. - -- Issue #13248: removed deprecated and undocumented difflib.isbjunk, - isbpopular. - -- Issue #17192: Update the ctypes module's libffi to v3.0.13. This - specifically addresses a stack misalignment issue on x86 and issues on - some more recent platforms. - -- Issue #8862: Fixed curses cleanup when getkey is interrupted by a signal. - -- Issue #17443: imaplib.IMAP4_stream was using the default unbuffered IO - in subprocess, but the imap code assumes buffered IO. In Python2 this - worked by accident. IMAP4_stream now explicitly uses buffered IO. - -- Issue #17476: Fixed regression relative to Python2 in undocumented pydoc - 'allmethods'; it was missing unbound methods on the class. - -- Issue #17474: Remove the deprecated methods of Request class. - -- Issue #16709: unittest discover order is no-longer filesystem specific. Patch - by Jeff Ramnani. - -- Use the HTTPS PyPI url for upload, overriding any plain HTTP URL in pypirc. - -- Issue #5024: sndhdr.whichhdr now returns the frame count for WAV files - rather than -1. - -- Issue #17460: Remove the strict argument of HTTPConnection and removing the - DeprecationWarning being issued from 3.2 onwards. - -- Issue #16880: Do not assume _imp.load_dynamic() is defined in the imp module. - -- Issue #16389: Fixed a performance regression relative to Python 3.1 in the - caching of compiled regular expressions. - -- Added missing FeedParser and BytesFeedParser to email.parser.__all__. - -- Issue #17431: Fix missing import of BytesFeedParser in email.parser. - -- Issue #12921: http.server's send_error takes an explain argument to send more - information in response. Patch contributed by Karl. - -- Issue #17414: Add timeit, repeat, and default_timer to timeit.__all__. - -- Issue #1285086: Get rid of the refcounting hack and speed up - urllib.parse.unquote() and urllib.parse.unquote_to_bytes(). - -- Issue #17099: Have importlib.find_loader() raise ValueError when __loader__ - is not set, harmonizing with what happens when the attribute is set to None. - -- Expose the O_PATH constant in the os module if it is available. - -- Issue #17368: Fix an off-by-one error in the Python JSON decoder that caused - a failure while decoding empty object literals when object_pairs_hook was - specified. - -- Issue #17385: Fix quadratic behavior in threading.Condition. The FIFO - queue now uses a deque instead of a list. - -- Issue #15806: Add contextlib.ignore(). This creates a context manager to - ignore specified exceptions, replacing the "except SomeException: pass" idiom. - -- Issue #14645: The email generator classes now produce output using the - specified linesep throughout. Previously if the prolog, epilog, or - body were stored with a different linesep, that linesep was used. This - fix corrects an RFC non-compliance issue with smtplib.send_message. - -- Issue #17278: Fix a crash in heapq.heappush() and heapq.heappop() when - the list is being resized concurrently. - -- Issue #16962: Use getdents64 instead of the obsolete getdents syscall - in the subprocess module on Linux. - -- Issue #16935: unittest now counts the module as skipped if it raises SkipTest, - instead of counting it as an error. Patch by Zachary Ware. - -- Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR. - -- Issue #17223: array module: Fix a crasher when converting an array containing - invalid characters (outside range [U+0000; U+10ffff]) to Unicode: - repr(array), str(array) and array.tounicode(). Patch written by Manuel Jacob. - -- Issue #17197: profile/cProfile modules refactored so that code of run() and - runctx() utility functions is not duplicated in both modules. - -- Issue #14720: sqlite3: Convert datetime microseconds correctly. - Patch by Lowe Thiderman. - -- Issue #15132: Allow a list for the defaultTest argument of - unittest.TestProgram. Patch by Jyrki Pulliainen. - -- Issue #17225: JSON decoder now counts columns in the first line starting - with 1, as in other lines. - -- Issue #6623: Added explicit DeprecationWarning for ftplib.netrc, which has - been deprecated and undocumented for a long time. - -- Issue #13700: Fix byte/string handling in imaplib authentication when an - authobject is specified. - -- Issue #13153: Tkinter functions now raise TclError instead of ValueError when - a string argument contains non-BMP character. - -- Issue #9669: Protect re against infinite loops on zero-width matching in - non-greedy repeat. Patch by Matthew Barnett. - -- Issue #13169: The maximal repetition number in a regular expression has been - increased from 65534 to 2147483647 (on 32-bit platform) or 4294967294 (on - 64-bit). - -- Issue #17143: Fix a missing import in the trace module. Initial patch by - Berker Peksag. - -- Issue #15220: email.feedparser's line splitting algorithm is now simpler and - faster. - -- Issue #16743: Fix mmap overflow check on 32 bit Windows. - -- Issue #16996: webbrowser module now uses shutil.which() to find a - web-browser on the executable search path. - -- Issue #16800: tempfile.gettempdir() no longer left temporary files when - the disk is full. Original patch by Amir Szekely. - -- Issue #17192: Import libffi-3.0.12. - -- Issue #16564: Fixed regression relative to Python2 in the operation of - email.encoders.encode_7or8bit when used with binary data. - -- Issue #17052: unittest discovery should use self.testLoader. - -- Issue #4591: Uid and gid values larger than 2**31 are supported now. - -- Issue #17141: random.vonmisesvariate() no longer hangs for large kappas. - -- Issue #17149: Fix random.vonmisesvariate to always return results in - [0, 2*math.pi]. - -- Issue #1470548: XMLGenerator now works with binary output streams. - -- Issue #6975: os.path.realpath() now correctly resolves multiple nested - symlinks on POSIX platforms. - -- Issue #13773: sqlite3.connect() gets a new `uri` parameter to pass the - filename as a URI, allowing custom options to be passed. - -- Issue #16564: Fixed regression relative to Python2 in the operation of - email.encoders.encode_noop when used with binary data. - -- Issue #10355: The mode, name, encoding and newlines properties now work on - SpooledTemporaryFile objects even when they have not yet rolled over. - Obsolete method xreadline (which has never worked in Python 3) has been - removed. - -- Issue #16686: Fixed a lot of bugs in audioop module. Fixed crashes in - avgpp(), maxpp() and ratecv(). Fixed an integer overflow in add(), bias(), - and ratecv(). reverse(), lin2lin() and ratecv() no more lose precision for - 32-bit samples. max() and rms() no more returns a negative result and - various other functions now work correctly with 32-bit sample -0x80000000. - -- Issue #17073: Fix some integer overflows in sqlite3 module. - -- Issue #16723: httplib.HTTPResponse no longer marked closed when the connection - is automatically closed. - -- Issue #15359: Add CAN_BCM protocol support to the socket module. Patch by - Brian Thorne. - -- Issue #16948: Fix quoted printable body encoding for non-latin1 character - sets in the email package. - -- Issue #16811: Fix folding of headers with no value in the provisional email - policies. - -- Issue #17132: Update symbol for "yield from" grammar changes. - -- Issue #17076: Make copying of xattrs more tolerant of missing FS support. - Patch by Thomas Wouters. - -- Issue #17089: Expat parser now correctly works with string input when the - internal XML encoding is not UTF-8 or US-ASCII. It also now accepts bytes - and strings larger than 2 GiB. - -- Issue #6083: Fix multiple segmentation faults occurred when PyArg_ParseTuple - parses nested mutating sequence. - -- Issue #5289: Fix ctypes.util.find_library on Solaris. - -- Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying - stream or a decoder produces data of an unexpected type (i.e. when - io.TextIOWrapper initialized with text stream or use bytes-to-bytes codec). - -- Issue #17015: When it has a spec, a Mock object now inspects its signature - when matching calls, so that arguments can be matched positionally or - by name. - -- Issue #15633: httplib.HTTPResponse is now mark closed when the server - sends less than the advertised Content-Length. - -- Issue #12268: The io module file object write methods no longer abort early - when one of its write system calls is interrupted (EINTR). - -- Issue #6972: The zipfile module no longer overwrites files outside of - its destination path when extracting malicious zip files. - -- Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an - incomplete "End of Central Directory" record. Original patch by Guilherme - Polo and Alan McIntyre. - -- Issue #17071: Signature.bind() now works when one of the keyword arguments - is named ``self``. - -- Issue #12004: Fix an internal error in PyZipFile when writing an invalid - Python file. Patch by Ben Morgan. - -- Have py_compile use importlib as much as possible to avoid code duplication. - Code now raises FileExistsError if the file path to be used for the - byte-compiled file is a symlink or non-regular file as a warning that import - will not keep the file path type if it writes to that path. - -- Issue #16972: Have site.addpackage() consider already known paths even when - none are explicitly passed in. Bug report and fix by Kirill. - -- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``) - now fills the ``os.environ`` variable correctly. - -- Issue #15505: `unittest.installHandler` no longer assumes SIGINT handler is - set to a callable object. - -- Issue #13454: Fix a crash when deleting an iterator created by itertools.tee() - if all other iterators were very advanced before. - -- Issue #12411: Fix to cgi.parse_multipart to correctly use bytes boundaries - and bytes data. Patch by Jonas Wagner. - -- Issue #16957: shutil.which() no longer searches a bare file name in the - current directory on Unix and no longer searches a relative file path with - a directory part in PATH directories. Patch by Thomas Kluyver. - -- Issue #1159051: GzipFile now raises EOFError when reading a corrupted file - with truncated header or footer. - -- Issue #16993: shutil.which() now preserves the case of the path and extension - on Windows. - -- Issue #16992: On Windows in signal.set_wakeup_fd, validate the file - descriptor argument. - -- Issue #16422: For compatibility with the Python version, the C version of - decimal now uses strings instead of integers for rounding mode constants. - -- Issue #15861: tkinter now correctly works with lists and tuples containing - strings with whitespaces, backslashes or unbalanced braces. - -- Issue #9720: zipfile now writes correct local headers for files larger than - 4 GiB. - -- Issue #16955: Fix the poll() method for multiprocessing's socket - connections on Windows. - -- SSLContext.load_dh_params() now properly closes the input file. - -- Issue #15031: Refactor some .pyc management code to cut down on code - duplication. Thanks to Ronan Lamy for the report and taking an initial stab - at the problem. - -- Issue #16398: Optimize deque.rotate() so that it only moves pointers - and doesn't touch the underlying data with increfs and decrefs. - -- Issue #16900: Issue a ResourceWarning when an ssl socket is left unclosed. - -- Issue #13899: ``\A``, ``\Z``, and ``\B`` now correctly match the A, Z, - and B literals when used inside character classes (e.g. ``'[\A]'``). - Patch by Matthew Barnett. - -- Issue #15545: Fix regression in sqlite3's iterdump method where it was - failing if the connection used a row factory (such as sqlite3.Row) that - produced unsortable objects. (Regression was introduced by fix for 9750). - -- fcntl: add F_DUPFD_CLOEXEC constant, available on Linux 2.6.24+. - -- Issue #15972: Fix error messages when os functions expecting a file name or - file descriptor receive the incorrect type. - -- Issue #8109: The ssl module now has support for server-side SNI, thanks - to a :meth:`SSLContext.set_servername_callback` method. Patch by Daniel - Black. - -- Issue #16860: In tempfile, use O_CLOEXEC when available to set the - close-on-exec flag atomically. - -- Issue #16674: random.getrandbits() is now 20-40% faster for small integers. - -- Issue #16009: JSON error messages now provide more information. - -- Issue #16828: Fix error incorrectly raised by bz2.compress(b'') and - bz2.BZ2Compressor.compress(b''). Initial patch by Martin Packman. - -- Issue #16833: In http.client.HTTPConnection, do not concatenate the request - headers and body when the payload exceeds 16 KB, since it can consume more - memory for no benefit. Patch by Benno Leslie. - -- Issue #16541: tk_setPalette() now works with keyword arguments. - -- Issue #16820: In configparser, `parser.popitem()` no longer raises ValueError. - This makes `parser.clean()` work correctly. - -- Issue #16820: In configparser, ``parser['section'] = {}`` now preserves - section order within the parser. This makes `parser.update()` preserve section - order as well. - -- Issue #16820: In configparser, ``parser['DEFAULT'] = {}`` now correctly - clears previous values stored in the default section. Same goes for - ``parser.update({'DEFAULT': {}})``. - -- Issue #9586: Redefine SEM_FAILED on MacOSX to keep compiler happy. - -- Issue #16787: Increase asyncore and asynchat default output buffers size, to - decrease CPU usage and increase throughput. - -- Issue #10527: make multiprocessing use poll() instead of select() if available. - -- Issue #16688: Now regexes contained backreferences correctly work with - non-ASCII strings. Patch by Matthew Barnett. - -- Issue #16486: Make aifc files act as context managers. - -- Issue #16485: Now file descriptors are closed if file header patching failed - on closing an aifc file. - -- Issue #16640: Run less code under a lock in sched module. - -- Issue #16165: sched.scheduler.run() no longer blocks a scheduler for other - threads. - -- Issue #16641: Default values of sched.scheduler.enter() are no longer - modifiable. - -- Issue #16618: Make glob.glob match consistently across strings and bytes - regarding leading dots. Patch by Serhiy Storchaka. - -- Issue #16788: Add samestat to Lib/ntpath.py - -- Issue #16713: Parsing of 'tel' urls using urlparse separates params from - path. - -- Issue #16443: Add docstrings to regular expression match objects. - Patch by Anton Kasyanov. - -- Issue #15701: Fix HTTPError info method call to return the headers information. - -- Issue #16752: Add a missing import to modulefinder. Patch by Berker Peksag. - -- Issue #16646: ftplib.FTP.makeport() might lose socket error details. - (patch by Serhiy Storchaka) - -- Issue #16626: Fix infinite recursion in glob.glob() on Windows when the - pattern contains a wildcard in the drive or UNC path. Patch by Serhiy - Storchaka. - -- Issue #15783: Except for the number methods, the C version of decimal now - supports all None default values present in decimal.py. These values were - largely undocumented. - -- Issue #11175: argparse.FileType now accepts encoding and errors - arguments. Patch by Lucas Maystre. - -- Issue #16488: epoll() objects now support the `with` statement. Patch - by Serhiy Storchaka. - -- Issue #16298: In HTTPResponse.read(), close the socket when there is no - Content-Length and the incoming stream is finished. Patch by Eran - Rundstein. - -- Issue #16049: Add abc.ABC class to enable the use of inheritance to create - ABCs, rather than the more cumbersome metaclass=ABCMeta. Patch by Bruno - Dupuis. - -- Expose the TCP_FASTOPEN and MSG_FASTOPEN flags in socket when they're - available. - -- Issue #15701: Add a .headers attribute to urllib.error.HTTPError. Patch - contributed by Berker Peksag. - -- Issue #15872: Fix 3.3 regression introduced by the new fd-based shutil.rmtree - that caused it to not ignore certain errors when ignore_errors was set. - Patch by Alessandro Moura and Serhiy Storchaka. - -- Issue #16248: Disable code execution from the user's home directory by - tkinter when the -E flag is passed to Python. Patch by Zachary Ware. - -- Issue #13390: New function :func:`sys.getallocatedblocks()` returns the - number of memory blocks currently allocated. - -- Issue #16628: Fix a memory leak in ctypes.resize(). - -- Issue #13614: Fix setup.py register failure with invalid rst in description. - Patch by Julien Courteau and Pierre Paul Lefebvre. - -- Issue #13512: Create ~/.pypirc securely (CVE-2011-4944). Initial patch by - Philip Jenvey, tested by Mageia and Debian. - -- Issue #7719: Make distutils ignore ``.nfs*`` files instead of choking later - on. Initial patch by SilentGhost and Jeff Ramnani. - -- Issue #13120: Allow calling pdb.set_trace() from thread. - Patch by Ilya Sandler. - -- Issue #16585: Make CJK encoders support error handlers that return bytes per - PEP 383. - -- Issue #10182: The re module doesn't truncate indices to 32 bits anymore. - Patch by Serhiy Storchaka. - -- Issue #16333: use (",", ": ") as default separator in json when indent is - specified, to avoid trailing whitespace. Patch by Serhiy Storchaka. - -- Issue #16573: In 2to3, treat enumerate() like a consuming call, so superfluous - list() calls aren't added to filter(), map(), and zip() which are directly - passed enumerate(). - -- Issue #16464: Reset the Content-Length header when a urllib Request is reused - with new data. - -- Issue #12848: The pure Python pickle implementation now treats object - lengths as unsigned 32-bit integers, like the C implementation does. - Patch by Serhiy Storchaka. - -- Issue #16423: urllib.request now has support for ``data:`` URLs. Patch by - Mathias Panzenb?ck. - -- Issue #4473: Add a POP3.stls() to switch a clear-text POP3 session into - an encrypted POP3 session, on supported servers. Patch by Lorenzo Catucci. - -- Issue #4473: Add a POP3.capa() method to query the capabilities advertised - by the POP3 server. Patch by Lorenzo Catucci. - -- Issue #4473: Ensure the socket is shutdown cleanly in POP3.close(). - Patch by Lorenzo Catucci. - -- Issue #16522: added FAIL_FAST flag to doctest. - -- Issue #15627: Add the importlib.abc.InspectLoader.source_to_code() method. - -- Issue #16408: Fix file descriptors not being closed in error conditions - in the zipfile module. Patch by Serhiy Storchaka. - -- Issue #14631: Add a new :class:`weakref.WeakMethod` to simulate weak - references to bound methods. - -- Issue #16469: Fix exceptions from float -> Fraction and Decimal -> Fraction - conversions for special values to be consistent with those for float -> int - and Decimal -> int. Patch by Alexey Kachayev. - -- Issue #16481: multiprocessing no longer leaks process handles on Windows. - -- Issue #12428: Add a pure Python implementation of functools.partial(). - Patch by Brian Thorne. - -- Issue #16140: The subprocess module no longer double closes its child - subprocess.PIPE parent file descriptors on child error prior to exec(). - -- Remove a bare print to stdout from the subprocess module that could have - happened if the child process wrote garbage to its pre-exec error pipe. - -- The subprocess module now raises its own SubprocessError instead of a - RuntimeError in various error situations which should not normally happen. - -- Issue #16327: The subprocess module no longer leaks file descriptors - used for stdin/stdout/stderr pipes to the child when fork() fails. - -- Issue #14396: Handle the odd rare case of waitpid returning 0 when not - expected in subprocess.Popen.wait(). - -- Issue #16411: Fix a bug where zlib.decompressobj().flush() might try to access - previously-freed memory. Patch by Serhiy Storchaka. - -- Issue #16357: fix calling accept() on a SSLSocket created through - SSLContext.wrap_socket(). Original patch by Jeff McNeil. - -- Issue #16409: The reporthook callback made by the legacy - urllib.request.urlretrieve API now properly supplies a constant non-zero - block_size as it did in Python 3.2 and 2.7. This matches the behavior of - urllib.request.URLopener.retrieve. - -- Issue #16431: Use the type information when constructing a Decimal subtype - from a Decimal argument. - -- Issue #15641: Clean up deprecated classes from importlib. - Patch by Taras Lyapun. - -- Issue #16350: zlib.decompressobj().decompress() now accumulates data from - successive calls after EOF in unused_data, instead of only saving the argument - to the last call. decompressobj().flush() now correctly sets unused_data and - unconsumed_tail. A bug in the handling of MemoryError when setting the - unconsumed_tail attribute has also been fixed. Patch by Serhiy Storchaka. - -- Issue #12759: sre_parse now raises a proper error when the name of the group - is missing. Initial patch by Serhiy Storchaka. - -- Issue #16152: fix tokenize to ignore whitespace at the end of the code when - no newline is found. Patch by Ned Batchelder. - -- Issue #16284: Prevent keeping unnecessary references to worker functions - in concurrent.futures ThreadPoolExecutor. - -- Issue #16230: Fix a crash in select.select() when one of the lists changes - size while iterated on. Patch by Serhiy Storchaka. - -- Issue #16228: Fix a crash in the json module where a list changes size - while it is being encoded. Patch by Serhiy Storchaka. - -- Issue #16351: New function gc.get_stats() returns per-generation collection - statistics. - -- Issue #14897: Enhance error messages of struct.pack and - struct.pack_into. Patch by Matti M?ki. - -- Issue #16316: mimetypes now recognizes the .xz and .txz (.tar.xz) extensions. - Patch by Serhiy Storchaka. - -- Issue #12890: cgitb no longer prints spurious

tags in text - mode when the logdir option is specified. - -- Issue #16307: Fix multiprocessing.Pool.map_async not calling its callbacks. - Patch by Janne Karila. - -- Issue #16305: Fix a segmentation fault occurring when interrupting - math.factorial. - -- Issue #16116: Fix include and library paths to be correct when building C - extensions in venvs. - -- Issue #16245: Fix the value of a few entities in html.entities.html5. - -- Issue #16301: Fix the localhost verification in urllib/request.py for ``file://`` - urls. - -- Issue #16250: Fix the invocations of URLError which had misplaced filename - attribute for exception. - -- Issue #10836: Fix exception raised when file not found in urlretrieve - Initial patch by Ezio Melotti. - -- Issue #14398: Fix size truncation and overflow bugs in the bz2 module. - -- Issue #12692: Fix resource leak in urllib.request when talking to an HTTP - server that does not include a ``Connection: close`` header in its responses. - -- Issue #12034: Fix bogus caching of result in check_GetFinalPathNameByHandle. - Patch by Atsuo Ishimoto. - -- Improve performance of `lzma.LZMAFile` (see also issue #16034). - -- Issue #16220: wsgiref now always calls close() on an iterable response. - Patch by Brent Tubbs. - -- Issue #16270: urllib may hang when used for retrieving files via FTP by using - a context manager. Patch by Giampaolo Rodola'. - -- Issue #16461: Wave library should be able to deal with 4GB wav files, - and sample rate of 44100 Hz. - -- Issue #16176: Properly identify Windows 8 via platform.platform() - -- Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in its response now. Patch by Antoine Pitrou. - -- Issue #16114: The subprocess module no longer provides a misleading error - message stating that args[0] did not exist when either the cwd or executable - keyword arguments specified a path that did not exist. - -- Issue #16169: Fix ctypes.WinError()'s confusion between errno and winerror. - -- Issue #16110: logging.fileConfig now accepts a pre-initialised ConfigParser - instance. - -- Issue #1492704: shutil.copyfile() raises a distinct SameFileError now if - source and destination are the same file. Patch by Atsuo Ishimoto. - -- Issue #13896: Make shelf instances work with 'with' as context managers. - Original patch by Filip Gruszczy?ski. - -- Issue #15417: Add support for csh and fish in venv activation scripts. - -- Issue #14377: ElementTree.write and some of the module-level functions have - a new parameter - *short_empty_elements*. It controls how elements with no - contents are emitted. - -- Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element - element_factory (fixes a regression in SimpleTAL). - -- Issue #9650: List commonly used format codes in time.strftime and - time.strptime docsttings. Original patch by Mike Hoy. - -- Issue #15452: logging configuration socket listener now has a verify option - that allows an application to apply a verification function to the - received configuration data before it is acted upon. - -- Issue #16034: Fix performance regressions in the new `bz2.BZ2File` - implementation. Initial patch by Serhiy Storchaka. - -- `pty.spawn()` now returns the child process status returned by `os.waitpid()`. - -- Issue #15756: `subprocess.poll()` now properly handles `errno.ECHILD` to - return a returncode of 0 when the child has already exited or cannot be waited - on. - -- Issue #15323: Improve failure message of `Mock.assert_called_once_with()`. - -- Issue #16064: ``unittest -m`` claims executable is "python", not "python3". - -- Issue #12376: Pass on parameters in `TextTestResult.__init__()` super call. - -- Issue #15222: Insert blank line after each message in mbox mailboxes. - -- Issue #16013: Fix `csv.Reader` parsing issue with ending quote characters. - Patch by Serhiy Storchaka. - -- Issue #15421: Fix an OverflowError in `Calendar.itermonthdates()` after - `datetime.MAXYEAR`. Patch by C?dric Krier. - -- Issue #16112: platform.architecture does not correctly escape argument to - /usr/bin/file. Patch by David Benjamin. - -- Issue #15970: `xml.etree.ElementTree` now serializes correctly the empty HTML - elements 'meta' and 'param'. - -- Issue #15842: The `SocketIO.{readable,writable,seekable}` methods now raise - ValueError when the file-like object is closed. Patch by Alessandro Moura. - -- Issue #15876: Fix a refleak in the `curses` module: window.encoding. - -- Issue #15881: Fix `atexit` hook in `multiprocessing`. Original patch by Chris - McDonough. - -- Issue #15841: The readable(), writable() and seekable() methods of - `io.BytesIO` and `io.StringIO` objects now raise ValueError when the object - has been closed. Patch by Alessandro Moura. - -- Issue #15447: Use `subprocess.DEVNULL` in webbrowser, instead of opening - `os.devnull` explicitly and leaving it open. - -- Issue #15509: `webbrowser.UnixBrowser` no longer passes empty arguments to - Popen when ``%action`` substitutions produce empty strings. - -- Issue #12776, issue #11839: Call `argparse` type function (specified by - add_argument) only once. Before, the type function was called twice in the - case where the default was specified and the argument was given as well. This - was especially problematic for the FileType type, as a default file would - always be opened, even if a file argument was specified on the command line. - -- Issue #15906: Fix a regression in argparse caused by the preceding change, - when ``action='append'``, ``type='str'`` and ``default=[]``. - -- Issue #16113: Added sha3 module based on the Keccak reference implementation - 3.2. The `hashlib` module has four additional hash algorithms: `sha3_224`, - `sha3_256`, `sha3_384` and `sha3_512`. As part of the patch some common - code was moved from _hashopenssl.c to hashlib.h. - -- ctypes.call_commethod was removed, since its only usage was in the defunct - samples directory. - -- Issue #16692: Added TLSv1.1 and TLSv1.2 support for the ssl modules. - -- Issue #16832: add abc.get_cache_token() to expose cache validity checking - support in ABCMeta. - -IDLE ----- - -- Issue #18429: Format / Format Paragraph, now works when comment blocks - are selected. As with text blocks, this works best when the selection - only includes complete lines. - -- Issue #18226: Add docstrings and unittests for FormatParagraph.py. - Original patches by Todd Rovito and Phil Webster. - -- Issue #18279: Format - Strip trailing whitespace no longer marks a file as - changed when it has not been changed. This fix followed the addition of a - test file originally written by Phil Webster (the issue's main goal). - -- Issue #7136: In the Idle File menu, "New Window" is renamed "New File". - Patch by Tal Einat, Roget Serwy, and Todd Rovito. - -- Remove dead imports of imp. - -- Issue #18196: Avoid displaying spurious SystemExit tracebacks. - -- Issue #5492: Avoid traceback when exiting IDLE caused by a race condition. - -- Issue #17511: Keep IDLE find dialog open after clicking "Find Next". - Original patch by Sarah K. - -- Issue #18055: Move IDLE off of imp and on to importlib. - -- Issue #15392: Create a unittest framework for IDLE. - Initial patch by Rajagopalasarma Jayakrishnan. - See Lib/idlelib/idle_test/README.txt for how to run Idle tests. - -- Issue #14146: Highlight source line while debugging on Windows. - -- Issue #17838: Allow sys.stdin to be reassigned. - -- Issue #13495: Avoid loading the color delegator twice in IDLE. - -- Issue #17798: Allow IDLE to edit new files when specified on command line. - -- Issue #14735: Update IDLE docs to omit "Control-z on Windows". - -- Issue #17532: Always include Options menu for IDLE on OS X. - Patch by Guilherme Sim?es. - -- Issue #17585: Fixed IDLE regression. Now closes when using exit() or quit(). - -- Issue #17657: Show full Tk version in IDLE's about dialog. - Patch by Todd Rovito. - -- Issue #17613: Prevent traceback when removing syntax colorizer in IDLE. - -- Issue #1207589: Backwards-compatibility patch for right-click menu in IDLE. - -- Issue #16887: IDLE now accepts Cancel in tabify/untabify dialog box. - -- Issue #17625: In IDLE, close the replace dialog after it is used. - -- Issue #14254: IDLE now handles readline correctly across shell restarts. - -- Issue #17614: IDLE no longer raises exception when quickly closing a file. - -- Issue #6698: IDLE now opens just an editor window when configured to do so. - -- Issue #8900: Using keyboard shortcuts in IDLE to open a file no longer - raises an exception. - -- Issue #6649: Fixed missing exit status in IDLE. Patch by Guilherme Polo. - -- Issue #17114: IDLE now uses non-strict config parser. - -- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase - interface and support all mandatory methods and properties. - -- Issue #5066: Update IDLE docs. Patch by Todd Rovito. - -- Issue #16829: IDLE printing no longer fails if there are spaces or other - special characters in the file path. - -- Issue #16491: IDLE now prints chained exception tracebacks. - -- Issue #16819: IDLE method completion now correctly works for bytes literals. - -- Issue #16504: IDLE now catches SyntaxErrors raised by tokenizer. Patch by - Roger Serwy. - -- Issue #16511: Use default IDLE width and height if config param is not valid. - Patch Serhiy Storchaka. - -- Issue #1207589: Add Cut/Copy/Paste items to IDLE right click Context Menu. - Patch by Todd Rovito. - -- Issue #16123: IDLE - deprecate running without a subprocess. - Patch by Roger Serwy. - -Tests ------ - -- Issue #1666318: Add a test that shutil.copytree() retains directory - permissions. Patch by Catherine Devlin. - -- Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json - and make them discoverable by unittest. Patch by Zachary Ware. - -- Fix a fcntl test case on KFreeBSD, Debian #708653 (Petr Salinger). - -- Issue #18396: Fix spurious test failure in test_signal on Windows when - faulthandler is enabled (Patch by Jeremy Kloth) - -- Issue #17046: Fix broken test_executable_without_cwd in test_subprocess. - -- Issue #15415: Add new temp_dir() and change_cwd() context managers to - test.support, and refactor temp_cwd() to use them. Patch by Chris Jerdonek. - -- Issue #15494: test.support is now a package rather than a module (Initial - patch by Indra Talip) - -- Issue #17944: test_zipfile now discoverable and uses subclassing to - generate tests for different compression types. Fixed a bug with skipping - some tests due to use of exhausted iterators. - -- Issue #18266: test_largefile now works with unittest test discovery and - supports running only selected tests. Patch by Zachary Ware. - -- Issue #17767: test_locale now works with unittest test discovery. - Original patch by Zachary Ware. - -- Issue #18375: Assume --randomize when --randseed is used for running the - testsuite. - -- Issue #11185: Fix test_wait4 under AIX. Patch by S?bastien Sabl?. - -- Issue #18207: Fix test_ssl for some versions of OpenSSL that ignore seconds - in ASN1_TIME fields. - -- Issue #18094: test_uuid no longer reports skipped tests as passed. - -- Issue #17992: Add timeouts to asyncore and asynchat tests so that they won't - accidentally hang. - -- Issue #17833: Fix test_gdb failures seen on machines where debug symbols - for glibc are available (seen on PPC64 Linux). - -- Issue #7855: Add tests for ctypes/winreg for issues found in IronPython. - Initial patch by Dino Viehland. - -- Issue #11078: test___all__ now checks for duplicates in __all__. - Initial patch by R. David Murray. - -- Issue #17712: Fix test_gdb failures on Ubuntu 13.04. - -- Issue #17835: Fix test_io when the default OS pipe buffer size is larger - than one million bytes. - -- Issue #17065: Use process-unique key for winreg tests to avoid failures if - test is run multiple times in parallel (eg: on a buildbot host). - -- Issue #12820: add tests for the xml.dom.minicompat module. - Patch by John Chandler and Phil Connell. - -- Issue #17691: test_univnewlines now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17790: test_set now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17789: test_random now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17779: test_osx_env now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17766: test_iterlen now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17690: test_time now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17692: test_sqlite now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #11995: test_pydoc doesn't import all sys.path modules anymore. - -- Issue #17448: test_sax now skips if there are no xml parsers available - instead of raising an ImportError. - -- Issue #11420: make test suite pass with -B/DONTWRITEBYTECODE set. - Initial patch by Thomas Wouters. - -- Issue #10652: make tcl/tk tests run after __all__ test, patch by - Zachary Ware. - -- Issue #11963: remove human verification from test_parser and test_subprocess. - -- Issue #11732: add a new suppress_crash_popup() context manager to test.support - that disables crash popups on Windows and use it in test_faulthandler and - test_capi. - -- Issue #13898: test_ssl no longer prints a spurious stack trace on Ubuntu. - -- Issue #17283: Share code between `__main__.py` and `regrtest.py` in - `Lib/test`. - -- Issue #17249: convert a test in test_capi to use unittest and reap threads. - -- Issue #17107: Test client-side SNI support in urllib.request thanks to - the new server-side SNI support in the ssl module. Initial patch by - Daniel Black. - -- Issue #17041: Fix testing when Python is configured with the - --without-doc-strings. - -- Issue #16923: Fix ResourceWarnings in test_ssl. - -- Issue #15539: Added regression tests for Tools/scripts/pindent.py. - -- Issue #17479: test_io now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17066: test_robotparser now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17334: test_index now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17333: test_imaplib now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17082: test_dbm* now work with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17079: test_ctypes now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17304: test_hash now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17303: test_future* now work with unittest test discovery. - Patch by Zachary Ware. - -- Issue #17163: test_file now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16925: test_configparser now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16918: test_codecs now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16919: test_crypt now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16910: test_bytes, test_unicode, and test_userstring now work with - unittest test discovery. Patch by Zachary Ware. - -- Issue #16905: test_warnings now works with unittest test discovery. - Initial patch by Berker Peksag. - -- Issue #16898: test_bufio now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16888: test_array now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16896: test_asyncore now works with unittest test discovery. - Patch by Zachary Ware. - -- Issue #16897: test_bisect now works with unittest test discovery. - Initial patch by Zachary Ware. - -- Issue #16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath - now work with unittest test discovery. Patch by Zachary Ware. - -- Issue #16748: test_heapq now works with unittest test discovery. - -- Issue #10646: Tests rearranged for os.samefile/samestat to check for not - just symlinks but also hard links. - -- Issue #15302: Switch regrtest from using getopt to using argparse. - -- Issue #15324: Fix regrtest parsing of --fromfile, --match, and --randomize - options. - -- Issue #16702: test_urllib2_localnet tests now correctly ignores proxies for - localhost tests. - -- Issue #16664: Add regression tests for glob's behaviour concerning entries - starting with a ".". Patch by Sebastian Kreft. - -- Issue #13390: The ``-R`` option to regrtest now also checks for memory - allocation leaks, using :func:`sys.getallocatedblocks()`. - -- Issue #16559: Add more tests for the json module, including some from the - official test suite at json.org. Patch by Serhiy Storchaka. - -- Issue #16661: Fix the `os.getgrouplist()` test by not assuming that it gives - the same output as :command:`id -G`. - -- Issue #16115: Add some tests for the executable argument to - subprocess.Popen(). Initial patch by Kushal Das. - -- Issue #16126: PyErr_Format format mismatch in _testcapimodule.c. - Patch by Serhiy Storchaka. - -- Issue #15304: Fix warning message when `os.chdir()` fails inside - `test.support.temp_cwd()`. Patch by Chris Jerdonek. - -- Issue #15802: Fix test logic in `TestMaildir.test_create_tmp()`. Patch by - Serhiy Storchaka. - -- Issue #15557: Added a test suite for the webbrowser module, thanks to Anton - Barkovsky. - -- Issue #16698: Skip posix test_getgroups when built with OS X - deployment target prior to 10.6. - -Build ------ - -- Issue #16067: Add description into MSI file to replace installer's - temporary name. - -- Issue #18257: Fix readlink usage in python-config. Install the python - version again on Darwin. - -- Issue #18481: Add C coverage reporting with gcov and lcov. A new make target - "coverage-report" creates an instrumented Python build, runs unit tests - and creates a HTML. The report can be updated with "make coverage-lcov". - -- Issue #17845: Clarified the message printed when some module are not built. - -- Issue #18256: Compilation fix for recent AIX releases. Patch by - David Edelsohn. - -- Issue #17547: In configure, explicitly pass -Wformat for the benefit for GCC - 4.8. - -- Issue #15172: Document NASM 2.10+ as requirement for building OpenSSL 1.0.1 - on Windows. - -- Issue #17591: Use lowercase filenames when including Windows header files. - Patch by Roumen Petrov. - -- Issue #17550: Fix the --enable-profiling configure switch. - -- Issue #17425: Build with openssl 1.0.1d on Windows. - -- Issue #16754: Fix the incorrect shared library extension on linux. Introduce - two makefile macros SHLIB_SUFFIX and EXT_SUFFIX. SO now has the value of - SHLIB_SUFFIX again (as in 2.x and 3.1). The SO macro is removed in 3.4. - -- Issue #5033: Fix building of the sqlite3 extension module when the - SQLite library version has "beta" in it. Patch by Andreas Pelme. - -- Issue #17228: Fix building without pymalloc. - -- Issue #3718: Use AC_ARG_VAR to set MACHDEP in configure.ac. - -- Issue #16235: Implement python-config as a shell script. - -- Issue #16769: Remove outdated Visual Studio projects. - -- Issue #17031: Fix running regen in cross builds. - -- Issue #3754: fix typo in pthread AC_CACHE_VAL. - -- Issue #15484: Fix _PYTHON_PROJECT_BASE for srcdir != builddir builds; - use _PYTHON_PROJECT_BASE in distutils/sysconfig.py. - -- Drop support for Windows 2000 (changeset e52df05b496a). - -- Issue #17029: Let h2py search the multiarch system include directory. - -- Issue #16953: Fix socket module compilation on platforms with - HAVE_BROKEN_POLL. Patch by Jeffrey Armstrong. - -- Issue #16320: Remove redundant Makefile dependencies for strings and bytes. - -- Cross compiling needs host and build settings. configure no longer - creates a broken PYTHON_FOR_BUILD variable when --build is missing. - -- Fix cross compiling issue in setup.py, ensure that lib_dirs and inc_dirs are - defined in cross compiling mode, too. - -- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host. - -- Issue #16593: Have BSD 'make -s' do the right thing, thanks to Daniel Shahaf - -- Issue #16262: fix out-of-src-tree builds, if mercurial is not installed. - -- Issue #15298: ensure _sysconfigdata is generated in build directory, not - source directory. - -- Issue #15833: Fix a regression in 3.3 that resulted in exceptions being - raised if importlib failed to write byte-compiled files. This affected - attempts to build Python out-of-tree from a read-only source directory. - -- Issue #15923: Fix a mistake in ``asdl_c.py`` that resulted in a TypeError - after 2801bf875a24 (see #15801). - -- Issue #16135: Remove OS/2 support. - -- Issue #15819: Make sure we can build Python out-of-tree from a read-only - source directory. (Somewhat related to issue #9860.) - -- Issue #15587: Enable Tk high-resolution text rendering on Macs with - Retina displays. Applies to Tkinter apps, such as IDLE, on OS X - framework builds linked with Cocoa Tk 8.5. - -- Issue #17161: make install now also installs a python3 man page. - -C-API ------ - -- Issue #18351: Fix various issues in a function in importlib provided to help - PyImport_ExecCodeModuleWithPathnames() (and thus by extension - PyImport_ExecCodeModule() and PyImport_ExecCodeModuleEx()). - -- Issue #15767: Added PyErr_SetImportErrorSubclass(). - -- PyErr_SetImportError() now sets TypeError when its msg argument is set. - -- Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and - PyObject_CallMethod() now changed to `const char*`. Based on patches by - J?rg M?ller and Lars Buitinck. - -- Issue #17206: Py_CLEAR(), Py_DECREF(), Py_XINCREF() and Py_XDECREF() now - expand their arguments once instead of multiple times. Patch written by Illia - Polosukhin. - -- Issue #17522: Add the PyGILState_Check() API. - -- Issue #17327: Add PyDict_SetDefault. - -- Issue #16881: Fix Py_ARRAY_LENGTH macro for GCC < 3.1. - -- Issue #16505: Remove unused Py_TPFLAGS_INT_SUBCLASS. - -- Issue #16086: PyTypeObject.tp_flags and PyType_Spec.flags are now unsigned - (unsigned long and unsigned int) to avoid an undefined behaviour with - Py_TPFLAGS_TYPE_SUBCLASS ((1 << 31). PyType_GetFlags() result type is - now unsigned too (unsigned long, instead of long). - -- Issue #16166: Add PY_LITTLE_ENDIAN and PY_BIG_ENDIAN macros and unified - endianness detection and handling. - -Documentation -------------- - -- Issue #23006: Improve the documentation and indexing of dict.__missing__. - Add an entry in the language datamodel special methods section. - Revise and index its discussion in the stdtypes mapping/dict section. - -- Issue #17701: Improving strftime documentation. - -- Issue #18440: Clarify that `hash()` can truncate the value returned from an - object's custom `__hash__()` method. - -- Issue #17844: Add links to encoders and decoders for bytes-to-bytes codecs. - -- Issue #14097: improve the "introduction" page of the tutorial. - -- Issue #17977: The documentation for the cadefault argument's default value - in urllib.request.urlopen() is fixed to match the code. - -- Issue #6696: add documentation for the Profile objects, and improve - profile/cProfile docs. Patch by Tom Pinckney. - -- Issue #15940: Specify effect of locale on time functions. - -- Issue #17538: Document XML vulnerabilties - -- Issue #16642: sched.scheduler timefunc initial default is time.monotonic. - Patch by Ramchandra Apte - -- Issue #17047: remove doubled words in docs and docstrings - reported by Serhiy Storchaka and Matthew Barnett. - -- Issue #15465: Document the versioning macros in the C API docs rather than - the standard library docs. Patch by Kushal Das. - -- Issue #16406: Combine the pages for uploading and registering to PyPI. - -- Issue #16403: Document how distutils uses the maintainer field in - PKG-INFO. Patch by Jyrki Pulliainen. - -- Issue #16695: Document how glob handles filenames starting with a - dot. Initial patch by Jyrki Pulliainen. - -- Issue #8890: Stop advertising an insecure practice by replacing uses - of the /tmp directory with better alternatives in the documentation. - Patch by Geoff Wilson. - -- Issue #17203: add long option names to unittest discovery docs. - -- Issue #13094: add "Why do lambdas defined in a loop with different values - all return the same result?" programming FAQ. - -- Issue #14901: Update portions of the Windows FAQ. - Patch by Ashish Nitin Patil. - -- Issue #16267: Better document the 3.3+ approach to combining - @abstractmethod with @staticmethod, @classmethod and @property - -- Issue #15209: Clarify exception chaining description in exceptions module - documentation - -- Issue #15990: Improve argument/parameter documentation. - -- Issue #16209: Move the documentation for the str built-in function to a new - str class entry in the "Text Sequence Type" section. - -- Issue #13538: Improve str() and object.__str__() documentation. - -- Issue #16489: Make it clearer that importlib.find_loader() needs parent - packages to be explicitly imported. - -- Issue #16400: Update the description of which versions of a given package - PyPI displays. - -- Issue #15677: Document that zlib and gzip accept a compression level of 0 to - mean 'no compression'. Patch by Brian Brazil. - -- Issue #16197: Update winreg docstrings and documentation to match code. - Patch by Zachary Ware. - -- Issue #8040: added a version switcher to the documentation. Patch by - Yury Selivanov. - -- Issue #16241: Document -X faulthandler command line option. - Patch by Marek ?uppa. - -- Additional comments and some style changes in the concurrent.futures URL - retrieval example - -- Issue #16115: Improve subprocess.Popen() documentation around args, shell, - and executable arguments. - -- Issue #13498: Clarify docs of os.makedirs()'s exist_ok argument. Done with - great native-speaker help from R. David Murray. - -- Issue #15533: Clarify docs and add tests for `subprocess.Popen()`'s cwd - argument. - -- Issue #15979: Improve timeit documentation. - -- Issue #16036: Improve documentation of built-in `int()`'s signature and - arguments. - -- Issue #15935: Clarification of `argparse` docs, re: add_argument() type and - default arguments. Patch contributed by Chris Jerdonek. - -- Issue #11964: Document a change in v3.2 to the behavior of the indent - parameter of json encoding operations. - -- Issue #15116: Remove references to appscript as it is no longer being - supported. - -Tools/Demos ------------ - -- Issue #18817: Fix a resource warning in Lib/aifc.py demo. Patch by - Vajrasky Kok. - -- Issue #18439: Make patchcheck work on Windows for ACKS, NEWS. - -- Issue #18448: Fix a typo in Tools/demo/eiffel.py. - -- Issue #18457: Fixed saving of formulas and complex numbers in - Tools/demo/ss1.py. - -- Issue #18449: Make Tools/demo/ss1.py work again on Python 3. Patch by - F?vry Thibault. - -- Issue #12990: The "Python Launcher" on OSX could not launch python scripts - that have paths that include wide characters. - -- Issue #15239: Make mkstringprep.py work again on Python 3. - -- Issue #17028: Allowed Python arguments to be supplied to the Windows - launcher. - -- Issue #17156: pygettext.py now detects the encoding of source files and - correctly writes and escapes non-ascii characters. - -- Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py. Now - pindent.py works with a "with" statement. pindent.py no longer produces - improper indentation. pindent.py now works with continued lines broken after - "class" or "def" keywords and with continuations at the start of line. - -- Issue #11797: Add a 2to3 fixer that maps reload() to imp.reload(). - -- Issue #10966: Remove the concept of unexpected skipped tests. - -- Issue #9893: Removed the Misc/Vim directory. - -- Removed the Misc/TextMate directory. - -- Issue #16245: Add the Tools/scripts/parse_html5_entities.py script to parse - the list of HTML5 entities and update the html.entities.html5 dictionary. - -- Issue #15378: Fix Tools/unicode/comparecodecs.py. Patch by Serhiy Storchaka. - -- Issue #16549: Make json.tool work again on Python 3 and add tests. - Initial patch by Berker Peksag and Serhiy Storchaka. - -- Issue #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. - Patch by Serhiy Storchaka. - -Windows -------- - -- Issue #18569: The installer now adds .py to the PATHEXT variable when extensions - are registered. Patch by Paul Moore. - **(For information about older versions, consult the HISTORY file.)** diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.6.0 release candidate 1 +This is Python version 3.6.1 release candidate 1 ================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, @@ -170,8 +170,8 @@ Install that version using "make install". Install all other versions using "make altinstall". -For example, if you want to install Python 2.6, 2.7 and 3.6 with 2.7 being the -primary version, you would execute "make install" in your 2.7 build directory +For example, if you want to install Python 2.7, 3.5, and 3.6 with 3.6 being the +primary version, you would execute "make install" in your 3.6 build directory and "make altinstall" in the others. -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Dec 23 07:04:19 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 23 Dec 2016 12:04:19 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-12-23 Message-ID: <2284ed2f-454f-4541-abc9-94e214c948be@irsmsx105.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-23 11:47:25 +0000 commit: 94900abda1a5 previous commit: 78bf34b6a713 revision date: 2016-12-23 03:10: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 v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.17% -1.92% 4.68% 6.86% :-) pybench 0.16% -0.07% 7.89% 3.69% :-| regex_v8 1.81% 0.19% -0.72% 11.65% :-) nbody 0.10% 0.01% 13.23% 2.49% :-| json_dump_v2 0.13% -0.03% 0.42% 10.33% :-( normal_startup 1.77% 0.67% -2.02% 1.09% :-| ssbench 0.09% -0.03% 0.24% 2.58% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-12-23/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Fri Dec 23 07:04:42 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 23 Dec 2016 12:04:42 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-12-23 Message-ID: Results for project Python default, build date 2016-12-23 11:03:10 +0000 commit: 0181578dc746 previous commit: c568b6ac5e89 revision date: 2016-12-22 18:02:28 +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.27% -0.29% -0.13% 15.35% :-| pybench 0.33% 0.02% 1.27% 5.52% :-| regex_v8 3.63% 0.57% -0.73% 2.77% :-| nbody 0.15% 0.05% 0.95% 2.17% :-) json_dump_v2 0.35% -0.19% 8.93% 10.96% :-| normal_startup 1.00% 0.06% -0.72% 6.76% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-12-23/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Fri Dec 23 15:14:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 23 Dec 2016 20:14:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Sort_and_remove_duplicates_from_PC/python3=2Edef_=28issue_=232?= =?utf-8?b?MzkwMyku?= Message-ID: <20161223201431.20021.77736.E2FAF100@psf.io> https://hg.python.org/cpython/rev/0927b5c80c50 changeset: 105797:0927b5c80c50 branch: 3.6 parent: 105794:a0aab1d2a8d6 parent: 105796:9cb87e53e324 user: Serhiy Storchaka date: Fri Dec 23 22:11:57 2016 +0200 summary: Sort and remove duplicates from PC/python3.def (issue #23903). files: PC/python3.def | 49 ++++++++++++++++++------------------- 1 files changed, 24 insertions(+), 25 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -318,6 +318,8 @@ PyMemoryView_GetContiguous=python36.PyMemoryView_GetContiguous PyMemoryView_Type=python36.PyMemoryView_Type DATA PyMethodDescr_Type=python36.PyMethodDescr_Type DATA + PyModuleDef_Init=python36.PyModuleDef_Init + PyModuleDef_Type=python36.PyModuleDef_Type DATA PyModule_AddIntConstant=python36.PyModule_AddIntConstant PyModule_AddObject=python36.PyModule_AddObject PyModule_AddStringConstant=python36.PyModule_AddStringConstant @@ -330,8 +332,6 @@ PyModule_GetState=python36.PyModule_GetState PyModule_New=python36.PyModule_New PyModule_Type=python36.PyModule_Type DATA - PyModuleDef_Init=python36.PyModuleDef_Init - PyModuleDef_Type=python36.PyModuleDef_Type DATA PyNullImporter_Type=python36.PyNullImporter_Type DATA PyNumber_Absolute=python36.PyNumber_Absolute PyNumber_Add=python36.PyNumber_Add @@ -368,6 +368,14 @@ PyNumber_ToBase=python36.PyNumber_ToBase PyNumber_TrueDivide=python36.PyNumber_TrueDivide PyNumber_Xor=python36.PyNumber_Xor + PyODictItems_Type=python36.PyODictItems_Type DATA + PyODictIter_Type=python36.PyODictIter_Type DATA + PyODictKeys_Type=python36.PyODictKeys_Type DATA + PyODictValues_Type=python36.PyODictValues_Type DATA + PyODict_DelItem=python36.PyODict_DelItem + PyODict_New=python36.PyODict_New + PyODict_SetItem=python36.PyODict_SetItem + PyODict_Type=python36.PyODict_Type DATA PyOS_AfterFork=python36.PyOS_AfterFork PyOS_InitInterrupts=python36.PyOS_InitInterrupts PyOS_InputHook=python36.PyOS_InputHook DATA @@ -434,14 +442,6 @@ PyObject_Size=python36.PyObject_Size PyObject_Str=python36.PyObject_Str PyObject_Type=python36.PyObject_Type DATA - PyODict_DelItem=python36.PyODict_DelItem - PyODict_New=python36.PyODict_New - PyODict_SetItem=python36.PyODict_SetItem - PyODict_Type=python36.PyODict_Type DATA - PyODictItems_Type=python36.PyODictItems_Type DATA - PyODictIter_Type=python36.PyODictIter_Type DATA - PyODictKeys_Type=python36.PyODictKeys_Type DATA - PyODictValues_Type=python36.PyODictValues_Type DATA PyParser_SimpleParseFileFlags=python36.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python36.PyParser_SimpleParseStringFlags PyProperty_Type=python36.PyProperty_Type DATA @@ -484,8 +484,8 @@ PySlice_New=python36.PySlice_New PySlice_Type=python36.PySlice_Type DATA PySortWrapper_Type=python36.PySortWrapper_Type DATA + PyState_AddModule=python36.PyState_AddModule PyState_FindModule=python36.PyState_FindModule - PyState_AddModule=python36.PyState_AddModule PyState_RemoveModule=python36.PyState_RemoveModule PyStructSequence_GetItem=python36.PyStructSequence_GetItem PyStructSequence_New=python36.PyStructSequence_New @@ -577,8 +577,10 @@ PyUnicode_AsUTF8String=python36.PyUnicode_AsUTF8String PyUnicode_AsUnicodeEscapeString=python36.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python36.PyUnicode_AsWideChar + PyUnicode_BuildEncodingMap=python36.PyUnicode_BuildEncodingMap PyUnicode_ClearFreelist=python36.PyUnicode_ClearFreelist PyUnicode_Compare=python36.PyUnicode_Compare + PyUnicode_CompareWithASCIIString=python36.PyUnicode_CompareWithASCIIString PyUnicode_Concat=python36.PyUnicode_Concat PyUnicode_Contains=python36.PyUnicode_Contains PyUnicode_Count=python36.PyUnicode_Count @@ -593,9 +595,12 @@ PyUnicode_DecodeUTF16Stateful=python36.PyUnicode_DecodeUTF16Stateful PyUnicode_DecodeUTF32=python36.PyUnicode_DecodeUTF32 PyUnicode_DecodeUTF32Stateful=python36.PyUnicode_DecodeUTF32Stateful + PyUnicode_DecodeUTF7=python36.PyUnicode_DecodeUTF7 + PyUnicode_DecodeUTF7Stateful=python36.PyUnicode_DecodeUTF7Stateful PyUnicode_DecodeUTF8=python36.PyUnicode_DecodeUTF8 PyUnicode_DecodeUTF8Stateful=python36.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python36.PyUnicode_DecodeUnicodeEscape + PyUnicode_EncodeFSDefault=python36.PyUnicode_EncodeFSDefault PyUnicode_FSConverter=python36.PyUnicode_FSConverter PyUnicode_FSDecoder=python36.PyUnicode_FSDecoder PyUnicode_Find=python36.PyUnicode_Find @@ -610,6 +615,9 @@ PyUnicode_FromWideChar=python36.PyUnicode_FromWideChar PyUnicode_GetDefaultEncoding=python36.PyUnicode_GetDefaultEncoding PyUnicode_GetSize=python36.PyUnicode_GetSize + PyUnicode_InternFromString=python36.PyUnicode_InternFromString + PyUnicode_InternImmortal=python36.PyUnicode_InternImmortal + PyUnicode_InternInPlace=python36.PyUnicode_InternInPlace PyUnicode_IsIdentifier=python36.PyUnicode_IsIdentifier PyUnicode_Join=python36.PyUnicode_Join PyUnicode_Partition=python36.PyUnicode_Partition @@ -623,14 +631,6 @@ PyUnicode_Splitlines=python36.PyUnicode_Splitlines PyUnicode_Tailmatch=python36.PyUnicode_Tailmatch PyUnicode_Translate=python36.PyUnicode_Translate - PyUnicode_BuildEncodingMap=python36.PyUnicode_BuildEncodingMap - PyUnicode_CompareWithASCIIString=python36.PyUnicode_CompareWithASCIIString - PyUnicode_DecodeUTF7=python36.PyUnicode_DecodeUTF7 - PyUnicode_DecodeUTF7Stateful=python36.PyUnicode_DecodeUTF7Stateful - PyUnicode_EncodeFSDefault=python36.PyUnicode_EncodeFSDefault - PyUnicode_InternFromString=python36.PyUnicode_InternFromString - PyUnicode_InternImmortal=python36.PyUnicode_InternImmortal - PyUnicode_InternInPlace=python36.PyUnicode_InternInPlace PyUnicode_Type=python36.PyUnicode_Type DATA PyWeakref_GetObject=python36.PyWeakref_GetObject DATA PyWeakref_NewProxy=python36.PyWeakref_NewProxy @@ -676,6 +676,11 @@ Py_SetRecursionLimit=python36.Py_SetRecursionLimit Py_SymtableString=python36.Py_SymtableString Py_VaBuildValue=python36.Py_VaBuildValue + _PyArg_ParseTupleAndKeywords_SizeT=python36._PyArg_ParseTupleAndKeywords_SizeT + _PyArg_ParseTuple_SizeT=python36._PyArg_ParseTuple_SizeT + _PyArg_Parse_SizeT=python36._PyArg_Parse_SizeT + _PyArg_VaParseTupleAndKeywords_SizeT=python36._PyArg_VaParseTupleAndKeywords_SizeT + _PyArg_VaParse_SizeT=python36._PyArg_VaParse_SizeT _PyErr_BadInternalCall=python36._PyErr_BadInternalCall _PyObject_CallFunction_SizeT=python36._PyObject_CallFunction_SizeT _PyObject_CallMethod_SizeT=python36._PyObject_CallMethod_SizeT @@ -706,9 +711,3 @@ _Py_SwappedOp=python36._Py_SwappedOp DATA _Py_TrueStruct=python36._Py_TrueStruct DATA _Py_VaBuildValue_SizeT=python36._Py_VaBuildValue_SizeT - _PyArg_Parse_SizeT=python36._PyArg_Parse_SizeT - _PyArg_ParseTuple_SizeT=python36._PyArg_ParseTuple_SizeT - _PyArg_ParseTupleAndKeywords_SizeT=python36._PyArg_ParseTupleAndKeywords_SizeT - _PyArg_VaParse_SizeT=python36._PyArg_VaParse_SizeT - _PyArg_VaParseTupleAndKeywords_SizeT=python36._PyArg_VaParseTupleAndKeywords_SizeT - _Py_BuildValue_SizeT=python36._Py_BuildValue_SizeT -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 15:14:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 23 Dec 2016 20:14:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Sort_and_remov?= =?utf-8?q?e_duplicates_from_PC/python3=2Edef_=28issue_=2323903=29=2E?= Message-ID: <20161223201431.79722.41864.ED9D203C@psf.io> https://hg.python.org/cpython/rev/9cb87e53e324 changeset: 105796:9cb87e53e324 branch: 3.5 parent: 105793:9cffc1188118 user: Serhiy Storchaka date: Fri Dec 23 22:09:48 2016 +0200 summary: Sort and remove duplicates from PC/python3.def (issue #23903). files: PC/python3.def | 49 ++++++++++++++++++------------------- 1 files changed, 24 insertions(+), 25 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -318,6 +318,8 @@ PyMemoryView_GetContiguous=python35.PyMemoryView_GetContiguous PyMemoryView_Type=python35.PyMemoryView_Type DATA PyMethodDescr_Type=python35.PyMethodDescr_Type DATA + PyModuleDef_Init=python35.PyModuleDef_Init + PyModuleDef_Type=python35.PyModuleDef_Type DATA PyModule_AddIntConstant=python35.PyModule_AddIntConstant PyModule_AddObject=python35.PyModule_AddObject PyModule_AddStringConstant=python35.PyModule_AddStringConstant @@ -330,8 +332,6 @@ PyModule_GetState=python35.PyModule_GetState PyModule_New=python35.PyModule_New PyModule_Type=python35.PyModule_Type DATA - PyModuleDef_Init=python35.PyModuleDef_Init - PyModuleDef_Type=python35.PyModuleDef_Type DATA PyNullImporter_Type=python35.PyNullImporter_Type DATA PyNumber_Absolute=python35.PyNumber_Absolute PyNumber_Add=python35.PyNumber_Add @@ -368,6 +368,14 @@ PyNumber_ToBase=python35.PyNumber_ToBase PyNumber_TrueDivide=python35.PyNumber_TrueDivide PyNumber_Xor=python35.PyNumber_Xor + PyODictItems_Type=python35.PyODictItems_Type DATA + PyODictIter_Type=python35.PyODictIter_Type DATA + PyODictKeys_Type=python35.PyODictKeys_Type DATA + PyODictValues_Type=python35.PyODictValues_Type DATA + PyODict_DelItem=python35.PyODict_DelItem + PyODict_New=python35.PyODict_New + PyODict_SetItem=python35.PyODict_SetItem + PyODict_Type=python35.PyODict_Type DATA PyOS_AfterFork=python35.PyOS_AfterFork PyOS_InitInterrupts=python35.PyOS_InitInterrupts PyOS_InputHook=python35.PyOS_InputHook DATA @@ -434,14 +442,6 @@ PyObject_Size=python35.PyObject_Size PyObject_Str=python35.PyObject_Str PyObject_Type=python35.PyObject_Type DATA - PyODict_DelItem=python35.PyODict_DelItem - PyODict_New=python35.PyODict_New - PyODict_SetItem=python35.PyODict_SetItem - PyODict_Type=python35.PyODict_Type DATA - PyODictItems_Type=python35.PyODictItems_Type DATA - PyODictIter_Type=python35.PyODictIter_Type DATA - PyODictKeys_Type=python35.PyODictKeys_Type DATA - PyODictValues_Type=python35.PyODictValues_Type DATA PyParser_SimpleParseFileFlags=python35.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python35.PyParser_SimpleParseStringFlags PyProperty_Type=python35.PyProperty_Type DATA @@ -484,8 +484,8 @@ PySlice_New=python35.PySlice_New PySlice_Type=python35.PySlice_Type DATA PySortWrapper_Type=python35.PySortWrapper_Type DATA + PyState_AddModule=python35.PyState_AddModule PyState_FindModule=python35.PyState_FindModule - PyState_AddModule=python35.PyState_AddModule PyState_RemoveModule=python35.PyState_RemoveModule PyStructSequence_GetItem=python35.PyStructSequence_GetItem PyStructSequence_New=python35.PyStructSequence_New @@ -577,8 +577,10 @@ PyUnicode_AsUTF8String=python35.PyUnicode_AsUTF8String PyUnicode_AsUnicodeEscapeString=python35.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python35.PyUnicode_AsWideChar + PyUnicode_BuildEncodingMap=python35.PyUnicode_BuildEncodingMap PyUnicode_ClearFreelist=python35.PyUnicode_ClearFreelist PyUnicode_Compare=python35.PyUnicode_Compare + PyUnicode_CompareWithASCIIString=python35.PyUnicode_CompareWithASCIIString PyUnicode_Concat=python35.PyUnicode_Concat PyUnicode_Contains=python35.PyUnicode_Contains PyUnicode_Count=python35.PyUnicode_Count @@ -593,9 +595,12 @@ PyUnicode_DecodeUTF16Stateful=python35.PyUnicode_DecodeUTF16Stateful PyUnicode_DecodeUTF32=python35.PyUnicode_DecodeUTF32 PyUnicode_DecodeUTF32Stateful=python35.PyUnicode_DecodeUTF32Stateful + PyUnicode_DecodeUTF7=python35.PyUnicode_DecodeUTF7 + PyUnicode_DecodeUTF7Stateful=python35.PyUnicode_DecodeUTF7Stateful PyUnicode_DecodeUTF8=python35.PyUnicode_DecodeUTF8 PyUnicode_DecodeUTF8Stateful=python35.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python35.PyUnicode_DecodeUnicodeEscape + PyUnicode_EncodeFSDefault=python35.PyUnicode_EncodeFSDefault PyUnicode_FSConverter=python35.PyUnicode_FSConverter PyUnicode_FSDecoder=python35.PyUnicode_FSDecoder PyUnicode_Find=python35.PyUnicode_Find @@ -610,6 +615,9 @@ PyUnicode_FromWideChar=python35.PyUnicode_FromWideChar PyUnicode_GetDefaultEncoding=python35.PyUnicode_GetDefaultEncoding PyUnicode_GetSize=python35.PyUnicode_GetSize + PyUnicode_InternFromString=python35.PyUnicode_InternFromString + PyUnicode_InternImmortal=python35.PyUnicode_InternImmortal + PyUnicode_InternInPlace=python35.PyUnicode_InternInPlace PyUnicode_IsIdentifier=python35.PyUnicode_IsIdentifier PyUnicode_Join=python35.PyUnicode_Join PyUnicode_Partition=python35.PyUnicode_Partition @@ -623,14 +631,6 @@ PyUnicode_Splitlines=python35.PyUnicode_Splitlines PyUnicode_Tailmatch=python35.PyUnicode_Tailmatch PyUnicode_Translate=python35.PyUnicode_Translate - PyUnicode_BuildEncodingMap=python35.PyUnicode_BuildEncodingMap - PyUnicode_CompareWithASCIIString=python35.PyUnicode_CompareWithASCIIString - PyUnicode_DecodeUTF7=python35.PyUnicode_DecodeUTF7 - PyUnicode_DecodeUTF7Stateful=python35.PyUnicode_DecodeUTF7Stateful - PyUnicode_EncodeFSDefault=python35.PyUnicode_EncodeFSDefault - PyUnicode_InternFromString=python35.PyUnicode_InternFromString - PyUnicode_InternImmortal=python35.PyUnicode_InternImmortal - PyUnicode_InternInPlace=python35.PyUnicode_InternInPlace PyUnicode_Type=python35.PyUnicode_Type DATA PyWeakref_GetObject=python35.PyWeakref_GetObject DATA PyWeakref_NewProxy=python35.PyWeakref_NewProxy @@ -675,6 +675,11 @@ Py_SetRecursionLimit=python35.Py_SetRecursionLimit Py_SymtableString=python35.Py_SymtableString Py_VaBuildValue=python35.Py_VaBuildValue + _PyArg_ParseTupleAndKeywords_SizeT=python35._PyArg_ParseTupleAndKeywords_SizeT + _PyArg_ParseTuple_SizeT=python35._PyArg_ParseTuple_SizeT + _PyArg_Parse_SizeT=python35._PyArg_Parse_SizeT + _PyArg_VaParseTupleAndKeywords_SizeT=python35._PyArg_VaParseTupleAndKeywords_SizeT + _PyArg_VaParse_SizeT=python35._PyArg_VaParse_SizeT _PyErr_BadInternalCall=python35._PyErr_BadInternalCall _PyObject_CallFunction_SizeT=python35._PyObject_CallFunction_SizeT _PyObject_CallMethod_SizeT=python35._PyObject_CallMethod_SizeT @@ -705,9 +710,3 @@ _Py_SwappedOp=python35._Py_SwappedOp DATA _Py_TrueStruct=python35._Py_TrueStruct DATA _Py_VaBuildValue_SizeT=python35._Py_VaBuildValue_SizeT - _PyArg_Parse_SizeT=python35._PyArg_Parse_SizeT - _PyArg_ParseTuple_SizeT=python35._PyArg_ParseTuple_SizeT - _PyArg_ParseTupleAndKeywords_SizeT=python35._PyArg_ParseTupleAndKeywords_SizeT - _PyArg_VaParse_SizeT=python35._PyArg_VaParse_SizeT - _PyArg_VaParseTupleAndKeywords_SizeT=python35._PyArg_VaParseTupleAndKeywords_SizeT - _Py_BuildValue_SizeT=python35._Py_BuildValue_SizeT -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 23 15:14:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 23 Dec 2016 20:14:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Sort_and_remove_duplicates_from_PC/python3=2Edef_=28issu?= =?utf-8?q?e_=2323903=29=2E?= Message-ID: <20161223201431.17238.71364.50F529CA@psf.io> https://hg.python.org/cpython/rev/e64a82371d72 changeset: 105798:e64a82371d72 parent: 105795:f138b53ee72e parent: 105797:0927b5c80c50 user: Serhiy Storchaka date: Fri Dec 23 22:13:29 2016 +0200 summary: Sort and remove duplicates from PC/python3.def (issue #23903). files: PC/python3.def | 49 ++++++++++++++++++------------------- 1 files changed, 24 insertions(+), 25 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -318,6 +318,8 @@ PyMemoryView_GetContiguous=python37.PyMemoryView_GetContiguous PyMemoryView_Type=python37.PyMemoryView_Type DATA PyMethodDescr_Type=python37.PyMethodDescr_Type DATA + PyModuleDef_Init=python37.PyModuleDef_Init + PyModuleDef_Type=python37.PyModuleDef_Type DATA PyModule_AddIntConstant=python37.PyModule_AddIntConstant PyModule_AddObject=python37.PyModule_AddObject PyModule_AddStringConstant=python37.PyModule_AddStringConstant @@ -330,8 +332,6 @@ PyModule_GetState=python37.PyModule_GetState PyModule_New=python37.PyModule_New PyModule_Type=python37.PyModule_Type DATA - PyModuleDef_Init=python37.PyModuleDef_Init - PyModuleDef_Type=python37.PyModuleDef_Type DATA PyNullImporter_Type=python37.PyNullImporter_Type DATA PyNumber_Absolute=python37.PyNumber_Absolute PyNumber_Add=python37.PyNumber_Add @@ -368,6 +368,14 @@ PyNumber_ToBase=python37.PyNumber_ToBase PyNumber_TrueDivide=python37.PyNumber_TrueDivide PyNumber_Xor=python37.PyNumber_Xor + PyODictItems_Type=python37.PyODictItems_Type DATA + PyODictIter_Type=python37.PyODictIter_Type DATA + PyODictKeys_Type=python37.PyODictKeys_Type DATA + PyODictValues_Type=python37.PyODictValues_Type DATA + PyODict_DelItem=python37.PyODict_DelItem + PyODict_New=python37.PyODict_New + PyODict_SetItem=python37.PyODict_SetItem + PyODict_Type=python37.PyODict_Type DATA PyOS_AfterFork=python37.PyOS_AfterFork PyOS_InitInterrupts=python37.PyOS_InitInterrupts PyOS_InputHook=python37.PyOS_InputHook DATA @@ -434,14 +442,6 @@ PyObject_Size=python37.PyObject_Size PyObject_Str=python37.PyObject_Str PyObject_Type=python37.PyObject_Type DATA - PyODict_DelItem=python37.PyODict_DelItem - PyODict_New=python37.PyODict_New - PyODict_SetItem=python37.PyODict_SetItem - PyODict_Type=python37.PyODict_Type DATA - PyODictItems_Type=python37.PyODictItems_Type DATA - PyODictIter_Type=python37.PyODictIter_Type DATA - PyODictKeys_Type=python37.PyODictKeys_Type DATA - PyODictValues_Type=python37.PyODictValues_Type DATA PyParser_SimpleParseFileFlags=python37.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python37.PyParser_SimpleParseStringFlags PyProperty_Type=python37.PyProperty_Type DATA @@ -484,8 +484,8 @@ PySlice_New=python37.PySlice_New PySlice_Type=python37.PySlice_Type DATA PySortWrapper_Type=python37.PySortWrapper_Type DATA + PyState_AddModule=python37.PyState_AddModule PyState_FindModule=python37.PyState_FindModule - PyState_AddModule=python37.PyState_AddModule PyState_RemoveModule=python37.PyState_RemoveModule PyStructSequence_GetItem=python37.PyStructSequence_GetItem PyStructSequence_New=python37.PyStructSequence_New @@ -577,8 +577,10 @@ PyUnicode_AsUTF8String=python37.PyUnicode_AsUTF8String PyUnicode_AsUnicodeEscapeString=python37.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python37.PyUnicode_AsWideChar + PyUnicode_BuildEncodingMap=python37.PyUnicode_BuildEncodingMap PyUnicode_ClearFreelist=python37.PyUnicode_ClearFreelist PyUnicode_Compare=python37.PyUnicode_Compare + PyUnicode_CompareWithASCIIString=python37.PyUnicode_CompareWithASCIIString PyUnicode_Concat=python37.PyUnicode_Concat PyUnicode_Contains=python37.PyUnicode_Contains PyUnicode_Count=python37.PyUnicode_Count @@ -593,9 +595,12 @@ PyUnicode_DecodeUTF16Stateful=python37.PyUnicode_DecodeUTF16Stateful PyUnicode_DecodeUTF32=python37.PyUnicode_DecodeUTF32 PyUnicode_DecodeUTF32Stateful=python37.PyUnicode_DecodeUTF32Stateful + PyUnicode_DecodeUTF7=python37.PyUnicode_DecodeUTF7 + PyUnicode_DecodeUTF7Stateful=python37.PyUnicode_DecodeUTF7Stateful PyUnicode_DecodeUTF8=python37.PyUnicode_DecodeUTF8 PyUnicode_DecodeUTF8Stateful=python37.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python37.PyUnicode_DecodeUnicodeEscape + PyUnicode_EncodeFSDefault=python37.PyUnicode_EncodeFSDefault PyUnicode_FSConverter=python37.PyUnicode_FSConverter PyUnicode_FSDecoder=python37.PyUnicode_FSDecoder PyUnicode_Find=python37.PyUnicode_Find @@ -610,6 +615,9 @@ PyUnicode_FromWideChar=python37.PyUnicode_FromWideChar PyUnicode_GetDefaultEncoding=python37.PyUnicode_GetDefaultEncoding PyUnicode_GetSize=python37.PyUnicode_GetSize + PyUnicode_InternFromString=python37.PyUnicode_InternFromString + PyUnicode_InternImmortal=python37.PyUnicode_InternImmortal + PyUnicode_InternInPlace=python37.PyUnicode_InternInPlace PyUnicode_IsIdentifier=python37.PyUnicode_IsIdentifier PyUnicode_Join=python37.PyUnicode_Join PyUnicode_Partition=python37.PyUnicode_Partition @@ -623,14 +631,6 @@ PyUnicode_Splitlines=python37.PyUnicode_Splitlines PyUnicode_Tailmatch=python37.PyUnicode_Tailmatch PyUnicode_Translate=python37.PyUnicode_Translate - PyUnicode_BuildEncodingMap=python37.PyUnicode_BuildEncodingMap - PyUnicode_CompareWithASCIIString=python37.PyUnicode_CompareWithASCIIString - PyUnicode_DecodeUTF7=python37.PyUnicode_DecodeUTF7 - PyUnicode_DecodeUTF7Stateful=python37.PyUnicode_DecodeUTF7Stateful - PyUnicode_EncodeFSDefault=python37.PyUnicode_EncodeFSDefault - PyUnicode_InternFromString=python37.PyUnicode_InternFromString - PyUnicode_InternImmortal=python37.PyUnicode_InternImmortal - PyUnicode_InternInPlace=python37.PyUnicode_InternInPlace PyUnicode_Type=python37.PyUnicode_Type DATA PyWeakref_GetObject=python37.PyWeakref_GetObject DATA PyWeakref_NewProxy=python37.PyWeakref_NewProxy @@ -676,6 +676,11 @@ Py_SetRecursionLimit=python37.Py_SetRecursionLimit Py_SymtableString=python37.Py_SymtableString Py_VaBuildValue=python37.Py_VaBuildValue + _PyArg_ParseTupleAndKeywords_SizeT=python37._PyArg_ParseTupleAndKeywords_SizeT + _PyArg_ParseTuple_SizeT=python37._PyArg_ParseTuple_SizeT + _PyArg_Parse_SizeT=python37._PyArg_Parse_SizeT + _PyArg_VaParseTupleAndKeywords_SizeT=python37._PyArg_VaParseTupleAndKeywords_SizeT + _PyArg_VaParse_SizeT=python37._PyArg_VaParse_SizeT _PyErr_BadInternalCall=python37._PyErr_BadInternalCall _PyObject_CallFunction_SizeT=python37._PyObject_CallFunction_SizeT _PyObject_CallMethod_SizeT=python37._PyObject_CallMethod_SizeT @@ -706,9 +711,3 @@ _Py_SwappedOp=python37._Py_SwappedOp DATA _Py_TrueStruct=python37._Py_TrueStruct DATA _Py_VaBuildValue_SizeT=python37._Py_VaBuildValue_SizeT - _PyArg_Parse_SizeT=python37._PyArg_Parse_SizeT - _PyArg_ParseTuple_SizeT=python37._PyArg_ParseTuple_SizeT - _PyArg_ParseTupleAndKeywords_SizeT=python37._PyArg_ParseTupleAndKeywords_SizeT - _PyArg_VaParse_SizeT=python37._PyArg_VaParse_SizeT - _PyArg_VaParseTupleAndKeywords_SizeT=python37._PyArg_VaParseTupleAndKeywords_SizeT - _Py_BuildValue_SizeT=python37._Py_BuildValue_SizeT -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:22 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328960=3A_Merge_Thread=2Ejoin=28=29_doc_from_3=2E5?= Message-ID: <20161224081822.107388.66742.8BC7805A@psf.io> https://hg.python.org/cpython/rev/d70fcf1866ad changeset: 105801:d70fcf1866ad branch: 3.6 parent: 105797:0927b5c80c50 parent: 105799:9347d0b2ee08 user: Martin Panter date: Sat Dec 24 07:40:09 2016 +0000 summary: Issue #28960: Merge Thread.join() doc from 3.5 files: Doc/library/threading.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -256,7 +256,7 @@ Wait until the thread terminates. This blocks the calling thread until the thread whose :meth:`~Thread.join` method is called terminates -- either - normally or through an unhandled exception --, or until the optional + normally or through an unhandled exception -- or until the optional timeout occurs. When the *timeout* argument is present and not ``None``, it should be a -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:22 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDA0?= =?utf-8?q?=3A_Document_binascii=2Ecrc=5Fhqx=28=29_implements_CRC-CCITT?= Message-ID: <20161224081822.6349.37456.F01F4C1B@psf.io> https://hg.python.org/cpython/rev/a33472f8a2c6 changeset: 105800:a33472f8a2c6 branch: 3.5 user: Martin Panter date: Sat Dec 24 07:36:44 2016 +0000 summary: Issue #29004: Document binascii.crc_hqx() implements CRC-CCITT files: Doc/library/binascii.rst | 6 ++++-- Modules/binascii.c | 4 ++-- Modules/clinic/binascii.c.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -115,8 +115,10 @@ .. function:: crc_hqx(data, value) - Compute the binhex4 crc value of *data*, starting with *value* as the - initial crc, and return the result. + Compute a 16-bit CRC value of *data*, starting with *value* as the + initial CRC, and return the result. This uses the CRC-CCITT polynomial + *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as + 0x1021. This CRC is used in the binhex4 format. .. function:: crc32(data[, value]) diff --git a/Modules/binascii.c b/Modules/binascii.c --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -915,12 +915,12 @@ crc: unsigned_int(bitwise=True) / -Compute hqx CRC incrementally. +Compute CRC-CCITT incrementally. [clinic start generated code]*/ static unsigned int binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) -/*[clinic end generated code: output=8ec2a78590d19170 input=add8c53712ccceda]*/ +/*[clinic end generated code: output=8ec2a78590d19170 input=f18240ff8c705b79]*/ { unsigned char *bin_data; Py_ssize_t len; diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -246,7 +246,7 @@ "crc_hqx($module, data, crc, /)\n" "--\n" "\n" -"Compute hqx CRC incrementally."); +"Compute CRC-CCITT incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ {"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__}, @@ -516,4 +516,4 @@ return return_value; } -/*[clinic end generated code: output=51173fc9718a5edc input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6d70d5edd9373d92 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:22 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329004=3A_Merge_crc=5Fhqx=28=29_doc_from_3=2E5?= Message-ID: <20161224081822.80070.47923.BAA8B3A9@psf.io> https://hg.python.org/cpython/rev/52db2072e88b changeset: 105802:52db2072e88b branch: 3.6 parent: 105801:d70fcf1866ad parent: 105800:a33472f8a2c6 user: Martin Panter date: Sat Dec 24 07:44:03 2016 +0000 summary: Issue #29004: Merge crc_hqx() doc from 3.5 files: Doc/library/binascii.rst | 6 ++++-- Modules/binascii.c | 4 ++-- Modules/clinic/binascii.c.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -116,8 +116,10 @@ .. function:: crc_hqx(data, value) - Compute the binhex4 crc value of *data*, starting with *value* as the - initial crc, and return the result. + Compute a 16-bit CRC value of *data*, starting with *value* as the + initial CRC, and return the result. This uses the CRC-CCITT polynomial + *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as + 0x1021. This CRC is used in the binhex4 format. .. function:: crc32(data[, value]) diff --git a/Modules/binascii.c b/Modules/binascii.c --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -900,12 +900,12 @@ crc: unsigned_int(bitwise=True) / -Compute hqx CRC incrementally. +Compute CRC-CCITT incrementally. [clinic start generated code]*/ static unsigned int binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) -/*[clinic end generated code: output=8ec2a78590d19170 input=add8c53712ccceda]*/ +/*[clinic end generated code: output=8ec2a78590d19170 input=f18240ff8c705b79]*/ { const unsigned char *bin_data; Py_ssize_t len; diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -263,7 +263,7 @@ "crc_hqx($module, data, crc, /)\n" "--\n" "\n" -"Compute hqx CRC incrementally."); +"Compute CRC-CCITT incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ {"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__}, @@ -550,4 +550,4 @@ return return_value; } -/*[clinic end generated code: output=1f8d6e48f75f6d1e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=458eb09731cb7877 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:22 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTYw?= =?utf-8?q?=3A_Drop_comma_attached_to_dash_in_Thread=2Ejoin=28=29_descript?= =?utf-8?q?ion?= Message-ID: <20161224081822.106798.48992.C058B947@psf.io> https://hg.python.org/cpython/rev/9347d0b2ee08 changeset: 105799:9347d0b2ee08 branch: 3.5 parent: 105796:9cb87e53e324 user: Martin Panter date: Sat Dec 24 07:28:26 2016 +0000 summary: Issue #28960: Drop comma attached to dash in Thread.join() description files: Doc/library/threading.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -256,7 +256,7 @@ Wait until the thread terminates. This blocks the calling thread until the thread whose :meth:`~Thread.join` method is called terminates -- either - normally or through an unhandled exception --, or until the optional + normally or through an unhandled exception -- or until the optional timeout occurs. When the *timeout* argument is present and not ``None``, it should be a -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:22 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328960=3A_Merge_Thread=2Ejoin=28=29_doc_from_3?= =?utf-8?q?=2E6?= Message-ID: <20161224081822.20642.35704.5E630223@psf.io> https://hg.python.org/cpython/rev/cefcfacd87e4 changeset: 105803:cefcfacd87e4 parent: 105798:e64a82371d72 parent: 105801:d70fcf1866ad user: Martin Panter date: Sat Dec 24 07:45:17 2016 +0000 summary: Issue #28960: Merge Thread.join() doc from 3.6 files: Doc/library/threading.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -256,7 +256,7 @@ Wait until the thread terminates. This blocks the calling thread until the thread whose :meth:`~Thread.join` method is called terminates -- either - normally or through an unhandled exception --, or until the optional + normally or through an unhandled exception -- or until the optional timeout occurs. When the *timeout* argument is present and not ``None``, it should be a -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:22 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI5MDA0OiBNZXJnZSBjcmNfaHF4KCkgZG9jIGZyb20gMy42?= Message-ID: <20161224081822.16930.69729.B207D83E@psf.io> https://hg.python.org/cpython/rev/3af3702b2f0a changeset: 105804:3af3702b2f0a parent: 105803:cefcfacd87e4 parent: 105802:52db2072e88b user: Martin Panter date: Sat Dec 24 07:45:56 2016 +0000 summary: Issue #29004: Merge crc_hqx() doc from 3.6 files: Doc/library/binascii.rst | 6 ++++-- Modules/binascii.c | 4 ++-- Modules/clinic/binascii.c.h | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -116,8 +116,10 @@ .. function:: crc_hqx(data, value) - Compute the binhex4 crc value of *data*, starting with *value* as the - initial crc, and return the result. + Compute a 16-bit CRC value of *data*, starting with *value* as the + initial CRC, and return the result. This uses the CRC-CCITT polynomial + *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as + 0x1021. This CRC is used in the binhex4 format. .. function:: crc32(data[, value]) diff --git a/Modules/binascii.c b/Modules/binascii.c --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -900,12 +900,12 @@ crc: unsigned_int(bitwise=True) / -Compute hqx CRC incrementally. +Compute CRC-CCITT incrementally. [clinic start generated code]*/ static unsigned int binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc) -/*[clinic end generated code: output=8ec2a78590d19170 input=add8c53712ccceda]*/ +/*[clinic end generated code: output=8ec2a78590d19170 input=f18240ff8c705b79]*/ { const unsigned char *bin_data; Py_ssize_t len; diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -263,7 +263,7 @@ "crc_hqx($module, data, crc, /)\n" "--\n" "\n" -"Compute hqx CRC incrementally."); +"Compute CRC-CCITT incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ {"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_VARARGS, binascii_crc_hqx__doc__}, @@ -550,4 +550,4 @@ return return_value; } -/*[clinic end generated code: output=1f8d6e48f75f6d1e input=a9049054013a1b77]*/ +/*[clinic end generated code: output=458eb09731cb7877 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:18:23 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:18:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MDA0?= =?utf-8?q?=3A_Document_binascii=2Ecrc=5Fhqx=28=29_implements_CRC-CCITT?= Message-ID: <20161224081822.17632.69004.B73300F3@psf.io> https://hg.python.org/cpython/rev/5ae6102270df changeset: 105805:5ae6102270df branch: 2.7 parent: 105792:d1c16588644f user: Martin Panter date: Sat Dec 24 07:53:57 2016 +0000 summary: Issue #29004: Document binascii.crc_hqx() implements CRC-CCITT files: Doc/library/binascii.rst | 6 ++++-- Modules/binascii.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -101,8 +101,10 @@ .. function:: crc_hqx(data, crc) - Compute the binhex4 crc value of *data*, starting with an initial *crc* and - returning the result. + Compute a 16-bit CRC value of *data*, starting with an initial *crc* and + returning the result. This uses the CRC-CCITT polynomial + *x*:sup:`16` + *x*:sup:`12` + *x*:sup:`5` + 1, often represented as + 0x1021. This CRC is used in the binhex4 format. .. function:: crc32(data[, crc]) diff --git a/Modules/binascii.c b/Modules/binascii.c --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -842,7 +842,7 @@ } PyDoc_STRVAR(doc_crc_hqx, -"(data, oldcrc) -> newcrc. Compute hqx CRC incrementally"); +"(data, oldcrc) -> newcrc. Compute CRC-CCITT incrementally"); static PyObject * binascii_crc_hqx(PyObject *self, PyObject *args) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:49:28 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:49:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=231446619=3A_Merge_slicing_description_from_3=2E6?= Message-ID: <20161224084928.3523.8959.33309958@psf.io> https://hg.python.org/cpython/rev/4383d403aaef changeset: 105808:4383d403aaef parent: 105804:3af3702b2f0a parent: 105807:031af2160094 user: Martin Panter date: Sat Dec 24 08:31:37 2016 +0000 summary: Issue #1446619: Merge slicing description from 3.6 files: Doc/library/stdtypes.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -942,8 +942,10 @@ The slice of *s* from *i* to *j* with step *k* is defined as the sequence of items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other words, the indices are ``i``, ``i+k``, ``i+2*k``, ``i+3*k`` and so on, stopping when - *j* is reached (but never including *j*). If *i* or *j* is greater than - ``len(s)``, use ``len(s)``. If *i* or *j* are omitted or ``None``, they become + *j* is reached (but never including *j*). When *k* is positive, + *i* and *j* are reduced to ``len(s)`` if they are greater. + When *k* is negative, *i* and *j* are reduced to ``len(s) - 1`` if + they are greater. If *i* or *j* are omitted or ``None``, they become "end" values (which end depends on the sign of *k*). Note, *k* cannot be zero. If *k* is ``None``, it is treated like ``1``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:49:28 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:49:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=231446619=3A_Merge_slicing_description_from_3=2E5?= Message-ID: <20161224084928.80239.95115.F0700883@psf.io> https://hg.python.org/cpython/rev/031af2160094 changeset: 105807:031af2160094 branch: 3.6 parent: 105802:52db2072e88b parent: 105806:b0b17b41edfc user: Martin Panter date: Sat Dec 24 08:31:11 2016 +0000 summary: Issue #1446619: Merge slicing description from 3.5 files: Doc/library/stdtypes.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -942,8 +942,10 @@ The slice of *s* from *i* to *j* with step *k* is defined as the sequence of items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other words, the indices are ``i``, ``i+k``, ``i+2*k``, ``i+3*k`` and so on, stopping when - *j* is reached (but never including *j*). If *i* or *j* is greater than - ``len(s)``, use ``len(s)``. If *i* or *j* are omitted or ``None``, they become + *j* is reached (but never including *j*). When *k* is positive, + *i* and *j* are reduced to ``len(s)`` if they are greater. + When *k* is negative, *i* and *j* are reduced to ``len(s) - 1`` if + they are greater. If *i* or *j* are omitted or ``None``, they become "end" values (which end depends on the sign of *k*). Note, *k* cannot be zero. If *k* is ``None``, it is treated like ``1``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:49:28 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:49:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE0NDY2?= =?utf-8?q?19=3A_Account_for_negative_slice_direction_in_description?= Message-ID: <20161224084928.18036.14437.8DE240BC@psf.io> https://hg.python.org/cpython/rev/b0b17b41edfc changeset: 105806:b0b17b41edfc branch: 3.5 parent: 105800:a33472f8a2c6 user: Martin Panter date: Sat Dec 24 08:25:15 2016 +0000 summary: Issue #1446619: Account for negative slice direction in description Based on suggestion from Fumihiro Bessho. files: Doc/library/stdtypes.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -942,8 +942,10 @@ The slice of *s* from *i* to *j* with step *k* is defined as the sequence of items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other words, the indices are ``i``, ``i+k``, ``i+2*k``, ``i+3*k`` and so on, stopping when - *j* is reached (but never including *j*). If *i* or *j* is greater than - ``len(s)``, use ``len(s)``. If *i* or *j* are omitted or ``None``, they become + *j* is reached (but never including *j*). When *k* is positive, + *i* and *j* are reduced to ``len(s)`` if they are greater. + When *k* is negative, *i* and *j* are reduced to ``len(s) - 1`` if + they are greater. If *i* or *j* are omitted or ``None``, they become "end" values (which end depends on the sign of *k*). Note, *k* cannot be zero. If *k* is ``None``, it is treated like ``1``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 03:49:28 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 08:49:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE0NDY2?= =?utf-8?q?19=3A_Account_for_negative_slice_direction_in_description?= Message-ID: <20161224084928.20642.38471.8CE8AB40@psf.io> https://hg.python.org/cpython/rev/d63a11bd98ce changeset: 105809:d63a11bd98ce branch: 2.7 parent: 105805:5ae6102270df user: Martin Panter date: Sat Dec 24 08:25:15 2016 +0000 summary: Issue #1446619: Account for negative slice direction in description Based on suggestion from Fumihiro Bessho. files: Doc/library/stdtypes.rst | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -834,8 +834,10 @@ The slice of *s* from *i* to *j* with step *k* is defined as the sequence of items with index ``x = i + n*k`` such that ``0 <= n < (j-i)/k``. In other words, the indices are ``i``, ``i+k``, ``i+2*k``, ``i+3*k`` and so on, stopping when - *j* is reached (but never including *j*). If *i* or *j* is greater than - ``len(s)``, use ``len(s)``. If *i* or *j* are omitted or ``None``, they become + *j* is reached (but never including *j*). When *k* is positive, + *i* and *j* are reduced to ``len(s)`` if they are greater. + When *k* is negative, *i* and *j* are reduced to ``len(s) - 1`` if + they are greater. If *i* or *j* are omitted or ``None``, they become "end" values (which end depends on the sign of *k*). Note, *k* cannot be zero. If *k* is ``None``, it is treated like ``1``. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Dec 24 04:08:09 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 24 Dec 2016 09:08:09 +0000 Subject: [Python-checkins] Daily reference leaks (e64a82371d72): sum=7 Message-ID: <20161224090808.79881.35868.DBD61D01@psf.io> results for e64a82371d72 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/reflog9nUZkq', '--timeout', '7200'] From python-checkins at python.org Sat Dec 24 05:27:59 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 10:27:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328954=3A_Merge_keyword_argument_syntax_from_3?= =?utf-8?q?=2E6?= Message-ID: <20161224102759.107736.63462.13A63723@psf.io> https://hg.python.org/cpython/rev/8e311f109b22 changeset: 105812:8e311f109b22 parent: 105808:4383d403aaef parent: 105811:ef53ef8e09e5 user: Martin Panter date: Sat Dec 24 10:21:48 2016 +0000 summary: Issue #28954: Merge keyword argument syntax from 3.6 files: Doc/reference/expressions.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -827,7 +827,7 @@ starred_and_keywords: ("*" `expression` | `keyword_item`) : ("," "*" `expression` | "," `keyword_item`)* keywords_arguments: (`keyword_item` | "**" `expression`) - : ("," `keyword_item` | "**" `expression`)* + : ("," `keyword_item` | "," "**" `expression`)* keyword_item: `identifier` "=" `expression` An optional trailing comma may be present after the positional and keyword arguments -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 05:27:59 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 10:27:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4OTU0?= =?utf-8?q?=3A_Add_missing_comma_to_keyword_argument_syntax?= Message-ID: <20161224102758.79468.57515.67E18FAF@psf.io> https://hg.python.org/cpython/rev/3f94e3c7dcc5 changeset: 105810:3f94e3c7dcc5 branch: 3.5 parent: 105806:b0b17b41edfc user: Martin Panter date: Sat Dec 24 10:20:38 2016 +0000 summary: Issue #28954: Add missing comma to keyword argument syntax files: Doc/reference/expressions.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -667,7 +667,7 @@ starred_and_keywords: ("*" `expression` | `keyword_item`) : ("," "*" `expression` | "," `keyword_item`)* keywords_arguments: (`keyword_item` | "**" `expression`) - : ("," `keyword_item` | "**" `expression`)* + : ("," `keyword_item` | "," "**" `expression`)* keyword_item: `identifier` "=" `expression` An optional trailing comma may be present after the positional and keyword arguments -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 05:27:59 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 10:27:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328954=3A_Merge_keyword_argument_syntax_from_3=2E5?= Message-ID: <20161224102759.20560.50058.9A05ED98@psf.io> https://hg.python.org/cpython/rev/ef53ef8e09e5 changeset: 105811:ef53ef8e09e5 branch: 3.6 parent: 105807:031af2160094 parent: 105810:3f94e3c7dcc5 user: Martin Panter date: Sat Dec 24 10:21:30 2016 +0000 summary: Issue #28954: Merge keyword argument syntax from 3.5 files: Doc/reference/expressions.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -827,7 +827,7 @@ starred_and_keywords: ("*" `expression` | `keyword_item`) : ("," "*" `expression` | "," `keyword_item`)* keywords_arguments: (`keyword_item` | "**" `expression`) - : ("," `keyword_item` | "**" `expression`)* + : ("," `keyword_item` | "," "**" `expression`)* keyword_item: `identifier` "=" `expression` An optional trailing comma may be present after the positional and keyword arguments -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 06:19:22 2016 From: python-checkins at python.org (inada.naoki) Date: Sat, 24 Dec 2016 11:19:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329049=3A_Call_=5F?= =?utf-8?q?PyObject=5FGC=5FTRACK=28=29_lazily_when_calling_Python_function?= =?utf-8?q?=2E?= Message-ID: <20161224111922.106884.74209.8619E8B1@psf.io> https://hg.python.org/cpython/rev/f5eb0c4f5d37 changeset: 105813:f5eb0c4f5d37 user: INADA Naoki date: Sat Dec 24 20:19:08 2016 +0900 summary: Issue #29049: Call _PyObject_GC_TRACK() lazily when calling Python function. Calling function is up to 5% faster. files: Include/frameobject.h | 6 +++++- Misc/NEWS | 3 +++ Objects/frameobject.c | 20 ++++++++++++++++---- Python/ceval.c | 31 +++++++++++++++++++++---------- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/Include/frameobject.h b/Include/frameobject.h --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -60,7 +60,11 @@ #define PyFrame_Check(op) (Py_TYPE(op) == &PyFrame_Type) PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, - PyObject *, PyObject *); + PyObject *, PyObject *); + +/* only internal use */ +PyFrameObject* _PyFrame_New_NoTrack(PyThreadState *, PyCodeObject *, + PyObject *, PyObject *); /* The rest of the interface is specific for frame objects */ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #29049: Call _PyObject_GC_TRACK() lazily when calling Python function. + Calling function is up to 5% faster. + - Issue #28927: bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not only spaces. Patch by Robert Xiao. diff --git a/Objects/frameobject.c b/Objects/frameobject.c --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -415,7 +415,9 @@ PyObject **p, **valuestack; PyCodeObject *co; - PyObject_GC_UnTrack(f); + if (_PyObject_GC_IS_TRACKED(f)) + _PyObject_GC_UNTRACK(f); + Py_TRASHCAN_SAFE_BEGIN(f) /* Kill all local variables */ valuestack = f->f_valuestack; @@ -606,8 +608,8 @@ } PyFrameObject* _Py_HOT_FUNCTION -PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, - PyObject *locals) +_PyFrame_New_NoTrack(PyThreadState *tstate, PyCodeObject *code, + PyObject *globals, PyObject *locals) { PyFrameObject *back = tstate->frame; PyFrameObject *f; @@ -727,10 +729,20 @@ f->f_executing = 0; f->f_gen = NULL; - _PyObject_GC_TRACK(f); return f; } +PyFrameObject* +PyFrame_New(PyThreadState *tstate, PyCodeObject *code, + PyObject *globals, PyObject *locals) +{ + PyFrameObject *f = _PyFrame_New_NoTrack(tstate, code, globals, locals); + if (f) + _PyObject_GC_TRACK(f); + return f; +} + + /* Block management */ void diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3931,7 +3931,7 @@ /* Create the frame */ tstate = PyThreadState_GET(); assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, locals); + f = _PyFrame_New_NoTrack(tstate, co, globals, locals); if (f == NULL) { return NULL; } @@ -4176,9 +4176,15 @@ so recursion_depth must be boosted for the duration. */ assert(tstate != NULL); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; + if (Py_REFCNT(f) > 1) { + Py_DECREF(f); + _PyObject_GC_TRACK(f); + } + else { + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + } return retval; } @@ -4904,11 +4910,11 @@ assert(globals != NULL); /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does + _PyFrame_New_NoTrack() that doesn't take locals, but does take builtins without sanity checking them. */ assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); + f = _PyFrame_New_NoTrack(tstate, co, globals, NULL); if (f == NULL) { return NULL; } @@ -4921,10 +4927,15 @@ } result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - + if (Py_REFCNT(f) > 1) { + Py_DECREF(f); + _PyObject_GC_TRACK(f); + } + else { + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + } return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 06:38:40 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 11:38:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4ODE1?= =?utf-8?q?=3A_Skip_TIPC_tests_if_/proc/modules_is_not_readable?= Message-ID: <20161224113838.106798.65485.A21C289B@psf.io> https://hg.python.org/cpython/rev/7889d7a771c7 changeset: 105814:7889d7a771c7 branch: 3.5 parent: 105810:3f94e3c7dcc5 user: Martin Panter date: Sat Dec 24 10:41:37 2016 +0000 summary: Issue #28815: Skip TIPC tests if /proc/modules is not readable Based on patch by Patrila. files: Lib/test/test_socket.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4717,9 +4717,17 @@ """ if not hasattr(socket, "AF_TIPC"): return False - if not os.path.isfile("/proc/modules"): - return False - with open("/proc/modules") as f: + try: + f = open("/proc/modules") + except IOError as e: + # It's ok if the file does not exist, is a directory or if we + # have not the permission to read it. In any other case it's a + # real error, so raise it again. + if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES): + return False + else: + raise + with f: for line in f: if line.startswith("tipc "): return True -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 06:38:40 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 11:38:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328815=3A_Merge_test=5Fsocket_fix_from_3=2E6?= Message-ID: <20161224113840.26886.97224.DF935455@psf.io> https://hg.python.org/cpython/rev/7ceacac48cd2 changeset: 105816:7ceacac48cd2 parent: 105813:f5eb0c4f5d37 parent: 105815:48b9d9cdfe3b user: Martin Panter date: Sat Dec 24 11:24:45 2016 +0000 summary: Issue #28815: Merge test_socket fix from 3.6 files: Lib/test/test_socket.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4796,9 +4796,17 @@ """ if not hasattr(socket, "AF_TIPC"): return False - if not os.path.isfile("/proc/modules"): - return False - with open("/proc/modules") as f: + try: + f = open("/proc/modules") + except IOError as e: + # It's ok if the file does not exist, is a directory or if we + # have not the permission to read it. In any other case it's a + # real error, so raise it again. + if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES): + return False + else: + raise + with f: for line in f: if line.startswith("tipc "): return True -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 06:38:40 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 11:38:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328815=3A_Merge_test=5Fsocket_fix_from_3=2E5?= Message-ID: <20161224113840.5849.44472.71330071@psf.io> https://hg.python.org/cpython/rev/48b9d9cdfe3b changeset: 105815:48b9d9cdfe3b branch: 3.6 parent: 105811:ef53ef8e09e5 parent: 105814:7889d7a771c7 user: Martin Panter date: Sat Dec 24 10:53:18 2016 +0000 summary: Issue #28815: Merge test_socket fix from 3.5 files: Lib/test/test_socket.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -4778,9 +4778,17 @@ """ if not hasattr(socket, "AF_TIPC"): return False - if not os.path.isfile("/proc/modules"): - return False - with open("/proc/modules") as f: + try: + f = open("/proc/modules") + except IOError as e: + # It's ok if the file does not exist, is a directory or if we + # have not the permission to read it. In any other case it's a + # real error, so raise it again. + if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES): + return False + else: + raise + with f: for line in f: if line.startswith("tipc "): return True -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 06:38:40 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 24 Dec 2016 11:38:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4ODE1?= =?utf-8?q?=3A_Skip_TIPC_tests_if_/proc/modules_is_not_readable?= Message-ID: <20161224113840.4083.45180.163F23DE@psf.io> https://hg.python.org/cpython/rev/41a99a2a7198 changeset: 105817:41a99a2a7198 branch: 2.7 parent: 105809:d63a11bd98ce user: Martin Panter date: Sat Dec 24 10:41:37 2016 +0000 summary: Issue #28815: Skip TIPC tests if /proc/modules is not readable Based on patch by Patrila. files: Lib/test/test_socket.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -1707,9 +1707,17 @@ """ if not hasattr(socket, "AF_TIPC"): return False - if not os.path.isfile("/proc/modules"): - return False - with open("/proc/modules") as f: + try: + f = open("/proc/modules") + except IOError as e: + # It's ok if the file does not exist, is a directory or if we + # have not the permission to read it. In any other case it's a + # real error, so raise it again. + if e.errno in (errno.ENOENT, errno.EISDIR, errno.EACCES): + return False + else: + raise + with f: for line in f: if line.startswith("tipc "): return True -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 21:35:29 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 25 Dec 2016 02:35:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzI1NTkxOiBpbXBy?= =?utf-8?q?ove_imap_tests=2E?= Message-ID: <20161225023529.3476.39120.B8E02825@psf.io> https://hg.python.org/cpython/rev/75f9cca86fa1 changeset: 105818:75f9cca86fa1 branch: 3.5 parent: 105814:7889d7a771c7 user: R David Murray date: Sat Dec 24 21:32:26 2016 -0500 summary: #25591: improve imap tests. Patch by Maciej Szulik. files: Lib/imaplib.py | 2 +- Lib/test/test_imaplib.py | 330 +++++++++++++++++++++++++++ 2 files changed, 331 insertions(+), 1 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -411,7 +411,7 @@ self.literal = _Authenticator(authobject).process typ, dat = self._simple_command('AUTHENTICATE', mech) if typ != 'OK': - raise self.error(dat[-1]) + raise self.error(dat[-1].decode('utf-8', 'replace')) self.state = 'AUTH' return typ, dat diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -10,10 +10,12 @@ import socketserver import time import calendar +import inspect from test.support import (reap_threads, verbose, transient_internet, run_with_tz, run_with_locale) import unittest +from unittest import mock from datetime import datetime, timezone, timedelta try: import ssl @@ -174,6 +176,334 @@ self._send_tagged(tag, 'OK', 'LOGIN completed') +class NewIMAPTestsMixin(): + client = None + + def _setup(self, imap_handler, connect=True): + """ + Sets up imap_handler for tests. imap_handler should inherit from either: + - SimpleIMAPHandler - for testing IMAP commands, + - socketserver.StreamRequestHandler - if raw access to stream is needed. + Returns (client, server). + """ + class TestTCPServer(self.server_class): + def handle_error(self, request, client_address): + """ + End request and raise the error if one occurs. + """ + self.close_request(request) + self.server_close() + raise + + self.addCleanup(self._cleanup) + self.server = self.server_class((support.HOST, 0), imap_handler) + self.thread = threading.Thread( + name=self._testMethodName+'-server', + target=self.server.serve_forever, + # Short poll interval to make the test finish quickly. + # Time between requests is short enough that we won't wake + # up spuriously too many times. + kwargs={'poll_interval': 0.01}) + self.thread.daemon = True # In case this function raises. + self.thread.start() + + if connect: + self.client = self.imap_class(*self.server.server_address) + + return self.client, self.server + + def _cleanup(self): + """ + Cleans up the test server. This method should not be called manually, + it is added to the cleanup queue in the _setup method already. + """ + # if logout was called already we'd raise an exception trying to + # shutdown the client once again + if self.client is not None and self.client.state != 'LOGOUT': + self.client.shutdown() + # cleanup the server + self.server.shutdown() + self.server.server_close() + self.thread.join(3.0) + + def test_EOF_without_complete_welcome_message(self): + # http://bugs.python.org/issue5949 + class EOFHandler(socketserver.StreamRequestHandler): + def handle(self): + self.wfile.write(b'* OK') + _, server = self._setup(EOFHandler, connect=False) + self.assertRaises(imaplib.IMAP4.abort, self.imap_class, + *server.server_address) + + def test_line_termination(self): + class BadNewlineHandler(SimpleIMAPHandler): + def cmd_CAPABILITY(self, tag, args): + self._send(b'* CAPABILITY IMAP4rev1 AUTH\n') + self._send_tagged(tag, 'OK', 'CAPABILITY completed') + _, server = self._setup(BadNewlineHandler, connect=False) + self.assertRaises(imaplib.IMAP4.abort, self.imap_class, + *server.server_address) + + def test_enable_raises_error_if_not_AUTH(self): + class EnableHandler(SimpleIMAPHandler): + capabilities = 'AUTH ENABLE UTF8=ACCEPT' + client, _ = self._setup(EnableHandler) + self.assertFalse(client.utf8_enabled) + with self.assertRaisesRegex(imaplib.IMAP4.error, 'ENABLE.*NONAUTH'): + client.enable('foo') + self.assertFalse(client.utf8_enabled) + + def test_enable_raises_error_if_no_capability(self): + client, _ = self._setup(SimpleIMAPHandler) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'does not support ENABLE'): + client.enable('foo') + + def test_enable_UTF8_raises_error_if_not_supported(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'does not support ENABLE'): + client.enable('UTF8=ACCEPT') + + def test_enable_UTF8_True_append(self): + class UTF8AppendServer(SimpleIMAPHandler): + capabilities = 'ENABLE UTF8=ACCEPT' + def cmd_ENABLE(self, tag, args): + self._send_tagged(tag, 'OK', 'ENABLE successful') + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + def cmd_APPEND(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'okay') + client, server = self._setup(UTF8AppendServer) + self.assertEqual(client._encoding, 'ascii') + code, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + code, _ = client.enable('UTF8=ACCEPT') + self.assertEqual(code, 'OK') + self.assertEqual(client._encoding, 'utf-8') + msg_string = 'Subject: ???????' + typ, data = client.append(None, None, None, msg_string.encode('utf-8')) + self.assertEqual(typ, 'OK') + self.assertEqual(server.response, + ('UTF8 (%s)\r\n' % msg_string).encode('utf-8')) + + def test_search_disallows_charset_in_utf8_mode(self): + class UTF8Server(SimpleIMAPHandler): + capabilities = 'AUTH ENABLE UTF8=ACCEPT' + def cmd_ENABLE(self, tag, args): + self._send_tagged(tag, 'OK', 'ENABLE successful') + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, _ = self._setup(UTF8Server) + typ, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(typ, 'OK') + typ, _ = client.enable('UTF8=ACCEPT') + self.assertEqual(typ, 'OK') + self.assertTrue(client.utf8_enabled) + with self.assertRaisesRegex(imaplib.IMAP4.error, 'charset.*UTF8'): + client.search('foo', 'bar') + + def test_bad_auth_name(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_tagged(tag, 'NO', + 'unrecognized authentication type {}'.format(args[0])) + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'unrecognized authentication type METHOD'): + client.authenticate('METHOD', lambda: 1) + + def test_invalid_authentication(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + self._send_tagged(tag, 'NO', '[AUTHENTICATIONFAILED] invalid') + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + r'\[AUTHENTICATIONFAILED\] invalid'): + client.authenticate('MYAUTH', lambda x: b'fake') + + def test_valid_authentication_bytes(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, server = self._setup(MyServer) + code, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + + def test_valid_authentication_plain_text(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, server = self._setup(MyServer) + code, _ = client.authenticate('MYAUTH', lambda x: 'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + + def test_login_cram_md5_bytes(self): + class AuthHandler(SimpleIMAPHandler): + capabilities = 'LOGINDISABLED AUTH=CRAM-MD5' + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm' + 'VzdG9uLm1jaS5uZXQ=') + r = yield + if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT' + b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'): + self._send_tagged(tag, 'OK', 'CRAM-MD5 successful') + else: + self._send_tagged(tag, 'NO', 'No access') + client, _ = self._setup(AuthHandler) + self.assertTrue('AUTH=CRAM-MD5' in client.capabilities) + ret, _ = client.login_cram_md5("tim", b"tanstaaftanstaaf") + self.assertEqual(ret, "OK") + + def test_login_cram_md5_plain_text(self): + class AuthHandler(SimpleIMAPHandler): + capabilities = 'LOGINDISABLED AUTH=CRAM-MD5' + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm' + 'VzdG9uLm1jaS5uZXQ=') + r = yield + if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT' + b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'): + self._send_tagged(tag, 'OK', 'CRAM-MD5 successful') + else: + self._send_tagged(tag, 'NO', 'No access') + client, _ = self._setup(AuthHandler) + self.assertTrue('AUTH=CRAM-MD5' in client.capabilities) + ret, _ = client.login_cram_md5("tim", "tanstaaftanstaaf") + self.assertEqual(ret, "OK") + + def test_aborted_authentication(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + if self.response == b'*\r\n': + self._send_tagged( + tag, + 'NO', + '[AUTHENTICATIONFAILED] aborted') + else: + self._send_tagged(tag, 'OK', 'MYAUTH successful') + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + r'\[AUTHENTICATIONFAILED\] aborted'): + client.authenticate('MYAUTH', lambda x: None) + + @mock.patch('imaplib._MAXLINE', 10) + def test_linetoolong(self): + class TooLongHandler(SimpleIMAPHandler): + def handle(self): + # send response line longer than the limit set in the next line + self.wfile.write(b'* OK ' + 11 * b'x' + b'\r\n') + _, server = self._setup(TooLongHandler, connect=False) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'got more than 10 bytes'): + self.imap_class(*server.server_address) + + def test_simple_with_statement(self): + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address): + pass + + def test_with_statement(self): + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address) as imap: + imap.login('user', 'pass') + self.assertEqual(server.logged, 'user') + self.assertIsNone(server.logged) + + def test_with_statement_logout(self): + # It is legal to log out explicitly inside the with block + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address) as imap: + imap.login('user', 'pass') + self.assertEqual(server.logged, 'user') + imap.logout() + self.assertIsNone(server.logged) + self.assertIsNone(server.logged) + + # command tests + + def test_login(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'LOGIN completed') + self.assertEqual(client.state, 'AUTH') + + def test_logout(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'LOGIN completed') + typ, data = client.logout() + self.assertEqual(typ, 'BYE') + self.assertEqual(data[0], b'IMAP4ref1 Server logging out') + self.assertEqual(client.state, 'LOGOUT') + + def test_lsub(self): + class LsubCmd(SimpleIMAPHandler): + def cmd_LSUB(self, tag, args): + self._send_textline('* LSUB () "." directoryA') + return self._send_tagged(tag, 'OK', 'LSUB completed') + client, _ = self._setup(LsubCmd) + client.login('user', 'pass') + typ, data = client.lsub() + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'() "." directoryA') + + +class NewIMAPTests(NewIMAPTestsMixin, unittest.TestCase): + imap_class = imaplib.IMAP4 + server_class = socketserver.TCPServer + + + at unittest.skipUnless(ssl, "SSL not available") +class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase): + imap_class = imaplib.IMAP4_SSL + server_class = SecureTCPServer + + def test_ssl_raises(self): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context.verify_mode = ssl.CERT_REQUIRED + ssl_context.check_hostname = True + ssl_context.load_verify_locations(CAFILE) + + with self.assertRaisesRegex(ssl.CertificateError, + "hostname '127.0.0.1' doesn't match 'localhost'"): + _, server = self._setup(SimpleIMAPHandler) + client = self.imap_class(*server.server_address, + ssl_context=ssl_context) + client.shutdown() + + def test_ssl_verified(self): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context.verify_mode = ssl.CERT_REQUIRED + ssl_context.check_hostname = True + ssl_context.load_verify_locations(CAFILE) + + _, server = self._setup(SimpleIMAPHandler) + client = self.imap_class("localhost", server.server_address[1], + ssl_context=ssl_context) + client.shutdown() + class ThreadedNetworkedTests(unittest.TestCase): server_class = socketserver.TCPServer imap_class = imaplib.IMAP4 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 21:35:29 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 25 Dec 2016 02:35:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge=3A_=2325591=3A_improve_imap_tests=2E?= Message-ID: <20161225023529.6349.60812.218442CE@psf.io> https://hg.python.org/cpython/rev/4663466b0d66 changeset: 105819:4663466b0d66 branch: 3.6 parent: 105815:48b9d9cdfe3b parent: 105818:75f9cca86fa1 user: R David Murray date: Sat Dec 24 21:34:05 2016 -0500 summary: Merge: #25591: improve imap tests. files: Lib/imaplib.py | 2 +- Lib/test/test_imaplib.py | 330 +++++++++++++++++++++++++++ 2 files changed, 331 insertions(+), 1 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -419,7 +419,7 @@ self.literal = _Authenticator(authobject).process typ, dat = self._simple_command('AUTHENTICATE', mech) if typ != 'OK': - raise self.error(dat[-1]) + raise self.error(dat[-1].decode('utf-8', 'replace')) self.state = 'AUTH' return typ, dat diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -10,10 +10,12 @@ import socketserver import time import calendar +import inspect from test.support import (reap_threads, verbose, transient_internet, run_with_tz, run_with_locale) import unittest +from unittest import mock from datetime import datetime, timezone, timedelta try: import ssl @@ -174,6 +176,334 @@ self._send_tagged(tag, 'OK', 'LOGIN completed') +class NewIMAPTestsMixin(): + client = None + + def _setup(self, imap_handler, connect=True): + """ + Sets up imap_handler for tests. imap_handler should inherit from either: + - SimpleIMAPHandler - for testing IMAP commands, + - socketserver.StreamRequestHandler - if raw access to stream is needed. + Returns (client, server). + """ + class TestTCPServer(self.server_class): + def handle_error(self, request, client_address): + """ + End request and raise the error if one occurs. + """ + self.close_request(request) + self.server_close() + raise + + self.addCleanup(self._cleanup) + self.server = self.server_class((support.HOST, 0), imap_handler) + self.thread = threading.Thread( + name=self._testMethodName+'-server', + target=self.server.serve_forever, + # Short poll interval to make the test finish quickly. + # Time between requests is short enough that we won't wake + # up spuriously too many times. + kwargs={'poll_interval': 0.01}) + self.thread.daemon = True # In case this function raises. + self.thread.start() + + if connect: + self.client = self.imap_class(*self.server.server_address) + + return self.client, self.server + + def _cleanup(self): + """ + Cleans up the test server. This method should not be called manually, + it is added to the cleanup queue in the _setup method already. + """ + # if logout was called already we'd raise an exception trying to + # shutdown the client once again + if self.client is not None and self.client.state != 'LOGOUT': + self.client.shutdown() + # cleanup the server + self.server.shutdown() + self.server.server_close() + self.thread.join(3.0) + + def test_EOF_without_complete_welcome_message(self): + # http://bugs.python.org/issue5949 + class EOFHandler(socketserver.StreamRequestHandler): + def handle(self): + self.wfile.write(b'* OK') + _, server = self._setup(EOFHandler, connect=False) + self.assertRaises(imaplib.IMAP4.abort, self.imap_class, + *server.server_address) + + def test_line_termination(self): + class BadNewlineHandler(SimpleIMAPHandler): + def cmd_CAPABILITY(self, tag, args): + self._send(b'* CAPABILITY IMAP4rev1 AUTH\n') + self._send_tagged(tag, 'OK', 'CAPABILITY completed') + _, server = self._setup(BadNewlineHandler, connect=False) + self.assertRaises(imaplib.IMAP4.abort, self.imap_class, + *server.server_address) + + def test_enable_raises_error_if_not_AUTH(self): + class EnableHandler(SimpleIMAPHandler): + capabilities = 'AUTH ENABLE UTF8=ACCEPT' + client, _ = self._setup(EnableHandler) + self.assertFalse(client.utf8_enabled) + with self.assertRaisesRegex(imaplib.IMAP4.error, 'ENABLE.*NONAUTH'): + client.enable('foo') + self.assertFalse(client.utf8_enabled) + + def test_enable_raises_error_if_no_capability(self): + client, _ = self._setup(SimpleIMAPHandler) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'does not support ENABLE'): + client.enable('foo') + + def test_enable_UTF8_raises_error_if_not_supported(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'does not support ENABLE'): + client.enable('UTF8=ACCEPT') + + def test_enable_UTF8_True_append(self): + class UTF8AppendServer(SimpleIMAPHandler): + capabilities = 'ENABLE UTF8=ACCEPT' + def cmd_ENABLE(self, tag, args): + self._send_tagged(tag, 'OK', 'ENABLE successful') + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + def cmd_APPEND(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'okay') + client, server = self._setup(UTF8AppendServer) + self.assertEqual(client._encoding, 'ascii') + code, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + code, _ = client.enable('UTF8=ACCEPT') + self.assertEqual(code, 'OK') + self.assertEqual(client._encoding, 'utf-8') + msg_string = 'Subject: ???????' + typ, data = client.append(None, None, None, msg_string.encode('utf-8')) + self.assertEqual(typ, 'OK') + self.assertEqual(server.response, + ('UTF8 (%s)\r\n' % msg_string).encode('utf-8')) + + def test_search_disallows_charset_in_utf8_mode(self): + class UTF8Server(SimpleIMAPHandler): + capabilities = 'AUTH ENABLE UTF8=ACCEPT' + def cmd_ENABLE(self, tag, args): + self._send_tagged(tag, 'OK', 'ENABLE successful') + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, _ = self._setup(UTF8Server) + typ, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(typ, 'OK') + typ, _ = client.enable('UTF8=ACCEPT') + self.assertEqual(typ, 'OK') + self.assertTrue(client.utf8_enabled) + with self.assertRaisesRegex(imaplib.IMAP4.error, 'charset.*UTF8'): + client.search('foo', 'bar') + + def test_bad_auth_name(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_tagged(tag, 'NO', + 'unrecognized authentication type {}'.format(args[0])) + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'unrecognized authentication type METHOD'): + client.authenticate('METHOD', lambda: 1) + + def test_invalid_authentication(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + self._send_tagged(tag, 'NO', '[AUTHENTICATIONFAILED] invalid') + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + r'\[AUTHENTICATIONFAILED\] invalid'): + client.authenticate('MYAUTH', lambda x: b'fake') + + def test_valid_authentication_bytes(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, server = self._setup(MyServer) + code, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + + def test_valid_authentication_plain_text(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, server = self._setup(MyServer) + code, _ = client.authenticate('MYAUTH', lambda x: 'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + + def test_login_cram_md5_bytes(self): + class AuthHandler(SimpleIMAPHandler): + capabilities = 'LOGINDISABLED AUTH=CRAM-MD5' + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm' + 'VzdG9uLm1jaS5uZXQ=') + r = yield + if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT' + b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'): + self._send_tagged(tag, 'OK', 'CRAM-MD5 successful') + else: + self._send_tagged(tag, 'NO', 'No access') + client, _ = self._setup(AuthHandler) + self.assertTrue('AUTH=CRAM-MD5' in client.capabilities) + ret, _ = client.login_cram_md5("tim", b"tanstaaftanstaaf") + self.assertEqual(ret, "OK") + + def test_login_cram_md5_plain_text(self): + class AuthHandler(SimpleIMAPHandler): + capabilities = 'LOGINDISABLED AUTH=CRAM-MD5' + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm' + 'VzdG9uLm1jaS5uZXQ=') + r = yield + if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT' + b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'): + self._send_tagged(tag, 'OK', 'CRAM-MD5 successful') + else: + self._send_tagged(tag, 'NO', 'No access') + client, _ = self._setup(AuthHandler) + self.assertTrue('AUTH=CRAM-MD5' in client.capabilities) + ret, _ = client.login_cram_md5("tim", "tanstaaftanstaaf") + self.assertEqual(ret, "OK") + + def test_aborted_authentication(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + if self.response == b'*\r\n': + self._send_tagged( + tag, + 'NO', + '[AUTHENTICATIONFAILED] aborted') + else: + self._send_tagged(tag, 'OK', 'MYAUTH successful') + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + r'\[AUTHENTICATIONFAILED\] aborted'): + client.authenticate('MYAUTH', lambda x: None) + + @mock.patch('imaplib._MAXLINE', 10) + def test_linetoolong(self): + class TooLongHandler(SimpleIMAPHandler): + def handle(self): + # send response line longer than the limit set in the next line + self.wfile.write(b'* OK ' + 11 * b'x' + b'\r\n') + _, server = self._setup(TooLongHandler, connect=False) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'got more than 10 bytes'): + self.imap_class(*server.server_address) + + def test_simple_with_statement(self): + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address): + pass + + def test_with_statement(self): + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address) as imap: + imap.login('user', 'pass') + self.assertEqual(server.logged, 'user') + self.assertIsNone(server.logged) + + def test_with_statement_logout(self): + # It is legal to log out explicitly inside the with block + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address) as imap: + imap.login('user', 'pass') + self.assertEqual(server.logged, 'user') + imap.logout() + self.assertIsNone(server.logged) + self.assertIsNone(server.logged) + + # command tests + + def test_login(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'LOGIN completed') + self.assertEqual(client.state, 'AUTH') + + def test_logout(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'LOGIN completed') + typ, data = client.logout() + self.assertEqual(typ, 'BYE') + self.assertEqual(data[0], b'IMAP4ref1 Server logging out') + self.assertEqual(client.state, 'LOGOUT') + + def test_lsub(self): + class LsubCmd(SimpleIMAPHandler): + def cmd_LSUB(self, tag, args): + self._send_textline('* LSUB () "." directoryA') + return self._send_tagged(tag, 'OK', 'LSUB completed') + client, _ = self._setup(LsubCmd) + client.login('user', 'pass') + typ, data = client.lsub() + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'() "." directoryA') + + +class NewIMAPTests(NewIMAPTestsMixin, unittest.TestCase): + imap_class = imaplib.IMAP4 + server_class = socketserver.TCPServer + + + at unittest.skipUnless(ssl, "SSL not available") +class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase): + imap_class = imaplib.IMAP4_SSL + server_class = SecureTCPServer + + def test_ssl_raises(self): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context.verify_mode = ssl.CERT_REQUIRED + ssl_context.check_hostname = True + ssl_context.load_verify_locations(CAFILE) + + with self.assertRaisesRegex(ssl.CertificateError, + "hostname '127.0.0.1' doesn't match 'localhost'"): + _, server = self._setup(SimpleIMAPHandler) + client = self.imap_class(*server.server_address, + ssl_context=ssl_context) + client.shutdown() + + def test_ssl_verified(self): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context.verify_mode = ssl.CERT_REQUIRED + ssl_context.check_hostname = True + ssl_context.load_verify_locations(CAFILE) + + _, server = self._setup(SimpleIMAPHandler) + client = self.imap_class("localhost", server.server_address[1], + ssl_context=ssl_context) + client.shutdown() + class ThreadedNetworkedTests(unittest.TestCase): server_class = socketserver.TCPServer imap_class = imaplib.IMAP4 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 24 21:35:29 2016 From: python-checkins at python.org (r.david.murray) Date: Sun, 25 Dec 2016 02:35:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2325591=3A_improve_imap_tests=2E?= Message-ID: <20161225023529.3544.50180.DC48C55F@psf.io> https://hg.python.org/cpython/rev/93d8cce449eb changeset: 105820:93d8cce449eb parent: 105816:7ceacac48cd2 parent: 105819:4663466b0d66 user: R David Murray date: Sat Dec 24 21:35:01 2016 -0500 summary: Merge: #25591: improve imap tests. files: Lib/imaplib.py | 2 +- Lib/test/test_imaplib.py | 330 +++++++++++++++++++++++++++ 2 files changed, 331 insertions(+), 1 deletions(-) diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -419,7 +419,7 @@ self.literal = _Authenticator(authobject).process typ, dat = self._simple_command('AUTHENTICATE', mech) if typ != 'OK': - raise self.error(dat[-1]) + raise self.error(dat[-1].decode('utf-8', 'replace')) self.state = 'AUTH' return typ, dat diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -10,10 +10,12 @@ import socketserver import time import calendar +import inspect from test.support import (reap_threads, verbose, transient_internet, run_with_tz, run_with_locale) import unittest +from unittest import mock from datetime import datetime, timezone, timedelta try: import ssl @@ -174,6 +176,334 @@ self._send_tagged(tag, 'OK', 'LOGIN completed') +class NewIMAPTestsMixin(): + client = None + + def _setup(self, imap_handler, connect=True): + """ + Sets up imap_handler for tests. imap_handler should inherit from either: + - SimpleIMAPHandler - for testing IMAP commands, + - socketserver.StreamRequestHandler - if raw access to stream is needed. + Returns (client, server). + """ + class TestTCPServer(self.server_class): + def handle_error(self, request, client_address): + """ + End request and raise the error if one occurs. + """ + self.close_request(request) + self.server_close() + raise + + self.addCleanup(self._cleanup) + self.server = self.server_class((support.HOST, 0), imap_handler) + self.thread = threading.Thread( + name=self._testMethodName+'-server', + target=self.server.serve_forever, + # Short poll interval to make the test finish quickly. + # Time between requests is short enough that we won't wake + # up spuriously too many times. + kwargs={'poll_interval': 0.01}) + self.thread.daemon = True # In case this function raises. + self.thread.start() + + if connect: + self.client = self.imap_class(*self.server.server_address) + + return self.client, self.server + + def _cleanup(self): + """ + Cleans up the test server. This method should not be called manually, + it is added to the cleanup queue in the _setup method already. + """ + # if logout was called already we'd raise an exception trying to + # shutdown the client once again + if self.client is not None and self.client.state != 'LOGOUT': + self.client.shutdown() + # cleanup the server + self.server.shutdown() + self.server.server_close() + self.thread.join(3.0) + + def test_EOF_without_complete_welcome_message(self): + # http://bugs.python.org/issue5949 + class EOFHandler(socketserver.StreamRequestHandler): + def handle(self): + self.wfile.write(b'* OK') + _, server = self._setup(EOFHandler, connect=False) + self.assertRaises(imaplib.IMAP4.abort, self.imap_class, + *server.server_address) + + def test_line_termination(self): + class BadNewlineHandler(SimpleIMAPHandler): + def cmd_CAPABILITY(self, tag, args): + self._send(b'* CAPABILITY IMAP4rev1 AUTH\n') + self._send_tagged(tag, 'OK', 'CAPABILITY completed') + _, server = self._setup(BadNewlineHandler, connect=False) + self.assertRaises(imaplib.IMAP4.abort, self.imap_class, + *server.server_address) + + def test_enable_raises_error_if_not_AUTH(self): + class EnableHandler(SimpleIMAPHandler): + capabilities = 'AUTH ENABLE UTF8=ACCEPT' + client, _ = self._setup(EnableHandler) + self.assertFalse(client.utf8_enabled) + with self.assertRaisesRegex(imaplib.IMAP4.error, 'ENABLE.*NONAUTH'): + client.enable('foo') + self.assertFalse(client.utf8_enabled) + + def test_enable_raises_error_if_no_capability(self): + client, _ = self._setup(SimpleIMAPHandler) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'does not support ENABLE'): + client.enable('foo') + + def test_enable_UTF8_raises_error_if_not_supported(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'does not support ENABLE'): + client.enable('UTF8=ACCEPT') + + def test_enable_UTF8_True_append(self): + class UTF8AppendServer(SimpleIMAPHandler): + capabilities = 'ENABLE UTF8=ACCEPT' + def cmd_ENABLE(self, tag, args): + self._send_tagged(tag, 'OK', 'ENABLE successful') + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + def cmd_APPEND(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'okay') + client, server = self._setup(UTF8AppendServer) + self.assertEqual(client._encoding, 'ascii') + code, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + code, _ = client.enable('UTF8=ACCEPT') + self.assertEqual(code, 'OK') + self.assertEqual(client._encoding, 'utf-8') + msg_string = 'Subject: ???????' + typ, data = client.append(None, None, None, msg_string.encode('utf-8')) + self.assertEqual(typ, 'OK') + self.assertEqual(server.response, + ('UTF8 (%s)\r\n' % msg_string).encode('utf-8')) + + def test_search_disallows_charset_in_utf8_mode(self): + class UTF8Server(SimpleIMAPHandler): + capabilities = 'AUTH ENABLE UTF8=ACCEPT' + def cmd_ENABLE(self, tag, args): + self._send_tagged(tag, 'OK', 'ENABLE successful') + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, _ = self._setup(UTF8Server) + typ, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(typ, 'OK') + typ, _ = client.enable('UTF8=ACCEPT') + self.assertEqual(typ, 'OK') + self.assertTrue(client.utf8_enabled) + with self.assertRaisesRegex(imaplib.IMAP4.error, 'charset.*UTF8'): + client.search('foo', 'bar') + + def test_bad_auth_name(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_tagged(tag, 'NO', + 'unrecognized authentication type {}'.format(args[0])) + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'unrecognized authentication type METHOD'): + client.authenticate('METHOD', lambda: 1) + + def test_invalid_authentication(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + self._send_tagged(tag, 'NO', '[AUTHENTICATIONFAILED] invalid') + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + r'\[AUTHENTICATIONFAILED\] invalid'): + client.authenticate('MYAUTH', lambda x: b'fake') + + def test_valid_authentication_bytes(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, server = self._setup(MyServer) + code, _ = client.authenticate('MYAUTH', lambda x: b'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + + def test_valid_authentication_plain_text(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.server.response = yield + self._send_tagged(tag, 'OK', 'FAKEAUTH successful') + client, server = self._setup(MyServer) + code, _ = client.authenticate('MYAUTH', lambda x: 'fake') + self.assertEqual(code, 'OK') + self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake' + + def test_login_cram_md5_bytes(self): + class AuthHandler(SimpleIMAPHandler): + capabilities = 'LOGINDISABLED AUTH=CRAM-MD5' + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm' + 'VzdG9uLm1jaS5uZXQ=') + r = yield + if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT' + b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'): + self._send_tagged(tag, 'OK', 'CRAM-MD5 successful') + else: + self._send_tagged(tag, 'NO', 'No access') + client, _ = self._setup(AuthHandler) + self.assertTrue('AUTH=CRAM-MD5' in client.capabilities) + ret, _ = client.login_cram_md5("tim", b"tanstaaftanstaaf") + self.assertEqual(ret, "OK") + + def test_login_cram_md5_plain_text(self): + class AuthHandler(SimpleIMAPHandler): + capabilities = 'LOGINDISABLED AUTH=CRAM-MD5' + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+ PDE4OTYuNjk3MTcwOTUyQHBvc3RvZmZpY2Uucm' + 'VzdG9uLm1jaS5uZXQ=') + r = yield + if (r == b'dGltIGYxY2E2YmU0NjRiOWVmYT' + b'FjY2E2ZmZkNmNmMmQ5ZjMy\r\n'): + self._send_tagged(tag, 'OK', 'CRAM-MD5 successful') + else: + self._send_tagged(tag, 'NO', 'No access') + client, _ = self._setup(AuthHandler) + self.assertTrue('AUTH=CRAM-MD5' in client.capabilities) + ret, _ = client.login_cram_md5("tim", "tanstaaftanstaaf") + self.assertEqual(ret, "OK") + + def test_aborted_authentication(self): + class MyServer(SimpleIMAPHandler): + def cmd_AUTHENTICATE(self, tag, args): + self._send_textline('+') + self.response = yield + if self.response == b'*\r\n': + self._send_tagged( + tag, + 'NO', + '[AUTHENTICATIONFAILED] aborted') + else: + self._send_tagged(tag, 'OK', 'MYAUTH successful') + client, _ = self._setup(MyServer) + with self.assertRaisesRegex(imaplib.IMAP4.error, + r'\[AUTHENTICATIONFAILED\] aborted'): + client.authenticate('MYAUTH', lambda x: None) + + @mock.patch('imaplib._MAXLINE', 10) + def test_linetoolong(self): + class TooLongHandler(SimpleIMAPHandler): + def handle(self): + # send response line longer than the limit set in the next line + self.wfile.write(b'* OK ' + 11 * b'x' + b'\r\n') + _, server = self._setup(TooLongHandler, connect=False) + with self.assertRaisesRegex(imaplib.IMAP4.error, + 'got more than 10 bytes'): + self.imap_class(*server.server_address) + + def test_simple_with_statement(self): + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address): + pass + + def test_with_statement(self): + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address) as imap: + imap.login('user', 'pass') + self.assertEqual(server.logged, 'user') + self.assertIsNone(server.logged) + + def test_with_statement_logout(self): + # It is legal to log out explicitly inside the with block + _, server = self._setup(SimpleIMAPHandler, connect=False) + with self.imap_class(*server.server_address) as imap: + imap.login('user', 'pass') + self.assertEqual(server.logged, 'user') + imap.logout() + self.assertIsNone(server.logged) + self.assertIsNone(server.logged) + + # command tests + + def test_login(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'LOGIN completed') + self.assertEqual(client.state, 'AUTH') + + def test_logout(self): + client, _ = self._setup(SimpleIMAPHandler) + typ, data = client.login('user', 'pass') + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'LOGIN completed') + typ, data = client.logout() + self.assertEqual(typ, 'BYE') + self.assertEqual(data[0], b'IMAP4ref1 Server logging out') + self.assertEqual(client.state, 'LOGOUT') + + def test_lsub(self): + class LsubCmd(SimpleIMAPHandler): + def cmd_LSUB(self, tag, args): + self._send_textline('* LSUB () "." directoryA') + return self._send_tagged(tag, 'OK', 'LSUB completed') + client, _ = self._setup(LsubCmd) + client.login('user', 'pass') + typ, data = client.lsub() + self.assertEqual(typ, 'OK') + self.assertEqual(data[0], b'() "." directoryA') + + +class NewIMAPTests(NewIMAPTestsMixin, unittest.TestCase): + imap_class = imaplib.IMAP4 + server_class = socketserver.TCPServer + + + at unittest.skipUnless(ssl, "SSL not available") +class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase): + imap_class = imaplib.IMAP4_SSL + server_class = SecureTCPServer + + def test_ssl_raises(self): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context.verify_mode = ssl.CERT_REQUIRED + ssl_context.check_hostname = True + ssl_context.load_verify_locations(CAFILE) + + with self.assertRaisesRegex(ssl.CertificateError, + "hostname '127.0.0.1' doesn't match 'localhost'"): + _, server = self._setup(SimpleIMAPHandler) + client = self.imap_class(*server.server_address, + ssl_context=ssl_context) + client.shutdown() + + def test_ssl_verified(self): + ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + ssl_context.verify_mode = ssl.CERT_REQUIRED + ssl_context.check_hostname = True + ssl_context.load_verify_locations(CAFILE) + + _, server = self._setup(SimpleIMAPHandler) + client = self.imap_class("localhost", server.server_address[1], + ssl_context=ssl_context) + client.shutdown() + class ThreadedNetworkedTests(unittest.TestCase): server_class = socketserver.TCPServer imap_class = imaplib.IMAP4 -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Dec 25 04:58:49 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 25 Dec 2016 09:58:49 +0000 Subject: [Python-checkins] Daily reference leaks (93d8cce449eb): sum=130349 Message-ID: <20161225095849.80070.72055.4F9CE6C7@psf.io> results for 93d8cce449eb on branch "default" -------------------------------------------- test_exceptions leaked [1227, 1227, 1227] references, sum=3681 test_exceptions leaked [342, 344, 344] memory blocks, sum=1030 test_capi leaked [6043, 6043, 6043] references, sum=18129 test_capi leaked [1715, 1717, 1717] memory blocks, sum=5149 test_cgi leaked [68, 68, 68] references, sum=204 test_cgi leaked [34, 34, 35] memory blocks, sum=103 test_collections leaked [0, -7, 8] memory blocks, sum=1 test_contextlib leaked [2162, 2162, 2162] references, sum=6486 test_contextlib leaked [635, 637, 637] memory blocks, sum=1909 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_importlib leaked [3068, 3068, 3068] references, sum=9204 test_importlib leaked [936, 938, 938] memory blocks, sum=2812 test_inspect leaked [34, 34, 34] references, sum=102 test_inspect leaked [10, 11, 10] memory blocks, sum=31 test_os leaked [182, 182, 182] references, sum=546 test_os leaked [112, 112, 112] memory blocks, sum=336 test_ssl leaked [3403, 3406, 3406] references, sum=10215 test_ssl leaked [977, 980, 980] memory blocks, sum=2937 test_threading leaked [12086, 12086, 12086] references, sum=36258 test_threading leaked [3430, 3432, 3432] memory blocks, sum=10294 test_timeout leaked [701, 701, 701] references, sum=2103 test_timeout leaked [203, 204, 204] memory blocks, sum=611 test_xml_etree leaked [3937, 3937, 3937] references, sum=11811 test_xml_etree leaked [1517, 1520, 1521] memory blocks, sum=4558 test_xml_etree_c leaked [354, 354, 354] references, sum=1062 test_xml_etree_c leaked [216, 217, 217] memory blocks, sum=650 test_yield_from leaked [33, 33, 33] references, sum=99 test_yield_from leaked [8, 8, 8] memory blocks, sum=24 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogApfV4L', '--timeout', '7200'] From python-checkins at python.org Sun Dec 25 09:24:32 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 25 Dec 2016 14:24:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_from_3=2E5=2E?= Message-ID: <20161225142432.17833.57397.BF5A7BA2@psf.io> https://hg.python.org/cpython/rev/02acb2f9c908 changeset: 105822:02acb2f9c908 branch: 3.6 parent: 105819:4663466b0d66 parent: 105821:34e7b9879e60 user: Serhiy Storchaka date: Sun Dec 25 16:23:42 2016 +0200 summary: Merge from 3.5. files: Doc/c-api/exceptions.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -396,7 +396,7 @@ by code that needs to save and restore the error indicator temporarily, e.g.:: { - PyObject **type, **value, **traceback; + PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); /* ... code that might produce other errors ... */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 25 09:24:32 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 25 Dec 2016 14:24:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDY4?= =?utf-8?q?=3A_Fixed_a_typo_in_PyErr=5FFetch_example=2E?= Message-ID: <20161225142431.19780.72457.9176DB5D@psf.io> https://hg.python.org/cpython/rev/34e7b9879e60 changeset: 105821:34e7b9879e60 branch: 3.5 parent: 105818:75f9cca86fa1 user: Serhiy Storchaka date: Sun Dec 25 16:22:23 2016 +0200 summary: Issue #29068: Fixed a typo in PyErr_Fetch example. Patch by Chi Hsuan Yen. files: Doc/c-api/exceptions.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -381,7 +381,7 @@ by code that needs to save and restore the error indicator temporarily, e.g.:: { - PyObject **type, **value, **traceback; + PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); /* ... code that might produce other errors ... */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Dec 25 09:24:33 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 25 Dec 2016 14:24:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgZnJvbSAzLjYu?= Message-ID: <20161225142432.107561.76056.7E906910@psf.io> https://hg.python.org/cpython/rev/eb1aa6f8701e changeset: 105823:eb1aa6f8701e parent: 105820:93d8cce449eb parent: 105822:02acb2f9c908 user: Serhiy Storchaka date: Sun Dec 25 16:24:15 2016 +0200 summary: Merge from 3.6. files: Doc/c-api/exceptions.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -396,7 +396,7 @@ by code that needs to save and restore the error indicator temporarily, e.g.:: { - PyObject **type, **value, **traceback; + PyObject *type, *value, *traceback; PyErr_Fetch(&type, &value, &traceback); /* ... code that might produce other errors ... */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 26 04:01:54 2016 From: python-checkins at python.org (inada.naoki) Date: Mon, 26 Dec 2016 09:01:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329049=3A_Fix_refl?= =?utf-8?q?eak_introduced_by_f5eb0c4f5d37=2E?= Message-ID: <20161226090153.107388.85084.F7661025@psf.io> https://hg.python.org/cpython/rev/d6913acb31e3 changeset: 105824:d6913acb31e3 user: INADA Naoki date: Mon Dec 26 18:01:46 2016 +0900 summary: Issue #29049: Fix refleak introduced by f5eb0c4f5d37. files: Python/ceval.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4152,8 +4152,11 @@ } else { gen = PyGen_NewWithQualName(f, name, qualname); } - if (gen == NULL) + if (gen == NULL) { + Py_DECREF(f); return NULL; + } + _PyObject_GC_TRACK(f); if (is_coro && coro_wrapper != NULL) { PyObject *wrapped; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 26 04:54:48 2016 From: python-checkins at python.org (inada.naoki) Date: Mon, 26 Dec 2016 09:54:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329049=3A_Remove_u?= =?utf-8?q?nnecessary_Py=5FDECREF?= Message-ID: <20161226095448.80407.30279.51D329D0@psf.io> https://hg.python.org/cpython/rev/5f3ac68f34f2 changeset: 105825:5f3ac68f34f2 user: INADA Naoki date: Mon Dec 26 18:52:46 2016 +0900 summary: Issue #29049: Remove unnecessary Py_DECREF files: Python/ceval.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4153,9 +4153,9 @@ gen = PyGen_NewWithQualName(f, name, qualname); } if (gen == NULL) { - Py_DECREF(f); return NULL; } + _PyObject_GC_TRACK(f); if (is_coro && coro_wrapper != NULL) { -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Dec 26 04:58:11 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 26 Dec 2016 09:58:11 +0000 Subject: [Python-checkins] Daily reference leaks (eb1aa6f8701e): sum=130344 Message-ID: <20161226095811.5828.91151.472E018F@psf.io> results for eb1aa6f8701e on branch "default" -------------------------------------------- test_exceptions leaked [1227, 1227, 1227] references, sum=3681 test_exceptions leaked [342, 344, 344] memory blocks, sum=1030 test_capi leaked [6043, 6043, 6043] references, sum=18129 test_capi leaked [1715, 1717, 1717] memory blocks, sum=5149 test_cgi leaked [68, 68, 68] references, sum=204 test_cgi leaked [34, 34, 35] memory blocks, sum=103 test_collections leaked [0, 0, -7] memory blocks, sum=-7 test_contextlib leaked [2162, 2162, 2162] references, sum=6486 test_contextlib leaked [635, 637, 637] memory blocks, sum=1909 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_importlib leaked [3068, 3068, 3068] references, sum=9204 test_importlib leaked [936, 938, 938] memory blocks, sum=2812 test_inspect leaked [34, 34, 34] references, sum=102 test_inspect leaked [10, 10, 10] memory blocks, sum=30 test_os leaked [182, 182, 182] references, sum=546 test_os leaked [112, 112, 112] memory blocks, sum=336 test_ssl leaked [3406, 3406, 3406] references, sum=10218 test_ssl leaked [978, 980, 980] memory blocks, sum=2938 test_threading leaked [12086, 12086, 12086] references, sum=36258 test_threading leaked [3430, 3432, 3432] memory blocks, sum=10294 test_timeout leaked [701, 701, 701] references, sum=2103 test_timeout leaked [203, 204, 204] memory blocks, sum=611 test_xml_etree leaked [3937, 3937, 3937] references, sum=11811 test_xml_etree leaked [1517, 1520, 1521] memory blocks, sum=4558 test_xml_etree_c leaked [354, 354, 354] references, sum=1062 test_xml_etree_c leaked [216, 217, 217] memory blocks, sum=650 test_yield_from leaked [33, 33, 33] references, sum=99 test_yield_from leaked [8, 8, 8] memory blocks, sum=24 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogl024xw', '--timeout', '7200'] From python-checkins at python.org Mon Dec 26 22:19:58 2016 From: python-checkins at python.org (inada.naoki) Date: Tue, 27 Dec 2016 03:19:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329062=3A_doc=3A_F?= =?utf-8?q?ix_hashlib_module_index_conflict?= Message-ID: <20161227031958.19780.71805.91D0AEFF@psf.io> https://hg.python.org/cpython/rev/1970c9ea8572 changeset: 105826:1970c9ea8572 user: INADA Naoki date: Tue Dec 27 12:19:51 2016 +0900 summary: Issue #29062: doc: Fix hashlib module index conflict files: Doc/library/hashlib-blake2.rst | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Doc/library/hashlib-blake2.rst b/Doc/library/hashlib-blake2.rst --- a/Doc/library/hashlib-blake2.rst +++ b/Doc/library/hashlib-blake2.rst @@ -3,8 +3,7 @@ :mod:`hashlib` --- BLAKE2 hash functions ======================================== -.. module:: hashlib - :synopsis: BLAKE2 hash function for Python +.. currentmodule:: hashlib .. sectionauthor:: Dmitry Chestnykh .. index:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 26 23:39:08 2016 From: python-checkins at python.org (xiang.zhang) Date: Tue, 27 Dec 2016 04:39:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDc4?= =?utf-8?q?=3A_Add_the_missing_import_in_datetime=2Etime_doc_example=2E?= Message-ID: <20161227043908.17793.59883.74FB419E@psf.io> https://hg.python.org/cpython/rev/172b2ac82037 changeset: 105828:172b2ac82037 branch: 3.5 parent: 105821:34e7b9879e60 user: Xiang Zhang date: Tue Dec 27 12:23:59 2016 +0800 summary: Issue #29078: Add the missing import in datetime.time doc example. Patch by Dhushyanth Ramasamy. files: Doc/library/datetime.rst | 2 +- Misc/ACKS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1460,7 +1460,7 @@ Example: - >>> from datetime import time, tzinfo + >>> from datetime import time, tzinfo, timedelta >>> class GMT1(tzinfo): ... def utcoffset(self, dt): ... return timedelta(hours=1) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1677,7 +1677,6 @@ Yuxiao Zeng Uwe Zessin Cheng Zhang -Xiang Zhang Kai Zhu Tarek Ziad? Jelle Zijlstra @@ -1686,3 +1685,4 @@ Peter ?strand evilzero Chi Hsuan Yen +Dhushyanth Ramasamy -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 26 23:39:08 2016 From: python-checkins at python.org (xiang.zhang) Date: Tue, 27 Dec 2016 04:39:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MDc4?= =?utf-8?q?=3A_Add_the_missing_import_in_datetime=2Etime_doc_example=2E?= Message-ID: <20161227043908.107800.63949.7491CC1B@psf.io> https://hg.python.org/cpython/rev/878a91174e74 changeset: 105827:878a91174e74 branch: 2.7 parent: 105817:41a99a2a7198 user: Xiang Zhang date: Tue Dec 27 12:21:28 2016 +0800 summary: Issue #29078: Add the missing import in datetime.time doc example. Patch by Dhushyanth Ramasamy. files: Doc/library/datetime.rst | 2 +- Misc/ACKS | 1 + 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1323,7 +1323,7 @@ Example: - >>> from datetime import time, tzinfo + >>> from datetime import time, tzinfo, timedelta >>> class GMT1(tzinfo): ... def utcoffset(self, dt): ... return timedelta(hours=1) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1573,3 +1573,4 @@ Jelle Zijlstra Gennadiy Zlobin Peter ?strand +Dhushyanth Ramasamy \ No newline at end of file -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 26 23:39:08 2016 From: python-checkins at python.org (xiang.zhang) Date: Tue, 27 Dec 2016 04:39:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329078=3A_Merge_3=2E5=2E?= Message-ID: <20161227043908.26768.63810.19573486@psf.io> https://hg.python.org/cpython/rev/83b089b7ab43 changeset: 105829:83b089b7ab43 branch: 3.6 parent: 105822:02acb2f9c908 parent: 105828:172b2ac82037 user: Xiang Zhang date: Tue Dec 27 12:30:42 2016 +0800 summary: Issue #29078: Merge 3.5. files: Doc/library/datetime.rst | 2 +- Misc/ACKS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1582,7 +1582,7 @@ Example: - >>> from datetime import time, tzinfo + >>> from datetime import time, tzinfo, timedelta >>> class GMT1(tzinfo): ... def utcoffset(self, dt): ... return timedelta(hours=1) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1704,7 +1704,6 @@ Yuxiao Zeng Uwe Zessin Cheng Zhang -Xiang Zhang Kai Zhu Tarek Ziad? Jelle Zijlstra @@ -1712,3 +1711,4 @@ Doug Zongker Peter ?strand evilzero +Dhushyanth Ramasamy -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Dec 26 23:39:08 2016 From: python-checkins at python.org (xiang.zhang) Date: Tue, 27 Dec 2016 04:39:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI5MDc4OiBNZXJnZSAzLjYu?= Message-ID: <20161227043908.26768.96770.BD6CDB1E@psf.io> https://hg.python.org/cpython/rev/f35c3b0b6eda changeset: 105830:f35c3b0b6eda parent: 105826:1970c9ea8572 parent: 105829:83b089b7ab43 user: Xiang Zhang date: Tue Dec 27 12:32:33 2016 +0800 summary: Issue #29078: Merge 3.6. files: Doc/library/datetime.rst | 2 +- Misc/ACKS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1582,7 +1582,7 @@ Example: - >>> from datetime import time, tzinfo + >>> from datetime import time, tzinfo, timedelta >>> class GMT1(tzinfo): ... def utcoffset(self, dt): ... return timedelta(hours=1) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1707,7 +1707,6 @@ Yuxiao Zeng Uwe Zessin Cheng Zhang -Xiang Zhang Kai Zhu Tarek Ziad? Jelle Zijlstra @@ -1715,3 +1714,4 @@ Doug Zongker Peter ?strand evilzero +Dhushyanth Ramasamy -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 00:05:55 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 27 Dec 2016 05:05:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E6?= Message-ID: <20161227050555.106798.89299.0031E01C@psf.io> https://hg.python.org/cpython/rev/5006bf5b7735 changeset: 105832:5006bf5b7735 parent: 105830:f35c3b0b6eda parent: 105831:a48cc85e5706 user: Terry Jan Reedy date: Tue Dec 27 00:05:41 2016 -0500 summary: Merge with 3.6 files: Lib/idlelib/colorizer.py | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py --- a/Lib/idlelib/colorizer.py +++ b/Lib/idlelib/colorizer.py @@ -21,7 +21,8 @@ # 1st 'file' colorized normal, 2nd as builtin, 3rd as string builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) - stringprefix = r"(\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?" + stringprefix = (r"(\br|R|u|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF" + "|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?") sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?" dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?' sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" @@ -261,8 +262,14 @@ top = Toplevel(parent) top.title("Test ColorDelegator") x, y = map(int, parent.geometry().split('+')[1:]) - top.geometry("200x100+%d+%d" % (x + 250, y + 175)) - source = "if somename: x = 'abc' # comment\nprint\n" + top.geometry("600x200+%d+%d" % (x + 100, y + 175)) + source = ("# Following has syntax errors\n" + "if True: then int 1\nelif False: print 0\nelse: float(None)\n" + "#unicode and byte strings, valid prefixes should be colored\n" + "'x', '''x''', \"x\", \"\"\"x\"\"\"\n" + "r'x', u'x', R'x', U'x', f'x', F'x', ur'is invalid'\n" + "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n" + "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n") text = Text(top, background="white") text.pack(expand=1, fill="both") text.insert("insert", source) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 00:05:55 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 27 Dec 2016 05:05:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MDcx?= =?utf-8?q?=3A_IDLE_now_colors_f-string_prefixes_=28but_not_invalid_ur_pre?= =?utf-8?q?fixes=29=2E?= Message-ID: <20161227050555.80188.16583.59B1614A@psf.io> https://hg.python.org/cpython/rev/a48cc85e5706 changeset: 105831:a48cc85e5706 branch: 3.6 parent: 105829:83b089b7ab43 user: Terry Jan Reedy date: Tue Dec 27 00:05:26 2016 -0500 summary: Issue #29071: IDLE now colors f-string prefixes (but not invalid ur prefixes). files: Lib/idlelib/colorizer.py | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py --- a/Lib/idlelib/colorizer.py +++ b/Lib/idlelib/colorizer.py @@ -21,7 +21,8 @@ # 1st 'file' colorized normal, 2nd as builtin, 3rd as string builtin = r"([^.'\"\\#]\b|^)" + any("BUILTIN", builtinlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) - stringprefix = r"(\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?" + stringprefix = (r"(\br|R|u|U|f|F|fr|Fr|fR|FR|rf|rF|Rf|RF" + "|b|B|br|Br|bR|BR|rb|rB|Rb|RB)?") sqstring = stringprefix + r"'[^'\\\n]*(\\.[^'\\\n]*)*'?" dqstring = stringprefix + r'"[^"\\\n]*(\\.[^"\\\n]*)*"?' sq3string = stringprefix + r"'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" @@ -261,8 +262,14 @@ top = Toplevel(parent) top.title("Test ColorDelegator") x, y = map(int, parent.geometry().split('+')[1:]) - top.geometry("200x100+%d+%d" % (x + 250, y + 175)) - source = "if somename: x = 'abc' # comment\nprint\n" + top.geometry("600x200+%d+%d" % (x + 100, y + 175)) + source = ("# Following has syntax errors\n" + "if True: then int 1\nelif False: print 0\nelse: float(None)\n" + "#unicode and byte strings, valid prefixes should be colored\n" + "'x', '''x''', \"x\", \"\"\"x\"\"\"\n" + "r'x', u'x', R'x', U'x', f'x', F'x', ur'is invalid'\n" + "fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x'\n" + "b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x'.rB'x',Rb'x',RB'x'\n") text = Text(top, background="white") text.pack(expand=1, fill="both") text.insert("insert", source) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 01:07:23 2016 From: python-checkins at python.org (inada.naoki) Date: Tue, 27 Dec 2016 06:07:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329062=3A_doc=3A_F?= =?utf-8?q?ix_heading_level_of_hashlib-blake2?= Message-ID: <20161227060723.106849.30043.7412CA9F@psf.io> https://hg.python.org/cpython/rev/c75ef013bca3 changeset: 105833:c75ef013bca3 user: INADA Naoki date: Tue Dec 27 15:07:18 2016 +0900 summary: Issue #29062: doc: Fix heading level of hashlib-blake2 files: Doc/library/hashlib-blake2.rst | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Doc/library/hashlib-blake2.rst b/Doc/library/hashlib-blake2.rst --- a/Doc/library/hashlib-blake2.rst +++ b/Doc/library/hashlib-blake2.rst @@ -25,9 +25,6 @@ :mod:`hashlib` objects. -Module -====== - Creating hash objects --------------------- @@ -137,10 +134,10 @@ Examples -======== +-------- Simple hashing --------------- +^^^^^^^^^^^^^^ To calculate hash of some data, you should first construct a hash object by calling the appropriate constructor function (:func:`blake2b` or @@ -175,7 +172,7 @@ Using different digest sizes ----------------------------- +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to 32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without changing @@ -207,7 +204,7 @@ Keyed hashing -------------- +^^^^^^^^^^^^^ Keyed hashing can be used for authentication as a faster and simpler replacement for `Hash-based message authentication code @@ -260,7 +257,7 @@ Randomized hashing ------------------- +^^^^^^^^^^^^^^^^^^ By setting *salt* parameter users can introduce randomization to the hash function. Randomized hashing is useful for protecting against collision attacks @@ -316,7 +313,7 @@ Personalization ---------------- +^^^^^^^^^^^^^^^ Sometimes it is useful to force hash function to produce different digests for the same input for different purposes. Quoting the authors of the Skein hash @@ -361,7 +358,7 @@ G9GtHFE1YluXY1zWPlYk1e/nWfu0WSEb0KRcjhDeP/o= Tree mode ---------- +^^^^^^^^^ Here's an example of hashing a minimal tree with two leaf nodes:: @@ -399,7 +396,7 @@ '3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa' Credits -======= +------- BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 04:07:20 2016 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 27 Dec 2016 09:07:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161227090720.17793.10386.F446B11B@psf.io> https://hg.python.org/cpython/rev/a1a5260be005 changeset: 105835:a1a5260be005 parent: 105833:c75ef013bca3 parent: 105834:0001ae913759 user: Raymond Hettinger date: Tue Dec 27 01:07:13 2016 -0800 summary: merge files: Lib/random.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/random.py b/Lib/random.py --- a/Lib/random.py +++ b/Lib/random.py @@ -254,7 +254,7 @@ try: i = self._randbelow(len(seq)) except ValueError: - raise IndexError('Cannot choose from an empty sequence') + raise IndexError('Cannot choose from an empty sequence') from None return seq[i] def shuffle(self, x, random=None): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -714,6 +714,9 @@ - Issue 28923: Remove editor artifacts from Tix.py. +- Issue #29055: Neaten-up empty population error on random.choice() + by suppressing the upstream exception. + - Issue #28871: Fixed a crash when deallocate deep ElementTree. - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 04:07:20 2016 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 27 Dec 2016 09:07:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MDU1?= =?utf-8?q?=3A_Suppress_upstream_exception_for_random=2Echoice=28=29?= Message-ID: <20161227090720.27199.45371.EDD8D4B0@psf.io> https://hg.python.org/cpython/rev/0001ae913759 changeset: 105834:0001ae913759 branch: 3.6 parent: 105831:a48cc85e5706 user: Raymond Hettinger date: Tue Dec 27 01:06:52 2016 -0800 summary: Issue #29055: Suppress upstream exception for random.choice() files: Lib/random.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/random.py b/Lib/random.py --- a/Lib/random.py +++ b/Lib/random.py @@ -254,7 +254,7 @@ try: i = self._randbelow(len(seq)) except ValueError: - raise IndexError('Cannot choose from an empty sequence') + raise IndexError('Cannot choose from an empty sequence') from None return seq[i] def shuffle(self, x, random=None): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -42,6 +42,9 @@ - Issue 28923: Remove editor artifacts from Tix.py. +- Issue #29055: Neaten-up empty population error on random.choice() + by suppressing the upstream exception. + - Issue #28871: Fixed a crash when deallocate deep ElementTree. - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Dec 27 04:08:41 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 27 Dec 2016 09:08:41 +0000 Subject: [Python-checkins] Daily reference leaks (5006bf5b7735): sum=7 Message-ID: <20161227090841.5888.40644.392A1673@psf.io> results for 5006bf5b7735 on branch "default" -------------------------------------------- test_asyncio leaked [0, 3, 0] memory blocks, sum=3 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog2CSN7j', '--timeout', '7200'] From python-checkins at python.org Tue Dec 27 05:01:10 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 10:01:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIzOTAz?= =?utf-8?q?=3A_Fixed_errors_and_remove_non-existing_names_in_python3=2Edef?= =?utf-8?q?=2E?= Message-ID: <20161227100109.107445.49369.DDD28172@psf.io> https://hg.python.org/cpython/rev/8423f86486b3 changeset: 105836:8423f86486b3 branch: 3.5 parent: 105828:172b2ac82037 user: Serhiy Storchaka date: Tue Dec 27 11:49:53 2016 +0200 summary: Issue #23903: Fixed errors and remove non-existing names in python3.def. files: PC/python3.def | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -189,7 +189,6 @@ PyExc_KeyboardInterrupt=python35.PyExc_KeyboardInterrupt DATA PyExc_LookupError=python35.PyExc_LookupError DATA PyExc_MemoryError=python35.PyExc_MemoryError DATA - PyExc_MemoryErrorInst=python35.PyExc_MemoryErrorInst DATA PyExc_NameError=python35.PyExc_NameError DATA PyExc_NotImplementedError=python35.PyExc_NotImplementedError DATA PyExc_OSError=python35.PyExc_OSError DATA @@ -441,7 +440,7 @@ PyObject_SetItem=python35.PyObject_SetItem PyObject_Size=python35.PyObject_Size PyObject_Str=python35.PyObject_Str - PyObject_Type=python35.PyObject_Type DATA + PyObject_Type=python35.PyObject_Type PyParser_SimpleParseFileFlags=python35.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python35.PyParser_SimpleParseStringFlags PyProperty_Type=python35.PyProperty_Type DATA @@ -578,7 +577,7 @@ PyUnicode_AsUnicodeEscapeString=python35.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python35.PyUnicode_AsWideChar PyUnicode_BuildEncodingMap=python35.PyUnicode_BuildEncodingMap - PyUnicode_ClearFreelist=python35.PyUnicode_ClearFreelist + PyUnicode_ClearFreeList=python35.PyUnicode_ClearFreeList PyUnicode_Compare=python35.PyUnicode_Compare PyUnicode_CompareWithASCIIString=python35.PyUnicode_CompareWithASCIIString PyUnicode_Concat=python35.PyUnicode_Concat @@ -626,13 +625,12 @@ PyUnicode_Replace=python35.PyUnicode_Replace PyUnicode_Resize=python35.PyUnicode_Resize PyUnicode_RichCompare=python35.PyUnicode_RichCompare - PyUnicode_SetDefaultEncoding=python35.PyUnicode_SetDefaultEncoding PyUnicode_Split=python35.PyUnicode_Split PyUnicode_Splitlines=python35.PyUnicode_Splitlines PyUnicode_Tailmatch=python35.PyUnicode_Tailmatch PyUnicode_Translate=python35.PyUnicode_Translate PyUnicode_Type=python35.PyUnicode_Type DATA - PyWeakref_GetObject=python35.PyWeakref_GetObject DATA + PyWeakref_GetObject=python35.PyWeakref_GetObject PyWeakref_NewProxy=python35.PyWeakref_NewProxy PyWeakref_NewRef=python35.PyWeakref_NewRef PyWrapperDescr_Type=python35.PyWrapperDescr_Type DATA -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 05:05:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 10:05:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2323903=3A_Fixed_errors_and_remove_non-existing_n?= =?utf-8?q?ames_in_python3=2Edef=2E?= Message-ID: <20161227100109.17850.71866.EECFFC04@psf.io> https://hg.python.org/cpython/rev/45507a5751d8 changeset: 105838:45507a5751d8 parent: 105835:a1a5260be005 parent: 105837:b5470d08969c user: Serhiy Storchaka date: Tue Dec 27 11:51:56 2016 +0200 summary: Issue #23903: Fixed errors and remove non-existing names in python3.def. files: PC/python3.def | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -189,7 +189,6 @@ PyExc_KeyboardInterrupt=python37.PyExc_KeyboardInterrupt DATA PyExc_LookupError=python37.PyExc_LookupError DATA PyExc_MemoryError=python37.PyExc_MemoryError DATA - PyExc_MemoryErrorInst=python37.PyExc_MemoryErrorInst DATA PyExc_NameError=python37.PyExc_NameError DATA PyExc_NotImplementedError=python37.PyExc_NotImplementedError DATA PyExc_OSError=python37.PyExc_OSError DATA @@ -441,7 +440,7 @@ PyObject_SetItem=python37.PyObject_SetItem PyObject_Size=python37.PyObject_Size PyObject_Str=python37.PyObject_Str - PyObject_Type=python37.PyObject_Type DATA + PyObject_Type=python37.PyObject_Type PyParser_SimpleParseFileFlags=python37.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python37.PyParser_SimpleParseStringFlags PyProperty_Type=python37.PyProperty_Type DATA @@ -578,7 +577,7 @@ PyUnicode_AsUnicodeEscapeString=python37.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python37.PyUnicode_AsWideChar PyUnicode_BuildEncodingMap=python37.PyUnicode_BuildEncodingMap - PyUnicode_ClearFreelist=python37.PyUnicode_ClearFreelist + PyUnicode_ClearFreeList=python37.PyUnicode_ClearFreeList PyUnicode_Compare=python37.PyUnicode_Compare PyUnicode_CompareWithASCIIString=python37.PyUnicode_CompareWithASCIIString PyUnicode_Concat=python37.PyUnicode_Concat @@ -626,13 +625,12 @@ PyUnicode_Replace=python37.PyUnicode_Replace PyUnicode_Resize=python37.PyUnicode_Resize PyUnicode_RichCompare=python37.PyUnicode_RichCompare - PyUnicode_SetDefaultEncoding=python37.PyUnicode_SetDefaultEncoding PyUnicode_Split=python37.PyUnicode_Split PyUnicode_Splitlines=python37.PyUnicode_Splitlines PyUnicode_Tailmatch=python37.PyUnicode_Tailmatch PyUnicode_Translate=python37.PyUnicode_Translate PyUnicode_Type=python37.PyUnicode_Type DATA - PyWeakref_GetObject=python37.PyWeakref_GetObject DATA + PyWeakref_GetObject=python37.PyWeakref_GetObject PyWeakref_NewProxy=python37.PyWeakref_NewProxy PyWeakref_NewRef=python37.PyWeakref_NewRef PyWrapperDescr_Type=python37.PyWrapperDescr_Type DATA -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 05:05:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 10:05:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2323903=3A_Fixed_errors_and_remove_non-existing_names_i?= =?utf-8?q?n_python3=2Edef=2E?= Message-ID: <20161227100109.17850.57298.14BC5CFF@psf.io> https://hg.python.org/cpython/rev/b5470d08969c changeset: 105837:b5470d08969c branch: 3.6 parent: 105834:0001ae913759 parent: 105836:8423f86486b3 user: Serhiy Storchaka date: Tue Dec 27 11:51:15 2016 +0200 summary: Issue #23903: Fixed errors and remove non-existing names in python3.def. files: PC/python3.def | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -189,7 +189,6 @@ PyExc_KeyboardInterrupt=python36.PyExc_KeyboardInterrupt DATA PyExc_LookupError=python36.PyExc_LookupError DATA PyExc_MemoryError=python36.PyExc_MemoryError DATA - PyExc_MemoryErrorInst=python36.PyExc_MemoryErrorInst DATA PyExc_NameError=python36.PyExc_NameError DATA PyExc_NotImplementedError=python36.PyExc_NotImplementedError DATA PyExc_OSError=python36.PyExc_OSError DATA @@ -441,7 +440,7 @@ PyObject_SetItem=python36.PyObject_SetItem PyObject_Size=python36.PyObject_Size PyObject_Str=python36.PyObject_Str - PyObject_Type=python36.PyObject_Type DATA + PyObject_Type=python36.PyObject_Type PyParser_SimpleParseFileFlags=python36.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python36.PyParser_SimpleParseStringFlags PyProperty_Type=python36.PyProperty_Type DATA @@ -578,7 +577,7 @@ PyUnicode_AsUnicodeEscapeString=python36.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python36.PyUnicode_AsWideChar PyUnicode_BuildEncodingMap=python36.PyUnicode_BuildEncodingMap - PyUnicode_ClearFreelist=python36.PyUnicode_ClearFreelist + PyUnicode_ClearFreeList=python36.PyUnicode_ClearFreeList PyUnicode_Compare=python36.PyUnicode_Compare PyUnicode_CompareWithASCIIString=python36.PyUnicode_CompareWithASCIIString PyUnicode_Concat=python36.PyUnicode_Concat @@ -626,13 +625,12 @@ PyUnicode_Replace=python36.PyUnicode_Replace PyUnicode_Resize=python36.PyUnicode_Resize PyUnicode_RichCompare=python36.PyUnicode_RichCompare - PyUnicode_SetDefaultEncoding=python36.PyUnicode_SetDefaultEncoding PyUnicode_Split=python36.PyUnicode_Split PyUnicode_Splitlines=python36.PyUnicode_Splitlines PyUnicode_Tailmatch=python36.PyUnicode_Tailmatch PyUnicode_Translate=python36.PyUnicode_Translate PyUnicode_Type=python36.PyUnicode_Type DATA - PyWeakref_GetObject=python36.PyWeakref_GetObject DATA + PyWeakref_GetObject=python36.PyWeakref_GetObject PyWeakref_NewProxy=python36.PyWeakref_NewProxy PyWeakref_NewRef=python36.PyWeakref_NewRef PyWrapperDescr_Type=python36.PyWrapperDescr_Type DATA -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 05:18:03 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 10:18:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2323903=3A_Added_missed_names_to_PC/python3=2Edef=2E?= Message-ID: <20161227101803.107800.67647.2231795D@psf.io> https://hg.python.org/cpython/rev/cb864fc4b3be changeset: 105840:cb864fc4b3be branch: 3.6 parent: 105837:b5470d08969c parent: 105839:d95fee442e27 user: Serhiy Storchaka date: Tue Dec 27 12:13:05 2016 +0200 summary: Issue #23903: Added missed names to PC/python3.def. files: Misc/NEWS | 2 + PC/python3.def | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -87,6 +87,8 @@ Build ----- +- Issue #23903: Added missed names to PC/python3.def. + - Issue #28762: lockf() is available on Android API level 24, but the F_LOCK macro is not defined in android-ndk-r13. diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -68,6 +68,7 @@ PyCodec_IncrementalEncoder=python36.PyCodec_IncrementalEncoder PyCodec_KnownEncoding=python36.PyCodec_KnownEncoding PyCodec_LookupError=python36.PyCodec_LookupError + PyCodec_NameReplaceErrors=python36.PyCodec_NameReplaceErrors PyCodec_Register=python36.PyCodec_Register PyCodec_RegisterError=python36.PyCodec_RegisterError PyCodec_ReplaceErrors=python36.PyCodec_ReplaceErrors @@ -122,6 +123,7 @@ PyErr_Fetch=python36.PyErr_Fetch PyErr_Format=python36.PyErr_Format PyErr_FormatV=python36.PyErr_FormatV + PyErr_GetExcInfo=python36.PyErr_GetExcInfo PyErr_GivenExceptionMatches=python36.PyErr_GivenExceptionMatches PyErr_NewException=python36.PyErr_NewException PyErr_NewExceptionWithDoc=python36.PyErr_NewExceptionWithDoc @@ -131,15 +133,21 @@ PyErr_Print=python36.PyErr_Print PyErr_PrintEx=python36.PyErr_PrintEx PyErr_ProgramText=python36.PyErr_ProgramText + PyErr_ResourceWarning=python36.PyErr_ResourceWarning PyErr_Restore=python36.PyErr_Restore + PyErr_SetExcInfo=python36.PyErr_SetExcInfo PyErr_SetFromErrno=python36.PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename=python36.PyErr_SetFromErrnoWithFilename PyErr_SetFromErrnoWithFilenameObject=python36.PyErr_SetFromErrnoWithFilenameObject + PyErr_SetFromErrnoWithFilenameObjects=python36.PyErr_SetFromErrnoWithFilenameObjects + PyErr_SetImportError=python36.PyErr_SetImportError + PyErr_SetImportErrorSubclass=python36.PyErr_SetImportErrorSubclass PyErr_SetInterrupt=python36.PyErr_SetInterrupt PyErr_SetNone=python36.PyErr_SetNone PyErr_SetObject=python36.PyErr_SetObject PyErr_SetString=python36.PyErr_SetString PyErr_SyntaxLocation=python36.PyErr_SyntaxLocation + PyErr_SyntaxLocationEx=python36.PyErr_SyntaxLocationEx PyErr_WarnEx=python36.PyErr_WarnEx PyErr_WarnExplicit=python36.PyErr_WarnExplicit PyErr_WarnFormat=python36.PyErr_WarnFormat @@ -171,12 +179,21 @@ PyExc_AssertionError=python36.PyExc_AssertionError DATA PyExc_AttributeError=python36.PyExc_AttributeError DATA PyExc_BaseException=python36.PyExc_BaseException DATA + PyExc_BlockingIOError=python36.PyExc_BlockingIOError DATA + PyExc_BrokenPipeError=python36.PyExc_BrokenPipeError DATA PyExc_BufferError=python36.PyExc_BufferError DATA PyExc_BytesWarning=python36.PyExc_BytesWarning DATA + PyExc_ChildProcessError=python36.PyExc_ChildProcessError DATA + PyExc_ConnectionAbortedError=python36.PyExc_ConnectionAbortedError DATA + PyExc_ConnectionError=python36.PyExc_ConnectionError DATA + PyExc_ConnectionRefusedError=python36.PyExc_ConnectionRefusedError DATA + PyExc_ConnectionResetError=python36.PyExc_ConnectionResetError DATA PyExc_DeprecationWarning=python36.PyExc_DeprecationWarning DATA PyExc_EOFError=python36.PyExc_EOFError DATA PyExc_EnvironmentError=python36.PyExc_EnvironmentError DATA PyExc_Exception=python36.PyExc_Exception DATA + PyExc_FileExistsError=python36.PyExc_FileExistsError DATA + PyExc_FileNotFoundError=python36.PyExc_FileNotFoundError DATA PyExc_FloatingPointError=python36.PyExc_FloatingPointError DATA PyExc_FutureWarning=python36.PyExc_FutureWarning DATA PyExc_GeneratorExit=python36.PyExc_GeneratorExit DATA @@ -185,25 +202,35 @@ PyExc_ImportWarning=python36.PyExc_ImportWarning DATA PyExc_IndentationError=python36.PyExc_IndentationError DATA PyExc_IndexError=python36.PyExc_IndexError DATA + PyExc_InterruptedError=python36.PyExc_InterruptedError DATA + PyExc_IsADirectoryError=python36.PyExc_IsADirectoryError DATA PyExc_KeyError=python36.PyExc_KeyError DATA PyExc_KeyboardInterrupt=python36.PyExc_KeyboardInterrupt DATA PyExc_LookupError=python36.PyExc_LookupError DATA PyExc_MemoryError=python36.PyExc_MemoryError DATA + PyExc_ModuleNotFoundError=python36.PyExc_ModuleNotFoundError DATA PyExc_NameError=python36.PyExc_NameError DATA + PyExc_NotADirectoryError=python36.PyExc_NotADirectoryError DATA PyExc_NotImplementedError=python36.PyExc_NotImplementedError DATA PyExc_OSError=python36.PyExc_OSError DATA PyExc_OverflowError=python36.PyExc_OverflowError DATA PyExc_PendingDeprecationWarning=python36.PyExc_PendingDeprecationWarning DATA + PyExc_PermissionError=python36.PyExc_PermissionError DATA + PyExc_ProcessLookupError=python36.PyExc_ProcessLookupError DATA + PyExc_RecursionError=python36.PyExc_RecursionError DATA PyExc_RecursionErrorInst=python36.PyExc_RecursionErrorInst DATA PyExc_ReferenceError=python36.PyExc_ReferenceError DATA + PyExc_ResourceWarning=python36.PyExc_ResourceWarning DATA PyExc_RuntimeError=python36.PyExc_RuntimeError DATA PyExc_RuntimeWarning=python36.PyExc_RuntimeWarning DATA + PyExc_StopAsyncIteration=python36.PyExc_StopAsyncIteration DATA PyExc_StopIteration=python36.PyExc_StopIteration DATA PyExc_SyntaxError=python36.PyExc_SyntaxError DATA PyExc_SyntaxWarning=python36.PyExc_SyntaxWarning DATA PyExc_SystemError=python36.PyExc_SystemError DATA PyExc_SystemExit=python36.PyExc_SystemExit DATA PyExc_TabError=python36.PyExc_TabError DATA + PyExc_TimeoutError=python36.PyExc_TimeoutError DATA PyExc_TypeError=python36.PyExc_TypeError DATA PyExc_UnboundLocalError=python36.PyExc_UnboundLocalError DATA PyExc_UnicodeDecodeError=python36.PyExc_UnicodeDecodeError DATA @@ -241,10 +268,12 @@ PyGILState_Release=python36.PyGILState_Release PyGetSetDescr_Type=python36.PyGetSetDescr_Type DATA PyImport_AddModule=python36.PyImport_AddModule + PyImport_AddModuleObject=python36.PyImport_AddModuleObject PyImport_AppendInittab=python36.PyImport_AppendInittab PyImport_Cleanup=python36.PyImport_Cleanup PyImport_ExecCodeModule=python36.PyImport_ExecCodeModule PyImport_ExecCodeModuleEx=python36.PyImport_ExecCodeModuleEx + PyImport_ExecCodeModuleObject=python36.PyImport_ExecCodeModuleObject PyImport_ExecCodeModuleWithPathnames=python36.PyImport_ExecCodeModuleWithPathnames PyImport_GetImporter=python36.PyImport_GetImporter PyImport_GetMagicNumber=python36.PyImport_GetMagicNumber @@ -252,8 +281,10 @@ PyImport_GetModuleDict=python36.PyImport_GetModuleDict PyImport_Import=python36.PyImport_Import PyImport_ImportFrozenModule=python36.PyImport_ImportFrozenModule + PyImport_ImportFrozenModuleObject=python36.PyImport_ImportFrozenModuleObject PyImport_ImportModule=python36.PyImport_ImportModule PyImport_ImportModuleLevel=python36.PyImport_ImportModuleLevel + PyImport_ImportModuleLevelObject=python36.PyImport_ImportModuleLevelObject PyImport_ImportModuleNoBlock=python36.PyImport_ImportModuleNoBlock PyImport_ReloadModule=python36.PyImport_ReloadModule PyInterpreterState_Clear=python36.PyInterpreterState_Clear @@ -309,27 +340,35 @@ PyMapping_SetItemString=python36.PyMapping_SetItemString PyMapping_Size=python36.PyMapping_Size PyMapping_Values=python36.PyMapping_Values + PyMem_Calloc=python36.PyMem_Calloc PyMem_Free=python36.PyMem_Free PyMem_Malloc=python36.PyMem_Malloc PyMem_Realloc=python36.PyMem_Realloc PyMemberDescr_Type=python36.PyMemberDescr_Type DATA + PyMemoryView_FromMemory=python36.PyMemoryView_FromMemory PyMemoryView_FromObject=python36.PyMemoryView_FromObject PyMemoryView_GetContiguous=python36.PyMemoryView_GetContiguous PyMemoryView_Type=python36.PyMemoryView_Type DATA PyMethodDescr_Type=python36.PyMethodDescr_Type DATA PyModuleDef_Init=python36.PyModuleDef_Init PyModuleDef_Type=python36.PyModuleDef_Type DATA + PyModule_AddFunctions=python36.PyModule_AddFunctions PyModule_AddIntConstant=python36.PyModule_AddIntConstant PyModule_AddObject=python36.PyModule_AddObject PyModule_AddStringConstant=python36.PyModule_AddStringConstant PyModule_Create2=python36.PyModule_Create2 + PyModule_ExecDef=python36.PyModule_ExecDef + PyModule_FromDefAndSpec2=python36.PyModule_FromDefAndSpec2 PyModule_GetDef=python36.PyModule_GetDef PyModule_GetDict=python36.PyModule_GetDict PyModule_GetFilename=python36.PyModule_GetFilename PyModule_GetFilenameObject=python36.PyModule_GetFilenameObject PyModule_GetName=python36.PyModule_GetName + PyModule_GetNameObject=python36.PyModule_GetNameObject PyModule_GetState=python36.PyModule_GetState PyModule_New=python36.PyModule_New + PyModule_NewObject=python36.PyModule_NewObject + PyModule_SetDocString=python36.PyModule_SetDocString PyModule_Type=python36.PyModule_Type DATA PyNullImporter_Type=python36.PyNullImporter_Type DATA PyNumber_Absolute=python36.PyNumber_Absolute @@ -344,6 +383,7 @@ PyNumber_InPlaceAnd=python36.PyNumber_InPlaceAnd PyNumber_InPlaceFloorDivide=python36.PyNumber_InPlaceFloorDivide PyNumber_InPlaceLshift=python36.PyNumber_InPlaceLshift + PyNumber_InPlaceMatrixMultiply=python36.PyNumber_InPlaceMatrixMultiply PyNumber_InPlaceMultiply=python36.PyNumber_InPlaceMultiply PyNumber_InPlaceOr=python36.PyNumber_InPlaceOr PyNumber_InPlacePower=python36.PyNumber_InPlacePower @@ -356,6 +396,7 @@ PyNumber_Invert=python36.PyNumber_Invert PyNumber_Long=python36.PyNumber_Long PyNumber_Lshift=python36.PyNumber_Lshift + PyNumber_MatrixMultiply=python36.PyNumber_MatrixMultiply PyNumber_Multiply=python36.PyNumber_Multiply PyNumber_Negative=python36.PyNumber_Negative PyNumber_Or=python36.PyNumber_Or @@ -376,6 +417,7 @@ PyODict_SetItem=python36.PyODict_SetItem PyODict_Type=python36.PyODict_Type DATA PyOS_AfterFork=python36.PyOS_AfterFork + PyOS_FSPath=python36.PyOS_FSPath PyOS_InitInterrupts=python36.PyOS_InitInterrupts PyOS_InputHook=python36.PyOS_InputHook DATA PyOS_InterruptOccurred=python36.PyOS_InterruptOccurred @@ -402,6 +444,7 @@ PyObject_CallMethod=python36.PyObject_CallMethod PyObject_CallMethodObjArgs=python36.PyObject_CallMethodObjArgs PyObject_CallObject=python36.PyObject_CallObject + PyObject_Calloc=python36.PyObject_Calloc PyObject_CheckReadBuffer=python36.PyObject_CheckReadBuffer PyObject_ClearWeakRefs=python36.PyObject_ClearWeakRefs PyObject_DelItem=python36.PyObject_DelItem @@ -414,6 +457,7 @@ PyObject_GC_UnTrack=python36.PyObject_GC_UnTrack PyObject_GenericGetAttr=python36.PyObject_GenericGetAttr PyObject_GenericSetAttr=python36.PyObject_GenericSetAttr + PyObject_GenericSetDict=python36.PyObject_GenericSetDict PyObject_GetAttr=python36.PyObject_GetAttr PyObject_GetAttrString=python36.PyObject_GetAttrString PyObject_GetItem=python36.PyObject_GetItem @@ -443,6 +487,7 @@ PyObject_Type=python36.PyObject_Type PyParser_SimpleParseFileFlags=python36.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python36.PyParser_SimpleParseStringFlags + PyParser_SimpleParseStringFlagsFilename=python36.PyParser_SimpleParseStringFlagsFilename PyProperty_Type=python36.PyProperty_Type DATA PyRangeIter_Type=python36.PyRangeIter_Type DATA PyRange_Type=python36.PyRange_Type DATA @@ -493,9 +538,11 @@ PySuper_Type=python36.PySuper_Type DATA PySys_AddWarnOption=python36.PySys_AddWarnOption PySys_AddWarnOptionUnicode=python36.PySys_AddWarnOptionUnicode + PySys_AddXOption=python36.PySys_AddXOption PySys_FormatStderr=python36.PySys_FormatStderr PySys_FormatStdout=python36.PySys_FormatStdout PySys_GetObject=python36.PySys_GetObject + PySys_GetXOptions=python36.PySys_GetXOptions PySys_HasWarnOptions=python36.PySys_HasWarnOptions PySys_ResetWarnOptions=python36.PySys_ResetWarnOptions PySys_SetArgv=python36.PySys_SetArgv @@ -571,11 +618,14 @@ PyUnicode_AsEncodedUnicode=python36.PyUnicode_AsEncodedUnicode PyUnicode_AsLatin1String=python36.PyUnicode_AsLatin1String PyUnicode_AsRawUnicodeEscapeString=python36.PyUnicode_AsRawUnicodeEscapeString + PyUnicode_AsUCS4=python36.PyUnicode_AsUCS4 + PyUnicode_AsUCS4Copy=python36.PyUnicode_AsUCS4Copy PyUnicode_AsUTF16String=python36.PyUnicode_AsUTF16String PyUnicode_AsUTF32String=python36.PyUnicode_AsUTF32String PyUnicode_AsUTF8String=python36.PyUnicode_AsUTF8String PyUnicode_AsUnicodeEscapeString=python36.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python36.PyUnicode_AsWideChar + PyUnicode_AsWideCharString=python36.PyUnicode_AsWideCharString PyUnicode_BuildEncodingMap=python36.PyUnicode_BuildEncodingMap PyUnicode_ClearFreeList=python36.PyUnicode_ClearFreeList PyUnicode_Compare=python36.PyUnicode_Compare @@ -589,6 +639,8 @@ PyUnicode_DecodeFSDefault=python36.PyUnicode_DecodeFSDefault PyUnicode_DecodeFSDefaultAndSize=python36.PyUnicode_DecodeFSDefaultAndSize PyUnicode_DecodeLatin1=python36.PyUnicode_DecodeLatin1 + PyUnicode_DecodeLocale=python36.PyUnicode_DecodeLocale + PyUnicode_DecodeLocaleAndSize=python36.PyUnicode_DecodeLocaleAndSize PyUnicode_DecodeRawUnicodeEscape=python36.PyUnicode_DecodeRawUnicodeEscape PyUnicode_DecodeUTF16=python36.PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful=python36.PyUnicode_DecodeUTF16Stateful @@ -600,9 +652,11 @@ PyUnicode_DecodeUTF8Stateful=python36.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python36.PyUnicode_DecodeUnicodeEscape PyUnicode_EncodeFSDefault=python36.PyUnicode_EncodeFSDefault + PyUnicode_EncodeLocale=python36.PyUnicode_EncodeLocale PyUnicode_FSConverter=python36.PyUnicode_FSConverter PyUnicode_FSDecoder=python36.PyUnicode_FSDecoder PyUnicode_Find=python36.PyUnicode_Find + PyUnicode_FindChar=python36.PyUnicode_FindChar PyUnicode_Format=python36.PyUnicode_Format PyUnicode_FromEncodedObject=python36.PyUnicode_FromEncodedObject PyUnicode_FromFormat=python36.PyUnicode_FromFormat @@ -613,6 +667,7 @@ PyUnicode_FromStringAndSize=python36.PyUnicode_FromStringAndSize PyUnicode_FromWideChar=python36.PyUnicode_FromWideChar PyUnicode_GetDefaultEncoding=python36.PyUnicode_GetDefaultEncoding + PyUnicode_GetLength=python36.PyUnicode_GetLength PyUnicode_GetSize=python36.PyUnicode_GetSize PyUnicode_InternFromString=python36.PyUnicode_InternFromString PyUnicode_InternImmortal=python36.PyUnicode_InternImmortal @@ -622,14 +677,17 @@ PyUnicode_Partition=python36.PyUnicode_Partition PyUnicode_RPartition=python36.PyUnicode_RPartition PyUnicode_RSplit=python36.PyUnicode_RSplit + PyUnicode_ReadChar=python36.PyUnicode_ReadChar PyUnicode_Replace=python36.PyUnicode_Replace PyUnicode_Resize=python36.PyUnicode_Resize PyUnicode_RichCompare=python36.PyUnicode_RichCompare PyUnicode_Split=python36.PyUnicode_Split PyUnicode_Splitlines=python36.PyUnicode_Splitlines + PyUnicode_Substring=python36.PyUnicode_Substring PyUnicode_Tailmatch=python36.PyUnicode_Tailmatch PyUnicode_Translate=python36.PyUnicode_Translate PyUnicode_Type=python36.PyUnicode_Type DATA + PyUnicode_WriteChar=python36.PyUnicode_WriteChar PyWeakref_GetObject=python36.PyWeakref_GetObject PyWeakref_NewProxy=python36.PyWeakref_NewProxy PyWeakref_NewRef=python36.PyWeakref_NewRef @@ -641,9 +699,12 @@ Py_BuildValue=python36.Py_BuildValue Py_CompileString=python36.Py_CompileString Py_DecRef=python36.Py_DecRef + Py_DecodeLocale=python36.Py_DecodeLocale + Py_EncodeLocale=python36.Py_EncodeLocale Py_EndInterpreter=python36.Py_EndInterpreter Py_Exit=python36.Py_Exit Py_FatalError=python36.Py_FatalError + Py_FileSystemDefaultEncodeErrors=python36.Py_FileSystemDefaultEncodeErrors DATA Py_FileSystemDefaultEncoding=python36.Py_FileSystemDefaultEncoding DATA Py_Finalize=python36.Py_Finalize Py_FinalizeEx=python36.Py_FinalizeEx @@ -669,6 +730,7 @@ Py_NewInterpreter=python36.Py_NewInterpreter Py_ReprEnter=python36.Py_ReprEnter Py_ReprLeave=python36.Py_ReprLeave + Py_SetPath=python36.Py_SetPath Py_SetProgramName=python36.Py_SetProgramName Py_SetPythonHome=python36.Py_SetPythonHome Py_SetRecursionLimit=python36.Py_SetRecursionLimit @@ -695,6 +757,8 @@ _PyTrash_delete_nesting=python36._PyTrash_delete_nesting DATA _PyTrash_deposit_object=python36._PyTrash_deposit_object _PyTrash_destroy_chain=python36._PyTrash_destroy_chain + _PyTrash_thread_deposit_object=python36._PyTrash_thread_deposit_object + _PyTrash_thread_destroy_chain=python36._PyTrash_thread_destroy_chain _PyWeakref_CallableProxyType=python36._PyWeakref_CallableProxyType DATA _PyWeakref_ProxyType=python36._PyWeakref_ProxyType DATA _PyWeakref_RefType=python36._PyWeakref_RefType DATA -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 05:18:03 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 10:18:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIzOTAz?= =?utf-8?q?=3A_Added_missed_names_to_PC/python3=2Edef=2E?= Message-ID: <20161227101803.26808.71080.9A626C9D@psf.io> https://hg.python.org/cpython/rev/d95fee442e27 changeset: 105839:d95fee442e27 branch: 3.5 parent: 105836:8423f86486b3 user: Serhiy Storchaka date: Tue Dec 27 12:10:58 2016 +0200 summary: Issue #23903: Added missed names to PC/python3.def. files: Misc/NEWS | 2 + PC/python3.def | 59 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -605,6 +605,8 @@ Build ----- +- Issue #23903: Added missed names to PC/python3.def. + - Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and Michael Haubenwallner. diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -68,6 +68,7 @@ PyCodec_IncrementalEncoder=python35.PyCodec_IncrementalEncoder PyCodec_KnownEncoding=python35.PyCodec_KnownEncoding PyCodec_LookupError=python35.PyCodec_LookupError + PyCodec_NameReplaceErrors=python35.PyCodec_NameReplaceErrors PyCodec_Register=python35.PyCodec_Register PyCodec_RegisterError=python35.PyCodec_RegisterError PyCodec_ReplaceErrors=python35.PyCodec_ReplaceErrors @@ -122,6 +123,7 @@ PyErr_Fetch=python35.PyErr_Fetch PyErr_Format=python35.PyErr_Format PyErr_FormatV=python35.PyErr_FormatV + PyErr_GetExcInfo=python35.PyErr_GetExcInfo PyErr_GivenExceptionMatches=python35.PyErr_GivenExceptionMatches PyErr_NewException=python35.PyErr_NewException PyErr_NewExceptionWithDoc=python35.PyErr_NewExceptionWithDoc @@ -132,14 +134,18 @@ PyErr_PrintEx=python35.PyErr_PrintEx PyErr_ProgramText=python35.PyErr_ProgramText PyErr_Restore=python35.PyErr_Restore + PyErr_SetExcInfo=python35.PyErr_SetExcInfo PyErr_SetFromErrno=python35.PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename=python35.PyErr_SetFromErrnoWithFilename PyErr_SetFromErrnoWithFilenameObject=python35.PyErr_SetFromErrnoWithFilenameObject + PyErr_SetFromErrnoWithFilenameObjects=python35.PyErr_SetFromErrnoWithFilenameObjects + PyErr_SetImportError=python35.PyErr_SetImportError PyErr_SetInterrupt=python35.PyErr_SetInterrupt PyErr_SetNone=python35.PyErr_SetNone PyErr_SetObject=python35.PyErr_SetObject PyErr_SetString=python35.PyErr_SetString PyErr_SyntaxLocation=python35.PyErr_SyntaxLocation + PyErr_SyntaxLocationEx=python35.PyErr_SyntaxLocationEx PyErr_WarnEx=python35.PyErr_WarnEx PyErr_WarnExplicit=python35.PyErr_WarnExplicit PyErr_WarnFormat=python35.PyErr_WarnFormat @@ -171,12 +177,21 @@ PyExc_AssertionError=python35.PyExc_AssertionError DATA PyExc_AttributeError=python35.PyExc_AttributeError DATA PyExc_BaseException=python35.PyExc_BaseException DATA + PyExc_BlockingIOError=python35.PyExc_BlockingIOError DATA + PyExc_BrokenPipeError=python35.PyExc_BrokenPipeError DATA PyExc_BufferError=python35.PyExc_BufferError DATA PyExc_BytesWarning=python35.PyExc_BytesWarning DATA + PyExc_ChildProcessError=python35.PyExc_ChildProcessError DATA + PyExc_ConnectionAbortedError=python35.PyExc_ConnectionAbortedError DATA + PyExc_ConnectionError=python35.PyExc_ConnectionError DATA + PyExc_ConnectionRefusedError=python35.PyExc_ConnectionRefusedError DATA + PyExc_ConnectionResetError=python35.PyExc_ConnectionResetError DATA PyExc_DeprecationWarning=python35.PyExc_DeprecationWarning DATA PyExc_EOFError=python35.PyExc_EOFError DATA PyExc_EnvironmentError=python35.PyExc_EnvironmentError DATA PyExc_Exception=python35.PyExc_Exception DATA + PyExc_FileExistsError=python35.PyExc_FileExistsError DATA + PyExc_FileNotFoundError=python35.PyExc_FileNotFoundError DATA PyExc_FloatingPointError=python35.PyExc_FloatingPointError DATA PyExc_FutureWarning=python35.PyExc_FutureWarning DATA PyExc_GeneratorExit=python35.PyExc_GeneratorExit DATA @@ -185,25 +200,34 @@ PyExc_ImportWarning=python35.PyExc_ImportWarning DATA PyExc_IndentationError=python35.PyExc_IndentationError DATA PyExc_IndexError=python35.PyExc_IndexError DATA + PyExc_InterruptedError=python35.PyExc_InterruptedError DATA + PyExc_IsADirectoryError=python35.PyExc_IsADirectoryError DATA PyExc_KeyError=python35.PyExc_KeyError DATA PyExc_KeyboardInterrupt=python35.PyExc_KeyboardInterrupt DATA PyExc_LookupError=python35.PyExc_LookupError DATA PyExc_MemoryError=python35.PyExc_MemoryError DATA PyExc_NameError=python35.PyExc_NameError DATA + PyExc_NotADirectoryError=python35.PyExc_NotADirectoryError DATA PyExc_NotImplementedError=python35.PyExc_NotImplementedError DATA PyExc_OSError=python35.PyExc_OSError DATA PyExc_OverflowError=python35.PyExc_OverflowError DATA PyExc_PendingDeprecationWarning=python35.PyExc_PendingDeprecationWarning DATA + PyExc_PermissionError=python35.PyExc_PermissionError DATA + PyExc_ProcessLookupError=python35.PyExc_ProcessLookupError DATA + PyExc_RecursionError=python35.PyExc_RecursionError DATA PyExc_RecursionErrorInst=python35.PyExc_RecursionErrorInst DATA PyExc_ReferenceError=python35.PyExc_ReferenceError DATA + PyExc_ResourceWarning=python35.PyExc_ResourceWarning DATA PyExc_RuntimeError=python35.PyExc_RuntimeError DATA PyExc_RuntimeWarning=python35.PyExc_RuntimeWarning DATA + PyExc_StopAsyncIteration=python35.PyExc_StopAsyncIteration DATA PyExc_StopIteration=python35.PyExc_StopIteration DATA PyExc_SyntaxError=python35.PyExc_SyntaxError DATA PyExc_SyntaxWarning=python35.PyExc_SyntaxWarning DATA PyExc_SystemError=python35.PyExc_SystemError DATA PyExc_SystemExit=python35.PyExc_SystemExit DATA PyExc_TabError=python35.PyExc_TabError DATA + PyExc_TimeoutError=python35.PyExc_TimeoutError DATA PyExc_TypeError=python35.PyExc_TypeError DATA PyExc_UnboundLocalError=python35.PyExc_UnboundLocalError DATA PyExc_UnicodeDecodeError=python35.PyExc_UnicodeDecodeError DATA @@ -241,10 +265,12 @@ PyGILState_Release=python35.PyGILState_Release PyGetSetDescr_Type=python35.PyGetSetDescr_Type DATA PyImport_AddModule=python35.PyImport_AddModule + PyImport_AddModuleObject=python35.PyImport_AddModuleObject PyImport_AppendInittab=python35.PyImport_AppendInittab PyImport_Cleanup=python35.PyImport_Cleanup PyImport_ExecCodeModule=python35.PyImport_ExecCodeModule PyImport_ExecCodeModuleEx=python35.PyImport_ExecCodeModuleEx + PyImport_ExecCodeModuleObject=python35.PyImport_ExecCodeModuleObject PyImport_ExecCodeModuleWithPathnames=python35.PyImport_ExecCodeModuleWithPathnames PyImport_GetImporter=python35.PyImport_GetImporter PyImport_GetMagicNumber=python35.PyImport_GetMagicNumber @@ -252,8 +278,10 @@ PyImport_GetModuleDict=python35.PyImport_GetModuleDict PyImport_Import=python35.PyImport_Import PyImport_ImportFrozenModule=python35.PyImport_ImportFrozenModule + PyImport_ImportFrozenModuleObject=python35.PyImport_ImportFrozenModuleObject PyImport_ImportModule=python35.PyImport_ImportModule PyImport_ImportModuleLevel=python35.PyImport_ImportModuleLevel + PyImport_ImportModuleLevelObject=python35.PyImport_ImportModuleLevelObject PyImport_ImportModuleNoBlock=python35.PyImport_ImportModuleNoBlock PyImport_ReloadModule=python35.PyImport_ReloadModule PyInterpreterState_Clear=python35.PyInterpreterState_Clear @@ -309,27 +337,35 @@ PyMapping_SetItemString=python35.PyMapping_SetItemString PyMapping_Size=python35.PyMapping_Size PyMapping_Values=python35.PyMapping_Values + PyMem_Calloc=python35.PyMem_Calloc PyMem_Free=python35.PyMem_Free PyMem_Malloc=python35.PyMem_Malloc PyMem_Realloc=python35.PyMem_Realloc PyMemberDescr_Type=python35.PyMemberDescr_Type DATA + PyMemoryView_FromMemory=python35.PyMemoryView_FromMemory PyMemoryView_FromObject=python35.PyMemoryView_FromObject PyMemoryView_GetContiguous=python35.PyMemoryView_GetContiguous PyMemoryView_Type=python35.PyMemoryView_Type DATA PyMethodDescr_Type=python35.PyMethodDescr_Type DATA PyModuleDef_Init=python35.PyModuleDef_Init PyModuleDef_Type=python35.PyModuleDef_Type DATA + PyModule_AddFunctions=python35.PyModule_AddFunctions PyModule_AddIntConstant=python35.PyModule_AddIntConstant PyModule_AddObject=python35.PyModule_AddObject PyModule_AddStringConstant=python35.PyModule_AddStringConstant PyModule_Create2=python35.PyModule_Create2 + PyModule_ExecDef=python35.PyModule_ExecDef + PyModule_FromDefAndSpec2=python35.PyModule_FromDefAndSpec2 PyModule_GetDef=python35.PyModule_GetDef PyModule_GetDict=python35.PyModule_GetDict PyModule_GetFilename=python35.PyModule_GetFilename PyModule_GetFilenameObject=python35.PyModule_GetFilenameObject PyModule_GetName=python35.PyModule_GetName + PyModule_GetNameObject=python35.PyModule_GetNameObject PyModule_GetState=python35.PyModule_GetState PyModule_New=python35.PyModule_New + PyModule_NewObject=python35.PyModule_NewObject + PyModule_SetDocString=python35.PyModule_SetDocString PyModule_Type=python35.PyModule_Type DATA PyNullImporter_Type=python35.PyNullImporter_Type DATA PyNumber_Absolute=python35.PyNumber_Absolute @@ -344,6 +380,7 @@ PyNumber_InPlaceAnd=python35.PyNumber_InPlaceAnd PyNumber_InPlaceFloorDivide=python35.PyNumber_InPlaceFloorDivide PyNumber_InPlaceLshift=python35.PyNumber_InPlaceLshift + PyNumber_InPlaceMatrixMultiply=python35.PyNumber_InPlaceMatrixMultiply PyNumber_InPlaceMultiply=python35.PyNumber_InPlaceMultiply PyNumber_InPlaceOr=python35.PyNumber_InPlaceOr PyNumber_InPlacePower=python35.PyNumber_InPlacePower @@ -356,6 +393,7 @@ PyNumber_Invert=python35.PyNumber_Invert PyNumber_Long=python35.PyNumber_Long PyNumber_Lshift=python35.PyNumber_Lshift + PyNumber_MatrixMultiply=python35.PyNumber_MatrixMultiply PyNumber_Multiply=python35.PyNumber_Multiply PyNumber_Negative=python35.PyNumber_Negative PyNumber_Or=python35.PyNumber_Or @@ -402,6 +440,7 @@ PyObject_CallMethod=python35.PyObject_CallMethod PyObject_CallMethodObjArgs=python35.PyObject_CallMethodObjArgs PyObject_CallObject=python35.PyObject_CallObject + PyObject_Calloc=python35.PyObject_Calloc PyObject_CheckReadBuffer=python35.PyObject_CheckReadBuffer PyObject_ClearWeakRefs=python35.PyObject_ClearWeakRefs PyObject_DelItem=python35.PyObject_DelItem @@ -414,6 +453,7 @@ PyObject_GC_UnTrack=python35.PyObject_GC_UnTrack PyObject_GenericGetAttr=python35.PyObject_GenericGetAttr PyObject_GenericSetAttr=python35.PyObject_GenericSetAttr + PyObject_GenericSetDict=python35.PyObject_GenericSetDict PyObject_GetAttr=python35.PyObject_GetAttr PyObject_GetAttrString=python35.PyObject_GetAttrString PyObject_GetItem=python35.PyObject_GetItem @@ -443,6 +483,7 @@ PyObject_Type=python35.PyObject_Type PyParser_SimpleParseFileFlags=python35.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python35.PyParser_SimpleParseStringFlags + PyParser_SimpleParseStringFlagsFilename=python35.PyParser_SimpleParseStringFlagsFilename PyProperty_Type=python35.PyProperty_Type DATA PyRangeIter_Type=python35.PyRangeIter_Type DATA PyRange_Type=python35.PyRange_Type DATA @@ -493,9 +534,11 @@ PySuper_Type=python35.PySuper_Type DATA PySys_AddWarnOption=python35.PySys_AddWarnOption PySys_AddWarnOptionUnicode=python35.PySys_AddWarnOptionUnicode + PySys_AddXOption=python35.PySys_AddXOption PySys_FormatStderr=python35.PySys_FormatStderr PySys_FormatStdout=python35.PySys_FormatStdout PySys_GetObject=python35.PySys_GetObject + PySys_GetXOptions=python35.PySys_GetXOptions PySys_HasWarnOptions=python35.PySys_HasWarnOptions PySys_ResetWarnOptions=python35.PySys_ResetWarnOptions PySys_SetArgv=python35.PySys_SetArgv @@ -571,11 +614,14 @@ PyUnicode_AsEncodedUnicode=python35.PyUnicode_AsEncodedUnicode PyUnicode_AsLatin1String=python35.PyUnicode_AsLatin1String PyUnicode_AsRawUnicodeEscapeString=python35.PyUnicode_AsRawUnicodeEscapeString + PyUnicode_AsUCS4=python35.PyUnicode_AsUCS4 + PyUnicode_AsUCS4Copy=python35.PyUnicode_AsUCS4Copy PyUnicode_AsUTF16String=python35.PyUnicode_AsUTF16String PyUnicode_AsUTF32String=python35.PyUnicode_AsUTF32String PyUnicode_AsUTF8String=python35.PyUnicode_AsUTF8String PyUnicode_AsUnicodeEscapeString=python35.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python35.PyUnicode_AsWideChar + PyUnicode_AsWideCharString=python35.PyUnicode_AsWideCharString PyUnicode_BuildEncodingMap=python35.PyUnicode_BuildEncodingMap PyUnicode_ClearFreeList=python35.PyUnicode_ClearFreeList PyUnicode_Compare=python35.PyUnicode_Compare @@ -589,6 +635,8 @@ PyUnicode_DecodeFSDefault=python35.PyUnicode_DecodeFSDefault PyUnicode_DecodeFSDefaultAndSize=python35.PyUnicode_DecodeFSDefaultAndSize PyUnicode_DecodeLatin1=python35.PyUnicode_DecodeLatin1 + PyUnicode_DecodeLocale=python35.PyUnicode_DecodeLocale + PyUnicode_DecodeLocaleAndSize=python35.PyUnicode_DecodeLocaleAndSize PyUnicode_DecodeRawUnicodeEscape=python35.PyUnicode_DecodeRawUnicodeEscape PyUnicode_DecodeUTF16=python35.PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful=python35.PyUnicode_DecodeUTF16Stateful @@ -600,9 +648,11 @@ PyUnicode_DecodeUTF8Stateful=python35.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python35.PyUnicode_DecodeUnicodeEscape PyUnicode_EncodeFSDefault=python35.PyUnicode_EncodeFSDefault + PyUnicode_EncodeLocale=python35.PyUnicode_EncodeLocale PyUnicode_FSConverter=python35.PyUnicode_FSConverter PyUnicode_FSDecoder=python35.PyUnicode_FSDecoder PyUnicode_Find=python35.PyUnicode_Find + PyUnicode_FindChar=python35.PyUnicode_FindChar PyUnicode_Format=python35.PyUnicode_Format PyUnicode_FromEncodedObject=python35.PyUnicode_FromEncodedObject PyUnicode_FromFormat=python35.PyUnicode_FromFormat @@ -613,6 +663,7 @@ PyUnicode_FromStringAndSize=python35.PyUnicode_FromStringAndSize PyUnicode_FromWideChar=python35.PyUnicode_FromWideChar PyUnicode_GetDefaultEncoding=python35.PyUnicode_GetDefaultEncoding + PyUnicode_GetLength=python35.PyUnicode_GetLength PyUnicode_GetSize=python35.PyUnicode_GetSize PyUnicode_InternFromString=python35.PyUnicode_InternFromString PyUnicode_InternImmortal=python35.PyUnicode_InternImmortal @@ -622,14 +673,17 @@ PyUnicode_Partition=python35.PyUnicode_Partition PyUnicode_RPartition=python35.PyUnicode_RPartition PyUnicode_RSplit=python35.PyUnicode_RSplit + PyUnicode_ReadChar=python35.PyUnicode_ReadChar PyUnicode_Replace=python35.PyUnicode_Replace PyUnicode_Resize=python35.PyUnicode_Resize PyUnicode_RichCompare=python35.PyUnicode_RichCompare PyUnicode_Split=python35.PyUnicode_Split PyUnicode_Splitlines=python35.PyUnicode_Splitlines + PyUnicode_Substring=python35.PyUnicode_Substring PyUnicode_Tailmatch=python35.PyUnicode_Tailmatch PyUnicode_Translate=python35.PyUnicode_Translate PyUnicode_Type=python35.PyUnicode_Type DATA + PyUnicode_WriteChar=python35.PyUnicode_WriteChar PyWeakref_GetObject=python35.PyWeakref_GetObject PyWeakref_NewProxy=python35.PyWeakref_NewProxy PyWeakref_NewRef=python35.PyWeakref_NewRef @@ -641,6 +695,8 @@ Py_BuildValue=python35.Py_BuildValue Py_CompileString=python35.Py_CompileString Py_DecRef=python35.Py_DecRef + Py_DecodeLocale=python35.Py_DecodeLocale + Py_EncodeLocale=python35.Py_EncodeLocale Py_EndInterpreter=python35.Py_EndInterpreter Py_Exit=python35.Py_Exit Py_FatalError=python35.Py_FatalError @@ -668,6 +724,7 @@ Py_NewInterpreter=python35.Py_NewInterpreter Py_ReprEnter=python35.Py_ReprEnter Py_ReprLeave=python35.Py_ReprLeave + Py_SetPath=python35.Py_SetPath Py_SetProgramName=python35.Py_SetProgramName Py_SetPythonHome=python35.Py_SetPythonHome Py_SetRecursionLimit=python35.Py_SetRecursionLimit @@ -694,6 +751,8 @@ _PyTrash_delete_nesting=python35._PyTrash_delete_nesting DATA _PyTrash_deposit_object=python35._PyTrash_deposit_object _PyTrash_destroy_chain=python35._PyTrash_destroy_chain + _PyTrash_thread_deposit_object=python35._PyTrash_thread_deposit_object + _PyTrash_thread_destroy_chain=python35._PyTrash_thread_destroy_chain _PyWeakref_CallableProxyType=python35._PyWeakref_CallableProxyType DATA _PyWeakref_ProxyType=python35._PyWeakref_ProxyType DATA _PyWeakref_RefType=python35._PyWeakref_RefType DATA -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 05:18:03 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 10:18:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2323903=3A_Added_missed_names_to_PC/python3=2Edef?= =?utf-8?q?=2E?= Message-ID: <20161227101803.79585.76321.FAE428F0@psf.io> https://hg.python.org/cpython/rev/513852ad0c5c changeset: 105841:513852ad0c5c parent: 105838:45507a5751d8 parent: 105840:cb864fc4b3be user: Serhiy Storchaka date: Tue Dec 27 12:17:41 2016 +0200 summary: Issue #23903: Added missed names to PC/python3.def. files: Misc/NEWS | 2 + PC/python3.def | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -584,6 +584,8 @@ Build ----- +- Issue #23903: Added missed names to PC/python3.def. + - Issue #28762: lockf() is available on Android API level 24, but the F_LOCK macro is not defined in android-ndk-r13. diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -68,6 +68,7 @@ PyCodec_IncrementalEncoder=python37.PyCodec_IncrementalEncoder PyCodec_KnownEncoding=python37.PyCodec_KnownEncoding PyCodec_LookupError=python37.PyCodec_LookupError + PyCodec_NameReplaceErrors=python37.PyCodec_NameReplaceErrors PyCodec_Register=python37.PyCodec_Register PyCodec_RegisterError=python37.PyCodec_RegisterError PyCodec_ReplaceErrors=python37.PyCodec_ReplaceErrors @@ -122,6 +123,7 @@ PyErr_Fetch=python37.PyErr_Fetch PyErr_Format=python37.PyErr_Format PyErr_FormatV=python37.PyErr_FormatV + PyErr_GetExcInfo=python37.PyErr_GetExcInfo PyErr_GivenExceptionMatches=python37.PyErr_GivenExceptionMatches PyErr_NewException=python37.PyErr_NewException PyErr_NewExceptionWithDoc=python37.PyErr_NewExceptionWithDoc @@ -131,15 +133,21 @@ PyErr_Print=python37.PyErr_Print PyErr_PrintEx=python37.PyErr_PrintEx PyErr_ProgramText=python37.PyErr_ProgramText + PyErr_ResourceWarning=python37.PyErr_ResourceWarning PyErr_Restore=python37.PyErr_Restore + PyErr_SetExcInfo=python37.PyErr_SetExcInfo PyErr_SetFromErrno=python37.PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename=python37.PyErr_SetFromErrnoWithFilename PyErr_SetFromErrnoWithFilenameObject=python37.PyErr_SetFromErrnoWithFilenameObject + PyErr_SetFromErrnoWithFilenameObjects=python37.PyErr_SetFromErrnoWithFilenameObjects + PyErr_SetImportError=python37.PyErr_SetImportError + PyErr_SetImportErrorSubclass=python37.PyErr_SetImportErrorSubclass PyErr_SetInterrupt=python37.PyErr_SetInterrupt PyErr_SetNone=python37.PyErr_SetNone PyErr_SetObject=python37.PyErr_SetObject PyErr_SetString=python37.PyErr_SetString PyErr_SyntaxLocation=python37.PyErr_SyntaxLocation + PyErr_SyntaxLocationEx=python37.PyErr_SyntaxLocationEx PyErr_WarnEx=python37.PyErr_WarnEx PyErr_WarnExplicit=python37.PyErr_WarnExplicit PyErr_WarnFormat=python37.PyErr_WarnFormat @@ -171,12 +179,21 @@ PyExc_AssertionError=python37.PyExc_AssertionError DATA PyExc_AttributeError=python37.PyExc_AttributeError DATA PyExc_BaseException=python37.PyExc_BaseException DATA + PyExc_BlockingIOError=python37.PyExc_BlockingIOError DATA + PyExc_BrokenPipeError=python37.PyExc_BrokenPipeError DATA PyExc_BufferError=python37.PyExc_BufferError DATA PyExc_BytesWarning=python37.PyExc_BytesWarning DATA + PyExc_ChildProcessError=python37.PyExc_ChildProcessError DATA + PyExc_ConnectionAbortedError=python37.PyExc_ConnectionAbortedError DATA + PyExc_ConnectionError=python37.PyExc_ConnectionError DATA + PyExc_ConnectionRefusedError=python37.PyExc_ConnectionRefusedError DATA + PyExc_ConnectionResetError=python37.PyExc_ConnectionResetError DATA PyExc_DeprecationWarning=python37.PyExc_DeprecationWarning DATA PyExc_EOFError=python37.PyExc_EOFError DATA PyExc_EnvironmentError=python37.PyExc_EnvironmentError DATA PyExc_Exception=python37.PyExc_Exception DATA + PyExc_FileExistsError=python37.PyExc_FileExistsError DATA + PyExc_FileNotFoundError=python37.PyExc_FileNotFoundError DATA PyExc_FloatingPointError=python37.PyExc_FloatingPointError DATA PyExc_FutureWarning=python37.PyExc_FutureWarning DATA PyExc_GeneratorExit=python37.PyExc_GeneratorExit DATA @@ -185,25 +202,35 @@ PyExc_ImportWarning=python37.PyExc_ImportWarning DATA PyExc_IndentationError=python37.PyExc_IndentationError DATA PyExc_IndexError=python37.PyExc_IndexError DATA + PyExc_InterruptedError=python37.PyExc_InterruptedError DATA + PyExc_IsADirectoryError=python37.PyExc_IsADirectoryError DATA PyExc_KeyError=python37.PyExc_KeyError DATA PyExc_KeyboardInterrupt=python37.PyExc_KeyboardInterrupt DATA PyExc_LookupError=python37.PyExc_LookupError DATA PyExc_MemoryError=python37.PyExc_MemoryError DATA + PyExc_ModuleNotFoundError=python37.PyExc_ModuleNotFoundError DATA PyExc_NameError=python37.PyExc_NameError DATA + PyExc_NotADirectoryError=python37.PyExc_NotADirectoryError DATA PyExc_NotImplementedError=python37.PyExc_NotImplementedError DATA PyExc_OSError=python37.PyExc_OSError DATA PyExc_OverflowError=python37.PyExc_OverflowError DATA PyExc_PendingDeprecationWarning=python37.PyExc_PendingDeprecationWarning DATA + PyExc_PermissionError=python37.PyExc_PermissionError DATA + PyExc_ProcessLookupError=python37.PyExc_ProcessLookupError DATA + PyExc_RecursionError=python37.PyExc_RecursionError DATA PyExc_RecursionErrorInst=python37.PyExc_RecursionErrorInst DATA PyExc_ReferenceError=python37.PyExc_ReferenceError DATA + PyExc_ResourceWarning=python37.PyExc_ResourceWarning DATA PyExc_RuntimeError=python37.PyExc_RuntimeError DATA PyExc_RuntimeWarning=python37.PyExc_RuntimeWarning DATA + PyExc_StopAsyncIteration=python37.PyExc_StopAsyncIteration DATA PyExc_StopIteration=python37.PyExc_StopIteration DATA PyExc_SyntaxError=python37.PyExc_SyntaxError DATA PyExc_SyntaxWarning=python37.PyExc_SyntaxWarning DATA PyExc_SystemError=python37.PyExc_SystemError DATA PyExc_SystemExit=python37.PyExc_SystemExit DATA PyExc_TabError=python37.PyExc_TabError DATA + PyExc_TimeoutError=python37.PyExc_TimeoutError DATA PyExc_TypeError=python37.PyExc_TypeError DATA PyExc_UnboundLocalError=python37.PyExc_UnboundLocalError DATA PyExc_UnicodeDecodeError=python37.PyExc_UnicodeDecodeError DATA @@ -241,10 +268,12 @@ PyGILState_Release=python37.PyGILState_Release PyGetSetDescr_Type=python37.PyGetSetDescr_Type DATA PyImport_AddModule=python37.PyImport_AddModule + PyImport_AddModuleObject=python37.PyImport_AddModuleObject PyImport_AppendInittab=python37.PyImport_AppendInittab PyImport_Cleanup=python37.PyImport_Cleanup PyImport_ExecCodeModule=python37.PyImport_ExecCodeModule PyImport_ExecCodeModuleEx=python37.PyImport_ExecCodeModuleEx + PyImport_ExecCodeModuleObject=python37.PyImport_ExecCodeModuleObject PyImport_ExecCodeModuleWithPathnames=python37.PyImport_ExecCodeModuleWithPathnames PyImport_GetImporter=python37.PyImport_GetImporter PyImport_GetMagicNumber=python37.PyImport_GetMagicNumber @@ -252,8 +281,10 @@ PyImport_GetModuleDict=python37.PyImport_GetModuleDict PyImport_Import=python37.PyImport_Import PyImport_ImportFrozenModule=python37.PyImport_ImportFrozenModule + PyImport_ImportFrozenModuleObject=python37.PyImport_ImportFrozenModuleObject PyImport_ImportModule=python37.PyImport_ImportModule PyImport_ImportModuleLevel=python37.PyImport_ImportModuleLevel + PyImport_ImportModuleLevelObject=python37.PyImport_ImportModuleLevelObject PyImport_ImportModuleNoBlock=python37.PyImport_ImportModuleNoBlock PyImport_ReloadModule=python37.PyImport_ReloadModule PyInterpreterState_Clear=python37.PyInterpreterState_Clear @@ -309,27 +340,35 @@ PyMapping_SetItemString=python37.PyMapping_SetItemString PyMapping_Size=python37.PyMapping_Size PyMapping_Values=python37.PyMapping_Values + PyMem_Calloc=python37.PyMem_Calloc PyMem_Free=python37.PyMem_Free PyMem_Malloc=python37.PyMem_Malloc PyMem_Realloc=python37.PyMem_Realloc PyMemberDescr_Type=python37.PyMemberDescr_Type DATA + PyMemoryView_FromMemory=python37.PyMemoryView_FromMemory PyMemoryView_FromObject=python37.PyMemoryView_FromObject PyMemoryView_GetContiguous=python37.PyMemoryView_GetContiguous PyMemoryView_Type=python37.PyMemoryView_Type DATA PyMethodDescr_Type=python37.PyMethodDescr_Type DATA PyModuleDef_Init=python37.PyModuleDef_Init PyModuleDef_Type=python37.PyModuleDef_Type DATA + PyModule_AddFunctions=python37.PyModule_AddFunctions PyModule_AddIntConstant=python37.PyModule_AddIntConstant PyModule_AddObject=python37.PyModule_AddObject PyModule_AddStringConstant=python37.PyModule_AddStringConstant PyModule_Create2=python37.PyModule_Create2 + PyModule_ExecDef=python37.PyModule_ExecDef + PyModule_FromDefAndSpec2=python37.PyModule_FromDefAndSpec2 PyModule_GetDef=python37.PyModule_GetDef PyModule_GetDict=python37.PyModule_GetDict PyModule_GetFilename=python37.PyModule_GetFilename PyModule_GetFilenameObject=python37.PyModule_GetFilenameObject PyModule_GetName=python37.PyModule_GetName + PyModule_GetNameObject=python37.PyModule_GetNameObject PyModule_GetState=python37.PyModule_GetState PyModule_New=python37.PyModule_New + PyModule_NewObject=python37.PyModule_NewObject + PyModule_SetDocString=python37.PyModule_SetDocString PyModule_Type=python37.PyModule_Type DATA PyNullImporter_Type=python37.PyNullImporter_Type DATA PyNumber_Absolute=python37.PyNumber_Absolute @@ -344,6 +383,7 @@ PyNumber_InPlaceAnd=python37.PyNumber_InPlaceAnd PyNumber_InPlaceFloorDivide=python37.PyNumber_InPlaceFloorDivide PyNumber_InPlaceLshift=python37.PyNumber_InPlaceLshift + PyNumber_InPlaceMatrixMultiply=python37.PyNumber_InPlaceMatrixMultiply PyNumber_InPlaceMultiply=python37.PyNumber_InPlaceMultiply PyNumber_InPlaceOr=python37.PyNumber_InPlaceOr PyNumber_InPlacePower=python37.PyNumber_InPlacePower @@ -356,6 +396,7 @@ PyNumber_Invert=python37.PyNumber_Invert PyNumber_Long=python37.PyNumber_Long PyNumber_Lshift=python37.PyNumber_Lshift + PyNumber_MatrixMultiply=python37.PyNumber_MatrixMultiply PyNumber_Multiply=python37.PyNumber_Multiply PyNumber_Negative=python37.PyNumber_Negative PyNumber_Or=python37.PyNumber_Or @@ -376,6 +417,7 @@ PyODict_SetItem=python37.PyODict_SetItem PyODict_Type=python37.PyODict_Type DATA PyOS_AfterFork=python37.PyOS_AfterFork + PyOS_FSPath=python37.PyOS_FSPath PyOS_InitInterrupts=python37.PyOS_InitInterrupts PyOS_InputHook=python37.PyOS_InputHook DATA PyOS_InterruptOccurred=python37.PyOS_InterruptOccurred @@ -402,6 +444,7 @@ PyObject_CallMethod=python37.PyObject_CallMethod PyObject_CallMethodObjArgs=python37.PyObject_CallMethodObjArgs PyObject_CallObject=python37.PyObject_CallObject + PyObject_Calloc=python37.PyObject_Calloc PyObject_CheckReadBuffer=python37.PyObject_CheckReadBuffer PyObject_ClearWeakRefs=python37.PyObject_ClearWeakRefs PyObject_DelItem=python37.PyObject_DelItem @@ -414,6 +457,7 @@ PyObject_GC_UnTrack=python37.PyObject_GC_UnTrack PyObject_GenericGetAttr=python37.PyObject_GenericGetAttr PyObject_GenericSetAttr=python37.PyObject_GenericSetAttr + PyObject_GenericSetDict=python37.PyObject_GenericSetDict PyObject_GetAttr=python37.PyObject_GetAttr PyObject_GetAttrString=python37.PyObject_GetAttrString PyObject_GetItem=python37.PyObject_GetItem @@ -443,6 +487,7 @@ PyObject_Type=python37.PyObject_Type PyParser_SimpleParseFileFlags=python37.PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlags=python37.PyParser_SimpleParseStringFlags + PyParser_SimpleParseStringFlagsFilename=python37.PyParser_SimpleParseStringFlagsFilename PyProperty_Type=python37.PyProperty_Type DATA PyRangeIter_Type=python37.PyRangeIter_Type DATA PyRange_Type=python37.PyRange_Type DATA @@ -493,9 +538,11 @@ PySuper_Type=python37.PySuper_Type DATA PySys_AddWarnOption=python37.PySys_AddWarnOption PySys_AddWarnOptionUnicode=python37.PySys_AddWarnOptionUnicode + PySys_AddXOption=python37.PySys_AddXOption PySys_FormatStderr=python37.PySys_FormatStderr PySys_FormatStdout=python37.PySys_FormatStdout PySys_GetObject=python37.PySys_GetObject + PySys_GetXOptions=python37.PySys_GetXOptions PySys_HasWarnOptions=python37.PySys_HasWarnOptions PySys_ResetWarnOptions=python37.PySys_ResetWarnOptions PySys_SetArgv=python37.PySys_SetArgv @@ -571,11 +618,14 @@ PyUnicode_AsEncodedUnicode=python37.PyUnicode_AsEncodedUnicode PyUnicode_AsLatin1String=python37.PyUnicode_AsLatin1String PyUnicode_AsRawUnicodeEscapeString=python37.PyUnicode_AsRawUnicodeEscapeString + PyUnicode_AsUCS4=python37.PyUnicode_AsUCS4 + PyUnicode_AsUCS4Copy=python37.PyUnicode_AsUCS4Copy PyUnicode_AsUTF16String=python37.PyUnicode_AsUTF16String PyUnicode_AsUTF32String=python37.PyUnicode_AsUTF32String PyUnicode_AsUTF8String=python37.PyUnicode_AsUTF8String PyUnicode_AsUnicodeEscapeString=python37.PyUnicode_AsUnicodeEscapeString PyUnicode_AsWideChar=python37.PyUnicode_AsWideChar + PyUnicode_AsWideCharString=python37.PyUnicode_AsWideCharString PyUnicode_BuildEncodingMap=python37.PyUnicode_BuildEncodingMap PyUnicode_ClearFreeList=python37.PyUnicode_ClearFreeList PyUnicode_Compare=python37.PyUnicode_Compare @@ -589,6 +639,8 @@ PyUnicode_DecodeFSDefault=python37.PyUnicode_DecodeFSDefault PyUnicode_DecodeFSDefaultAndSize=python37.PyUnicode_DecodeFSDefaultAndSize PyUnicode_DecodeLatin1=python37.PyUnicode_DecodeLatin1 + PyUnicode_DecodeLocale=python37.PyUnicode_DecodeLocale + PyUnicode_DecodeLocaleAndSize=python37.PyUnicode_DecodeLocaleAndSize PyUnicode_DecodeRawUnicodeEscape=python37.PyUnicode_DecodeRawUnicodeEscape PyUnicode_DecodeUTF16=python37.PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful=python37.PyUnicode_DecodeUTF16Stateful @@ -600,9 +652,11 @@ PyUnicode_DecodeUTF8Stateful=python37.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python37.PyUnicode_DecodeUnicodeEscape PyUnicode_EncodeFSDefault=python37.PyUnicode_EncodeFSDefault + PyUnicode_EncodeLocale=python37.PyUnicode_EncodeLocale PyUnicode_FSConverter=python37.PyUnicode_FSConverter PyUnicode_FSDecoder=python37.PyUnicode_FSDecoder PyUnicode_Find=python37.PyUnicode_Find + PyUnicode_FindChar=python37.PyUnicode_FindChar PyUnicode_Format=python37.PyUnicode_Format PyUnicode_FromEncodedObject=python37.PyUnicode_FromEncodedObject PyUnicode_FromFormat=python37.PyUnicode_FromFormat @@ -613,6 +667,7 @@ PyUnicode_FromStringAndSize=python37.PyUnicode_FromStringAndSize PyUnicode_FromWideChar=python37.PyUnicode_FromWideChar PyUnicode_GetDefaultEncoding=python37.PyUnicode_GetDefaultEncoding + PyUnicode_GetLength=python37.PyUnicode_GetLength PyUnicode_GetSize=python37.PyUnicode_GetSize PyUnicode_InternFromString=python37.PyUnicode_InternFromString PyUnicode_InternImmortal=python37.PyUnicode_InternImmortal @@ -622,14 +677,17 @@ PyUnicode_Partition=python37.PyUnicode_Partition PyUnicode_RPartition=python37.PyUnicode_RPartition PyUnicode_RSplit=python37.PyUnicode_RSplit + PyUnicode_ReadChar=python37.PyUnicode_ReadChar PyUnicode_Replace=python37.PyUnicode_Replace PyUnicode_Resize=python37.PyUnicode_Resize PyUnicode_RichCompare=python37.PyUnicode_RichCompare PyUnicode_Split=python37.PyUnicode_Split PyUnicode_Splitlines=python37.PyUnicode_Splitlines + PyUnicode_Substring=python37.PyUnicode_Substring PyUnicode_Tailmatch=python37.PyUnicode_Tailmatch PyUnicode_Translate=python37.PyUnicode_Translate PyUnicode_Type=python37.PyUnicode_Type DATA + PyUnicode_WriteChar=python37.PyUnicode_WriteChar PyWeakref_GetObject=python37.PyWeakref_GetObject PyWeakref_NewProxy=python37.PyWeakref_NewProxy PyWeakref_NewRef=python37.PyWeakref_NewRef @@ -641,9 +699,12 @@ Py_BuildValue=python37.Py_BuildValue Py_CompileString=python37.Py_CompileString Py_DecRef=python37.Py_DecRef + Py_DecodeLocale=python37.Py_DecodeLocale + Py_EncodeLocale=python37.Py_EncodeLocale Py_EndInterpreter=python37.Py_EndInterpreter Py_Exit=python37.Py_Exit Py_FatalError=python37.Py_FatalError + Py_FileSystemDefaultEncodeErrors=python37.Py_FileSystemDefaultEncodeErrors DATA Py_FileSystemDefaultEncoding=python37.Py_FileSystemDefaultEncoding DATA Py_Finalize=python37.Py_Finalize Py_FinalizeEx=python37.Py_FinalizeEx @@ -669,6 +730,7 @@ Py_NewInterpreter=python37.Py_NewInterpreter Py_ReprEnter=python37.Py_ReprEnter Py_ReprLeave=python37.Py_ReprLeave + Py_SetPath=python37.Py_SetPath Py_SetProgramName=python37.Py_SetProgramName Py_SetPythonHome=python37.Py_SetPythonHome Py_SetRecursionLimit=python37.Py_SetRecursionLimit @@ -695,6 +757,8 @@ _PyTrash_delete_nesting=python37._PyTrash_delete_nesting DATA _PyTrash_deposit_object=python37._PyTrash_deposit_object _PyTrash_destroy_chain=python37._PyTrash_destroy_chain + _PyTrash_thread_deposit_object=python37._PyTrash_thread_deposit_object + _PyTrash_thread_destroy_chain=python37._PyTrash_thread_destroy_chain _PyWeakref_CallableProxyType=python37._PyWeakref_CallableProxyType DATA _PyWeakref_ProxyType=python37._PyWeakref_ProxyType DATA _PyWeakref_RefType=python37._PyWeakref_RefType DATA -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 07:07:57 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 27 Dec 2016 12:07:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Move_versionad?= =?utf-8?q?ded_inside_of_the_get=5Fterminal=5Fsize=28=29_block?= Message-ID: <20161227120757.20512.17542.D598FDA1@psf.io> https://hg.python.org/cpython/rev/89d59916cb2c changeset: 105842:89d59916cb2c branch: 3.5 parent: 105839:d95fee442e27 user: Berker Peksag date: Tue Dec 27 15:09:11 2016 +0300 summary: Move versionadded inside of the get_terminal_size() block files: Doc/library/shutil.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -625,8 +625,6 @@ Querying the size of the output terminal ---------------------------------------- -.. versionadded:: 3.3 - .. function:: get_terminal_size(fallback=(columns, lines)) Get the size of the terminal window. @@ -650,6 +648,8 @@ See also: The Single UNIX Specification, Version 2, `Other Environment Variables`_. + .. versionadded:: 3.3 + .. _`Other Environment Variables`: http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 07:07:57 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 27 Dec 2016 12:07:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_from_3=2E5?= Message-ID: <20161227120757.26704.54147.EDA6E75D@psf.io> https://hg.python.org/cpython/rev/af71708d7445 changeset: 105843:af71708d7445 branch: 3.6 parent: 105840:cb864fc4b3be parent: 105842:89d59916cb2c user: Berker Peksag date: Tue Dec 27 15:09:35 2016 +0300 summary: Merge from 3.5 files: Doc/library/shutil.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -625,8 +625,6 @@ Querying the size of the output terminal ---------------------------------------- -.. versionadded:: 3.3 - .. function:: get_terminal_size(fallback=(columns, lines)) Get the size of the terminal window. @@ -650,6 +648,8 @@ See also: The Single UNIX Specification, Version 2, `Other Environment Variables`_. + .. versionadded:: 3.3 + .. _`Other Environment Variables`: http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 07:07:58 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 27 Dec 2016 12:07:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E6?= Message-ID: <20161227120758.79468.23528.E5519964@psf.io> https://hg.python.org/cpython/rev/ed247c49c002 changeset: 105844:ed247c49c002 parent: 105841:513852ad0c5c parent: 105843:af71708d7445 user: Berker Peksag date: Tue Dec 27 15:09:55 2016 +0300 summary: Merge from 3.6 files: Doc/library/shutil.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -625,8 +625,6 @@ Querying the size of the output terminal ---------------------------------------- -.. versionadded:: 3.3 - .. function:: get_terminal_size(fallback=(columns, lines)) Get the size of the terminal window. @@ -650,6 +648,8 @@ See also: The Single UNIX Specification, Version 2, `Other Environment Variables`_. + .. versionadded:: 3.3 + .. _`Other Environment Variables`: http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag_002_003 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 07:15:16 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 27 Dec 2016 12:15:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329069=3A_Merge_from_3=2E6?= Message-ID: <20161227121516.107001.81090.F9451028@psf.io> https://hg.python.org/cpython/rev/b712e4818ff8 changeset: 105847:b712e4818ff8 parent: 105844:ed247c49c002 parent: 105846:b1ccf713e8f8 user: Berker Peksag date: Tue Dec 27 15:17:14 2016 +0300 summary: Issue #29069: Merge from 3.6 files: Doc/distutils/packageindex.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/distutils/packageindex.rst b/Doc/distutils/packageindex.rst --- a/Doc/distutils/packageindex.rst +++ b/Doc/distutils/packageindex.rst @@ -173,7 +173,7 @@ Each section describing a repository defines three variables: - *repository*, that defines the url of the PyPI server. Defaults to - ``https://www.python.org/pypi``. + ``https://upload.pypi.org/legacy/``. - *username*, which is the registered username on the PyPI server. - *password*, that will be used to authenticate. If omitted the user will be prompt to type it when needed. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 07:15:16 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 27 Dec 2016 12:15:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDY5?= =?utf-8?q?=3A_Update_the_default_URL_of_PyPI_server?= Message-ID: <20161227121516.80239.42102.1162ED9B@psf.io> https://hg.python.org/cpython/rev/c4cd7e00a640 changeset: 105845:c4cd7e00a640 branch: 3.5 parent: 105842:89d59916cb2c user: Berker Peksag date: Tue Dec 27 15:16:25 2016 +0300 summary: Issue #29069: Update the default URL of PyPI server Patch by paka. files: Doc/distutils/packageindex.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/distutils/packageindex.rst b/Doc/distutils/packageindex.rst --- a/Doc/distutils/packageindex.rst +++ b/Doc/distutils/packageindex.rst @@ -173,7 +173,7 @@ Each section describing a repository defines three variables: - *repository*, that defines the url of the PyPI server. Defaults to - ``https://www.python.org/pypi``. + ``https://upload.pypi.org/legacy/``. - *username*, which is the registered username on the PyPI server. - *password*, that will be used to authenticate. If omitted the user will be prompt to type it when needed. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 07:15:16 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 27 Dec 2016 12:15:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329069=3A_Merge_from_3=2E5?= Message-ID: <20161227121516.79498.88945.EA423D01@psf.io> https://hg.python.org/cpython/rev/b1ccf713e8f8 changeset: 105846:b1ccf713e8f8 branch: 3.6 parent: 105843:af71708d7445 parent: 105845:c4cd7e00a640 user: Berker Peksag date: Tue Dec 27 15:16:55 2016 +0300 summary: Issue #29069: Merge from 3.5 files: Doc/distutils/packageindex.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/distutils/packageindex.rst b/Doc/distutils/packageindex.rst --- a/Doc/distutils/packageindex.rst +++ b/Doc/distutils/packageindex.rst @@ -173,7 +173,7 @@ Each section describing a repository defines three variables: - *repository*, that defines the url of the PyPI server. Defaults to - ``https://www.python.org/pypi``. + ``https://upload.pypi.org/legacy/``. - *username*, which is the registered username on the PyPI server. - *password*, that will be used to authenticate. If omitted the user will be prompt to type it when needed. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 08:05:17 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 13:05:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MDU4?= =?utf-8?q?=3A_All_stable_API_extensions_added_after_Python_3=2E2_are_now?= Message-ID: <20161227130517.17154.17135.5E4C7B8B@psf.io> https://hg.python.org/cpython/rev/f26c16aba11e changeset: 105848:f26c16aba11e branch: 3.6 parent: 105846:b1ccf713e8f8 user: Serhiy Storchaka date: Tue Dec 27 14:57:39 2016 +0200 summary: Issue #29058: All stable API extensions added after Python 3.2 are now available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python version supporting this API. files: Include/abstract.h | 4 ++++ Include/bytesobject.h | 2 ++ Include/codecs.h | 4 ++++ Include/fileobject.h | 2 ++ Include/fileutils.h | 2 ++ Include/import.h | 10 +++++++++- Include/memoryobject.h | 2 ++ Include/moduleobject.h | 4 ++++ Include/object.h | 2 ++ Include/objimpl.h | 2 ++ Include/odictobject.h | 9 ++++++--- Include/osmodule.h | 2 ++ Include/pyerrors.h | 21 ++++++++++++++++++--- Include/pymem.h | 2 ++ Include/pythonrun.h | 2 ++ Include/pythread.h | 2 ++ Include/unicodeobject.h | 18 ++++++++++++++++++ Include/warnings.h | 2 ++ Misc/NEWS | 7 +++++++ 19 files changed, 92 insertions(+), 7 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -750,11 +750,13 @@ o1*o2. */ +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); /* This is the equivalent of the Python expression: o1 @ o2. */ +#endif PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); @@ -930,11 +932,13 @@ o1 *= o2. */ +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); /* This is the equivalent of the Python expression: o1 @= o2. */ +#endif PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2); diff --git a/Include/bytesobject.h b/Include/bytesobject.h --- a/Include/bytesobject.h +++ b/Include/bytesobject.h @@ -74,11 +74,13 @@ PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); +#ifndef Py_LIMITED_API /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *, const char **); +#endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API diff --git a/Include/codecs.h b/Include/codecs.h --- a/Include/codecs.h +++ b/Include/codecs.h @@ -225,10 +225,14 @@ /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc); +#endif +#ifndef Py_LIMITED_API PyAPI_DATA(const char *) Py_hexdigits; +#endif #ifdef __cplusplus } diff --git a/Include/fileobject.h b/Include/fileobject.h --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -23,7 +23,9 @@ If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; +#endif PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; /* Internal API diff --git a/Include/fileutils.h b/Include/fileutils.h --- a/Include/fileutils.h +++ b/Include/fileutils.h @@ -5,6 +5,7 @@ extern "C" { #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(wchar_t *) Py_DecodeLocale( const char *arg, size_t *size); @@ -12,6 +13,7 @@ PyAPI_FUNC(char*) Py_EncodeLocale( const wchar_t *text, size_t *error_pos); +#endif #ifndef Py_LIMITED_API diff --git a/Include/import.h b/Include/import.h --- a/Include/import.h +++ b/Include/import.h @@ -9,9 +9,9 @@ #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyImportZip_Init(void); -#endif /* !Py_LIMITED_API */ PyMODINIT_FUNC PyInit_imp(void); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( @@ -29,16 +29,20 @@ const char *pathname, /* decoded from the filesystem encoding */ const char *cpathname /* decoded from the filesystem encoding */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname ); +#endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -55,6 +59,7 @@ PyObject *fromlist, int level ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *name, PyObject *globals, @@ -62,6 +67,7 @@ PyObject *fromlist, int level ); +#endif #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, 0) @@ -70,9 +76,11 @@ PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( PyObject *name ); +#endif PyAPI_FUNC(int) PyImport_ImportFrozenModule( const char *name /* UTF-8 encoded string */ ); diff --git a/Include/memoryobject.h b/Include/memoryobject.h --- a/Include/memoryobject.h +++ b/Include/memoryobject.h @@ -21,8 +21,10 @@ #endif PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); #endif diff --git a/Include/moduleobject.h b/Include/moduleobject.h --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -12,14 +12,18 @@ #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); +#endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); diff --git a/Include/object.h b/Include/object.h --- a/Include/object.h +++ b/Include/object.h @@ -547,7 +547,9 @@ PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *); +#endif PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject *); PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); diff --git a/Include/objimpl.h b/Include/objimpl.h --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -95,7 +95,9 @@ the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); diff --git a/Include/odictobject.h b/Include/odictobject.h --- a/Include/odictobject.h +++ b/Include/odictobject.h @@ -17,12 +17,13 @@ PyAPI_DATA(PyTypeObject) PyODictItems_Type; PyAPI_DATA(PyTypeObject) PyODictValues_Type; -#endif /* Py_LIMITED_API */ - #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) #define PyODict_SIZE(op) ((PyDictObject *)op)->ma_used -#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key) + +#endif /* Py_LIMITED_API */ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyODict_New(void); PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); @@ -37,6 +38,8 @@ #define PyODict_GetItemString(od, key) \ PyDict_GetItemString((PyObject *)od, key) +#endif + #ifdef __cplusplus } #endif diff --git a/Include/osmodule.h b/Include/osmodule.h --- a/Include/osmodule.h +++ b/Include/osmodule.h @@ -7,7 +7,9 @@ extern "C" { #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); +#endif #ifdef __cplusplus } diff --git a/Include/pyerrors.h b/Include/pyerrors.h --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -87,8 +87,10 @@ PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); +#endif #if defined(__clang__) || \ (defined(__GNUC_MAJOR__) && \ @@ -147,7 +149,9 @@ PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration; +#endif PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; @@ -160,7 +164,9 @@ PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError; +#endif PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; @@ -168,7 +174,9 @@ PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_RecursionError; +#endif PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; @@ -185,6 +193,7 @@ PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_DATA(PyObject *) PyExc_BlockingIOError; PyAPI_DATA(PyObject *) PyExc_BrokenPipeError; PyAPI_DATA(PyObject *) PyExc_ChildProcessError; @@ -200,6 +209,7 @@ PyAPI_DATA(PyObject *) PyExc_PermissionError; PyAPI_DATA(PyObject *) PyExc_ProcessLookupError; PyAPI_DATA(PyObject *) PyExc_TimeoutError; +#endif /* Compatibility aliases */ @@ -232,8 +242,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects( PyObject *, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *exc, const char *filename /* decoded from the filesystem encoding */ @@ -279,8 +291,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects( PyObject *,int, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *exc, int ierr, @@ -293,13 +307,14 @@ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ -PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *, - PyObject *); - +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *, PyObject *, PyObject *); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *, PyObject *); +#endif /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); diff --git a/Include/pymem.h b/Include/pymem.h --- a/Include/pymem.h +++ b/Include/pymem.h @@ -101,7 +101,9 @@ */ PyAPI_FUNC(void *) PyMem_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_Free(void *ptr); diff --git a/Include/pythonrun.h b/Include/pythonrun.h --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -91,9 +91,11 @@ #endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *, const char *, int, int); +#endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int); diff --git a/Include/pythread.h b/Include/pythread.h --- a/Include/pythread.h +++ b/Include/pythread.h @@ -69,7 +69,9 @@ PyAPI_FUNC(size_t) PyThread_get_stacksize(void); PyAPI_FUNC(int) PyThread_set_stacksize(size_t); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); +#endif /* Thread Local Storage (TLS) API */ PyAPI_FUNC(int) PyThread_create_key(void); diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -718,10 +718,12 @@ Py_ssize_t size); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_Substring( PyObject *str, Py_ssize_t start, Py_ssize_t end); +#endif #ifndef Py_LIMITED_API /* Compute the maximum character of the substring unicode[start:end]. @@ -732,6 +734,7 @@ Py_ssize_t end); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Copy the string into a UCS4 buffer including the null character if copy_null is set. Return NULL and raise an exception on error. Raise a SystemError if the buffer is smaller than the string. Return buffer on success. @@ -747,6 +750,7 @@ * PyMem_Malloc; if this fails, NULL is returned with a memory error exception set. */ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); +#endif /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. @@ -771,11 +775,13 @@ ); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Get the length of the Unicode object. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength( PyObject *unicode ); +#endif /* Get the number of Py_UNICODE units in the string representation. */ @@ -784,6 +790,7 @@ PyObject *unicode /* Unicode object */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Read a character from the string. */ PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar( @@ -801,6 +808,7 @@ Py_ssize_t index, Py_UCS4 character ); +#endif #ifndef Py_LIMITED_API /* Get the maximum ordinal for a Unicode character. */ @@ -1486,6 +1494,7 @@ const char *errors /* error handling */ ); +#ifndef Py_LIMITED_API /* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( @@ -1496,6 +1505,7 @@ invalid escaped char in string. */ ); +#endif PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ @@ -1686,6 +1696,7 @@ Py_ssize_t *consumed /* bytes consumed */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( int code_page, /* code page number */ const char *string, /* encoded string */ @@ -1693,6 +1704,7 @@ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); +#endif PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ @@ -1706,11 +1718,13 @@ ); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( int code_page, /* code page number */ PyObject *unicode, /* Unicode object */ const char *errors /* error handling */ ); +#endif #endif /* MS_WINDOWS */ @@ -1773,6 +1787,7 @@ /* --- Locale encoding --------------------------------------------------- */ +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Decode a string from the current locale encoding. The decoder is strict if *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' error handler (PEP 383) to escape undecodable bytes. If a byte sequence can @@ -1802,6 +1817,7 @@ PyObject *unicode, const char *errors ); +#endif /* --- File system encoding ---------------------------------------------- */ @@ -1998,6 +2014,7 @@ int direction /* Find direction: +1 forward, -1 backward */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Like PyUnicode_Find, but search for single character only. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( PyObject *str, @@ -2006,6 +2023,7 @@ Py_ssize_t end, int direction ); +#endif /* Count the number of occurrences of substr in str[start:end]. */ diff --git a/Include/warnings.h b/Include/warnings.h --- a/Include/warnings.h +++ b/Include/warnings.h @@ -18,12 +18,14 @@ const char *format, /* ASCII-encoded string */ ...); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 /* Emit a ResourceWarning warning */ PyAPI_FUNC(int) PyErr_ResourceWarning( PyObject *source, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *category, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -72,6 +72,13 @@ - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. +C API +----- + +- Issue #29058: All stable API extensions added after Python 3.2 are now + available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of + the minimum Python version supporting this API. + Tests ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 08:05:18 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 13:05:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329058=3A_All_stable_API_extensions_added_after_?= =?utf-8?q?Python_3=2E2_are_now?= Message-ID: <20161227130517.19637.13768.D290ECE7@psf.io> https://hg.python.org/cpython/rev/77f5f31bf699 changeset: 105849:77f5f31bf699 parent: 105847:b712e4818ff8 parent: 105848:f26c16aba11e user: Serhiy Storchaka date: Tue Dec 27 15:04:59 2016 +0200 summary: Issue #29058: All stable API extensions added after Python 3.2 are now available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python version supporting this API. files: Include/abstract.h | 4 ++++ Include/bytesobject.h | 2 ++ Include/codecs.h | 4 ++++ Include/fileobject.h | 2 ++ Include/fileutils.h | 2 ++ Include/import.h | 10 +++++++++- Include/memoryobject.h | 2 ++ Include/moduleobject.h | 4 ++++ Include/object.h | 2 ++ Include/objimpl.h | 2 ++ Include/odictobject.h | 9 ++++++--- Include/osmodule.h | 2 ++ Include/pyerrors.h | 21 ++++++++++++++++++--- Include/pymem.h | 2 ++ Include/pythonrun.h | 2 ++ Include/pythread.h | 2 ++ Include/unicodeobject.h | 18 ++++++++++++++++++ Include/warnings.h | 2 ++ Misc/NEWS | 4 ++++ 19 files changed, 89 insertions(+), 7 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -612,8 +612,10 @@ This is the equivalent of the Python expression: o1 * o2. */ PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* This is the equivalent of the Python expression: o1 @ o2. */ PyAPI_FUNC(PyObject *) PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2); +#endif /* Returns the result of dividing o1 by o2 giving an integral result, or NULL on failure. @@ -743,8 +745,10 @@ This is the equivalent of the Python expression: o1 *= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* This is the equivalent of the Python expression: o1 @= o2. */ PyAPI_FUNC(PyObject *) PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2); +#endif /* Returns the result of dividing o1 by o2 giving an integral result, possibly in-place, or NULL on failure. diff --git a/Include/bytesobject.h b/Include/bytesobject.h --- a/Include/bytesobject.h +++ b/Include/bytesobject.h @@ -74,11 +74,13 @@ PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *); +#ifndef Py_LIMITED_API /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, const char *, Py_ssize_t, const char *, const char **); +#endif /* Macro, trading safety for speed */ #ifndef Py_LIMITED_API diff --git a/Include/codecs.h b/Include/codecs.h --- a/Include/codecs.h +++ b/Include/codecs.h @@ -225,10 +225,14 @@ /* replace the unicode encode error with backslash escapes (\x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 /* replace the unicode encode error with backslash escapes (\N, \x, \u and \U) */ PyAPI_FUNC(PyObject *) PyCodec_NameReplaceErrors(PyObject *exc); +#endif +#ifndef Py_LIMITED_API PyAPI_DATA(const char *) Py_hexdigits; +#endif #ifdef __cplusplus } diff --git a/Include/fileobject.h b/Include/fileobject.h --- a/Include/fileobject.h +++ b/Include/fileobject.h @@ -23,7 +23,9 @@ If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(const char *) Py_FileSystemDefaultEncodeErrors; +#endif PyAPI_DATA(int) Py_HasFileSystemDefaultEncoding; /* Internal API diff --git a/Include/fileutils.h b/Include/fileutils.h --- a/Include/fileutils.h +++ b/Include/fileutils.h @@ -5,6 +5,7 @@ extern "C" { #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(wchar_t *) Py_DecodeLocale( const char *arg, size_t *size); @@ -12,6 +13,7 @@ PyAPI_FUNC(char*) Py_EncodeLocale( const wchar_t *text, size_t *error_pos); +#endif #ifndef Py_LIMITED_API diff --git a/Include/import.h b/Include/import.h --- a/Include/import.h +++ b/Include/import.h @@ -9,9 +9,9 @@ #ifndef Py_LIMITED_API PyAPI_FUNC(void) _PyImportZip_Init(void); -#endif /* !Py_LIMITED_API */ PyMODINIT_FUNC PyInit_imp(void); +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(long) PyImport_GetMagicNumber(void); PyAPI_FUNC(const char *) PyImport_GetMagicTag(void); PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule( @@ -29,16 +29,20 @@ const char *pathname, /* decoded from the filesystem encoding */ const char *cpathname /* decoded from the filesystem encoding */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleObject( PyObject *name, PyObject *co, PyObject *pathname, PyObject *cpathname ); +#endif PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyImport_AddModuleObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyImport_AddModule( const char *name /* UTF-8 encoded string */ ); @@ -55,6 +59,7 @@ PyObject *fromlist, int level ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevelObject( PyObject *name, PyObject *globals, @@ -62,6 +67,7 @@ PyObject *fromlist, int level ); +#endif #define PyImport_ImportModuleEx(n, g, l, f) \ PyImport_ImportModuleLevel(n, g, l, f, 0) @@ -70,9 +76,11 @@ PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); PyAPI_FUNC(void) PyImport_Cleanup(void); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyImport_ImportFrozenModuleObject( PyObject *name ); +#endif PyAPI_FUNC(int) PyImport_ImportFrozenModule( const char *name /* UTF-8 encoded string */ ); diff --git a/Include/memoryobject.h b/Include/memoryobject.h --- a/Include/memoryobject.h +++ b/Include/memoryobject.h @@ -21,8 +21,10 @@ #endif PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); #endif diff --git a/Include/moduleobject.h b/Include/moduleobject.h --- a/Include/moduleobject.h +++ b/Include/moduleobject.h @@ -12,14 +12,18 @@ #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_NewObject( PyObject *name ); +#endif PyAPI_FUNC(PyObject *) PyModule_New( const char *name /* UTF-8 encoded string */ ); PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *); +#endif PyAPI_FUNC(const char *) PyModule_GetName(PyObject *); PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *) Py_DEPRECATED(3.2); PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *); diff --git a/Include/object.h b/Include/object.h --- a/Include/object.h +++ b/Include/object.h @@ -547,7 +547,9 @@ PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(int) PyObject_GenericSetDict(PyObject *, PyObject *, void *); +#endif PyAPI_FUNC(Py_hash_t) PyObject_Hash(PyObject *); PyAPI_FUNC(Py_hash_t) PyObject_HashNotImplemented(PyObject *); PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); diff --git a/Include/objimpl.h b/Include/objimpl.h --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -95,7 +95,9 @@ the raw memory. */ PyAPI_FUNC(void *) PyObject_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyObject_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyObject_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyObject_Free(void *ptr); diff --git a/Include/odictobject.h b/Include/odictobject.h --- a/Include/odictobject.h +++ b/Include/odictobject.h @@ -17,12 +17,13 @@ PyAPI_DATA(PyTypeObject) PyODictItems_Type; PyAPI_DATA(PyTypeObject) PyODictValues_Type; -#endif /* Py_LIMITED_API */ - #define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type) #define PyODict_CheckExact(op) (Py_TYPE(op) == &PyODict_Type) #define PyODict_SIZE(op) PyDict_GET_SIZE((op)) -#define PyODict_HasKey(od, key) (PyMapping_HasKey(PyObject *)od, key) + +#endif /* Py_LIMITED_API */ + +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(PyObject *) PyODict_New(void); PyAPI_FUNC(int) PyODict_SetItem(PyObject *od, PyObject *key, PyObject *item); @@ -37,6 +38,8 @@ #define PyODict_GetItemString(od, key) \ PyDict_GetItemString((PyObject *)od, key) +#endif + #ifdef __cplusplus } #endif diff --git a/Include/osmodule.h b/Include/osmodule.h --- a/Include/osmodule.h +++ b/Include/osmodule.h @@ -7,7 +7,9 @@ extern "C" { #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); +#endif #ifdef __cplusplus } diff --git a/Include/pyerrors.h b/Include/pyerrors.h --- a/Include/pyerrors.h +++ b/Include/pyerrors.h @@ -87,8 +87,10 @@ PyAPI_FUNC(void) PyErr_Clear(void); PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **); PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *); +#endif #if defined(__clang__) || \ (defined(__GNUC_MAJOR__) && \ @@ -147,7 +149,9 @@ PyAPI_DATA(PyObject *) PyExc_BaseException; PyAPI_DATA(PyObject *) PyExc_Exception; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration; +#endif PyAPI_DATA(PyObject *) PyExc_StopIteration; PyAPI_DATA(PyObject *) PyExc_GeneratorExit; PyAPI_DATA(PyObject *) PyExc_ArithmeticError; @@ -160,7 +164,9 @@ PyAPI_DATA(PyObject *) PyExc_FloatingPointError; PyAPI_DATA(PyObject *) PyExc_OSError; PyAPI_DATA(PyObject *) PyExc_ImportError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError; +#endif PyAPI_DATA(PyObject *) PyExc_IndexError; PyAPI_DATA(PyObject *) PyExc_KeyError; PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; @@ -168,7 +174,9 @@ PyAPI_DATA(PyObject *) PyExc_NameError; PyAPI_DATA(PyObject *) PyExc_OverflowError; PyAPI_DATA(PyObject *) PyExc_RuntimeError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_DATA(PyObject *) PyExc_RecursionError; +#endif PyAPI_DATA(PyObject *) PyExc_NotImplementedError; PyAPI_DATA(PyObject *) PyExc_SyntaxError; PyAPI_DATA(PyObject *) PyExc_IndentationError; @@ -185,6 +193,7 @@ PyAPI_DATA(PyObject *) PyExc_ValueError; PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_DATA(PyObject *) PyExc_BlockingIOError; PyAPI_DATA(PyObject *) PyExc_BrokenPipeError; PyAPI_DATA(PyObject *) PyExc_ChildProcessError; @@ -200,6 +209,7 @@ PyAPI_DATA(PyObject *) PyExc_PermissionError; PyAPI_DATA(PyObject *) PyExc_ProcessLookupError; PyAPI_DATA(PyObject *) PyExc_TimeoutError; +#endif /* Compatibility aliases */ @@ -232,8 +242,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects( PyObject *, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( PyObject *exc, const char *filename /* decoded from the filesystem encoding */ @@ -279,8 +291,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( PyObject *,int, PyObject *); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000 PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects( PyObject *,int, PyObject *, PyObject *); +#endif PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( PyObject *exc, int ierr, @@ -293,13 +307,14 @@ PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); #endif /* MS_WINDOWS */ -PyAPI_FUNC(PyObject *) PyErr_SetExcWithArgsKwargs(PyObject *, PyObject *, - PyObject *); - +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *, PyObject *, PyObject *); +#endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *, PyObject *); +#endif /* Export the old function so that the existing API remains available: */ PyAPI_FUNC(void) PyErr_BadInternalCall(void); diff --git a/Include/pymem.h b/Include/pymem.h --- a/Include/pymem.h +++ b/Include/pymem.h @@ -101,7 +101,9 @@ */ PyAPI_FUNC(void *) PyMem_Malloc(size_t size); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000 PyAPI_FUNC(void *) PyMem_Calloc(size_t nelem, size_t elsize); +#endif PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size); PyAPI_FUNC(void) PyMem_Free(void *ptr); diff --git a/Include/pythonrun.h b/Include/pythonrun.h --- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -91,9 +91,11 @@ #endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, int); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlagsFilename(const char *, const char *, int, int); +#endif PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, int, int); diff --git a/Include/pythread.h b/Include/pythread.h --- a/Include/pythread.h +++ b/Include/pythread.h @@ -69,7 +69,9 @@ PyAPI_FUNC(size_t) PyThread_get_stacksize(void); PyAPI_FUNC(int) PyThread_set_stacksize(size_t); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyThread_GetInfo(void); +#endif /* Thread Local Storage (TLS) API */ PyAPI_FUNC(int) PyThread_create_key(void); diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h --- a/Include/unicodeobject.h +++ b/Include/unicodeobject.h @@ -722,10 +722,12 @@ Py_ssize_t size); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_Substring( PyObject *str, Py_ssize_t start, Py_ssize_t end); +#endif #ifndef Py_LIMITED_API /* Compute the maximum character of the substring unicode[start:end]. @@ -736,6 +738,7 @@ Py_ssize_t end); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Copy the string into a UCS4 buffer including the null character if copy_null is set. Return NULL and raise an exception on error. Raise a SystemError if the buffer is smaller than the string. Return buffer on success. @@ -751,6 +754,7 @@ * PyMem_Malloc; if this fails, NULL is returned with a memory error exception set. */ PyAPI_FUNC(Py_UCS4*) PyUnicode_AsUCS4Copy(PyObject *unicode); +#endif /* Return a read-only pointer to the Unicode object's internal Py_UNICODE buffer. @@ -775,11 +779,13 @@ ) /* Py_DEPRECATED(3.3) */; #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Get the length of the Unicode object. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength( PyObject *unicode ); +#endif /* Get the number of Py_UNICODE units in the string representation. */ @@ -788,6 +794,7 @@ PyObject *unicode /* Unicode object */ ) Py_DEPRECATED(3.3); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Read a character from the string. */ PyAPI_FUNC(Py_UCS4) PyUnicode_ReadChar( @@ -805,6 +812,7 @@ Py_ssize_t index, Py_UCS4 character ); +#endif #ifndef Py_LIMITED_API /* Get the maximum ordinal for a Unicode character. */ @@ -1490,6 +1498,7 @@ const char *errors /* error handling */ ); +#ifndef Py_LIMITED_API /* Helper for PyUnicode_DecodeUnicodeEscape that detects invalid escape chars. */ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscape( @@ -1500,6 +1509,7 @@ invalid escaped char in string. */ ); +#endif PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( PyObject *unicode /* Unicode object */ @@ -1690,6 +1700,7 @@ Py_ssize_t *consumed /* bytes consumed */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_DecodeCodePageStateful( int code_page, /* code page number */ const char *string, /* encoded string */ @@ -1697,6 +1708,7 @@ const char *errors, /* error handling */ Py_ssize_t *consumed /* bytes consumed */ ); +#endif PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( PyObject *unicode /* Unicode object */ @@ -1710,11 +1722,13 @@ ) Py_DEPRECATED(3.3); #endif +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 PyAPI_FUNC(PyObject*) PyUnicode_EncodeCodePage( int code_page, /* code page number */ PyObject *unicode, /* Unicode object */ const char *errors /* error handling */ ); +#endif #endif /* MS_WINDOWS */ @@ -1777,6 +1791,7 @@ /* --- Locale encoding --------------------------------------------------- */ +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Decode a string from the current locale encoding. The decoder is strict if *surrogateescape* is equal to zero, otherwise it uses the 'surrogateescape' error handler (PEP 383) to escape undecodable bytes. If a byte sequence can @@ -1806,6 +1821,7 @@ PyObject *unicode, const char *errors ); +#endif /* --- File system encoding ---------------------------------------------- */ @@ -2002,6 +2018,7 @@ int direction /* Find direction: +1 forward, -1 backward */ ); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000 /* Like PyUnicode_Find, but search for single character only. */ PyAPI_FUNC(Py_ssize_t) PyUnicode_FindChar( PyObject *str, @@ -2010,6 +2027,7 @@ Py_ssize_t end, int direction ); +#endif /* Count the number of occurrences of substr in str[start:end]. */ diff --git a/Include/warnings.h b/Include/warnings.h --- a/Include/warnings.h +++ b/Include/warnings.h @@ -18,12 +18,14 @@ const char *format, /* ASCII-encoded string */ ...); +#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000 /* Emit a ResourceWarning warning */ PyAPI_FUNC(int) PyErr_ResourceWarning( PyObject *source, Py_ssize_t stack_level, const char *format, /* ASCII-encoded string */ ...); +#endif #ifndef Py_LIMITED_API PyAPI_FUNC(int) PyErr_WarnExplicitObject( PyObject *category, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -552,6 +552,10 @@ C API ----- +- Issue #29058: All stable API extensions added after Python 3.2 are now + available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of + the minimum Python version supporting this API. + - Issue #28822: The indices parameters *start* and *end* of PyUnicode_FindChar() are now adjusted to behave like ``str[start:end]``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 08:09:53 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 13:09:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4OTk4?= =?utf-8?q?=3A_More_APIs_now_support_longs_as_well_as_ints=2E?= Message-ID: <20161227130953.106725.9749.4511AB56@psf.io> https://hg.python.org/cpython/rev/ffcb321ba9c0 changeset: 105850:ffcb321ba9c0 branch: 2.7 parent: 105827:878a91174e74 user: Serhiy Storchaka date: Tue Dec 27 15:09:36 2016 +0200 summary: Issue #28998: More APIs now support longs as well as ints. files: Lib/asynchat.py | 2 +- Lib/compiler/pyassem.py | 2 +- Lib/compiler/transformer.py | 2 +- Lib/idlelib/PyShell.py | 4 ++-- Lib/imaplib.py | 2 +- Lib/lib-tk/Tkinter.py | 4 ++-- Lib/lib-tk/turtle.py | 4 ++-- Lib/lib2to3/pgen2/pgen.py | 2 +- Lib/logging/__init__.py | 2 +- Lib/multiprocessing/pool.py | 2 +- Lib/multiprocessing/process.py | 6 +++--- Lib/multiprocessing/util.py | 2 +- Lib/pickletools.py | 4 ++-- Lib/subprocess.py | 12 ++++++------ Lib/unittest/signals.py | 2 +- Lib/warnings.py | 8 ++++---- Misc/NEWS | 2 ++ Modules/_csv.c | 17 ++++++++++++----- Modules/_cursesmodule.c | 14 +++++++++++--- Modules/dlmodule.c | 5 ++++- Modules/svmodule.c | 4 ++-- Modules/termios.c | 5 ++++- Objects/intobject.c | 7 +++++-- 23 files changed, 70 insertions(+), 44 deletions(-) diff --git a/Lib/asynchat.py b/Lib/asynchat.py --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -133,7 +133,7 @@ # no terminator, collect it all self.collect_incoming_data (self.ac_in_buffer) self.ac_in_buffer = '' - elif isinstance(terminator, int) or isinstance(terminator, long): + elif isinstance(terminator, (int, long)): # numeric terminator n = terminator if lb < n: diff --git a/Lib/compiler/pyassem.py b/Lib/compiler/pyassem.py --- a/Lib/compiler/pyassem.py +++ b/Lib/compiler/pyassem.py @@ -581,7 +581,7 @@ def twobyte(val): """Convert an int argument into high and low bytes""" - assert isinstance(val, int) + assert isinstance(val, (int, long)) return divmod(val, 256) class LineAddrTable: diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -1526,7 +1526,7 @@ def debug_tree(tree): l = [] for elt in tree: - if isinstance(elt, int): + if isinstance(elt, (int, long)): l.append(_names.get(elt, elt)) elif isinstance(elt, str): l.append(elt) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -1370,7 +1370,7 @@ raise ValueError("read from closed file") if size is None: size = -1 - elif not isinstance(size, int): + elif not isinstance(size, (int, long)): raise TypeError('must be int, not ' + type(size).__name__) result = self._line_buffer self._line_buffer = '' @@ -1393,7 +1393,7 @@ raise ValueError("read from closed file") if size is None: size = -1 - elif not isinstance(size, int): + elif not isinstance(size, (int, long)): raise TypeError('must be int, not ' + type(size).__name__) line = self._line_buffer or self.shell.readline() if size < 0: diff --git a/Lib/imaplib.py b/Lib/imaplib.py --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -1409,7 +1409,7 @@ be in the correct format. """ - if isinstance(date_time, (int, float)): + if isinstance(date_time, (int, long, float)): tt = time.localtime(date_time) elif isinstance(date_time, (tuple, time.struct_time)): tt = date_time diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -1174,9 +1174,9 @@ elif isinstance(v, (tuple, list)): nv = [] for item in v: - if not isinstance(item, (basestring, int)): + if not isinstance(item, (basestring, int, long)): break - elif isinstance(item, int): + elif isinstance(item, (int, long)): nv.append('%d' % item) else: # format it to proper Tcl code if it contains space diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -276,7 +276,7 @@ return self[0]*other[0]+self[1]*other[1] return Vec2D(self[0]*other, self[1]*other) def __rmul__(self, other): - if isinstance(other, int) or isinstance(other, float): + if isinstance(other, (int, long, float)): return Vec2D(self[0]*other, self[1]*other) def __sub__(self, other): return Vec2D(self[0]-other[0], self[1]-other[1]) @@ -2352,7 +2352,7 @@ self._resizemode = p["resizemode"] if "stretchfactor" in p: sf = p["stretchfactor"] - if isinstance(sf, (int, float)): + if isinstance(sf, (int, long, float)): sf = (sf, sf) self._stretchfactor = sf if "outline" in p: diff --git a/Lib/lib2to3/pgen2/pgen.py b/Lib/lib2to3/pgen2/pgen.py --- a/Lib/lib2to3/pgen2/pgen.py +++ b/Lib/lib2to3/pgen2/pgen.py @@ -74,7 +74,7 @@ else: # A named token (NAME, NUMBER, STRING) itoken = getattr(token, label, None) - assert isinstance(itoken, int), label + assert isinstance(itoken, (int, long)), label assert itoken in token.tok_name, label if itoken in c.tokens: return c.tokens[itoken] diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1222,7 +1222,7 @@ logger.log(level, "We have a %s", "mysterious problem", exc_info=1) """ - if not isinstance(level, int): + if not isinstance(level, (int, long)): if raiseExceptions: raise TypeError("level must be an integer") else: diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py --- a/Lib/multiprocessing/pool.py +++ b/Lib/multiprocessing/pool.py @@ -86,7 +86,7 @@ def worker(inqueue, outqueue, initializer=None, initargs=(), maxtasks=None): - assert maxtasks is None or (type(maxtasks) == int and maxtasks > 0) + assert maxtasks is None or (type(maxtasks) in (int, long) and maxtasks > 0) put = outqueue.put get = inqueue.get if hasattr(inqueue, '_writer'): diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -227,7 +227,7 @@ else: status = 'started' - if type(status) is int: + if type(status) in (int, long): if status == 0: status = 'stopped' else: @@ -262,8 +262,8 @@ except SystemExit, e: if not e.args: exitcode = 1 - elif isinstance(e.args[0], int): - exitcode = e.args[0] + elif isinstance(e.args[0], (int, long)): + exitcode = int(e.args[0]) else: sys.stderr.write(str(e.args[0]) + '\n') sys.stderr.flush() diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -174,7 +174,7 @@ Class which supports object finalization using weakrefs ''' def __init__(self, obj, callback, args=(), kwargs=None, exitpriority=None): - assert exitpriority is None or type(exitpriority) is int + assert exitpriority is None or type(exitpriority) in (int, long) if obj is not None: self._weakref = weakref.ref(obj, self) diff --git a/Lib/pickletools.py b/Lib/pickletools.py --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -185,7 +185,7 @@ assert isinstance(name, str) self.name = name - assert isinstance(n, int) and (n >= 0 or + assert isinstance(n, (int, long)) and (n >= 0 or n in (UP_TO_NEWLINE, TAKEN_FROM_ARGUMENT1, TAKEN_FROM_ARGUMENT4)) @@ -873,7 +873,7 @@ assert isinstance(x, StackObject) self.stack_after = stack_after - assert isinstance(proto, int) and 0 <= proto <= 2 + assert isinstance(proto, (int, long)) and 0 <= proto <= 2 self.proto = proto assert isinstance(doc, str) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -507,7 +507,7 @@ p2cread, _ = _subprocess.CreatePipe(None, 0) elif stdin == PIPE: p2cread, p2cwrite = _subprocess.CreatePipe(None, 0) - elif isinstance(stdin, int): + elif isinstance(stdin, (int, long)): p2cread = msvcrt.get_osfhandle(stdin) else: # Assuming file-like object @@ -524,7 +524,7 @@ _, c2pwrite = _subprocess.CreatePipe(None, 0) elif stdout == PIPE: c2pread, c2pwrite = _subprocess.CreatePipe(None, 0) - elif isinstance(stdout, int): + elif isinstance(stdout, (int, long)): c2pwrite = msvcrt.get_osfhandle(stdout) else: # Assuming file-like object @@ -543,7 +543,7 @@ errread, errwrite = _subprocess.CreatePipe(None, 0) elif stderr == STDOUT: errwrite = c2pwrite - elif isinstance(stderr, int): + elif isinstance(stderr, (int, long)): errwrite = msvcrt.get_osfhandle(stderr) else: # Assuming file-like object @@ -800,7 +800,7 @@ elif stdin == PIPE: p2cread, p2cwrite = self.pipe_cloexec() to_close.update((p2cread, p2cwrite)) - elif isinstance(stdin, int): + elif isinstance(stdin, (int, long)): p2cread = stdin else: # Assuming file-like object @@ -811,7 +811,7 @@ elif stdout == PIPE: c2pread, c2pwrite = self.pipe_cloexec() to_close.update((c2pread, c2pwrite)) - elif isinstance(stdout, int): + elif isinstance(stdout, (int, long)): c2pwrite = stdout else: # Assuming file-like object @@ -827,7 +827,7 @@ errwrite = c2pwrite else: # child's stdout is not set, use parent's stdout errwrite = sys.__stdout__.fileno() - elif isinstance(stderr, int): + elif isinstance(stderr, (int, long)): errwrite = stderr else: # Assuming file-like object diff --git a/Lib/unittest/signals.py b/Lib/unittest/signals.py --- a/Lib/unittest/signals.py +++ b/Lib/unittest/signals.py @@ -10,7 +10,7 @@ def __init__(self, default_handler): self.called = False self.original_handler = default_handler - if isinstance(default_handler, int): + if isinstance(default_handler, (int, long)): if default_handler == signal.SIG_DFL: # Pretend it's signal.default_int_handler instead. default_handler = signal.default_int_handler diff --git a/Lib/warnings.py b/Lib/warnings.py --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -84,10 +84,10 @@ "category must be a class" assert issubclass(category, Warning), "category must be a Warning subclass" assert isinstance(module, basestring), "module must be a string" - assert isinstance(lineno, int) and lineno >= 0, \ + assert isinstance(lineno, (int, long)) and lineno >= 0, \ "lineno must be an int >= 0" item = (action, re.compile(message, re.I), category, - re.compile(module), lineno) + re.compile(module), int(lineno)) if append: filters.append(item) else: @@ -105,9 +105,9 @@ """ assert action in ("error", "ignore", "always", "default", "module", "once"), "invalid action: %r" % (action,) - assert isinstance(lineno, int) and lineno >= 0, \ + assert isinstance(lineno, (int, long)) and lineno >= 0, \ "lineno must be an int >= 0" - item = (action, None, category, None, lineno) + item = (action, None, category, None, int(lineno)) if append: filters.append(item) else: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,8 @@ Library ------- +- Issue #28998: More APIs now support longs as well as ints. + - Issue 28923: Remove editor artifacts from Tix.py, including encoding not recognized by codecs.lookup. diff --git a/Modules/_csv.c b/Modules/_csv.c --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -220,15 +220,19 @@ static int _set_int(const char *name, int *target, PyObject *src, int dflt) { + int value; if (src == NULL) *target = dflt; else { - if (!PyInt_Check(src)) { + if (!PyInt_Check(src) && !PyLong_Check(src)) { PyErr_Format(PyExc_TypeError, "\"%s\" must be an integer", name); return -1; } - *target = PyInt_AsLong(src); + value = PyInt_AsLong(src); + if (value == -1 && PyErr_Occurred()) + return -1; + *target = value; } return 0; } @@ -1443,17 +1447,20 @@ csv_field_size_limit(PyObject *module, PyObject *args) { PyObject *new_limit = NULL; - long old_limit = field_limit; + long old_limit = field_limit, limit; if (!PyArg_UnpackTuple(args, "field_size_limit", 0, 1, &new_limit)) return NULL; if (new_limit != NULL) { - if (!PyInt_Check(new_limit)) { + if (!PyInt_Check(new_limit) && !PyLong_Check(new_limit)) { PyErr_Format(PyExc_TypeError, "limit must be an integer"); return NULL; } - field_limit = PyInt_AsLong(new_limit); + limit = PyInt_AsLong(new_limit); + if (limit == -1 && PyErr_Occurred()) + return NULL; + field_limit = limit; } return PyInt_FromLong(old_limit); } diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -194,8 +194,10 @@ static int PyCurses_ConvertToChtype(PyObject *obj, chtype *ch) { - if (PyInt_Check(obj)) { + if (PyInt_Check(obj) || PyLong_Check(obj)) { *ch = (chtype) PyInt_AsLong(obj); + if (*ch == (chtype) -1 && PyErr_Occurred()) + return 0; } else if(PyString_Check(obj) && (PyString_Size(obj) == 1)) { *ch = (chtype) *PyString_AsString(obj); @@ -2576,8 +2578,11 @@ if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL; - if (PyInt_Check(temp)) + if (PyInt_Check(temp) || PyLong_Check(temp)) { ch = (chtype) PyInt_AsLong(temp); + if (ch == (chtype) -1 && PyErr_Occurred()) + return NULL; + } else if (PyString_Check(temp)) ch = (chtype) *PyString_AsString(temp); else { @@ -2598,8 +2603,11 @@ if (!PyArg_ParseTuple(args,"O;ch or int",&temp)) return NULL; - if (PyInt_Check(temp)) + if (PyInt_Check(temp) || PyLong_Check(temp)) { ch = (int) PyInt_AsLong(temp); + if (ch == -1 && PyErr_Occurred()) + return NULL; + } else if (PyString_Check(temp)) ch = (int) *PyString_AsString(temp); else { diff --git a/Modules/dlmodule.c b/Modules/dlmodule.c --- a/Modules/dlmodule.c +++ b/Modules/dlmodule.c @@ -107,8 +107,11 @@ } for (i = 1; i < n; i++) { PyObject *v = PyTuple_GetItem(args, i); - if (PyInt_Check(v)) + if (PyInt_Check(v) || PyLong_Check(v)) { alist[i-1] = PyInt_AsLong(v); + if (alist[i-1] == -1 && PyErr_Occurred()) + return NULL; + } else if (PyString_Check(v)) alist[i-1] = (long)PyString_AsString(v); else if (v == Py_None) diff --git a/Modules/svmodule.c b/Modules/svmodule.c --- a/Modules/svmodule.c +++ b/Modules/svmodule.c @@ -686,7 +686,7 @@ if (!cell) goto finally; - if (!PyInt_Check(cell)) { + if (!PyInt_Check(cell) && !PyLong_Check(cell)) { PyErr_BadArgument(); goto finally; } @@ -757,7 +757,7 @@ if (!v) goto finally; - if (!PyInt_Check(v)) { + if (!PyInt_Check(v) && !PyLong_Check(v)) { PyErr_BadArgument(); goto finally; } diff --git a/Modules/termios.c b/Modules/termios.c --- a/Modules/termios.c +++ b/Modules/termios.c @@ -185,8 +185,11 @@ if (PyString_Check(v) && PyString_Size(v) == 1) mode.c_cc[i] = (cc_t) * PyString_AsString(v); - else if (PyInt_Check(v)) + else if (PyInt_Check(v) || PyLong_Check(v)) { mode.c_cc[i] = (cc_t) PyInt_AsLong(v); + if (mode.c_cc[i] == (cc_t) -1 && PyErr_Occurred()) + return NULL; + } else { PyErr_SetString(PyExc_TypeError, "tcsetattr: elements of attributes must be characters or integers"); diff --git a/Objects/intobject.c b/Objects/intobject.c --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -155,6 +155,11 @@ return -1; } + if (PyLong_CheckExact(op)) { + /* avoid creating temporary int object */ + return PyLong_AsLong(op); + } + io = (PyIntObject*) (*nb->nb_int) (op); if (io == NULL) return -1; @@ -163,8 +168,6 @@ /* got a long? => retry int conversion */ val = PyLong_AsLong((PyObject *)io); Py_DECREF(io); - if ((val == -1) && PyErr_Occurred()) - return -1; return val; } else -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 08:37:23 2016 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 27 Dec 2016 13:37:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2328427=3A_old_keys_should_not_remove_new_values_from?= Message-ID: <20161227133723.79403.12014.06BC6331@psf.io> https://hg.python.org/cpython/rev/97d6616b2d22 changeset: 105852:97d6616b2d22 branch: 3.6 parent: 105848:f26c16aba11e parent: 105851:b8b0718d424f user: Antoine Pitrou date: Tue Dec 27 14:23:43 2016 +0100 summary: Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. files: Include/dictobject.h | 2 + Lib/test/test_weakref.py | 12 +++ Lib/weakref.py | 34 +++++++- Misc/NEWS | 3 + Modules/_weakref.c | 41 ++++++++++ Modules/clinic/_weakref.c.h | 32 ++++++++- Objects/dictobject.c | 95 ++++++++++++++++++++----- 7 files changed, 195 insertions(+), 24 deletions(-) diff --git a/Include/dictobject.h b/Include/dictobject.h --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -88,6 +88,8 @@ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); #endif PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1676,6 +1676,18 @@ x = d.pop(10, 10) self.assertIsNot(x, None) # we never put None in there! + def test_threaded_weak_valued_consistency(self): + # Issue #28427: old keys should not remove new values from + # WeakValueDictionary when collecting from another thread. + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(200000): + o = RefCycle() + d[10] = o + # o is still alive, so the dict can't be empty + self.assertEqual(len(d), 1) + o = None # lose ref + from test import mapping_tests diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -16,7 +16,8 @@ proxy, CallableProxyType, ProxyType, - ReferenceType) + ReferenceType, + _remove_dead_weakref) from _weakrefset import WeakSet, _IterationGuard @@ -111,7 +112,9 @@ if self._iterating: self._pending_removals.append(wr.key) else: - del self.data[wr.key] + # Atomic removal is necessary since this function + # can be called asynchronously by the GC + _remove_dead_weakref(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] @@ -125,9 +128,12 @@ # We shouldn't encounter any KeyError, because this method should # always be called *before* mutating the dict. while l: - del d[l.pop()] + key = l.pop() + _remove_dead_weakref(d, key) def __getitem__(self, key): + if self._pending_removals: + self._commit_removals() o = self.data[key]() if o is None: raise KeyError(key) @@ -140,9 +146,13 @@ del self.data[key] def __len__(self): - return len(self.data) - len(self._pending_removals) + if self._pending_removals: + self._commit_removals() + return len(self.data) def __contains__(self, key): + if self._pending_removals: + self._commit_removals() try: o = self.data[key]() except KeyError: @@ -158,6 +168,8 @@ self.data[key] = KeyedRef(value, self._remove, key) def copy(self): + if self._pending_removals: + self._commit_removals() new = WeakValueDictionary() for key, wr in self.data.items(): o = wr() @@ -169,6 +181,8 @@ def __deepcopy__(self, memo): from copy import deepcopy + if self._pending_removals: + self._commit_removals() new = self.__class__() for key, wr in self.data.items(): o = wr() @@ -177,6 +191,8 @@ return new def get(self, key, default=None): + if self._pending_removals: + self._commit_removals() try: wr = self.data[key] except KeyError: @@ -190,6 +206,8 @@ return o def items(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k, wr in self.data.items(): v = wr() @@ -197,6 +215,8 @@ yield k, v def keys(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k, wr in self.data.items(): if wr() is not None: @@ -214,10 +234,14 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): yield from self.data.values() def values(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for wr in self.data.values(): obj = wr() @@ -290,6 +314,8 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() return list(self.data.values()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,9 @@ Library ------- +- Issue #28427: old keys should not remove new values from + WeakValueDictionary when collecting from another thread. + - Issue 28923: Remove editor artifacts from Tix.py. - Issue #29055: Neaten-up empty population error on random.choice() diff --git a/Modules/_weakref.c b/Modules/_weakref.c --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -35,6 +35,46 @@ } +static int +is_dead_weakref(PyObject *value) +{ + if (!PyWeakref_Check(value)) { + PyErr_SetString(PyExc_TypeError, "not a weakref"); + return -1; + } + return PyWeakref_GET_OBJECT(value) == Py_None; +} + +/*[clinic input] + +_weakref._remove_dead_weakref -> object + + dct: object(subclass_of='&PyDict_Type') + key: object + / + +Atomically remove key from dict if it points to a dead weakref. +[clinic start generated code]*/ + +static PyObject * +_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, + PyObject *key) +/*[clinic end generated code: output=d9ff53061fcb875c input=19fc91f257f96a1d]*/ +{ + if (_PyDict_DelItemIf(dct, key, is_dead_weakref) < 0) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) + /* This function is meant to allow safe weak-value dicts + with GC in another thread (see issue #28427), so it's + ok if the key doesn't exist anymore. + */ + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + + PyDoc_STRVAR(weakref_getweakrefs__doc__, "getweakrefs(object) -- return a list of all weak reference objects\n" "that point to 'object'."); @@ -88,6 +128,7 @@ static PyMethodDef weakref_functions[] = { _WEAKREF_GETWEAKREFCOUNT_METHODDEF + _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF {"getweakrefs", weakref_getweakrefs, METH_O, weakref_getweakrefs__doc__}, {"proxy", weakref_proxy, METH_VARARGS, diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h --- a/Modules/clinic/_weakref.c.h +++ b/Modules/clinic/_weakref.c.h @@ -29,4 +29,34 @@ exit: return return_value; } -/*[clinic end generated code: output=e1ad587147323e19 input=a9049054013a1b77]*/ + +PyDoc_STRVAR(_weakref__remove_dead_weakref__doc__, +"_remove_dead_weakref($module, dct, key, /)\n" +"--\n" +"\n" +"Atomically remove key from dict if it points to a dead weakref."); + +#define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \ + {"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_VARARGS, _weakref__remove_dead_weakref__doc__}, + +static PyObject * +_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, + PyObject *key); + +static PyObject * +_weakref__remove_dead_weakref(PyObject *module, PyObject *args) +{ + PyObject *return_value = NULL; + PyObject *dct; + PyObject *key; + + if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref", + &PyDict_Type, &dct, &key)) { + goto exit; + } + return_value = _weakref__remove_dead_weakref_impl(module, dct, key); + +exit: + return return_value; +} +/*[clinic end generated code: output=e860dd818a44bc9b input=a9049054013a1b77]*/ diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1591,11 +1591,34 @@ return insertdict(mp, key, hash, value); } +static int +delitem_common(PyDictObject *mp, Py_ssize_t hashpos, Py_ssize_t ix, + PyObject **value_addr) +{ + PyObject *old_key, *old_value; + PyDictKeyEntry *ep; + + old_value = *value_addr; + assert(old_value != NULL); + *value_addr = NULL; + mp->ma_used--; + mp->ma_version_tag = DICT_NEXT_VERSION(); + ep = &DK_ENTRIES(mp->ma_keys)[ix]; + dk_set_index(mp->ma_keys, hashpos, DKIX_DUMMY); + ENSURE_ALLOWS_DELETIONS(mp); + old_key = ep->me_key; + ep->me_key = NULL; + Py_DECREF(old_key); + Py_DECREF(old_value); + + assert(_PyDict_CheckConsistency(mp)); + return 0; +} + int PyDict_DelItem(PyObject *op, PyObject *key) { Py_hash_t hash; - assert(key); if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) { @@ -1612,8 +1635,6 @@ { Py_ssize_t hashpos, ix; PyDictObject *mp; - PyDictKeyEntry *ep; - PyObject *old_key, *old_value; PyObject **value_addr; if (!PyDict_Check(op)) { @@ -1640,24 +1661,60 @@ ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); assert(ix >= 0); } - - old_value = *value_addr; - assert(old_value != NULL); - *value_addr = NULL; - mp->ma_used--; - mp->ma_version_tag = DICT_NEXT_VERSION(); - ep = &DK_ENTRIES(mp->ma_keys)[ix]; - dk_set_index(mp->ma_keys, hashpos, DKIX_DUMMY); - ENSURE_ALLOWS_DELETIONS(mp); - old_key = ep->me_key; - ep->me_key = NULL; - Py_DECREF(old_key); - Py_DECREF(old_value); - - assert(_PyDict_CheckConsistency(mp)); - return 0; + return delitem_common(mp, hashpos, ix, value_addr); } +/* This function promises that the predicate -> deletion sequence is atomic + * (i.e. protected by the GIL), assuming the predicate itself doesn't + * release the GIL. + */ +int +_PyDict_DelItemIf(PyObject *op, PyObject *key, + int (*predicate)(PyObject *value)) +{ + Py_ssize_t hashpos, ix; + PyDictObject *mp; + Py_hash_t hash; + PyObject **value_addr; + int res; + + if (!PyDict_Check(op)) { + PyErr_BadInternalCall(); + return -1; + } + assert(key); + hash = PyObject_Hash(key); + if (hash == -1) + return -1; + mp = (PyDictObject *)op; + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + if (ix == DKIX_ERROR) + return -1; + if (ix == DKIX_EMPTY || *value_addr == NULL) { + _PyErr_SetKeyError(key); + return -1; + } + assert(dk_get_index(mp->ma_keys, hashpos) == ix); + + // Split table doesn't allow deletion. Combine it. + if (_PyDict_HasSplitTable(mp)) { + if (dictresize(mp, DK_SIZE(mp->ma_keys))) { + return -1; + } + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, &hashpos); + assert(ix >= 0); + } + + res = predicate(*value_addr); + if (res == -1) + return -1; + if (res > 0) + return delitem_common(mp, hashpos, ix, value_addr); + else + return 0; +} + + void PyDict_Clear(PyObject *op) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 08:37:23 2016 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 27 Dec 2016 13:37:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328427=3A_old_keys_should_not_remove_new_values_?= =?utf-8?q?from?= Message-ID: <20161227133723.20315.83397.A885E501@psf.io> https://hg.python.org/cpython/rev/e5ce7bdf9e99 changeset: 105853:e5ce7bdf9e99 parent: 105849:77f5f31bf699 parent: 105852:97d6616b2d22 user: Antoine Pitrou date: Tue Dec 27 14:34:54 2016 +0100 summary: Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. files: Include/dictobject.h | 2 + Lib/test/test_weakref.py | 12 +++ Lib/weakref.py | 34 ++++++++- Misc/NEWS | 3 + Modules/_weakref.c | 41 +++++++++++ Modules/clinic/_weakref.c.h | 32 ++++++++- Objects/dictobject.c | 92 ++++++++++++++++++++---- 7 files changed, 194 insertions(+), 22 deletions(-) diff --git a/Include/dictobject.h b/Include/dictobject.h --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -88,6 +88,8 @@ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); #endif PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1676,6 +1676,18 @@ x = d.pop(10, 10) self.assertIsNot(x, None) # we never put None in there! + def test_threaded_weak_valued_consistency(self): + # Issue #28427: old keys should not remove new values from + # WeakValueDictionary when collecting from another thread. + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(200000): + o = RefCycle() + d[10] = o + # o is still alive, so the dict can't be empty + self.assertEqual(len(d), 1) + o = None # lose ref + from test import mapping_tests diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -16,7 +16,8 @@ proxy, CallableProxyType, ProxyType, - ReferenceType) + ReferenceType, + _remove_dead_weakref) from _weakrefset import WeakSet, _IterationGuard @@ -111,7 +112,9 @@ if self._iterating: self._pending_removals.append(wr.key) else: - del self.data[wr.key] + # Atomic removal is necessary since this function + # can be called asynchronously by the GC + _remove_dead_weakref(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] @@ -125,9 +128,12 @@ # We shouldn't encounter any KeyError, because this method should # always be called *before* mutating the dict. while l: - del d[l.pop()] + key = l.pop() + _remove_dead_weakref(d, key) def __getitem__(self, key): + if self._pending_removals: + self._commit_removals() o = self.data[key]() if o is None: raise KeyError(key) @@ -140,9 +146,13 @@ del self.data[key] def __len__(self): - return len(self.data) - len(self._pending_removals) + if self._pending_removals: + self._commit_removals() + return len(self.data) def __contains__(self, key): + if self._pending_removals: + self._commit_removals() try: o = self.data[key]() except KeyError: @@ -158,6 +168,8 @@ self.data[key] = KeyedRef(value, self._remove, key) def copy(self): + if self._pending_removals: + self._commit_removals() new = WeakValueDictionary() for key, wr in self.data.items(): o = wr() @@ -169,6 +181,8 @@ def __deepcopy__(self, memo): from copy import deepcopy + if self._pending_removals: + self._commit_removals() new = self.__class__() for key, wr in self.data.items(): o = wr() @@ -177,6 +191,8 @@ return new def get(self, key, default=None): + if self._pending_removals: + self._commit_removals() try: wr = self.data[key] except KeyError: @@ -190,6 +206,8 @@ return o def items(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k, wr in self.data.items(): v = wr() @@ -197,6 +215,8 @@ yield k, v def keys(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k, wr in self.data.items(): if wr() is not None: @@ -214,10 +234,14 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): yield from self.data.values() def values(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for wr in self.data.values(): obj = wr() @@ -290,6 +314,8 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() return list(self.data.values()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -208,6 +208,9 @@ Library ------- +- Issue #28427: old keys should not remove new values from + WeakValueDictionary when collecting from another thread. + - Issue 28923: Remove editor artifacts from Tix.py. - Issue #28871: Fixed a crash when deallocate deep ElementTree. diff --git a/Modules/_weakref.c b/Modules/_weakref.c --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -35,6 +35,46 @@ } +static int +is_dead_weakref(PyObject *value) +{ + if (!PyWeakref_Check(value)) { + PyErr_SetString(PyExc_TypeError, "not a weakref"); + return -1; + } + return PyWeakref_GET_OBJECT(value) == Py_None; +} + +/*[clinic input] + +_weakref._remove_dead_weakref -> object + + dct: object(subclass_of='&PyDict_Type') + key: object + / + +Atomically remove key from dict if it points to a dead weakref. +[clinic start generated code]*/ + +static PyObject * +_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, + PyObject *key) +/*[clinic end generated code: output=d9ff53061fcb875c input=19fc91f257f96a1d]*/ +{ + if (_PyDict_DelItemIf(dct, key, is_dead_weakref) < 0) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) + /* This function is meant to allow safe weak-value dicts + with GC in another thread (see issue #28427), so it's + ok if the key doesn't exist anymore. + */ + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + + PyDoc_STRVAR(weakref_getweakrefs__doc__, "getweakrefs(object) -- return a list of all weak reference objects\n" "that point to 'object'."); @@ -88,6 +128,7 @@ static PyMethodDef weakref_functions[] = { _WEAKREF_GETWEAKREFCOUNT_METHODDEF + _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF {"getweakrefs", weakref_getweakrefs, METH_O, weakref_getweakrefs__doc__}, {"proxy", weakref_proxy, METH_VARARGS, diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h --- a/Modules/clinic/_weakref.c.h +++ b/Modules/clinic/_weakref.c.h @@ -29,4 +29,34 @@ exit: return return_value; } -/*[clinic end generated code: output=e1ad587147323e19 input=a9049054013a1b77]*/ + +PyDoc_STRVAR(_weakref__remove_dead_weakref__doc__, +"_remove_dead_weakref($module, dct, key, /)\n" +"--\n" +"\n" +"Atomically remove key from dict if it points to a dead weakref."); + +#define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \ + {"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_VARARGS, _weakref__remove_dead_weakref__doc__}, + +static PyObject * +_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, + PyObject *key); + +static PyObject * +_weakref__remove_dead_weakref(PyObject *module, PyObject *args) +{ + PyObject *return_value = NULL; + PyObject *dct; + PyObject *key; + + if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref", + &PyDict_Type, &dct, &key)) { + goto exit; + } + return_value = _weakref__remove_dead_weakref_impl(module, dct, key); + +exit: + return return_value; +} +/*[clinic end generated code: output=e860dd818a44bc9b input=a9049054013a1b77]*/ diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1583,11 +1583,32 @@ return insertdict(mp, key, hash, value); } +static int +delitem_common(PyDictObject *mp, Py_ssize_t hashpos, Py_ssize_t ix, + PyObject *old_value) +{ + PyObject *old_key; + PyDictKeyEntry *ep; + + mp->ma_used--; + mp->ma_version_tag = DICT_NEXT_VERSION(); + ep = &DK_ENTRIES(mp->ma_keys)[ix]; + dk_set_index(mp->ma_keys, hashpos, DKIX_DUMMY); + ENSURE_ALLOWS_DELETIONS(mp); + old_key = ep->me_key; + ep->me_key = NULL; + ep->me_value = NULL; + Py_DECREF(old_key); + Py_DECREF(old_value); + + assert(_PyDict_CheckConsistency(mp)); + return 0; +} + int PyDict_DelItem(PyObject *op, PyObject *key) { Py_hash_t hash; - assert(key); if (!PyUnicode_CheckExact(key) || (hash = ((PyASCIIObject *) key)->hash) == -1) { @@ -1604,8 +1625,7 @@ { Py_ssize_t hashpos, ix; PyDictObject *mp; - PyDictKeyEntry *ep; - PyObject *old_key, *old_value; + PyObject *old_value; if (!PyDict_Check(op)) { PyErr_BadInternalCall(); @@ -1632,22 +1652,60 @@ assert(ix >= 0); } - assert(old_value != NULL); - mp->ma_used--; - mp->ma_version_tag = DICT_NEXT_VERSION(); - ep = &DK_ENTRIES(mp->ma_keys)[ix]; - dk_set_index(mp->ma_keys, hashpos, DKIX_DUMMY); - ENSURE_ALLOWS_DELETIONS(mp); - old_key = ep->me_key; - ep->me_key = NULL; - ep->me_value = NULL; - Py_DECREF(old_key); - Py_DECREF(old_value); - - assert(_PyDict_CheckConsistency(mp)); - return 0; + return delitem_common(mp, hashpos, ix, old_value); } +/* This function promises that the predicate -> deletion sequence is atomic + * (i.e. protected by the GIL), assuming the predicate itself doesn't + * release the GIL. + */ +int +_PyDict_DelItemIf(PyObject *op, PyObject *key, + int (*predicate)(PyObject *value)) +{ + Py_ssize_t hashpos, ix; + PyDictObject *mp; + Py_hash_t hash; + PyObject *old_value; + int res; + + if (!PyDict_Check(op)) { + PyErr_BadInternalCall(); + return -1; + } + assert(key); + hash = PyObject_Hash(key); + if (hash == -1) + return -1; + mp = (PyDictObject *)op; + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + if (ix == DKIX_ERROR) + return -1; + if (ix == DKIX_EMPTY || old_value == NULL) { + _PyErr_SetKeyError(key); + return -1; + } + assert(dk_get_index(mp->ma_keys, hashpos) == ix); + + // Split table doesn't allow deletion. Combine it. + if (_PyDict_HasSplitTable(mp)) { + if (dictresize(mp, DK_SIZE(mp->ma_keys))) { + return -1; + } + ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &old_value, &hashpos); + assert(ix >= 0); + } + + res = predicate(old_value); + if (res == -1) + return -1; + if (res > 0) + return delitem_common(mp, hashpos, ix, old_value); + else + return 0; +} + + void PyDict_Clear(PyObject *op) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 08:37:27 2016 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 27 Dec 2016 13:37:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI4NDI3?= =?utf-8?q?=3A_old_keys_should_not_remove_new_values_from?= Message-ID: <20161227133723.26723.81480.D1552A19@psf.io> https://hg.python.org/cpython/rev/b8b0718d424f changeset: 105851:b8b0718d424f branch: 3.5 parent: 105845:c4cd7e00a640 user: Antoine Pitrou date: Tue Dec 27 14:19:20 2016 +0100 summary: Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. files: Include/dictobject.h | 2 + Lib/test/test_weakref.py | 12 +++ Lib/weakref.py | 34 +++++++++- Misc/NEWS | 3 + Modules/_weakref.c | 41 ++++++++++++ Modules/clinic/_weakref.c.h | 31 +++++++++- Objects/dictobject.c | 81 +++++++++++++++++------- 7 files changed, 174 insertions(+), 30 deletions(-) diff --git a/Include/dictobject.h b/Include/dictobject.h --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -75,6 +75,8 @@ #ifndef Py_LIMITED_API PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key, Py_hash_t hash); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); #endif PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1673,6 +1673,18 @@ x = d.pop(10, 10) self.assertIsNot(x, None) # we never put None in there! + def test_threaded_weak_valued_consistency(self): + # Issue #28427: old keys should not remove new values from + # WeakValueDictionary when collecting from another thread. + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(200000): + o = RefCycle() + d[10] = o + # o is still alive, so the dict can't be empty + self.assertEqual(len(d), 1) + o = None # lose ref + from test import mapping_tests diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -16,7 +16,8 @@ proxy, CallableProxyType, ProxyType, - ReferenceType) + ReferenceType, + _remove_dead_weakref) from _weakrefset import WeakSet, _IterationGuard @@ -111,7 +112,9 @@ if self._iterating: self._pending_removals.append(wr.key) else: - del self.data[wr.key] + # Atomic removal is necessary since this function + # can be called asynchronously by the GC + _remove_dead_weakref(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] @@ -125,9 +128,12 @@ # We shouldn't encounter any KeyError, because this method should # always be called *before* mutating the dict. while l: - del d[l.pop()] + key = l.pop() + _remove_dead_weakref(d, key) def __getitem__(self, key): + if self._pending_removals: + self._commit_removals() o = self.data[key]() if o is None: raise KeyError(key) @@ -140,9 +146,13 @@ del self.data[key] def __len__(self): - return len(self.data) - len(self._pending_removals) + if self._pending_removals: + self._commit_removals() + return len(self.data) def __contains__(self, key): + if self._pending_removals: + self._commit_removals() try: o = self.data[key]() except KeyError: @@ -158,6 +168,8 @@ self.data[key] = KeyedRef(value, self._remove, key) def copy(self): + if self._pending_removals: + self._commit_removals() new = WeakValueDictionary() for key, wr in self.data.items(): o = wr() @@ -169,6 +181,8 @@ def __deepcopy__(self, memo): from copy import deepcopy + if self._pending_removals: + self._commit_removals() new = self.__class__() for key, wr in self.data.items(): o = wr() @@ -177,6 +191,8 @@ return new def get(self, key, default=None): + if self._pending_removals: + self._commit_removals() try: wr = self.data[key] except KeyError: @@ -190,6 +206,8 @@ return o def items(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k, wr in self.data.items(): v = wr() @@ -197,6 +215,8 @@ yield k, v def keys(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k, wr in self.data.items(): if wr() is not None: @@ -214,10 +234,14 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): yield from self.data.values() def values(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for wr in self.data.values(): obj = wr() @@ -290,6 +314,8 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() return list(self.data.values()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -138,6 +138,9 @@ Library ------- +- Issue #28427: old keys should not remove new values from + WeakValueDictionary when collecting from another thread. + - Issue 28923: Remove editor artifacts from Tix.py. - Issue #28871: Fixed a crash when deallocate deep ElementTree. diff --git a/Modules/_weakref.c b/Modules/_weakref.c --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -35,6 +35,46 @@ } +static int +is_dead_weakref(PyObject *value) +{ + if (!PyWeakref_Check(value)) { + PyErr_SetString(PyExc_TypeError, "not a weakref"); + return -1; + } + return PyWeakref_GET_OBJECT(value) == Py_None; +} + +/*[clinic input] + +_weakref._remove_dead_weakref -> object + + dct: object(subclass_of='&PyDict_Type') + key: object + / + +Atomically remove key from dict if it points to a dead weakref. +[clinic start generated code]*/ + +static PyObject * +_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, + PyObject *key) +/*[clinic end generated code: output=d9ff53061fcb875c input=19fc91f257f96a1d]*/ +{ + if (_PyDict_DelItemIf(dct, key, is_dead_weakref) < 0) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) + /* This function is meant to allow safe weak-value dicts + with GC in another thread (see issue #28427), so it's + ok if the key doesn't exist anymore. + */ + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + + PyDoc_STRVAR(weakref_getweakrefs__doc__, "getweakrefs(object) -- return a list of all weak reference objects\n" "that point to 'object'."); @@ -88,6 +128,7 @@ static PyMethodDef weakref_functions[] = { _WEAKREF_GETWEAKREFCOUNT_METHODDEF + _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF {"getweakrefs", weakref_getweakrefs, METH_O, weakref_getweakrefs__doc__}, {"proxy", weakref_proxy, METH_VARARGS, diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h --- a/Modules/clinic/_weakref.c.h +++ b/Modules/clinic/_weakref.c.h @@ -28,4 +28,33 @@ exit: return return_value; } -/*[clinic end generated code: output=d9086c8576d46933 input=a9049054013a1b77]*/ + +PyDoc_STRVAR(_weakref__remove_dead_weakref__doc__, +"_remove_dead_weakref($module, dct, key, /)\n" +"--\n" +"\n" +"Atomically remove key from dict if it points to a dead weakref."); + +#define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \ + {"_remove_dead_weakref", (PyCFunction)_weakref__remove_dead_weakref, METH_VARARGS, _weakref__remove_dead_weakref__doc__}, + +static PyObject * +_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct, + PyObject *key); + +static PyObject * +_weakref__remove_dead_weakref(PyObject *module, PyObject *args) +{ + PyObject *return_value = NULL; + PyObject *dct; + PyObject *key; + + if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref", + &PyDict_Type, &dct, &key)) + goto exit; + return_value = _weakref__remove_dead_weakref_impl(module, dct, key); + +exit: + return return_value; +} +/*[clinic end generated code: output=5764cb64a6f66ffd input=a9049054013a1b77]*/ diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -1246,13 +1246,31 @@ return insertdict(mp, key, hash, value); } +static int +delitem_common(PyDictObject *mp, PyDictKeyEntry *ep, PyObject **value_addr) +{ + PyObject *old_key, *old_value; + + old_value = *value_addr; + *value_addr = NULL; + mp->ma_used--; + if (!_PyDict_HasSplitTable(mp)) { + ENSURE_ALLOWS_DELETIONS(mp); + old_key = ep->me_key; + Py_INCREF(dummy); + ep->me_key = dummy; + Py_DECREF(old_key); + } + Py_DECREF(old_value); + return 0; +} + int PyDict_DelItem(PyObject *op, PyObject *key) { PyDictObject *mp; Py_hash_t hash; PyDictKeyEntry *ep; - PyObject *old_key, *old_value; PyObject **value_addr; if (!PyDict_Check(op)) { @@ -1274,18 +1292,7 @@ _PyErr_SetKeyError(key); return -1; } - old_value = *value_addr; - *value_addr = NULL; - mp->ma_used--; - if (!_PyDict_HasSplitTable(mp)) { - ENSURE_ALLOWS_DELETIONS(mp); - old_key = ep->me_key; - Py_INCREF(dummy); - ep->me_key = dummy; - Py_DECREF(old_key); - } - Py_DECREF(old_value); - return 0; + return delitem_common(mp, ep, value_addr); } int @@ -1293,7 +1300,6 @@ { PyDictObject *mp; PyDictKeyEntry *ep; - PyObject *old_key, *old_value; PyObject **value_addr; if (!PyDict_Check(op)) { @@ -1310,20 +1316,45 @@ _PyErr_SetKeyError(key); return -1; } - old_value = *value_addr; - *value_addr = NULL; - mp->ma_used--; - if (!_PyDict_HasSplitTable(mp)) { - ENSURE_ALLOWS_DELETIONS(mp); - old_key = ep->me_key; - Py_INCREF(dummy); - ep->me_key = dummy; - Py_DECREF(old_key); + return delitem_common(mp, ep, value_addr); +} + +int +_PyDict_DelItemIf(PyObject *op, PyObject *key, + int (*predicate)(PyObject *value)) +{ + PyDictObject *mp; + Py_hash_t hash; + PyDictKeyEntry *ep; + PyObject **value_addr; + int res; + + if (!PyDict_Check(op)) { + PyErr_BadInternalCall(); + return -1; } - Py_DECREF(old_value); - return 0; + assert(key); + hash = PyObject_Hash(key); + if (hash == -1) + return -1; + mp = (PyDictObject *)op; + ep = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr); + if (ep == NULL) + return -1; + if (*value_addr == NULL) { + _PyErr_SetKeyError(key); + return -1; + } + res = predicate(*value_addr); + if (res == -1) + return -1; + if (res > 0) + return delitem_common(mp, ep, value_addr); + else + return 0; } + void PyDict_Clear(PyObject *op) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 09:09:46 2016 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 27 Dec 2016 14:09:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI4NDI3?= =?utf-8?q?=3A_old_keys_should_not_remove_new_values_from?= Message-ID: <20161227140946.5995.68327.C32A6746@psf.io> https://hg.python.org/cpython/rev/9acdcafd1418 changeset: 105854:9acdcafd1418 branch: 2.7 parent: 105850:ffcb321ba9c0 user: Antoine Pitrou date: Tue Dec 27 15:08:27 2016 +0100 summary: Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. files: Include/dictobject.h | 3 + Lib/test/test_weakref.py | 12 +++++ Lib/weakref.py | 40 +++++++++++++++-- Misc/NEWS | 3 + Modules/_weakref.c | 39 ++++++++++++++++ Objects/dictobject.c | 65 +++++++++++++++++++++++---- 6 files changed, 147 insertions(+), 15 deletions(-) diff --git a/Include/dictobject.h b/Include/dictobject.h --- a/Include/dictobject.h +++ b/Include/dictobject.h @@ -111,6 +111,9 @@ PyAPI_FUNC(PyObject *) _PyDict_GetItemWithError(PyObject *mp, PyObject *key); PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); +PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key, + int (*predicate)(PyObject *value)); + PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); PyAPI_FUNC(int) PyDict_Next( PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -1437,6 +1437,18 @@ x = d.pop(10, 10) self.assertIsNot(x, None) # we never put None in there! + def test_threaded_weak_valued_consistency(self): + # Issue #28427: old keys should not remove new values from + # WeakValueDictionary when collecting from another thread. + d = weakref.WeakValueDictionary() + with collect_in_thread(): + for i in range(200000): + o = RefCycle() + d[10] = o + # o is still alive, so the dict can't be empty + self.assertEqual(len(d), 1) + o = None # lose ref + from test import mapping_tests diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -18,7 +18,8 @@ proxy, CallableProxyType, ProxyType, - ReferenceType) + ReferenceType, + _remove_dead_weakref) from _weakrefset import WeakSet, _IterationGuard @@ -58,7 +59,9 @@ if self._iterating: self._pending_removals.append(wr.key) else: - del self.data[wr.key] + # Atomic removal is necessary since this function + # can be called asynchronously by the GC + _remove_dead_weakref(self.data, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] @@ -71,9 +74,12 @@ # We shouldn't encounter any KeyError, because this method should # always be called *before* mutating the dict. while l: - del d[l.pop()] + key = l.pop() + _remove_dead_weakref(d, key) def __getitem__(self, key): + if self._pending_removals: + self._commit_removals() o = self.data[key]() if o is None: raise KeyError, key @@ -86,6 +92,8 @@ del self.data[key] def __contains__(self, key): + if self._pending_removals: + self._commit_removals() try: o = self.data[key]() except KeyError: @@ -93,6 +101,8 @@ return o is not None def has_key(self, key): + if self._pending_removals: + self._commit_removals() try: o = self.data[key]() except KeyError: @@ -113,6 +123,8 @@ self.data.clear() def copy(self): + if self._pending_removals: + self._commit_removals() new = WeakValueDictionary() for key, wr in self.data.items(): o = wr() @@ -124,6 +136,8 @@ def __deepcopy__(self, memo): from copy import deepcopy + if self._pending_removals: + self._commit_removals() new = self.__class__() for key, wr in self.data.items(): o = wr() @@ -132,6 +146,8 @@ return new def get(self, key, default=None): + if self._pending_removals: + self._commit_removals() try: wr = self.data[key] except KeyError: @@ -145,6 +161,8 @@ return o def items(self): + if self._pending_removals: + self._commit_removals() L = [] for key, wr in self.data.items(): o = wr() @@ -153,6 +171,8 @@ return L def iteritems(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for wr in self.data.itervalues(): value = wr() @@ -160,6 +180,8 @@ yield wr.key, value def iterkeys(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for k in self.data.iterkeys(): yield k @@ -176,11 +198,15 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for wr in self.data.itervalues(): yield wr def itervalues(self): + if self._pending_removals: + self._commit_removals() with _IterationGuard(self): for wr in self.data.itervalues(): obj = wr() @@ -212,13 +238,13 @@ return o def setdefault(self, key, default=None): + if self._pending_removals: + self._commit_removals() try: o = self.data[key]() except KeyError: o = None if o is None: - if self._pending_removals: - self._commit_removals() self.data[key] = KeyedRef(default, self._remove, key) return default else: @@ -254,9 +280,13 @@ keep the values around longer than needed. """ + if self._pending_removals: + self._commit_removals() return self.data.values() def values(self): + if self._pending_removals: + self._commit_removals() L = [] for wr in self.data.values(): o = wr() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Library ------- +- Issue #28427: old keys should not remove new values from + WeakValueDictionary when collecting from another thread. + - Issue #28998: More APIs now support longs as well as ints. - Issue 28923: Remove editor artifacts from Tix.py, diff --git a/Modules/_weakref.c b/Modules/_weakref.c --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -5,6 +5,43 @@ ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o)) +static int +is_dead_weakref(PyObject *value) +{ + if (!PyWeakref_Check(value)) { + PyErr_SetString(PyExc_TypeError, "not a weakref"); + return -1; + } + return PyWeakref_GET_OBJECT(value) == Py_None; +} + +PyDoc_STRVAR(remove_dead_weakref__doc__, +"_remove_dead_weakref(dict, key) -- atomically remove key from dict\n" +"if it points to a dead weakref."); + +static PyObject * +remove_dead_weakref(PyObject *self, PyObject *args) +{ + PyObject *dct, *key; + + if (!PyArg_ParseTuple(args, "O!O:_remove_dead_weakref", + &PyDict_Type, &dct, &key)) { + return NULL; + } + if (_PyDict_DelItemIf(dct, key, is_dead_weakref) < 0) { + if (PyErr_ExceptionMatches(PyExc_KeyError)) + /* This function is meant to allow safe weak-value dicts + with GC in another thread (see issue #28427), so it's + ok if the key doesn't exist anymore. + */ + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + + PyDoc_STRVAR(weakref_getweakrefcount__doc__, "getweakrefcount(object) -- return the number of weak references\n" "to 'object'."); @@ -84,6 +121,8 @@ weakref_getweakrefs__doc__}, {"proxy", weakref_proxy, METH_VARARGS, weakref_proxy__doc__}, + {"_remove_dead_weakref", remove_dead_weakref, METH_VARARGS, + remove_dead_weakref__doc__}, {NULL, NULL, 0, NULL} }; diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -848,13 +848,28 @@ return dict_set_item_by_hash_or_entry(op, key, hash, NULL, value); } +static int +delitem_common(PyDictObject *mp, PyDictEntry *ep) +{ + PyObject *old_value, *old_key; + + old_key = ep->me_key; + Py_INCREF(dummy); + ep->me_key = dummy; + old_value = ep->me_value; + ep->me_value = NULL; + mp->ma_used--; + Py_DECREF(old_value); + Py_DECREF(old_key); + return 0; +} + int PyDict_DelItem(PyObject *op, PyObject *key) { register PyDictObject *mp; register long hash; register PyDictEntry *ep; - PyObject *old_value, *old_key; if (!PyDict_Check(op)) { PyErr_BadInternalCall(); @@ -875,15 +890,45 @@ set_key_error(key); return -1; } - old_key = ep->me_key; - Py_INCREF(dummy); - ep->me_key = dummy; - old_value = ep->me_value; - ep->me_value = NULL; - mp->ma_used--; - Py_DECREF(old_value); - Py_DECREF(old_key); - return 0; + + return delitem_common(mp, ep); +} + +int +_PyDict_DelItemIf(PyObject *op, PyObject *key, + int (*predicate)(PyObject *value)) +{ + register PyDictObject *mp; + register long hash; + register PyDictEntry *ep; + int res; + + if (!PyDict_Check(op)) { + PyErr_BadInternalCall(); + return -1; + } + assert(key); + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) { + hash = PyObject_Hash(key); + if (hash == -1) + return -1; + } + mp = (PyDictObject *)op; + ep = (mp->ma_lookup)(mp, key, hash); + if (ep == NULL) + return -1; + if (ep->me_value == NULL) { + set_key_error(key); + return -1; + } + res = predicate(ep->me_value); + if (res == -1) + return -1; + if (res > 0) + return delitem_common(mp, ep); + else + return 0; } void -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Dec 27 09:40:12 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 27 Dec 2016 14:40:12 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-12-27 Message-ID: <29b5070f-07ac-4b26-8c46-3709e8d68e08@irsmsx106.ger.corp.intel.com> Results for project Python 2.7, build date 2016-12-27 16:36:01 +0000 commit: 878a91174e74 previous commit: 94900abda1a5 revision date: 2016-12-27 04:21:28 +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.20% 5.82% 5.38% :-) pybench 0.17% -0.00% 7.88% 4.49% :-| regex_v8 1.85% 0.02% -0.70% 10.75% :-) nbody 0.14% -0.02% 13.21% -0.15% :-| json_dump_v2 0.09% 0.03% 0.46% 10.21% :-( normal_startup 1.96% -0.03% -2.05% 1.52% :-| ssbench 0.11% -0.01% 0.23% 2.35% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-12-27/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Tue Dec 27 09:40:53 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 27 Dec 2016 14:40:53 +0000 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-12-27 Message-ID: Results for project Python default, build date 2016-12-27 11:03:37 +0000 commit: 5f3ac68f34f2 previous commit: 0181578dc746 revision date: 2016-12-26 09:52:46 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.17% 1.42% 1.29% 12.71% :-| pybench 0.29% -0.03% 1.24% 5.92% :-( regex_v8 3.49% -1.40% -2.14% 4.36% :-( nbody 0.10% -3.12% -2.14% 6.88% :-) json_dump_v2 0.39% -0.19% 8.75% 9.48% :-| normal_startup 1.23% 0.34% -0.17% 6.13% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-12-27/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Tue Dec 27 10:55:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 15:55:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIzOTAz?= =?utf-8?q?=3A_Added_missed_Windows-specific_names_to_PC/python3=2Edef=2E?= Message-ID: <20161227155511.20642.5110.689FF430@psf.io> https://hg.python.org/cpython/rev/2e5ad97c9c19 changeset: 105855:2e5ad97c9c19 branch: 3.5 parent: 105851:b8b0718d424f user: Serhiy Storchaka date: Tue Dec 27 17:38:16 2016 +0200 summary: Issue #23903: Added missed Windows-specific names to PC/python3.def. files: PC/python3.def | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -134,11 +134,17 @@ PyErr_PrintEx=python35.PyErr_PrintEx PyErr_ProgramText=python35.PyErr_ProgramText PyErr_Restore=python35.PyErr_Restore + PyErr_SetExcFromWindowsErr=python35.PyErr_SetExcFromWindowsErr + PyErr_SetExcFromWindowsErrWithFilename=python35.PyErr_SetExcFromWindowsErrWithFilename + PyErr_SetExcFromWindowsErrWithFilenameObject=python35.PyErr_SetExcFromWindowsErrWithFilenameObject + PyErr_SetExcFromWindowsErrWithFilenameObjects=python35.PyErr_SetExcFromWindowsErrWithFilenameObjects PyErr_SetExcInfo=python35.PyErr_SetExcInfo PyErr_SetFromErrno=python35.PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename=python35.PyErr_SetFromErrnoWithFilename PyErr_SetFromErrnoWithFilenameObject=python35.PyErr_SetFromErrnoWithFilenameObject PyErr_SetFromErrnoWithFilenameObjects=python35.PyErr_SetFromErrnoWithFilenameObjects + PyErr_SetFromWindowsErr=python35.PyErr_SetFromWindowsErr + PyErr_SetFromWindowsErrWithFilename=python35.PyErr_SetFromWindowsErrWithFilename PyErr_SetImportError=python35.PyErr_SetImportError PyErr_SetInterrupt=python35.PyErr_SetInterrupt PyErr_SetNone=python35.PyErr_SetNone @@ -238,6 +244,7 @@ PyExc_UserWarning=python35.PyExc_UserWarning DATA PyExc_ValueError=python35.PyExc_ValueError DATA PyExc_Warning=python35.PyExc_Warning DATA + PyExc_WindowsError=python35.PyExc_WindowsError DATA PyExc_ZeroDivisionError=python35.PyExc_ZeroDivisionError DATA PyException_GetCause=python35.PyException_GetCause PyException_GetContext=python35.PyException_GetContext @@ -414,6 +421,7 @@ PyODict_SetItem=python35.PyODict_SetItem PyODict_Type=python35.PyODict_Type DATA PyOS_AfterFork=python35.PyOS_AfterFork + PyOS_CheckStack=python35.PyOS_CheckStack PyOS_InitInterrupts=python35.PyOS_InitInterrupts PyOS_InputHook=python35.PyOS_InputHook DATA PyOS_InterruptOccurred=python35.PyOS_InterruptOccurred @@ -613,6 +621,7 @@ PyUnicode_AsEncodedString=python35.PyUnicode_AsEncodedString PyUnicode_AsEncodedUnicode=python35.PyUnicode_AsEncodedUnicode PyUnicode_AsLatin1String=python35.PyUnicode_AsLatin1String + PyUnicode_AsMBCSString=python35.PyUnicode_AsMBCSString PyUnicode_AsRawUnicodeEscapeString=python35.PyUnicode_AsRawUnicodeEscapeString PyUnicode_AsUCS4=python35.PyUnicode_AsUCS4 PyUnicode_AsUCS4Copy=python35.PyUnicode_AsUCS4Copy @@ -632,11 +641,14 @@ PyUnicode_Decode=python35.PyUnicode_Decode PyUnicode_DecodeASCII=python35.PyUnicode_DecodeASCII PyUnicode_DecodeCharmap=python35.PyUnicode_DecodeCharmap + PyUnicode_DecodeCodePageStateful=python35.PyUnicode_DecodeCodePageStateful PyUnicode_DecodeFSDefault=python35.PyUnicode_DecodeFSDefault PyUnicode_DecodeFSDefaultAndSize=python35.PyUnicode_DecodeFSDefaultAndSize PyUnicode_DecodeLatin1=python35.PyUnicode_DecodeLatin1 PyUnicode_DecodeLocale=python35.PyUnicode_DecodeLocale PyUnicode_DecodeLocaleAndSize=python35.PyUnicode_DecodeLocaleAndSize + PyUnicode_DecodeMBCS=python35.PyUnicode_DecodeMBCS + PyUnicode_DecodeMBCSStateful=python35.PyUnicode_DecodeMBCSStateful PyUnicode_DecodeRawUnicodeEscape=python35.PyUnicode_DecodeRawUnicodeEscape PyUnicode_DecodeUTF16=python35.PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful=python35.PyUnicode_DecodeUTF16Stateful @@ -647,6 +659,7 @@ PyUnicode_DecodeUTF8=python35.PyUnicode_DecodeUTF8 PyUnicode_DecodeUTF8Stateful=python35.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python35.PyUnicode_DecodeUnicodeEscape + PyUnicode_EncodeCodePage=python35.PyUnicode_EncodeCodePage PyUnicode_EncodeFSDefault=python35.PyUnicode_EncodeFSDefault PyUnicode_EncodeLocale=python35.PyUnicode_EncodeLocale PyUnicode_FSConverter=python35.PyUnicode_FSConverter -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 10:55:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 15:55:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2323903=3A_Added_missed_Windows-specific_names_to?= =?utf-8?q?_PC/python3=2Edef=2E?= Message-ID: <20161227155511.107736.37732.DAB1A77F@psf.io> https://hg.python.org/cpython/rev/3a2595f82447 changeset: 105857:3a2595f82447 parent: 105853:e5ce7bdf9e99 parent: 105856:86a412584c02 user: Serhiy Storchaka date: Tue Dec 27 17:44:18 2016 +0200 summary: Issue #23903: Added missed Windows-specific names to PC/python3.def. files: PC/python3.def | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -135,11 +135,17 @@ PyErr_ProgramText=python37.PyErr_ProgramText PyErr_ResourceWarning=python37.PyErr_ResourceWarning PyErr_Restore=python37.PyErr_Restore + PyErr_SetExcFromWindowsErr=python37.PyErr_SetExcFromWindowsErr + PyErr_SetExcFromWindowsErrWithFilename=python37.PyErr_SetExcFromWindowsErrWithFilename + PyErr_SetExcFromWindowsErrWithFilenameObject=python37.PyErr_SetExcFromWindowsErrWithFilenameObject + PyErr_SetExcFromWindowsErrWithFilenameObjects=python37.PyErr_SetExcFromWindowsErrWithFilenameObjects PyErr_SetExcInfo=python37.PyErr_SetExcInfo PyErr_SetFromErrno=python37.PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename=python37.PyErr_SetFromErrnoWithFilename PyErr_SetFromErrnoWithFilenameObject=python37.PyErr_SetFromErrnoWithFilenameObject PyErr_SetFromErrnoWithFilenameObjects=python37.PyErr_SetFromErrnoWithFilenameObjects + PyErr_SetFromWindowsErr=python37.PyErr_SetFromWindowsErr + PyErr_SetFromWindowsErrWithFilename=python37.PyErr_SetFromWindowsErrWithFilename PyErr_SetImportError=python37.PyErr_SetImportError PyErr_SetImportErrorSubclass=python37.PyErr_SetImportErrorSubclass PyErr_SetInterrupt=python37.PyErr_SetInterrupt @@ -241,6 +247,7 @@ PyExc_UserWarning=python37.PyExc_UserWarning DATA PyExc_ValueError=python37.PyExc_ValueError DATA PyExc_Warning=python37.PyExc_Warning DATA + PyExc_WindowsError=python37.PyExc_WindowsError DATA PyExc_ZeroDivisionError=python37.PyExc_ZeroDivisionError DATA PyException_GetCause=python37.PyException_GetCause PyException_GetContext=python37.PyException_GetContext @@ -417,6 +424,7 @@ PyODict_SetItem=python37.PyODict_SetItem PyODict_Type=python37.PyODict_Type DATA PyOS_AfterFork=python37.PyOS_AfterFork + PyOS_CheckStack=python37.PyOS_CheckStack PyOS_FSPath=python37.PyOS_FSPath PyOS_InitInterrupts=python37.PyOS_InitInterrupts PyOS_InputHook=python37.PyOS_InputHook DATA @@ -617,6 +625,7 @@ PyUnicode_AsEncodedString=python37.PyUnicode_AsEncodedString PyUnicode_AsEncodedUnicode=python37.PyUnicode_AsEncodedUnicode PyUnicode_AsLatin1String=python37.PyUnicode_AsLatin1String + PyUnicode_AsMBCSString=python37.PyUnicode_AsMBCSString PyUnicode_AsRawUnicodeEscapeString=python37.PyUnicode_AsRawUnicodeEscapeString PyUnicode_AsUCS4=python37.PyUnicode_AsUCS4 PyUnicode_AsUCS4Copy=python37.PyUnicode_AsUCS4Copy @@ -636,11 +645,14 @@ PyUnicode_Decode=python37.PyUnicode_Decode PyUnicode_DecodeASCII=python37.PyUnicode_DecodeASCII PyUnicode_DecodeCharmap=python37.PyUnicode_DecodeCharmap + PyUnicode_DecodeCodePageStateful=python37.PyUnicode_DecodeCodePageStateful PyUnicode_DecodeFSDefault=python37.PyUnicode_DecodeFSDefault PyUnicode_DecodeFSDefaultAndSize=python37.PyUnicode_DecodeFSDefaultAndSize PyUnicode_DecodeLatin1=python37.PyUnicode_DecodeLatin1 PyUnicode_DecodeLocale=python37.PyUnicode_DecodeLocale PyUnicode_DecodeLocaleAndSize=python37.PyUnicode_DecodeLocaleAndSize + PyUnicode_DecodeMBCS=python37.PyUnicode_DecodeMBCS + PyUnicode_DecodeMBCSStateful=python37.PyUnicode_DecodeMBCSStateful PyUnicode_DecodeRawUnicodeEscape=python37.PyUnicode_DecodeRawUnicodeEscape PyUnicode_DecodeUTF16=python37.PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful=python37.PyUnicode_DecodeUTF16Stateful @@ -651,6 +663,7 @@ PyUnicode_DecodeUTF8=python37.PyUnicode_DecodeUTF8 PyUnicode_DecodeUTF8Stateful=python37.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python37.PyUnicode_DecodeUnicodeEscape + PyUnicode_EncodeCodePage=python37.PyUnicode_EncodeCodePage PyUnicode_EncodeFSDefault=python37.PyUnicode_EncodeFSDefault PyUnicode_EncodeLocale=python37.PyUnicode_EncodeLocale PyUnicode_FSConverter=python37.PyUnicode_FSConverter -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 10:55:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 15:55:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2323903=3A_Added_missed_Windows-specific_names_to_PC/py?= =?utf-8?q?thon3=2Edef=2E?= Message-ID: <20161227155511.79468.227.04ED7A7A@psf.io> https://hg.python.org/cpython/rev/86a412584c02 changeset: 105856:86a412584c02 branch: 3.6 parent: 105852:97d6616b2d22 parent: 105855:2e5ad97c9c19 user: Serhiy Storchaka date: Tue Dec 27 17:41:07 2016 +0200 summary: Issue #23903: Added missed Windows-specific names to PC/python3.def. files: PC/python3.def | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/PC/python3.def b/PC/python3.def --- a/PC/python3.def +++ b/PC/python3.def @@ -135,11 +135,17 @@ PyErr_ProgramText=python36.PyErr_ProgramText PyErr_ResourceWarning=python36.PyErr_ResourceWarning PyErr_Restore=python36.PyErr_Restore + PyErr_SetExcFromWindowsErr=python36.PyErr_SetExcFromWindowsErr + PyErr_SetExcFromWindowsErrWithFilename=python36.PyErr_SetExcFromWindowsErrWithFilename + PyErr_SetExcFromWindowsErrWithFilenameObject=python36.PyErr_SetExcFromWindowsErrWithFilenameObject + PyErr_SetExcFromWindowsErrWithFilenameObjects=python36.PyErr_SetExcFromWindowsErrWithFilenameObjects PyErr_SetExcInfo=python36.PyErr_SetExcInfo PyErr_SetFromErrno=python36.PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename=python36.PyErr_SetFromErrnoWithFilename PyErr_SetFromErrnoWithFilenameObject=python36.PyErr_SetFromErrnoWithFilenameObject PyErr_SetFromErrnoWithFilenameObjects=python36.PyErr_SetFromErrnoWithFilenameObjects + PyErr_SetFromWindowsErr=python36.PyErr_SetFromWindowsErr + PyErr_SetFromWindowsErrWithFilename=python36.PyErr_SetFromWindowsErrWithFilename PyErr_SetImportError=python36.PyErr_SetImportError PyErr_SetImportErrorSubclass=python36.PyErr_SetImportErrorSubclass PyErr_SetInterrupt=python36.PyErr_SetInterrupt @@ -241,6 +247,7 @@ PyExc_UserWarning=python36.PyExc_UserWarning DATA PyExc_ValueError=python36.PyExc_ValueError DATA PyExc_Warning=python36.PyExc_Warning DATA + PyExc_WindowsError=python36.PyExc_WindowsError DATA PyExc_ZeroDivisionError=python36.PyExc_ZeroDivisionError DATA PyException_GetCause=python36.PyException_GetCause PyException_GetContext=python36.PyException_GetContext @@ -417,6 +424,7 @@ PyODict_SetItem=python36.PyODict_SetItem PyODict_Type=python36.PyODict_Type DATA PyOS_AfterFork=python36.PyOS_AfterFork + PyOS_CheckStack=python36.PyOS_CheckStack PyOS_FSPath=python36.PyOS_FSPath PyOS_InitInterrupts=python36.PyOS_InitInterrupts PyOS_InputHook=python36.PyOS_InputHook DATA @@ -617,6 +625,7 @@ PyUnicode_AsEncodedString=python36.PyUnicode_AsEncodedString PyUnicode_AsEncodedUnicode=python36.PyUnicode_AsEncodedUnicode PyUnicode_AsLatin1String=python36.PyUnicode_AsLatin1String + PyUnicode_AsMBCSString=python36.PyUnicode_AsMBCSString PyUnicode_AsRawUnicodeEscapeString=python36.PyUnicode_AsRawUnicodeEscapeString PyUnicode_AsUCS4=python36.PyUnicode_AsUCS4 PyUnicode_AsUCS4Copy=python36.PyUnicode_AsUCS4Copy @@ -636,11 +645,14 @@ PyUnicode_Decode=python36.PyUnicode_Decode PyUnicode_DecodeASCII=python36.PyUnicode_DecodeASCII PyUnicode_DecodeCharmap=python36.PyUnicode_DecodeCharmap + PyUnicode_DecodeCodePageStateful=python36.PyUnicode_DecodeCodePageStateful PyUnicode_DecodeFSDefault=python36.PyUnicode_DecodeFSDefault PyUnicode_DecodeFSDefaultAndSize=python36.PyUnicode_DecodeFSDefaultAndSize PyUnicode_DecodeLatin1=python36.PyUnicode_DecodeLatin1 PyUnicode_DecodeLocale=python36.PyUnicode_DecodeLocale PyUnicode_DecodeLocaleAndSize=python36.PyUnicode_DecodeLocaleAndSize + PyUnicode_DecodeMBCS=python36.PyUnicode_DecodeMBCS + PyUnicode_DecodeMBCSStateful=python36.PyUnicode_DecodeMBCSStateful PyUnicode_DecodeRawUnicodeEscape=python36.PyUnicode_DecodeRawUnicodeEscape PyUnicode_DecodeUTF16=python36.PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful=python36.PyUnicode_DecodeUTF16Stateful @@ -651,6 +663,7 @@ PyUnicode_DecodeUTF8=python36.PyUnicode_DecodeUTF8 PyUnicode_DecodeUTF8Stateful=python36.PyUnicode_DecodeUTF8Stateful PyUnicode_DecodeUnicodeEscape=python36.PyUnicode_DecodeUnicodeEscape + PyUnicode_EncodeCodePage=python36.PyUnicode_EncodeCodePage PyUnicode_EncodeFSDefault=python36.PyUnicode_EncodeFSDefault PyUnicode_EncodeLocale=python36.PyUnicode_EncodeLocale PyUnicode_FSConverter=python36.PyUnicode_FSConverter -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Dec 27 10:59:27 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 27 Dec 2016 15:59:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2328915=3A_Exclude_?= =?utf-8?q?=5FPy=5FVaBuildStack_from_the_limited_API=2E?= Message-ID: <20161227155925.26790.33477.85125BED@psf.io> https://hg.python.org/cpython/rev/fa9933bf4ea0 changeset: 105858:fa9933bf4ea0 user: Serhiy Storchaka date: Tue Dec 27 17:59:04 2016 +0200 summary: Issue #28915: Exclude _Py_VaBuildStack from the limited API. files: Include/modsupport.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Include/modsupport.h b/Include/modsupport.h --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -21,7 +21,9 @@ #endif /* !Py_LIMITED_API */ #define Py_BuildValue _Py_BuildValue_SizeT #define Py_VaBuildValue _Py_VaBuildValue_SizeT +#ifndef Py_LIMITED_API #define _Py_VaBuildStack _Py_VaBuildStack_SizeT +#endif #else #ifndef Py_LIMITED_API PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); @@ -54,12 +56,14 @@ const char *, char **, va_list); #endif PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); +#ifndef Py_LIMITED_API PyAPI_FUNC(PyObject **) _Py_VaBuildStack( PyObject **small_stack, Py_ssize_t small_stack_len, const char *format, va_list va, Py_ssize_t *p_nargs); +#endif #ifndef Py_LIMITED_API typedef struct _PyArg_Parser { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:20:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:20:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDg3?= =?utf-8?q?=3A_Removed_the_documentation_of_non-existing_UCS4_support_func?= =?utf-8?q?tions=2E?= Message-ID: <20161228072015.79546.12836.CA3FA02B@psf.io> https://hg.python.org/cpython/rev/29d46d29e169 changeset: 105859:29d46d29e169 branch: 3.5 parent: 105855:2e5ad97c9c19 user: Serhiy Storchaka date: Wed Dec 28 09:19:15 2016 +0200 summary: Issue #29087: Removed the documentation of non-existing UCS4 support functions. files: Doc/c-api/unicode.rst | 20 -------------------- 1 files changed, 0 insertions(+), 20 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -937,26 +937,6 @@ .. versionadded:: 3.2 -UCS4 Support -"""""""""""" - -.. versionadded:: 3.3 - -.. XXX are these meant to be public? - -.. c:function:: size_t Py_UCS4_strlen(const Py_UCS4 *u) - Py_UCS4* Py_UCS4_strcpy(Py_UCS4 *s1, const Py_UCS4 *s2) - Py_UCS4* Py_UCS4_strncpy(Py_UCS4 *s1, const Py_UCS4 *s2, size_t n) - Py_UCS4* Py_UCS4_strcat(Py_UCS4 *s1, const Py_UCS4 *s2) - int Py_UCS4_strcmp(const Py_UCS4 *s1, const Py_UCS4 *s2) - int Py_UCS4_strncmp(const Py_UCS4 *s1, const Py_UCS4 *s2, size_t n) - Py_UCS4* Py_UCS4_strchr(const Py_UCS4 *s, Py_UCS4 c) - Py_UCS4* Py_UCS4_strrchr(const Py_UCS4 *s, Py_UCS4 c) - - These utility functions work on strings of :c:type:`Py_UCS4` characters and - otherwise behave like the C standard library functions with the same name. - - .. _builtincodecs: Built-in Codecs -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:20:15 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:20:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329087=3A_Removed_the_documentation_of_non-existing_UC?= =?utf-8?q?S4_support_functions=2E?= Message-ID: <20161228072015.79585.91111.44122A39@psf.io> https://hg.python.org/cpython/rev/e44b6b01c8cf changeset: 105860:e44b6b01c8cf branch: 3.6 parent: 105856:86a412584c02 parent: 105859:29d46d29e169 user: Serhiy Storchaka date: Wed Dec 28 09:19:45 2016 +0200 summary: Issue #29087: Removed the documentation of non-existing UCS4 support functions. files: Doc/c-api/unicode.rst | 20 -------------------- 1 files changed, 0 insertions(+), 20 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -942,26 +942,6 @@ .. versionadded:: 3.2 -UCS4 Support -"""""""""""" - -.. versionadded:: 3.3 - -.. XXX are these meant to be public? - -.. c:function:: size_t Py_UCS4_strlen(const Py_UCS4 *u) - Py_UCS4* Py_UCS4_strcpy(Py_UCS4 *s1, const Py_UCS4 *s2) - Py_UCS4* Py_UCS4_strncpy(Py_UCS4 *s1, const Py_UCS4 *s2, size_t n) - Py_UCS4* Py_UCS4_strcat(Py_UCS4 *s1, const Py_UCS4 *s2) - int Py_UCS4_strcmp(const Py_UCS4 *s1, const Py_UCS4 *s2) - int Py_UCS4_strncmp(const Py_UCS4 *s1, const Py_UCS4 *s2, size_t n) - Py_UCS4* Py_UCS4_strchr(const Py_UCS4 *s, Py_UCS4 c) - Py_UCS4* Py_UCS4_strrchr(const Py_UCS4 *s, Py_UCS4 c) - - These utility functions work on strings of :c:type:`Py_UCS4` characters and - otherwise behave like the C standard library functions with the same name. - - .. _builtincodecs: Built-in Codecs -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:20:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:20:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329087=3A_Removed_the_documentation_of_non-exist?= =?utf-8?q?ing_UCS4_support_functions=2E?= Message-ID: <20161228072016.20512.57636.0B172643@psf.io> https://hg.python.org/cpython/rev/0ec4befef7e0 changeset: 105861:0ec4befef7e0 parent: 105858:fa9933bf4ea0 parent: 105860:e44b6b01c8cf user: Serhiy Storchaka date: Wed Dec 28 09:20:00 2016 +0200 summary: Issue #29087: Removed the documentation of non-existing UCS4 support functions. files: Doc/c-api/unicode.rst | 20 -------------------- 1 files changed, 0 insertions(+), 20 deletions(-) diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -942,26 +942,6 @@ .. versionadded:: 3.2 -UCS4 Support -"""""""""""" - -.. versionadded:: 3.3 - -.. XXX are these meant to be public? - -.. c:function:: size_t Py_UCS4_strlen(const Py_UCS4 *u) - Py_UCS4* Py_UCS4_strcpy(Py_UCS4 *s1, const Py_UCS4 *s2) - Py_UCS4* Py_UCS4_strncpy(Py_UCS4 *s1, const Py_UCS4 *s2, size_t n) - Py_UCS4* Py_UCS4_strcat(Py_UCS4 *s1, const Py_UCS4 *s2) - int Py_UCS4_strcmp(const Py_UCS4 *s1, const Py_UCS4 *s2) - int Py_UCS4_strncmp(const Py_UCS4 *s1, const Py_UCS4 *s2, size_t n) - Py_UCS4* Py_UCS4_strchr(const Py_UCS4 *s, Py_UCS4 c) - Py_UCS4* Py_UCS4_strrchr(const Py_UCS4 *s, Py_UCS4 c) - - These utility functions work on strings of :c:type:`Py_UCS4` characters and - otherwise behave like the C standard library functions with the same name. - - .. _builtincodecs: Built-in Codecs -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:28:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:28:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Backed_out_cha?= =?utf-8?q?ngeset_78bf34b6a713?= Message-ID: <20161228072810.107649.13020.9B570332@psf.io> https://hg.python.org/cpython/rev/81b36ac643b3 changeset: 105862:81b36ac643b3 branch: 2.7 parent: 105854:9acdcafd1418 user: Serhiy Storchaka date: Wed Dec 28 09:23:17 2016 +0200 summary: Backed out changeset 78bf34b6a713 files: Lib/test/test_xml_etree_c.py | 11 ----------- Misc/NEWS | 2 -- Modules/_elementtree.c | 23 ++++------------------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -17,7 +17,6 @@ """ - at unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @precisionbigmemtest(size=_2G + 100, memuse=1) @@ -63,22 +62,12 @@ del element.attrib self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'}) - def test_trashcan(self): - # If this test fails, it will most likely die via segfault. - e = root = cET.Element('root') - for i in range(200000): - e = cET.SubElement(e, 'x') - del e - del root - test_support.gc_collect() - def test_main(): from test import test_xml_etree, test_xml_etree_c # Run the tests specific to the C implementation test_support.run_doctest(test_xml_etree_c, verbosity=True) - test_support.run_unittest(MiscTests) # Assign the C implementation before running the doctests # Patch the __name__, to prevent confusion with the pure Python test diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,8 +26,6 @@ - Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict. Original patch by Rasmus Villemoes. -- Issue #28871: Fixed a crash when deallocate deep ElementTree. - - Issue #19542: Fix bugs in WeakValueDictionary.setdefault() and WeakValueDictionary.pop() when a GC collection happens in another thread. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -121,18 +121,6 @@ #define JOIN_SET(p, flag) ((void*) ((Py_uintptr_t) (JOIN_OBJ(p)) | (flag))) #define JOIN_OBJ(p) ((PyObject*) ((Py_uintptr_t) (p) & ~1)) -/* Py_CLEAR for a PyObject* that uses a join flag. Pass the pointer by - * reference since this function sets it to NULL. -*/ -static void _clear_joined_ptr(PyObject **p) -{ - if (*p) { - PyObject *tmp = JOIN_OBJ(*p); - *p = NULL; - Py_DECREF(tmp); - } -} - /* glue functions (see the init function for details) */ static PyObject* elementtree_parseerror_obj; static PyObject* elementtree_copyelement_obj; @@ -550,20 +538,17 @@ static void element_dealloc(ElementObject* self) { - Py_TRASHCAN_SAFE_BEGIN(self) + if (self->extra) + element_dealloc_extra(self); /* discard attributes */ Py_DECREF(self->tag); - _clear_joined_ptr(&self->text); - _clear_joined_ptr(&self->tail); - - if (self->extra) - element_dealloc_extra(self); + Py_DECREF(JOIN_OBJ(self->text)); + Py_DECREF(JOIN_OBJ(self->tail)); RELEASE(sizeof(ElementObject), "destroy element"); PyObject_Del(self); - Py_TRASHCAN_SAFE_END(self) } /* -------------------------------------------------------------------- */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:28:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:28:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fixed_running_?= =?utf-8?q?MiscTests_in_test=5Fxml=5Fetree=5Fc=2E?= Message-ID: <20161228072810.106798.28257.53DA9EBB@psf.io> https://hg.python.org/cpython/rev/40a68cfb1739 changeset: 105863:40a68cfb1739 branch: 2.7 user: Serhiy Storchaka date: Wed Dec 28 09:27:56 2016 +0200 summary: Fixed running MiscTests in test_xml_etree_c. files: Lib/test/test_xml_etree_c.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py +++ b/Lib/test/test_xml_etree_c.py @@ -17,6 +17,7 @@ """ + at unittest.skipUnless(cET, 'requires _elementtree') class MiscTests(unittest.TestCase): # Issue #8651. @precisionbigmemtest(size=_2G + 100, memuse=1) @@ -67,6 +68,7 @@ from test import test_xml_etree, test_xml_etree_c # Run the tests specific to the C implementation + test_support.run_unittest(MiscTests) test_support.run_doctest(test_xml_etree_c, verbosity=True) # Assign the C implementation before running the doctests -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:57:26 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:57:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDcz?= =?utf-8?q?=3A_bytearray_formatting_no_longer_truncates_on_first_null_byte?= =?utf-8?q?=2E?= Message-ID: <20161228075726.26751.67673.D1F0D5F6@psf.io> https://hg.python.org/cpython/rev/277b36596a54 changeset: 105864:277b36596a54 branch: 3.5 parent: 105859:29d46d29e169 user: Serhiy Storchaka date: Wed Dec 28 09:54:22 2016 +0200 summary: Issue #29073: bytearray formatting no longer truncates on first null byte. files: Lib/test/test_format.py | 7 +++++++ Misc/NEWS | 2 ++ Objects/bytearrayobject.c | 4 +++- 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -388,6 +388,13 @@ else: raise TestFailed('"%*d"%(maxsize, -127) should fail') + def test_nul(self): + # test the null character + testcommon("a\0b", (), 'a\0b') + testcommon("a%cb", (0,), 'a\0b') + testformat("a%sb", ('c\0d',), 'ac\0db') + testcommon(b"a%sb", (b'c\0d',), b'ac\0db') + def test_non_ascii(self): testformat("\u20ac=%f", (1.0,), "\u20ac=1.000000") diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #29073: bytearray formatting no longer truncates on first null byte. + - Issue #28932: Do not include if it does not exist. - Issue #28147: Fix a memory leak in split-table dictionaries: setattr() diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -283,13 +283,15 @@ { PyObject *bytes_in, *bytes_out, *res; char *bytestring; + Py_ssize_t bytesize; if (self == NULL || !PyByteArray_Check(self) || args == NULL) { PyErr_BadInternalCall(); return NULL; } bytestring = PyByteArray_AS_STRING(self); - bytes_in = PyBytes_FromString(bytestring); + bytesize = PyByteArray_GET_SIZE(self); + bytes_in = PyBytes_FromStringAndSize(bytestring, bytesize); if (bytes_in == NULL) return NULL; bytes_out = _PyBytes_Format(bytes_in, args); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:57:26 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:57:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329073=3A_Added_a_test_for_bytearray_formatting_?= =?utf-8?q?with_null_byte=2E?= Message-ID: <20161228075726.17902.52565.8BF5EB30@psf.io> https://hg.python.org/cpython/rev/82bfdf599e24 changeset: 105866:82bfdf599e24 parent: 105861:0ec4befef7e0 parent: 105865:9b77e3a586b0 user: Serhiy Storchaka date: Wed Dec 28 09:57:11 2016 +0200 summary: Issue #29073: Added a test for bytearray formatting with null byte. files: Lib/test/test_format.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -390,6 +390,13 @@ else: raise TestFailed('"%*d"%(maxsize, -127) should fail') + def test_nul(self): + # test the null character + testcommon("a\0b", (), 'a\0b') + testcommon("a%cb", (0,), 'a\0b') + testformat("a%sb", ('c\0d',), 'ac\0db') + testcommon(b"a%sb", (b'c\0d',), b'ac\0db') + def test_non_ascii(self): testformat("\u20ac=%f", (1.0,), "\u20ac=1.000000") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 02:57:26 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 07:57:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329073=3A_Added_a_test_for_bytearray_formatting_with_n?= =?utf-8?q?ull_byte=2E?= Message-ID: <20161228075726.107288.86096.FBC3CB0B@psf.io> https://hg.python.org/cpython/rev/9b77e3a586b0 changeset: 105865:9b77e3a586b0 branch: 3.6 parent: 105860:e44b6b01c8cf parent: 105864:277b36596a54 user: Serhiy Storchaka date: Wed Dec 28 09:56:52 2016 +0200 summary: Issue #29073: Added a test for bytearray formatting with null byte. files: Lib/test/test_format.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -390,6 +390,13 @@ else: raise TestFailed('"%*d"%(maxsize, -127) should fail') + def test_nul(self): + # test the null character + testcommon("a\0b", (), 'a\0b') + testcommon("a%cb", (0,), 'a\0b') + testformat("a%sb", ('c\0d',), 'ac\0db') + testcommon(b"a%sb", (b'c\0d',), b'ac\0db') + def test_non_ascii(self): testformat("\u20ac=%f", (1.0,), "\u20ac=1.000000") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:07:48 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:07:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=239770=3A_curses=2Eascii_predicates_now_work_correctly_?= =?utf-8?q?with_negative_integers=2E?= Message-ID: <20161228080748.80213.90691.0A80E753@psf.io> https://hg.python.org/cpython/rev/eb81f2d2a42b changeset: 105869:eb81f2d2a42b branch: 3.6 parent: 105865:9b77e3a586b0 parent: 105867:cba619a7bf6a user: Serhiy Storchaka date: Wed Dec 28 10:06:33 2016 +0200 summary: Issue #9770: curses.ascii predicates now work correctly with negative integers. files: Lib/curses/ascii.py | 18 +++++++++--------- Lib/test/test_curses.py | 19 +++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -53,19 +53,19 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) -def isascii(c): return _ctoi(c) <= 127 # ? +def isascii(c): return 0 <= _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (9, 32) -def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 -def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 -def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 -def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 -def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 +def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127 +def isdigit(c): return 48 <= _ctoi(c) <= 57 +def isgraph(c): return 33 <= _ctoi(c) <= 126 +def islower(c): return 97 <= _ctoi(c) <= 122 +def isprint(c): return 32 <= _ctoi(c) <= 126 def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) -def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 +def isupper(c): return 65 <= _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ - (_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102) -def isctrl(c): return _ctoi(c) < 32 + (65 <= _ctoi(c) <= 70) or (97 <= _ctoi(c) <= 102) +def isctrl(c): return 0 <= _ctoi(c) < 32 def ismeta(c): return _ctoi(c) > 127 def ascii(c): diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -436,6 +436,25 @@ check(curses.ascii.ispunct, c in string.punctuation) check(curses.ascii.isxdigit, c in string.hexdigits) + for i in (-2, -1, 256, sys.maxunicode, sys.maxunicode+1): + self.assertFalse(curses.ascii.isalnum(i)) + self.assertFalse(curses.ascii.isalpha(i)) + self.assertFalse(curses.ascii.isdigit(i)) + self.assertFalse(curses.ascii.islower(i)) + self.assertFalse(curses.ascii.isspace(i)) + self.assertFalse(curses.ascii.isupper(i)) + + self.assertFalse(curses.ascii.isascii(i)) + self.assertFalse(curses.ascii.isctrl(i)) + self.assertFalse(curses.ascii.iscntrl(i)) + self.assertFalse(curses.ascii.isblank(i)) + self.assertFalse(curses.ascii.isgraph(i)) + self.assertFalse(curses.ascii.isprint(i)) + self.assertFalse(curses.ascii.ispunct(i)) + self.assertFalse(curses.ascii.isxdigit(i)) + + self.assertFalse(curses.ascii.ismeta(-1)) + def test_ascii(self): ascii = curses.ascii.ascii self.assertEqual(ascii('\xc1'), 'A') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,9 @@ Library ------- +- Issue #9770: curses.ascii predicates now work correctly with negative + integers. + - Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:07:48 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:07:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzk3NzA6?= =?utf-8?q?_curses=2Eascii_predicates_now_work_correctly_with_negative_int?= =?utf-8?q?egers=2E?= Message-ID: <20161228080748.5972.69930.A4471108@psf.io> https://hg.python.org/cpython/rev/84ca252ac346 changeset: 105868:84ca252ac346 branch: 2.7 parent: 105863:40a68cfb1739 user: Serhiy Storchaka date: Wed Dec 28 10:04:27 2016 +0200 summary: Issue #9770: curses.ascii predicates now work correctly with negative integers. files: Lib/curses/ascii.py | 18 +++++++++--------- Lib/test/test_curses.py | 19 +++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -53,19 +53,19 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) -def isascii(c): return _ctoi(c) <= 127 # ? +def isascii(c): return 0 <= _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (9, 32) -def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 -def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 -def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 -def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 -def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 +def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127 +def isdigit(c): return 48 <= _ctoi(c) <= 57 +def isgraph(c): return 33 <= _ctoi(c) <= 126 +def islower(c): return 97 <= _ctoi(c) <= 122 +def isprint(c): return 32 <= _ctoi(c) <= 126 def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) -def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 +def isupper(c): return 65 <= _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ - (_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102) -def isctrl(c): return _ctoi(c) < 32 + (65 <= _ctoi(c) <= 70) or (97 <= _ctoi(c) <= 102) +def isctrl(c): return 0 <= _ctoi(c) < 32 def ismeta(c): return _ctoi(c) > 127 def ascii(c): diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -358,6 +358,25 @@ check(curses.ascii.ispunct, c in string.punctuation) check(curses.ascii.isxdigit, c in string.hexdigits) + for i in (-2, -1, 256, sys.maxunicode, sys.maxunicode+1): + self.assertFalse(curses.ascii.isalnum(i)) + self.assertFalse(curses.ascii.isalpha(i)) + self.assertFalse(curses.ascii.isdigit(i)) + self.assertFalse(curses.ascii.islower(i)) + self.assertFalse(curses.ascii.isspace(i)) + self.assertFalse(curses.ascii.isupper(i)) + + self.assertFalse(curses.ascii.isascii(i)) + self.assertFalse(curses.ascii.isctrl(i)) + self.assertFalse(curses.ascii.iscntrl(i)) + self.assertFalse(curses.ascii.isblank(i)) + self.assertFalse(curses.ascii.isgraph(i)) + self.assertFalse(curses.ascii.isprint(i)) + self.assertFalse(curses.ascii.ispunct(i)) + self.assertFalse(curses.ascii.isxdigit(i)) + + self.assertFalse(curses.ascii.ismeta(-1)) + def test_ascii(self): ascii = curses.ascii.ascii self.assertEqual(ascii('\xc1'), 'A') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Library ------- +- Issue #9770: curses.ascii predicates now work correctly with negative + integers. + - Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:07:48 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:07:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzk3NzA6?= =?utf-8?q?_curses=2Eascii_predicates_now_work_correctly_with_negative_int?= =?utf-8?q?egers=2E?= Message-ID: <20161228080748.79374.14727.C612B3AA@psf.io> https://hg.python.org/cpython/rev/cba619a7bf6a changeset: 105867:cba619a7bf6a branch: 3.5 parent: 105864:277b36596a54 user: Serhiy Storchaka date: Wed Dec 28 10:04:27 2016 +0200 summary: Issue #9770: curses.ascii predicates now work correctly with negative integers. files: Lib/curses/ascii.py | 18 +++++++++--------- Lib/test/test_curses.py | 19 +++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -53,19 +53,19 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) -def isascii(c): return _ctoi(c) <= 127 # ? +def isascii(c): return 0 <= _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (9, 32) -def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 -def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 -def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 -def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 -def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 +def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127 +def isdigit(c): return 48 <= _ctoi(c) <= 57 +def isgraph(c): return 33 <= _ctoi(c) <= 126 +def islower(c): return 97 <= _ctoi(c) <= 122 +def isprint(c): return 32 <= _ctoi(c) <= 126 def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) -def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 +def isupper(c): return 65 <= _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ - (_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102) -def isctrl(c): return _ctoi(c) < 32 + (65 <= _ctoi(c) <= 70) or (97 <= _ctoi(c) <= 102) +def isctrl(c): return 0 <= _ctoi(c) < 32 def ismeta(c): return _ctoi(c) > 127 def ascii(c): diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -436,6 +436,25 @@ check(curses.ascii.ispunct, c in string.punctuation) check(curses.ascii.isxdigit, c in string.hexdigits) + for i in (-2, -1, 256, sys.maxunicode, sys.maxunicode+1): + self.assertFalse(curses.ascii.isalnum(i)) + self.assertFalse(curses.ascii.isalpha(i)) + self.assertFalse(curses.ascii.isdigit(i)) + self.assertFalse(curses.ascii.islower(i)) + self.assertFalse(curses.ascii.isspace(i)) + self.assertFalse(curses.ascii.isupper(i)) + + self.assertFalse(curses.ascii.isascii(i)) + self.assertFalse(curses.ascii.isctrl(i)) + self.assertFalse(curses.ascii.iscntrl(i)) + self.assertFalse(curses.ascii.isblank(i)) + self.assertFalse(curses.ascii.isgraph(i)) + self.assertFalse(curses.ascii.isprint(i)) + self.assertFalse(curses.ascii.ispunct(i)) + self.assertFalse(curses.ascii.isxdigit(i)) + + self.assertFalse(curses.ascii.ismeta(-1)) + def test_ascii(self): ascii = curses.ascii.ascii self.assertEqual(ascii('\xc1'), 'A') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -140,6 +140,9 @@ Library ------- +- Issue #9770: curses.ascii predicates now work correctly with negative + integers. + - Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:07:48 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:07:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=239770=3A_curses=2Eascii_predicates_now_work_corr?= =?utf-8?q?ectly_with_negative_integers=2E?= Message-ID: <20161228080748.107561.11076.B26F079D@psf.io> https://hg.python.org/cpython/rev/1c0b72996e60 changeset: 105870:1c0b72996e60 parent: 105866:82bfdf599e24 parent: 105869:eb81f2d2a42b user: Serhiy Storchaka date: Wed Dec 28 10:07:16 2016 +0200 summary: Issue #9770: curses.ascii predicates now work correctly with negative integers. files: Lib/curses/ascii.py | 18 +++++++++--------- Lib/test/test_curses.py | 19 +++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -53,19 +53,19 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) -def isascii(c): return _ctoi(c) <= 127 # ? +def isascii(c): return 0 <= _ctoi(c) <= 127 # ? def isblank(c): return _ctoi(c) in (9, 32) -def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 -def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 -def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 -def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 -def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 +def iscntrl(c): return 0 <= _ctoi(c) <= 31 or _ctoi(c) == 127 +def isdigit(c): return 48 <= _ctoi(c) <= 57 +def isgraph(c): return 33 <= _ctoi(c) <= 126 +def islower(c): return 97 <= _ctoi(c) <= 122 +def isprint(c): return 32 <= _ctoi(c) <= 126 def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) -def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 +def isupper(c): return 65 <= _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ - (_ctoi(c) >= 65 and _ctoi(c) <= 70) or (_ctoi(c) >= 97 and _ctoi(c) <= 102) -def isctrl(c): return _ctoi(c) < 32 + (65 <= _ctoi(c) <= 70) or (97 <= _ctoi(c) <= 102) +def isctrl(c): return 0 <= _ctoi(c) < 32 def ismeta(c): return _ctoi(c) > 127 def ascii(c): diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -436,6 +436,25 @@ check(curses.ascii.ispunct, c in string.punctuation) check(curses.ascii.isxdigit, c in string.hexdigits) + for i in (-2, -1, 256, sys.maxunicode, sys.maxunicode+1): + self.assertFalse(curses.ascii.isalnum(i)) + self.assertFalse(curses.ascii.isalpha(i)) + self.assertFalse(curses.ascii.isdigit(i)) + self.assertFalse(curses.ascii.islower(i)) + self.assertFalse(curses.ascii.isspace(i)) + self.assertFalse(curses.ascii.isupper(i)) + + self.assertFalse(curses.ascii.isascii(i)) + self.assertFalse(curses.ascii.isctrl(i)) + self.assertFalse(curses.ascii.iscntrl(i)) + self.assertFalse(curses.ascii.isblank(i)) + self.assertFalse(curses.ascii.isgraph(i)) + self.assertFalse(curses.ascii.isprint(i)) + self.assertFalse(curses.ascii.ispunct(i)) + self.assertFalse(curses.ascii.isxdigit(i)) + + self.assertFalse(curses.ascii.ismeta(-1)) + def test_ascii(self): ascii = curses.ascii.ascii self.assertEqual(ascii('\xc1'), 'A') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -208,6 +208,9 @@ Library ------- +- Issue #9770: curses.ascii predicates now work correctly with negative + integers. + - Issue #28427: old keys should not remove new values from WeakValueDictionary when collecting from another thread. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:23:39 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:23:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzEzMDUx?= =?utf-8?q?=3A_Fixed_recursion_errors_in_large_or_resized_curses=2Etextpad?= =?utf-8?b?LlRleHRib3gu?= Message-ID: <20161228082339.79403.32062.5B72BF3C@psf.io> https://hg.python.org/cpython/rev/b446a4aab9cf changeset: 105871:b446a4aab9cf branch: 3.5 parent: 105867:cba619a7bf6a user: Serhiy Storchaka date: Wed Dec 28 10:16:06 2016 +0200 summary: Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. files: Lib/curses/textpad.py | 31 ++++++++++++++++++++-------- Lib/test/test_curses.py | 9 ++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Lib/curses/textpad.py b/Lib/curses/textpad.py --- a/Lib/curses/textpad.py +++ b/Lib/curses/textpad.py @@ -43,16 +43,20 @@ def __init__(self, win, insert_mode=False): self.win = win self.insert_mode = insert_mode - (self.maxy, self.maxx) = win.getmaxyx() - self.maxy = self.maxy - 1 - self.maxx = self.maxx - 1 + self._update_max_yx() self.stripspaces = 1 self.lastcmd = None win.keypad(1) + def _update_max_yx(self): + maxy, maxx = self.win.getmaxyx() + self.maxy = maxy - 1 + self.maxx = maxx - 1 + def _end_of_line(self, y): """Go to the location of the first blank on the given line, returning the index of the last non-blank character.""" + self._update_max_yx() last = self.maxx while True: if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP: @@ -64,8 +68,10 @@ return last def _insert_printable_char(self, ch): + self._update_max_yx() (y, x) = self.win.getyx() - if y < self.maxy or x < self.maxx: + backyx = None + while y < self.maxy or x < self.maxx: if self.insert_mode: oldch = self.win.inch() # The try-catch ignores the error we trigger from some curses @@ -75,14 +81,20 @@ self.win.addch(ch) except curses.error: pass - if self.insert_mode: - (backy, backx) = self.win.getyx() - if curses.ascii.isprint(oldch): - self._insert_printable_char(oldch) - self.win.move(backy, backx) + if not self.insert_mode or not curses.ascii.isprint(oldch): + break + ch = oldch + (y, x) = self.win.getyx() + # Remember where to put the cursor back since we are in insert_mode + if backyx is None: + backyx = y, x + + if backyx is not None: + self.win.move(*backyx) def do_command(self, ch): "Process a single editing command." + self._update_max_yx() (y, x) = self.win.getyx() self.lastcmd = ch if curses.ascii.isprint(ch): @@ -148,6 +160,7 @@ def gather(self): "Collect and return the contents of the window." result = "" + self._update_max_yx() for y in range(self.maxy+1): self.win.move(y, 0) stop = self._end_of_line(y) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -27,6 +27,7 @@ curses = import_module('curses') import_module('curses.panel') import_module('curses.ascii') +import_module('curses.textpad') def requires_curses_func(name): return unittest.skipUnless(hasattr(curses, name), @@ -392,6 +393,14 @@ human_readable_signature = stdscr.addch.__doc__.split("\n")[0] self.assertIn("[y, x,]", human_readable_signature) + def test_issue13051(self): + stdscr = self.stdscr + box = curses.textpad.Textbox(stdscr, insert_mode=True) + lines, cols = stdscr.getmaxyx() + stdscr.resize(lines-2, cols-2) + # this may cause infinite recursion, leading to a RuntimeError + box._insert_printable_char('a') + class MiscTests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -41,6 +41,7 @@ Mark Anacker Shashwat Anand Anders Andersen +Tycho Andersen John Anderson Pehr Anderson Erik Anders?n diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -140,6 +140,9 @@ Library ------- +- Issue #13051: Fixed recursion errors in large or resized + curses.textpad.Textbox. Based on patch by Tycho Andersen. + - Issue #9770: curses.ascii predicates now work correctly with negative integers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:23:40 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:23:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEzMDUx?= =?utf-8?q?=3A_Fixed_recursion_errors_in_large_or_resized_curses=2Etextpad?= =?utf-8?b?LlRleHRib3gu?= Message-ID: <20161228082339.19924.81561.7EBEAE66@psf.io> https://hg.python.org/cpython/rev/d87771d1c1e6 changeset: 105872:d87771d1c1e6 branch: 2.7 parent: 105868:84ca252ac346 user: Serhiy Storchaka date: Wed Dec 28 10:16:06 2016 +0200 summary: Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. files: Lib/curses/textpad.py | 31 ++++++++++++++++++++-------- Lib/test/test_curses.py | 9 ++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Lib/curses/textpad.py b/Lib/curses/textpad.py --- a/Lib/curses/textpad.py +++ b/Lib/curses/textpad.py @@ -43,16 +43,20 @@ def __init__(self, win, insert_mode=False): self.win = win self.insert_mode = insert_mode - (self.maxy, self.maxx) = win.getmaxyx() - self.maxy = self.maxy - 1 - self.maxx = self.maxx - 1 + self._update_max_yx() self.stripspaces = 1 self.lastcmd = None win.keypad(1) + def _update_max_yx(self): + maxy, maxx = self.win.getmaxyx() + self.maxy = maxy - 1 + self.maxx = maxx - 1 + def _end_of_line(self, y): """Go to the location of the first blank on the given line, returning the index of the last non-blank character.""" + self._update_max_yx() last = self.maxx while True: if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP: @@ -64,8 +68,10 @@ return last def _insert_printable_char(self, ch): + self._update_max_yx() (y, x) = self.win.getyx() - if y < self.maxy or x < self.maxx: + backyx = None + while y < self.maxy or x < self.maxx: if self.insert_mode: oldch = self.win.inch() # The try-catch ignores the error we trigger from some curses @@ -75,14 +81,20 @@ self.win.addch(ch) except curses.error: pass - if self.insert_mode: - (backy, backx) = self.win.getyx() - if curses.ascii.isprint(oldch): - self._insert_printable_char(oldch) - self.win.move(backy, backx) + if not self.insert_mode or not curses.ascii.isprint(oldch): + break + ch = oldch + (y, x) = self.win.getyx() + # Remember where to put the cursor back since we are in insert_mode + if backyx is None: + backyx = y, x + + if backyx is not None: + self.win.move(*backyx) def do_command(self, ch): "Process a single editing command." + self._update_max_yx() (y, x) = self.win.getyx() self.lastcmd = ch if curses.ascii.isprint(ch): @@ -148,6 +160,7 @@ def gather(self): "Collect and return the contents of the window." result = "" + self._update_max_yx() for y in range(self.maxy+1): self.win.move(y, 0) stop = self._end_of_line(y) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -26,6 +26,7 @@ curses = import_module('curses') import_module('curses.panel') import_module('curses.ascii') +import_module('curses.textpad') def requires_curses_func(name): return unittest.skipUnless(hasattr(curses, name), @@ -327,6 +328,14 @@ b = curses.tparm(curses.tigetstr("cup"), 5, 3) self.assertIs(type(b), bytes) + def test_issue13051(self): + stdscr = self.stdscr + box = curses.textpad.Textbox(stdscr, insert_mode=True) + lines, cols = stdscr.getmaxyx() + stdscr.resize(lines-2, cols-2) + # this may cause infinite recursion, leading to a RuntimeError + box._insert_printable_char('a') + class TestAscii(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -37,6 +37,7 @@ Mark Anacker Shashwat Anand Anders Andersen +Tycho Andersen John Anderson Pehr Anderson Erik Anders?n diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -15,6 +15,9 @@ Library ------- +- Issue #13051: Fixed recursion errors in large or resized + curses.textpad.Textbox. Based on patch by Tycho Andersen. + - Issue #9770: curses.ascii predicates now work correctly with negative integers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:23:40 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:23:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2313051=3A_Fixed_recursion_errors_in_large_or_resized_c?= =?utf-8?q?urses=2Etextpad=2ETextbox=2E?= Message-ID: <20161228082340.106757.43845.811E46DD@psf.io> https://hg.python.org/cpython/rev/ea87e00a3e89 changeset: 105873:ea87e00a3e89 branch: 3.6 parent: 105869:eb81f2d2a42b parent: 105871:b446a4aab9cf user: Serhiy Storchaka date: Wed Dec 28 10:22:56 2016 +0200 summary: Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. files: Lib/curses/textpad.py | 31 ++++++++++++++++++++-------- Lib/test/test_curses.py | 9 ++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Lib/curses/textpad.py b/Lib/curses/textpad.py --- a/Lib/curses/textpad.py +++ b/Lib/curses/textpad.py @@ -43,16 +43,20 @@ def __init__(self, win, insert_mode=False): self.win = win self.insert_mode = insert_mode - (self.maxy, self.maxx) = win.getmaxyx() - self.maxy = self.maxy - 1 - self.maxx = self.maxx - 1 + self._update_max_yx() self.stripspaces = 1 self.lastcmd = None win.keypad(1) + def _update_max_yx(self): + maxy, maxx = self.win.getmaxyx() + self.maxy = maxy - 1 + self.maxx = maxx - 1 + def _end_of_line(self, y): """Go to the location of the first blank on the given line, returning the index of the last non-blank character.""" + self._update_max_yx() last = self.maxx while True: if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP: @@ -64,8 +68,10 @@ return last def _insert_printable_char(self, ch): + self._update_max_yx() (y, x) = self.win.getyx() - if y < self.maxy or x < self.maxx: + backyx = None + while y < self.maxy or x < self.maxx: if self.insert_mode: oldch = self.win.inch() # The try-catch ignores the error we trigger from some curses @@ -75,14 +81,20 @@ self.win.addch(ch) except curses.error: pass - if self.insert_mode: - (backy, backx) = self.win.getyx() - if curses.ascii.isprint(oldch): - self._insert_printable_char(oldch) - self.win.move(backy, backx) + if not self.insert_mode or not curses.ascii.isprint(oldch): + break + ch = oldch + (y, x) = self.win.getyx() + # Remember where to put the cursor back since we are in insert_mode + if backyx is None: + backyx = y, x + + if backyx is not None: + self.win.move(*backyx) def do_command(self, ch): "Process a single editing command." + self._update_max_yx() (y, x) = self.win.getyx() self.lastcmd = ch if curses.ascii.isprint(ch): @@ -148,6 +160,7 @@ def gather(self): "Collect and return the contents of the window." result = "" + self._update_max_yx() for y in range(self.maxy+1): self.win.move(y, 0) stop = self._end_of_line(y) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -27,6 +27,7 @@ curses = import_module('curses') import_module('curses.panel') import_module('curses.ascii') +import_module('curses.textpad') def requires_curses_func(name): return unittest.skipUnless(hasattr(curses, name), @@ -392,6 +393,14 @@ human_readable_signature = stdscr.addch.__doc__.split("\n")[0] self.assertIn("[y, x,]", human_readable_signature) + def test_issue13051(self): + stdscr = self.stdscr + box = curses.textpad.Textbox(stdscr, insert_mode=True) + lines, cols = stdscr.getmaxyx() + stdscr.resize(lines-2, cols-2) + # this may cause infinite recursion, leading to a RuntimeError + box._insert_printable_char('a') + class MiscTests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -41,6 +41,7 @@ Mark Anacker Shashwat Anand Anders Andersen +Tycho Andersen John Anderson Pehr Anderson Erik Anders?n diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,9 @@ Library ------- +- Issue #13051: Fixed recursion errors in large or resized + curses.textpad.Textbox. Based on patch by Tycho Andersen. + - Issue #9770: curses.ascii predicates now work correctly with negative integers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 03:23:40 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 28 Dec 2016 08:23:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2313051=3A_Fixed_recursion_errors_in_large_or_res?= =?utf-8?q?ized_curses=2Etextpad=2ETextbox=2E?= Message-ID: <20161228082340.106884.76367.2E9ABCB6@psf.io> https://hg.python.org/cpython/rev/ea7f22cf9c8c changeset: 105874:ea7f22cf9c8c parent: 105870:1c0b72996e60 parent: 105873:ea87e00a3e89 user: Serhiy Storchaka date: Wed Dec 28 10:23:24 2016 +0200 summary: Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. files: Lib/curses/textpad.py | 31 ++++++++++++++++++++-------- Lib/test/test_curses.py | 9 ++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/Lib/curses/textpad.py b/Lib/curses/textpad.py --- a/Lib/curses/textpad.py +++ b/Lib/curses/textpad.py @@ -43,16 +43,20 @@ def __init__(self, win, insert_mode=False): self.win = win self.insert_mode = insert_mode - (self.maxy, self.maxx) = win.getmaxyx() - self.maxy = self.maxy - 1 - self.maxx = self.maxx - 1 + self._update_max_yx() self.stripspaces = 1 self.lastcmd = None win.keypad(1) + def _update_max_yx(self): + maxy, maxx = self.win.getmaxyx() + self.maxy = maxy - 1 + self.maxx = maxx - 1 + def _end_of_line(self, y): """Go to the location of the first blank on the given line, returning the index of the last non-blank character.""" + self._update_max_yx() last = self.maxx while True: if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP: @@ -64,8 +68,10 @@ return last def _insert_printable_char(self, ch): + self._update_max_yx() (y, x) = self.win.getyx() - if y < self.maxy or x < self.maxx: + backyx = None + while y < self.maxy or x < self.maxx: if self.insert_mode: oldch = self.win.inch() # The try-catch ignores the error we trigger from some curses @@ -75,14 +81,20 @@ self.win.addch(ch) except curses.error: pass - if self.insert_mode: - (backy, backx) = self.win.getyx() - if curses.ascii.isprint(oldch): - self._insert_printable_char(oldch) - self.win.move(backy, backx) + if not self.insert_mode or not curses.ascii.isprint(oldch): + break + ch = oldch + (y, x) = self.win.getyx() + # Remember where to put the cursor back since we are in insert_mode + if backyx is None: + backyx = y, x + + if backyx is not None: + self.win.move(*backyx) def do_command(self, ch): "Process a single editing command." + self._update_max_yx() (y, x) = self.win.getyx() self.lastcmd = ch if curses.ascii.isprint(ch): @@ -148,6 +160,7 @@ def gather(self): "Collect and return the contents of the window." result = "" + self._update_max_yx() for y in range(self.maxy+1): self.win.move(y, 0) stop = self._end_of_line(y) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -27,6 +27,7 @@ curses = import_module('curses') import_module('curses.panel') import_module('curses.ascii') +import_module('curses.textpad') def requires_curses_func(name): return unittest.skipUnless(hasattr(curses, name), @@ -392,6 +393,14 @@ human_readable_signature = stdscr.addch.__doc__.split("\n")[0] self.assertIn("[y, x,]", human_readable_signature) + def test_issue13051(self): + stdscr = self.stdscr + box = curses.textpad.Textbox(stdscr, insert_mode=True) + lines, cols = stdscr.getmaxyx() + stdscr.resize(lines-2, cols-2) + # this may cause infinite recursion, leading to a RuntimeError + box._insert_printable_char('a') + class MiscTests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -41,6 +41,7 @@ Mark Anacker Shashwat Anand Anders Andersen +Tycho Andersen John Anderson Pehr Anderson Erik Anders?n diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -208,6 +208,9 @@ Library ------- +- Issue #13051: Fixed recursion errors in large or resized + curses.textpad.Textbox. Based on patch by Tycho Andersen. + - Issue #9770: curses.ascii predicates now work correctly with negative integers. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Dec 28 04:09:05 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 28 Dec 2016 09:09:05 +0000 Subject: [Python-checkins] Daily reference leaks (fa9933bf4ea0): sum=4 Message-ID: <20161228090905.20560.69269.0E2D208D@psf.io> results for fa9933bf4ea0 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_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/reflogRRWaQp', '--timeout', '7200'] From lp_benchmark_robot at intel.com Wed Dec 28 09:02:31 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 28 Dec 2016 14:02:31 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-12-28 Message-ID: Results for project Python 2.7, build date 2016-12-28 11:50:50 +0000 commit: 9acdcafd1418 previous commit: 878a91174e74 revision date: 2016-12-27 14:08:27 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release 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.19% -0.64% 5.22% 5.17% :-) pybench 0.12% -0.21% 7.69% 3.07% :-| regex_v8 0.53% 0.65% -0.04% 9.44% :-) nbody 0.10% -1.28% 12.10% 3.60% :-| json_dump_v2 0.35% -0.76% -0.30% 9.76% :-( normal_startup 1.83% -0.47% -2.53% 2.20% :-| ssbench 0.13% -0.22% 0.01% 2.22% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-12-28/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Wed Dec 28 09:03:16 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 28 Dec 2016 14:03:16 +0000 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-12-28 Message-ID: <0f9daf46-baaa-4acd-876e-0cbe9af8479b@irsmsx105.ger.corp.intel.com> Results for project Python default, build date 2016-12-28 11:05:34 +0000 commit: fa9933bf4ea0 previous commit: 5f3ac68f34f2 revision date: 2016-12-27 15:59: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 v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-| django_v2 0.24% 0.27% 1.56% 14.92% :-| pybench 0.22% 0.02% 1.27% 4.68% :-| regex_v8 3.58% 0.86% -1.27% 3.49% :-| nbody 0.10% 1.29% -0.81% 7.02% :-) json_dump_v2 0.33% 1.58% 10.20% 8.73% :-| normal_startup 0.99% 0.45% 0.35% 5.88% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-12-28/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Dec 28 17:39:19 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 22:39:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDgw?= =?utf-8?q?=3A_Removes_hard_dependency_on_hg=2Eexe_from_PC/build=2Ebat?= Message-ID: <20161228223919.26684.85163.F4F56D1B@psf.io> https://hg.python.org/cpython/rev/bc71c144e6f0 changeset: 105875:bc71c144e6f0 branch: 3.5 parent: 105871:b446a4aab9cf user: Steve Dower date: Wed Dec 28 14:37:44 2016 -0800 summary: Issue #29080: Removes hard dependency on hg.exe from PC/build.bat files: Misc/NEWS | 2 ++ PCbuild/build.bat | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -616,6 +616,8 @@ Build ----- +- Issue #29080: Removes hard dependency on hg.exe from PC/build.bat + - Issue #23903: Added missed names to PC/python3.def. - Issue #10656: Fix out-of-tree building on AIX. Patch by Tristan Carel and diff --git a/PCbuild/build.bat b/PCbuild/build.bat --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -106,7 +106,8 @@ ) if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 +if exist "%HG%" set HGProperty=/p:HG="%HG%" +if not exist "%HG%" echo Cannot find Mercurial on PATH & set HGProperty= rem Setup the environment call "%dir%env.bat" %vs_platf% >nul @@ -144,8 +145,7 @@ /p:Configuration=%conf% /p:Platform=%platf%^ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ - /p:UseTestMarker=%UseTestMarker%^ - /p:HG="%HG%"^ + /p:UseTestMarker=%UseTestMarker% %HGProperty%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 17:39:22 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 22:39:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329080=3A_Removes_hard_dependency_on_hg=2Eexe_from_PC/?= =?utf-8?q?build=2Ebat?= Message-ID: <20161228223922.17410.83037.FAEFD0A8@psf.io> https://hg.python.org/cpython/rev/f98d8c9f3cde changeset: 105876:f98d8c9f3cde branch: 3.6 parent: 105873:ea87e00a3e89 parent: 105875:bc71c144e6f0 user: Steve Dower date: Wed Dec 28 14:38:08 2016 -0800 summary: Issue #29080: Removes hard dependency on hg.exe from PC/build.bat files: Misc/NEWS | 2 ++ PCbuild/build.bat | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -103,6 +103,8 @@ Build ----- +- Issue #29080: Removes hard dependency on hg.exe from PC/build.bat + - Issue #23903: Added missed names to PC/python3.def. - Issue #28762: lockf() is available on Android API level 24, but the F_LOCK diff --git a/PCbuild/build.bat b/PCbuild/build.bat --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -106,7 +106,8 @@ ) if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 +if exist "%HG%" set HGProperty=/p:HG="%HG%" +if not exist "%HG%" echo Cannot find Mercurial on PATH & set HGProperty= rem Setup the environment call "%dir%env.bat" %vs_platf% >nul @@ -144,8 +145,7 @@ /p:Configuration=%conf% /p:Platform=%platf%^ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ - /p:UseTestMarker=%UseTestMarker%^ - /p:HG="%HG%"^ + /p:UseTestMarker=%UseTestMarker% %HGProperty%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 17:39:22 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 22:39:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329080=3A_Removes_hard_dependency_on_hg=2Eexe_fr?= =?utf-8?q?om_PC/build=2Ebat?= Message-ID: <20161228223922.106798.49972.02ED25E9@psf.io> https://hg.python.org/cpython/rev/57c2fc60c989 changeset: 105877:57c2fc60c989 parent: 105874:ea7f22cf9c8c parent: 105876:f98d8c9f3cde user: Steve Dower date: Wed Dec 28 14:38:54 2016 -0800 summary: Issue #29080: Removes hard dependency on hg.exe from PC/build.bat files: Misc/NEWS | 2 ++ PCbuild/build.bat | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -597,6 +597,8 @@ Build ----- +- Issue #29080: Removes hard dependency on hg.exe from PC/build.bat + - Issue #23903: Added missed names to PC/python3.def. - Issue #28762: lockf() is available on Android API level 24, but the F_LOCK diff --git a/PCbuild/build.bat b/PCbuild/build.bat --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -106,7 +106,8 @@ ) if not exist "%HG%" where hg > "%TEMP%\hg.loc" 2> nul && set /P HG= < "%TEMP%\hg.loc" & del "%TEMP%\hg.loc" -if not exist "%HG%" echo Cannot find Mercurial on PATH && exit /B 1 +if exist "%HG%" set HGProperty=/p:HG="%HG%" +if not exist "%HG%" echo Cannot find Mercurial on PATH & set HGProperty= rem Setup the environment call "%dir%env.bat" %vs_platf% >nul @@ -144,8 +145,7 @@ /p:Configuration=%conf% /p:Platform=%platf%^ /p:IncludeExternals=%IncludeExternals%^ /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ - /p:UseTestMarker=%UseTestMarker%^ - /p:HG="%HG%"^ + /p:UseTestMarker=%UseTestMarker% %HGProperty%^ %1 %2 %3 %4 %5 %6 %7 %8 %9 @echo off -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 18:42:01 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 23:42:01 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328768=3A_Fix_implicit_declaration_of_function_?= =?utf-8?q?=5Fsetmode=2E_Patch_by_Masayuki?= Message-ID: <20161228234201.79546.71543.1CE6CBB8@psf.io> https://hg.python.org/cpython/rev/276d1bae92be changeset: 105879:276d1bae92be parent: 105877:57c2fc60c989 parent: 105878:5027780d456b user: Steve Dower date: Wed Dec 28 15:41:53 2016 -0800 summary: Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto files: Misc/NEWS | 3 +++ Modules/_io/fileio.c | 3 +++ Modules/main.c | 3 +++ 3 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -597,6 +597,9 @@ Build ----- +- Issue #28768: Fix implicit declaration of function _setmode. Patch by + Masayuki Yamamoto + - Issue #29080: Removes hard dependency on hg.exe from PC/build.bat - Issue #23903: Added missed names to PC/python3.def. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -9,6 +9,9 @@ #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_FCNTL_H #include #endif diff --git a/Modules/main.c b/Modules/main.c --- a/Modules/main.c +++ b/Modules/main.c @@ -7,6 +7,9 @@ #if defined(MS_WINDOWS) || defined(__CYGWIN__) #include +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_FCNTL_H #include #endif -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 18:42:01 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 23:42:01 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NzY4?= =?utf-8?q?=3A_Fix_implicit_declaration_of_function_=5Fsetmode=2E_Patch_by?= =?utf-8?q?_Masayuki?= Message-ID: <20161228234201.20377.31483.B4F5832C@psf.io> https://hg.python.org/cpython/rev/5027780d456b changeset: 105878:5027780d456b branch: 3.6 parent: 105876:f98d8c9f3cde user: Steve Dower date: Wed Dec 28 15:41:09 2016 -0800 summary: Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto files: Misc/NEWS | 3 +++ Modules/_io/fileio.c | 3 +++ Modules/main.c | 3 +++ 3 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -103,6 +103,9 @@ Build ----- +- Issue #28768: Fix implicit declaration of function _setmode. Patch by + Masayuki Yamamoto + - Issue #29080: Removes hard dependency on hg.exe from PC/build.bat - Issue #23903: Added missed names to PC/python3.def. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -9,6 +9,9 @@ #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_FCNTL_H #include #endif diff --git a/Modules/main.c b/Modules/main.c --- a/Modules/main.c +++ b/Modules/main.c @@ -7,6 +7,9 @@ #if defined(MS_WINDOWS) || defined(__CYGWIN__) #include +#ifdef HAVE_IO_H +#include +#endif #ifdef HAVE_FCNTL_H #include #endif -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 18:43:54 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 23:43:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MDgw?= =?utf-8?q?=3A_Fixes_Misc/NEWS_entry?= Message-ID: <20161228234354.26723.81005.1498808B@psf.io> https://hg.python.org/cpython/rev/84beb5cba826 changeset: 105880:84beb5cba826 branch: 3.5 parent: 105875:bc71c144e6f0 user: Steve Dower date: Wed Dec 28 15:43:08 2016 -0800 summary: Issue #29080: Fixes Misc/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 @@ -616,7 +616,7 @@ Build ----- -- Issue #29080: Removes hard dependency on hg.exe from PC/build.bat +- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - Issue #23903: Added missed names to PC/python3.def. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 18:43:54 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 23:43:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329080=3A_Fixes_Misc/NEWS_entry?= Message-ID: <20161228234354.79881.35816.B52FAA1B@psf.io> https://hg.python.org/cpython/rev/048d1942b325 changeset: 105881:048d1942b325 branch: 3.6 parent: 105878:5027780d456b parent: 105880:84beb5cba826 user: Steve Dower date: Wed Dec 28 15:43:28 2016 -0800 summary: Issue #29080: Fixes Misc/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 @@ -106,7 +106,7 @@ - Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto -- Issue #29080: Removes hard dependency on hg.exe from PC/build.bat +- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - Issue #23903: Added missed names to PC/python3.def. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 18:43:54 2016 From: python-checkins at python.org (steve.dower) Date: Wed, 28 Dec 2016 23:43:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329080=3A_Fixes_Misc/NEWS_entry?= Message-ID: <20161228234354.17850.47945.D3AC33C6@psf.io> https://hg.python.org/cpython/rev/38e44a23ea66 changeset: 105882:38e44a23ea66 parent: 105879:276d1bae92be parent: 105881:048d1942b325 user: Steve Dower date: Wed Dec 28 15:43:45 2016 -0800 summary: Issue #29080: Fixes Misc/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 @@ -600,7 +600,7 @@ - Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto -- Issue #29080: Removes hard dependency on hg.exe from PC/build.bat +- Issue #29080: Removes hard dependency on hg.exe from PCBuild/build.bat - Issue #23903: Added missed names to PC/python3.def. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 19:03:55 2016 From: python-checkins at python.org (steve.dower) Date: Thu, 29 Dec 2016 00:03:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MDc5?= =?utf-8?q?=3A_Prevent_infinite_loop_in_pathlib=2Eresolve=28=29_on_Windows?= Message-ID: <20161229000355.106725.24393.A7CD5617@psf.io> https://hg.python.org/cpython/rev/af8c8551ea45 changeset: 105883:af8c8551ea45 branch: 3.6 parent: 105881:048d1942b325 user: Steve Dower date: Wed Dec 28 16:02:59 2016 -0800 summary: Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows files: Lib/pathlib.py | 4 +++- Misc/NEWS | 2 ++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -192,7 +192,9 @@ s = self._ext_to_normal(_getfinalpathname(s)) except FileNotFoundError: previous_s = s - s = os.path.abspath(os.path.join(s, os.pardir)) + s = os.path.dirname(s) + if previous_s == s: + return path else: if previous_s is None: return s diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,8 @@ Library ------- +- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows + - Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 19:03:55 2016 From: python-checkins at python.org (steve.dower) Date: Thu, 29 Dec 2016 00:03:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329079=3A_Prevent_infinite_loop_in_pathlib=2Eres?= =?utf-8?q?olve=28=29_on_Windows?= Message-ID: <20161229000355.5952.10053.0F780616@psf.io> https://hg.python.org/cpython/rev/9de7bf6c60d2 changeset: 105884:9de7bf6c60d2 parent: 105882:38e44a23ea66 parent: 105883:af8c8551ea45 user: Steve Dower date: Wed Dec 28 16:03:28 2016 -0800 summary: Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows files: Lib/pathlib.py | 4 +++- Misc/NEWS | 2 ++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -192,7 +192,9 @@ s = self._ext_to_normal(_getfinalpathname(s)) except FileNotFoundError: previous_s = s - s = os.path.abspath(os.path.join(s, os.pardir)) + s = os.path.dirname(s) + if previous_s == s: + return path else: if previous_s is None: return s diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -208,6 +208,8 @@ Library ------- +- Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows + - Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 23:03:28 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 29 Dec 2016 04:03:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_fix_error_chec?= =?utf-8?q?k=2C_so_that_Random=2Eseed_actually_uses_OS_randomness_=28close?= =?utf-8?b?cyAjMjkwODUp?= Message-ID: <20161229040328.26704.49918.E55232B8@psf.io> https://hg.python.org/cpython/rev/0a55e039d25f changeset: 105885:0a55e039d25f branch: 3.6 parent: 105883:af8c8551ea45 user: Benjamin Peterson date: Wed Dec 28 20:02:35 2016 -0800 summary: fix error check, so that Random.seed actually uses OS randomness (closes #29085) files: Misc/NEWS | 3 +++ Modules/_randommodule.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -40,6 +40,9 @@ Library ------- +- Issue #29085: Allow random.Random.seed() to use high quality OS randomness + rather than the pid and time. + - Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows - Issue #13051: Fixed recursion errors in large or resized diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -245,7 +245,7 @@ return NULL; if (arg == NULL || arg == Py_None) { - if (random_seed_urandom(self) >= 0) { + if (random_seed_urandom(self) < 0) { PyErr_Clear(); /* Reading system entropy failed, fall back on the worst entropy: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Dec 28 23:03:28 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 29 Dec 2016 04:03:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy42ICgjMjkwODUp?= Message-ID: <20161229040328.79585.85176.EBC54906@psf.io> https://hg.python.org/cpython/rev/fc3eab44765f changeset: 105886:fc3eab44765f parent: 105884:9de7bf6c60d2 parent: 105885:0a55e039d25f user: Benjamin Peterson date: Wed Dec 28 20:03:23 2016 -0800 summary: merge 3.6 (#29085) files: Misc/NEWS | 3 +++ Modules/_randommodule.c | 2 +- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -734,6 +734,9 @@ Library ------- +- Issue #29085: Allow random.Random.seed() to use high quality OS randomness + rather than the pid and time. + - Issue 28923: Remove editor artifacts from Tix.py. - Issue #29055: Neaten-up empty population error on random.choice() diff --git a/Modules/_randommodule.c b/Modules/_randommodule.c --- a/Modules/_randommodule.c +++ b/Modules/_randommodule.c @@ -245,7 +245,7 @@ return NULL; if (arg == NULL || arg == Py_None) { - if (random_seed_urandom(self) >= 0) { + if (random_seed_urandom(self) < 0) { PyErr_Clear(); /* Reading system entropy failed, fall back on the worst entropy: -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Dec 29 04:10:27 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 29 Dec 2016 09:10:27 +0000 Subject: [Python-checkins] Daily reference leaks (fc3eab44765f): sum=4 Message-ID: <20161229091027.80403.92100.414582C2@psf.io> results for fc3eab44765f 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/reflogIa4xZJ', '--timeout', '7200'] From lp_benchmark_robot at intel.com Thu Dec 29 09:23:07 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 29 Dec 2016 14:23:07 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-12-29 Message-ID: Results for project Python 2.7, build date 2016-12-29 11:47:59 +0000 commit: d87771d1c1e6 previous commit: 9acdcafd1418 revision date: 2016-12-28 08:16: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 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.39% 4.85% 6.43% :-) pybench 0.10% 0.04% 7.72% 2.40% :-| regex_v8 0.80% -0.12% -0.15% 10.57% :-) nbody 0.08% -0.26% 11.87% 1.80% :-| json_dump_v2 0.36% 0.61% 0.32% 8.41% :-( normal_startup 1.91% -0.19% -2.72% 2.85% :-| ssbench 0.18% 0.34% 0.35% 2.14% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-12-29/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Thu Dec 29 09:23:38 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 29 Dec 2016 14:23:38 +0000 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-12-29 Message-ID: <8713daf2-5cbf-49d4-b0e1-6c30796ce5dd@irsmsx153.ger.corp.intel.com> Results for project Python default, build date 2016-12-29 11:03:16 +0000 commit: 9de7bf6c60d2 previous commit: fa9933bf4ea0 revision date: 2016-12-29 00:03:28 +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.21% 0.36% 15.43% :-| pybench 0.24% 0.29% 1.55% 5.71% :-| regex_v8 3.56% -0.11% -1.38% 3.37% :-| nbody 0.15% -0.05% -0.86% 5.82% :-) json_dump_v2 0.26% -0.22% 10.01% 9.71% :-| normal_startup 0.98% 0.13% 0.02% 5.88% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-12-29/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Dec 29 20:15:43 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 30 Dec 2016 01:15:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20161230011543.16930.76192.E54FCEF7@psf.io> https://hg.python.org/cpython/rev/e0f3a2df0798 changeset: 105889:e0f3a2df0798 parent: 105886:fc3eab44765f parent: 105888:44fffbc8f970 user: Victor Stinner date: Fri Dec 30 02:15:37 2016 +0100 summary: Merge 3.6 files: Doc/library/tracemalloc.rst | 26 ++++++++++++------------ Misc/ACKS | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -66,7 +66,7 @@ :5: size=49.7 KiB, count=148, average=344 B /usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB -We can see that Python loaded ``4.8 MiB`` data (bytecode and constants) from +We can see that Python loaded ``4855 KiB`` data (bytecode and constants) from modules and that the :mod:`collections` module allocated ``244 KiB`` to build :class:`~collections.namedtuple` types. @@ -106,8 +106,8 @@ /usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B /usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B -We can see that Python has loaded ``8.2 MiB`` of module data (bytecode and -constants), and that this is ``4.4 MiB`` more than had been loaded before the +We can see that Python has loaded ``8173 KiB`` of module data (bytecode and +constants), and that this is ``4428 KiB`` more than had been loaded before the tests, when the previous snapshot was taken. Similarly, the :mod:`linecache` module has cached ``940 KiB`` of Python source code to format tracebacks, all of it since the previous snapshot. @@ -176,7 +176,7 @@ "__main__", fname, loader, pkg_name) We can see that the most memory was allocated in the :mod:`importlib` module to -load data (bytecode and constants) from modules: ``870 KiB``. The traceback is +load data (bytecode and constants) from modules: ``870.1 KiB``. The traceback is where the :mod:`importlib` loaded data most recently: on the ``import pdb`` line of the :mod:`doctest` module. The traceback may change if a new module is loaded. @@ -192,12 +192,12 @@ import os import tracemalloc - def display_top(snapshot, group_by='lineno', limit=10): + def display_top(snapshot, key_type='lineno', limit=10): snapshot = snapshot.filter_traces(( tracemalloc.Filter(False, ""), tracemalloc.Filter(False, ""), )) - top_stats = snapshot.statistics(group_by) + top_stats = snapshot.statistics(key_type) print("Top %s lines" % limit) for index, stat in enumerate(top_stats[:limit], 1): @@ -468,12 +468,12 @@ The :func:`take_snapshot` function creates a snapshot instance. - .. method:: compare_to(old_snapshot: Snapshot, group_by: str, cumulative: bool=False) + .. method:: compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False) Compute the differences with an old snapshot. Get statistics as a sorted - list of :class:`StatisticDiff` instances grouped by *group_by*. + list of :class:`StatisticDiff` instances grouped by *key_type*. - See the :meth:`Snapshot.statistics` method for *group_by* and *cumulative* + See the :meth:`Snapshot.statistics` method for *key_type* and *cumulative* parameters. The result is sorted from the biggest to the smallest by: absolute value @@ -511,13 +511,13 @@ See also :meth:`dump`. - .. method:: statistics(group_by: str, cumulative: bool=False) + .. method:: statistics(key_type: str, cumulative: bool=False) Get statistics as a sorted list of :class:`Statistic` instances grouped - by *group_by*: + by *key_type*: ===================== ======================== - group_by description + key_type description ===================== ======================== ``'filename'`` filename ``'lineno'`` filename and line number @@ -526,7 +526,7 @@ If *cumulative* is ``True``, cumulate size and count of memory blocks of all frames of the traceback of a trace, not only the most recent frame. - The cumulative mode can only be used with *group_by* equals to + The cumulative mode can only be used with *key_type* equals to ``'filename'`` and ``'lineno'``. The result is sorted from the biggest to the smallest by: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1142,6 +1142,7 @@ Randy Pausch Samuele Pedroni Justin Peel +Loic Pefferkorn Marcel van der Peijl Berker Peksag Andreas Pelme -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 29 20:15:43 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 30 Dec 2016 01:15:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTA5?= =?utf-8?q?=3A_Enhance_tracemalloc_documentation?= Message-ID: <20161230011543.79403.6109.BBFC99E8@psf.io> https://hg.python.org/cpython/rev/192e0ae17236 changeset: 105887:192e0ae17236 branch: 3.5 parent: 105880:84beb5cba826 user: Victor Stinner date: Fri Dec 30 02:14:59 2016 +0100 summary: Issue #29109: Enhance tracemalloc documentation * Wrong parameter name, 'group_by' instead of 'key_type' * Don't round up numbers when explaining the examples. If they exactly match what can be read in the script output, it is to easier to understand (4.8 MiB vs 4855 KiB) * Fix incorrect method link that was pointing to another module Patch written by Loic Pefferkorn. files: Doc/library/tracemalloc.rst | 26 ++++++++++++------------ Misc/ACKS | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -66,7 +66,7 @@ :5: size=49.7 KiB, count=148, average=344 B /usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB -We can see that Python loaded ``4.8 MiB`` data (bytecode and constants) from +We can see that Python loaded ``4855 KiB`` data (bytecode and constants) from modules and that the :mod:`collections` module allocated ``244 KiB`` to build :class:`~collections.namedtuple` types. @@ -106,8 +106,8 @@ /usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B /usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B -We can see that Python has loaded ``8.2 MiB`` of module data (bytecode and -constants), and that this is ``4.4 MiB`` more than had been loaded before the +We can see that Python has loaded ``8173 KiB`` of module data (bytecode and +constants), and that this is ``4428 KiB`` more than had been loaded before the tests, when the previous snapshot was taken. Similarly, the :mod:`linecache` module has cached ``940 KiB`` of Python source code to format tracebacks, all of it since the previous snapshot. @@ -176,7 +176,7 @@ "__main__", fname, loader, pkg_name) We can see that the most memory was allocated in the :mod:`importlib` module to -load data (bytecode and constants) from modules: ``870 KiB``. The traceback is +load data (bytecode and constants) from modules: ``870.1 KiB``. The traceback is where the :mod:`importlib` loaded data most recently: on the ``import pdb`` line of the :mod:`doctest` module. The traceback may change if a new module is loaded. @@ -192,12 +192,12 @@ import os import tracemalloc - def display_top(snapshot, group_by='lineno', limit=10): + def display_top(snapshot, key_type='lineno', limit=10): snapshot = snapshot.filter_traces(( tracemalloc.Filter(False, ""), tracemalloc.Filter(False, ""), )) - top_stats = snapshot.statistics(group_by) + top_stats = snapshot.statistics(key_type) print("Top %s lines" % limit) for index, stat in enumerate(top_stats[:limit], 1): @@ -438,12 +438,12 @@ The :func:`take_snapshot` function creates a snapshot instance. - .. method:: compare_to(old_snapshot: Snapshot, group_by: str, cumulative: bool=False) + .. method:: compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False) Compute the differences with an old snapshot. Get statistics as a sorted - list of :class:`StatisticDiff` instances grouped by *group_by*. + list of :class:`StatisticDiff` instances grouped by *key_type*. - See the :meth:`Snapshot.statistics` method for *group_by* and *cumulative* + See the :meth:`Snapshot.statistics` method for *key_type* and *cumulative* parameters. The result is sorted from the biggest to the smallest by: absolute value @@ -478,13 +478,13 @@ See also :meth:`dump`. - .. method:: statistics(group_by: str, cumulative: bool=False) + .. method:: statistics(key_type: str, cumulative: bool=False) Get statistics as a sorted list of :class:`Statistic` instances grouped - by *group_by*: + by *key_type*: ===================== ======================== - group_by description + key_type description ===================== ======================== ``'filename'`` filename ``'lineno'`` filename and line number @@ -493,7 +493,7 @@ If *cumulative* is ``True``, cumulate size and count of memory blocks of all frames of the traceback of a trace, not only the most recent frame. - The cumulative mode can only be used with *group_by* equals to + The cumulative mode can only be used with *key_type* equals to ``'filename'`` and ``'lineno'``. The result is sorted from the biggest to the smallest by: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1127,6 +1127,7 @@ Randy Pausch Samuele Pedroni Justin Peel +Loic Pefferkorn Marcel van der Peijl Berker Peksag Andreas Pelme -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 29 20:15:43 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 30 Dec 2016 01:15:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5?= Message-ID: <20161230011543.18299.53316.5FE57AA7@psf.io> https://hg.python.org/cpython/rev/44fffbc8f970 changeset: 105888:44fffbc8f970 branch: 3.6 parent: 105885:0a55e039d25f parent: 105887:192e0ae17236 user: Victor Stinner date: Fri Dec 30 02:15:29 2016 +0100 summary: Merge 3.5 files: Doc/library/tracemalloc.rst | 26 ++++++++++++------------ Misc/ACKS | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -66,7 +66,7 @@ :5: size=49.7 KiB, count=148, average=344 B /usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB -We can see that Python loaded ``4.8 MiB`` data (bytecode and constants) from +We can see that Python loaded ``4855 KiB`` data (bytecode and constants) from modules and that the :mod:`collections` module allocated ``244 KiB`` to build :class:`~collections.namedtuple` types. @@ -106,8 +106,8 @@ /usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B /usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B -We can see that Python has loaded ``8.2 MiB`` of module data (bytecode and -constants), and that this is ``4.4 MiB`` more than had been loaded before the +We can see that Python has loaded ``8173 KiB`` of module data (bytecode and +constants), and that this is ``4428 KiB`` more than had been loaded before the tests, when the previous snapshot was taken. Similarly, the :mod:`linecache` module has cached ``940 KiB`` of Python source code to format tracebacks, all of it since the previous snapshot. @@ -176,7 +176,7 @@ "__main__", fname, loader, pkg_name) We can see that the most memory was allocated in the :mod:`importlib` module to -load data (bytecode and constants) from modules: ``870 KiB``. The traceback is +load data (bytecode and constants) from modules: ``870.1 KiB``. The traceback is where the :mod:`importlib` loaded data most recently: on the ``import pdb`` line of the :mod:`doctest` module. The traceback may change if a new module is loaded. @@ -192,12 +192,12 @@ import os import tracemalloc - def display_top(snapshot, group_by='lineno', limit=10): + def display_top(snapshot, key_type='lineno', limit=10): snapshot = snapshot.filter_traces(( tracemalloc.Filter(False, ""), tracemalloc.Filter(False, ""), )) - top_stats = snapshot.statistics(group_by) + top_stats = snapshot.statistics(key_type) print("Top %s lines" % limit) for index, stat in enumerate(top_stats[:limit], 1): @@ -468,12 +468,12 @@ The :func:`take_snapshot` function creates a snapshot instance. - .. method:: compare_to(old_snapshot: Snapshot, group_by: str, cumulative: bool=False) + .. method:: compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False) Compute the differences with an old snapshot. Get statistics as a sorted - list of :class:`StatisticDiff` instances grouped by *group_by*. + list of :class:`StatisticDiff` instances grouped by *key_type*. - See the :meth:`Snapshot.statistics` method for *group_by* and *cumulative* + See the :meth:`Snapshot.statistics` method for *key_type* and *cumulative* parameters. The result is sorted from the biggest to the smallest by: absolute value @@ -511,13 +511,13 @@ See also :meth:`dump`. - .. method:: statistics(group_by: str, cumulative: bool=False) + .. method:: statistics(key_type: str, cumulative: bool=False) Get statistics as a sorted list of :class:`Statistic` instances grouped - by *group_by*: + by *key_type*: ===================== ======================== - group_by description + key_type description ===================== ======================== ``'filename'`` filename ``'lineno'`` filename and line number @@ -526,7 +526,7 @@ If *cumulative* is ``True``, cumulate size and count of memory blocks of all frames of the traceback of a trace, not only the most recent frame. - The cumulative mode can only be used with *group_by* equals to + The cumulative mode can only be used with *key_type* equals to ``'filename'`` and ``'lineno'``. The result is sorted from the biggest to the smallest by: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1141,6 +1141,7 @@ Randy Pausch Samuele Pedroni Justin Peel +Loic Pefferkorn Marcel van der Peijl Berker Peksag Andreas Pelme -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 29 23:01:46 2016 From: python-checkins at python.org (xiang.zhang) Date: Fri, 30 Dec 2016 04:01:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MTEy?= =?utf-8?q?=3A_Fix_a_questionable_wording_in_sequence_doc=2E?= Message-ID: <20161230040146.16972.81978.632B38DE@psf.io> https://hg.python.org/cpython/rev/0d20da97a6a0 changeset: 105890:0d20da97a6a0 branch: 2.7 parent: 105872:d87771d1c1e6 user: Xiang Zhang date: Fri Dec 30 11:55:28 2016 +0800 summary: Issue #29112: Fix a questionable wording in sequence doc. files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -819,7 +819,7 @@ :ref:`faq-multidimensional-list`. (3) - If *i* or *j* is negative, the index is relative to the end of the string: + If *i* or *j* is negative, the index is relative to the end of sequence *s*: ``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is still ``0``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 29 23:01:46 2016 From: python-checkins at python.org (xiang.zhang) Date: Fri, 30 Dec 2016 04:01:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329112=3A_Merge_3=2E5=2E?= Message-ID: <20161230040146.3455.42610.9CA7C9E8@psf.io> https://hg.python.org/cpython/rev/b09d0a2587da changeset: 105892:b09d0a2587da branch: 3.6 parent: 105888:44fffbc8f970 parent: 105891:f4b747f59804 user: Xiang Zhang date: Fri Dec 30 11:57:40 2016 +0800 summary: Issue #29112: Merge 3.5. files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -927,7 +927,7 @@ :ref:`faq-multidimensional-list`. (3) - If *i* or *j* is negative, the index is relative to the end of the string: + If *i* or *j* is negative, the index is relative to the end of sequence *s*: ``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is still ``0``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 29 23:01:46 2016 From: python-checkins at python.org (xiang.zhang) Date: Fri, 30 Dec 2016 04:01:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzI5MTEyOiBNZXJnZSAzLjYu?= Message-ID: <20161230040146.17072.45177.129E9A05@psf.io> https://hg.python.org/cpython/rev/4432cba89398 changeset: 105893:4432cba89398 parent: 105889:e0f3a2df0798 parent: 105892:b09d0a2587da user: Xiang Zhang date: Fri Dec 30 11:58:14 2016 +0800 summary: Issue #29112: Merge 3.6. files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -927,7 +927,7 @@ :ref:`faq-multidimensional-list`. (3) - If *i* or *j* is negative, the index is relative to the end of the string: + If *i* or *j* is negative, the index is relative to the end of sequence *s*: ``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is still ``0``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Dec 29 23:01:46 2016 From: python-checkins at python.org (xiang.zhang) Date: Fri, 30 Dec 2016 04:01:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTEy?= =?utf-8?q?=3A_Fix_a_questionable_wording_in_sequence_doc=2E?= Message-ID: <20161230040146.106884.3998.4BE1AEB1@psf.io> https://hg.python.org/cpython/rev/f4b747f59804 changeset: 105891:f4b747f59804 branch: 3.5 parent: 105887:192e0ae17236 user: Xiang Zhang date: Fri Dec 30 11:57:09 2016 +0800 summary: Issue #29112: Fix a questionable wording in sequence doc. files: Doc/library/stdtypes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -927,7 +927,7 @@ :ref:`faq-multidimensional-list`. (3) - If *i* or *j* is negative, the index is relative to the end of the string: + If *i* or *j* is negative, the index is relative to the end of sequence *s*: ``len(s) + i`` or ``len(s) + j`` is substituted. But note that ``-0`` is still ``0``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 00:55:12 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 30 Dec 2016 05:55:12 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MDYx?= =?utf-8?q?=3A__secrets=2Erandbelow=28=29_would_hang_with_a_negative_input?= Message-ID: <20161230055512.17316.43264.73A2DB95@psf.io> https://hg.python.org/cpython/rev/0509844f38df changeset: 105894:0509844f38df branch: 3.6 parent: 105892:b09d0a2587da user: Raymond Hettinger date: Thu Dec 29 22:54:25 2016 -0700 summary: Issue #29061: secrets.randbelow() would hang with a negative input files: Lib/secrets.py | 2 ++ Lib/test/test_secrets.py | 1 + Misc/ACKS | 1 + Misc/NEWS | 3 +++ 4 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Lib/secrets.py b/Lib/secrets.py --- a/Lib/secrets.py +++ b/Lib/secrets.py @@ -26,6 +26,8 @@ def randbelow(exclusive_upper_bound): """Return a random int in the range [0, n).""" + if exclusive_upper_bound <= 0: + raise ValueError("Upper bound must be positive.") return _sysrand._randbelow(exclusive_upper_bound) DEFAULT_ENTROPY = 32 # number of bytes to return by default diff --git a/Lib/test/test_secrets.py b/Lib/test/test_secrets.py --- a/Lib/test/test_secrets.py +++ b/Lib/test/test_secrets.py @@ -70,6 +70,7 @@ for i in range(2, 10): self.assertIn(secrets.randbelow(i), range(i)) self.assertRaises(ValueError, secrets.randbelow, 0) + self.assertRaises(ValueError, secrets.randbelow, -1) class Token_Tests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -369,6 +369,7 @@ Josip Djolonga Walter D?rwald Jaromir Dolecek +Brendan Donegan Ismail Donmez Robert Donohue Marcos Donolo diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -43,6 +43,9 @@ - Issue #29085: Allow random.Random.seed() to use high quality OS randomness rather than the pid and time. +- Issue #29061: Fixed bug in secrets.randbelow() which would hang when given + a negative input. Patch by Brendan Donegan. + - Issue #29079: Prevent infinite loop in pathlib.resolve() on Windows - Issue #13051: Fixed recursion errors in large or resized -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 00:55:12 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 30 Dec 2016 05:55:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161230055512.79853.52768.9B8D2C97@psf.io> https://hg.python.org/cpython/rev/96b7b865c100 changeset: 105895:96b7b865c100 parent: 105893:4432cba89398 parent: 105894:0509844f38df user: Raymond Hettinger date: Thu Dec 29 22:55:03 2016 -0700 summary: merge files: Lib/secrets.py | 2 ++ Lib/test/test_secrets.py | 1 + Misc/ACKS | 1 + 3 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/secrets.py b/Lib/secrets.py --- a/Lib/secrets.py +++ b/Lib/secrets.py @@ -26,6 +26,8 @@ def randbelow(exclusive_upper_bound): """Return a random int in the range [0, n).""" + if exclusive_upper_bound <= 0: + raise ValueError("Upper bound must be positive.") return _sysrand._randbelow(exclusive_upper_bound) DEFAULT_ENTROPY = 32 # number of bytes to return by default diff --git a/Lib/test/test_secrets.py b/Lib/test/test_secrets.py --- a/Lib/test/test_secrets.py +++ b/Lib/test/test_secrets.py @@ -70,6 +70,7 @@ for i in range(2, 10): self.assertIn(secrets.randbelow(i), range(i)) self.assertRaises(ValueError, secrets.randbelow, 0) + self.assertRaises(ValueError, secrets.randbelow, -1) class Token_Tests(unittest.TestCase): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -369,6 +369,7 @@ Josip Djolonga Walter D?rwald Jaromir Dolecek +Brendan Donegan Ismail Donmez Robert Donohue Marcos Donolo -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 01:49:46 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 30 Dec 2016 06:49:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Clearer_compac?= =?utf-8?q?t_dict_attribution_to_the_original_proposal?= Message-ID: <20161230064946.4526.7278.2FAD358D@psf.io> https://hg.python.org/cpython/rev/1003eabb2705 changeset: 105896:1003eabb2705 branch: 3.6 parent: 105894:0509844f38df user: Raymond Hettinger date: Thu Dec 29 23:49:20 2016 -0700 summary: Clearer compact dict attribution to the original proposal files: Doc/whatsnew/3.6.rst | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -81,7 +81,9 @@ * The :ref:`dict ` type has been reimplemented to use a :ref:`more compact representation ` - similar to the `PyPy dict implementation`_. This resulted in dictionaries + based on `a proposal by Raymond Hettinger + `_ + and similar to the `PyPy dict implementation`_. This resulted in dictionaries using 20% to 25% less memory when compared to Python 3.5. * Customization of class creation has been simplified with the @@ -581,7 +583,10 @@ --------------------------------------------- The :ref:`dict ` type now uses a "compact" representation -`pioneered by PyPy `_. +based on `a proposal by Raymond Hettinger +`_ +which was `first implemented by PyPy +`_. The memory usage of the new :func:`dict` is between 20% and 25% smaller compared to Python 3.5. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 01:49:46 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 30 Dec 2016 06:49:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161230064946.5888.77625.1268F2FD@psf.io> https://hg.python.org/cpython/rev/5069b51382b2 changeset: 105897:5069b51382b2 parent: 105895:96b7b865c100 parent: 105896:1003eabb2705 user: Raymond Hettinger date: Thu Dec 29 23:49:41 2016 -0700 summary: merge files: Doc/whatsnew/3.6.rst | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -81,7 +81,9 @@ * The :ref:`dict ` type has been reimplemented to use a :ref:`more compact representation ` - similar to the `PyPy dict implementation`_. This resulted in dictionaries + based on `a proposal by Raymond Hettinger + `_ + and similar to the `PyPy dict implementation`_. This resulted in dictionaries using 20% to 25% less memory when compared to Python 3.5. * Customization of class creation has been simplified with the @@ -581,7 +583,10 @@ --------------------------------------------- The :ref:`dict ` type now uses a "compact" representation -`pioneered by PyPy `_. +based on `a proposal by Raymond Hettinger +`_ +which was `first implemented by PyPy +`_. The memory usage of the new :func:`dict` is between 20% and 25% smaller compared to Python 3.5. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 01:57:38 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 30 Dec 2016 06:57:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161230065738.107649.58278.54269F1A@psf.io> https://hg.python.org/cpython/rev/1c486516b39e changeset: 105899:1c486516b39e parent: 105897:5069b51382b2 parent: 105898:bf6987b93358 user: Raymond Hettinger date: Thu Dec 29 23:57:31 2016 -0700 summary: merge files: Lib/enum.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/enum.py b/Lib/enum.py --- a/Lib/enum.py +++ b/Lib/enum.py @@ -1,7 +1,7 @@ import sys from types import MappingProxyType, DynamicClassAttribute from functools import reduce -from operator import or_ as _or_, and_ as _and_, xor, neg +from operator import or_ as _or_ # try _collections first to reduce startup cost try: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 01:57:38 2016 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 30 Dec 2016 06:57:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MTAz?= =?utf-8?q?=3A_Remove_unused_import=2E__Noticed_by_Jean-Sebastien_Bevilacq?= =?utf-8?b?dWEu?= Message-ID: <20161230065738.19864.65413.85A4D4C0@psf.io> https://hg.python.org/cpython/rev/bf6987b93358 changeset: 105898:bf6987b93358 branch: 3.6 parent: 105896:1003eabb2705 user: Raymond Hettinger date: Thu Dec 29 23:57:12 2016 -0700 summary: Issue #29103: Remove unused import. Noticed by Jean-Sebastien Bevilacqua. files: Lib/enum.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/enum.py b/Lib/enum.py --- a/Lib/enum.py +++ b/Lib/enum.py @@ -1,7 +1,7 @@ import sys from types import MappingProxyType, DynamicClassAttribute from functools import reduce -from operator import or_ as _or_, and_ as _and_, xor, neg +from operator import or_ as _or_ # try _collections first to reduce startup cost try: -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Dec 30 04:11:02 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 30 Dec 2016 09:11:02 +0000 Subject: [Python-checkins] Daily reference leaks (4432cba89398): sum=9 Message-ID: <20161230091100.19924.73724.D6505BE1@psf.io> results for 4432cba89398 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 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/reflogPrlIiv', '--timeout', '7200'] From python-checkins at python.org Fri Dec 30 06:26:32 2016 From: python-checkins at python.org (stefan.krah) Date: Fri, 30 Dec 2016 11:26:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5=2E?= Message-ID: <20161230112631.107242.73442.117CEDB6@psf.io> https://hg.python.org/cpython/rev/c6989c3b228b changeset: 105901:c6989c3b228b branch: 3.6 parent: 105898:bf6987b93358 parent: 105900:1e1e24629218 user: Stefan Krah date: Fri Dec 30 12:24:23 2016 +0100 summary: Merge 3.5. files: Objects/memoryobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -221,7 +221,7 @@ PyDoc_STRVAR(memory_doc, -"memoryview($module, object)\n--\n\ +"memoryview(object)\n--\n\ \n\ Create a new memoryview object which references the given object."); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 06:26:32 2016 From: python-checkins at python.org (stefan.krah) Date: Fri, 30 Dec 2016 11:26:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTEx?= =?utf-8?q?=3A_Fix_memoryview_signature=2E?= Message-ID: <20161230112631.80213.25971.18292796@psf.io> https://hg.python.org/cpython/rev/1e1e24629218 changeset: 105900:1e1e24629218 branch: 3.5 parent: 105891:f4b747f59804 user: Stefan Krah date: Fri Dec 30 12:23:35 2016 +0100 summary: Issue #29111: Fix memoryview signature. files: Objects/memoryobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -221,7 +221,7 @@ PyDoc_STRVAR(memory_doc, -"memoryview($module, object)\n--\n\ +"memoryview(object)\n--\n\ \n\ Create a new memoryview object which references the given object."); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Dec 30 06:26:32 2016 From: python-checkins at python.org (stefan.krah) Date: Fri, 30 Dec 2016 11:26:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42Lg==?= Message-ID: <20161230112632.79881.68854.436EAA63@psf.io> https://hg.python.org/cpython/rev/223699bbff9b changeset: 105902:223699bbff9b parent: 105899:1c486516b39e parent: 105901:c6989c3b228b user: Stefan Krah date: Fri Dec 30 12:24:59 2016 +0100 summary: Merge 3.6. files: Objects/memoryobject.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -221,7 +221,7 @@ PyDoc_STRVAR(memory_doc, -"memoryview($module, object)\n--\n\ +"memoryview(object)\n--\n\ \n\ Create a new memoryview object which references the given object."); -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Dec 30 07:53:36 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 30 Dec 2016 12:53:36 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-12-30 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-12-30 11:48:09 +0000 commit: d87771d1c1e6 previous commit: 9acdcafd1418 revision date: 2016-12-28 08:16: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 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.39% 4.85% 6.43% :-) pybench 0.10% 0.04% 7.72% 2.40% :-| regex_v8 0.80% -0.12% -0.15% 10.57% :-) nbody 0.08% -0.26% 11.87% 1.80% :-| json_dump_v2 0.36% 0.61% 0.32% 8.41% :-( normal_startup 1.91% -0.19% -2.72% 2.85% :-| ssbench 0.18% 0.34% 0.35% 2.14% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-12-30/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Fri Dec 30 07:54:56 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 30 Dec 2016 12:54:56 +0000 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-12-30 Message-ID: <93d51b04-bf6f-43fa-8325-ab5e2ee7ad7b@irsmsx106.ger.corp.intel.com> Results for project Python default, build date 2016-12-30 11:03:16 +0000 commit: e0f3a2df0798 previous commit: 9de7bf6c60d2 revision date: 2016-12-30 01:15: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.15% -0.70% -0.34% 16.54% :-| pybench 0.24% -0.32% 1.24% 4.74% :-| regex_v8 3.55% 0.10% -1.29% 4.08% :-| nbody 0.11% 0.04% -0.82% 6.34% :-) json_dump_v2 0.30% 0.30% 10.27% 7.24% :-| normal_startup 0.96% 0.14% 0.23% 6.22% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-12-30/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From solipsis at pitrou.net Sat Dec 31 04:09:59 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 31 Dec 2016 09:09:59 +0000 Subject: [Python-checkins] Daily reference leaks (223699bbff9b): sum=11 Message-ID: <20161231090958.21253.87708.E643413E@psf.io> results for 223699bbff9b on branch "default" -------------------------------------------- test_collections leaked [0, 0, 7] 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/reflogiUGh7a', '--timeout', '7200'] From python-checkins at python.org Sat Dec 31 06:07:43 2016 From: python-checkins at python.org (vinay.sajip) Date: Sat, 31 Dec 2016 11:07:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merged_documentation_update_from_3=2E6=2E?= Message-ID: <20161231110743.28303.58762.5810792E@psf.io> https://hg.python.org/cpython/rev/70c5b89e0e1e changeset: 105904:70c5b89e0e1e parent: 105902:223699bbff9b parent: 105903:4255c7aae85b user: Vinay Sajip date: Sat Dec 31 11:07:35 2016 +0000 summary: Merged documentation update from 3.6. files: Doc/library/logging.handlers.rst | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -282,16 +282,17 @@ You can use the *maxBytes* and *backupCount* values to allow the file to :dfn:`rollover` at a predetermined size. When the size is about to be exceeded, the file is closed and a new file is silently opened for output. Rollover occurs - whenever the current log file is nearly *maxBytes* in length; if either of - *maxBytes* or *backupCount* is zero, rollover never occurs. If *backupCount* - is non-zero, the system will save old log files by appending the extensions - '.1', '.2' etc., to the filename. For example, with a *backupCount* of 5 and - a base file name of :file:`app.log`, you would get :file:`app.log`, + whenever the current log file is nearly *maxBytes* in length; but if either of + *maxBytes* or *backupCount* is zero, rollover never occurs, so you generally want + to set *backupCount* to at least 1, and have a non-zero *maxBytes*. + When *backupCount* is non-zero, the system will save old log files by appending + the extensions '.1', '.2' etc., to the filename. For example, with a *backupCount* + of 5 and a base file name of :file:`app.log`, you would get :file:`app.log`, :file:`app.log.1`, :file:`app.log.2`, up to :file:`app.log.5`. The file being written to is always :file:`app.log`. When this file is filled, it is closed and renamed to :file:`app.log.1`, and if files :file:`app.log.1`, - :file:`app.log.2`, etc. exist, then they are renamed to :file:`app.log.2`, - :file:`app.log.3` etc. respectively. + :file:`app.log.2`, etc. exist, then they are renamed to :file:`app.log.2`, + :file:`app.log.3` etc. respectively. .. versionchanged:: 3.6 As well as string values, :class:`~pathlib.Path` objects are also accepted -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 06:07:43 2016 From: python-checkins at python.org (vinay.sajip) Date: Sat, 31 Dec 2016 11:07:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogQ2xvc2VzICMyOTEw?= =?utf-8?q?5=3A_Updated_RotatingFileHandler_documentation=2E?= Message-ID: <20161231110743.25558.82679.E522EDA5@psf.io> https://hg.python.org/cpython/rev/4255c7aae85b changeset: 105903:4255c7aae85b branch: 3.6 parent: 105901:c6989c3b228b user: Vinay Sajip date: Sat Dec 31 11:06:57 2016 +0000 summary: Closes #29105: Updated RotatingFileHandler documentation. files: Doc/library/logging.handlers.rst | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Doc/library/logging.handlers.rst b/Doc/library/logging.handlers.rst --- a/Doc/library/logging.handlers.rst +++ b/Doc/library/logging.handlers.rst @@ -282,16 +282,17 @@ You can use the *maxBytes* and *backupCount* values to allow the file to :dfn:`rollover` at a predetermined size. When the size is about to be exceeded, the file is closed and a new file is silently opened for output. Rollover occurs - whenever the current log file is nearly *maxBytes* in length; if either of - *maxBytes* or *backupCount* is zero, rollover never occurs. If *backupCount* - is non-zero, the system will save old log files by appending the extensions - '.1', '.2' etc., to the filename. For example, with a *backupCount* of 5 and - a base file name of :file:`app.log`, you would get :file:`app.log`, + whenever the current log file is nearly *maxBytes* in length; but if either of + *maxBytes* or *backupCount* is zero, rollover never occurs, so you generally want + to set *backupCount* to at least 1, and have a non-zero *maxBytes*. + When *backupCount* is non-zero, the system will save old log files by appending + the extensions '.1', '.2' etc., to the filename. For example, with a *backupCount* + of 5 and a base file name of :file:`app.log`, you would get :file:`app.log`, :file:`app.log.1`, :file:`app.log.2`, up to :file:`app.log.5`. The file being written to is always :file:`app.log`. When this file is filled, it is closed and renamed to :file:`app.log.1`, and if files :file:`app.log.1`, - :file:`app.log.2`, etc. exist, then they are renamed to :file:`app.log.2`, - :file:`app.log.3` etc. respectively. + :file:`app.log.2`, etc. exist, then they are renamed to :file:`app.log.2`, + :file:`app.log.3` etc. respectively. .. versionchanged:: 3.6 As well as string values, :class:`~pathlib.Path` objects are also accepted -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 06:40:19 2016 From: python-checkins at python.org (vinay.sajip) Date: Sat, 31 Dec 2016 11:40:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Closes_=2328524=3A_added_d?= =?utf-8?q?efault_level_for_logging=2Edisable=28=29=2E?= Message-ID: <20161231114018.54628.13208.47B59FC4@psf.io> https://hg.python.org/cpython/rev/459500606560 changeset: 105905:459500606560 user: Vinay Sajip date: Sat Dec 31 11:40:11 2016 +0000 summary: Closes #28524: added default level for logging.disable(). files: Doc/library/logging.rst | 10 +++++++++- Lib/logging/__init__.py | 2 +- Lib/test/test_logging.py | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -1023,7 +1023,7 @@ handlers being added multiple times to the root logger, which can in turn lead to multiple messages for the same event. -.. function:: disable(lvl) +.. function:: disable(lvl=CRITICAL) Provides an overriding level *lvl* for all loggers which takes precedence over the logger's own level. When the need arises to temporarily throttle logging @@ -1036,6 +1036,14 @@ overriding level, so that logging output again depends on the effective levels of individual loggers. + Note that if you have defined any custom logging level higher than + ``CRITICAL`` (this is not recommended), you won't be able to rely on the + default value for the *lvl* parameter, but will have to explicitly supply a + suitable value. + + .. versionchanged:: 3.7 + The *lvl* parameter was defaulted to level ``CRITICAL``. See Issue + #28524 for more information about this change. .. function:: addLevelName(lvl, levelName) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -1889,7 +1889,7 @@ basicConfig() root.log(level, msg, *args, **kwargs) -def disable(level): +def disable(level=CRITICAL): """ Disable all logging calls of severity 'level' and below. """ diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -3473,6 +3473,11 @@ logging.disable(83) self.assertEqual(logging.root.manager.disable, 83) + # test the default value introduced in 3.7 + # (Issue #28524) + logging.disable() + self.assertEqual(logging.root.manager.disable, logging.CRITICAL) + def _test_log(self, method, level=None): called = [] support.patch(self, logging, 'basicConfig', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 12:06:56 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 17:06:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326267=3A_Merge_from_3=2E6?= Message-ID: <20161231170655.124348.54616.D8EB6CE1@psf.io> https://hg.python.org/cpython/rev/8b19c2a1b197 changeset: 105908:8b19c2a1b197 parent: 105905:459500606560 parent: 105907:c9e944cc6301 user: Berker Peksag date: Sat Dec 31 20:09:14 2016 +0300 summary: Issue #26267: Merge from 3.6 files: Doc/library/uuid.rst | 7 +++++++ Lib/test/test_uuid.py | 4 ++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst --- a/Doc/library/uuid.rst +++ b/Doc/library/uuid.rst @@ -45,6 +45,13 @@ variant and version number set according to RFC 4122, overriding bits in the given *hex*, *bytes*, *bytes_le*, *fields*, or *int*. + Comparison of UUID objects are made by way of comparing their + :attr:`UUID.int` attributes. Comparison with a non-UUID object + raises a :exc:`TypeError`. + + ``str(uuid)`` returns a string in the form + ``12345678-1234-5678-1234-567812345678`` where the 32 hexadecimal digits + represent the UUID. :class:`UUID` instances have these read-only attributes: diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -292,6 +292,10 @@ badtype(lambda: setattr(u, 'clock_seq_low', 0)) badtype(lambda: setattr(u, 'node', 0)) + # Comparison with a non-UUID object + badtype(lambda: u < object()) + badtype(lambda: u > object()) + def test_getnode(self): node1 = uuid.getnode() self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 12:06:56 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 17:06:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2326267=3A_Merge_from_3=2E5?= Message-ID: <20161231170655.55444.42597.FA80B4C4@psf.io> https://hg.python.org/cpython/rev/c9e944cc6301 changeset: 105907:c9e944cc6301 branch: 3.6 parent: 105903:4255c7aae85b parent: 105906:1a25c639f81e user: Berker Peksag date: Sat Dec 31 20:08:53 2016 +0300 summary: Issue #26267: Merge from 3.5 files: Doc/library/uuid.rst | 7 +++++++ Lib/test/test_uuid.py | 4 ++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst --- a/Doc/library/uuid.rst +++ b/Doc/library/uuid.rst @@ -45,6 +45,13 @@ variant and version number set according to RFC 4122, overriding bits in the given *hex*, *bytes*, *bytes_le*, *fields*, or *int*. + Comparison of UUID objects are made by way of comparing their + :attr:`UUID.int` attributes. Comparison with a non-UUID object + raises a :exc:`TypeError`. + + ``str(uuid)`` returns a string in the form + ``12345678-1234-5678-1234-567812345678`` where the 32 hexadecimal digits + represent the UUID. :class:`UUID` instances have these read-only attributes: diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -292,6 +292,10 @@ badtype(lambda: setattr(u, 'clock_seq_low', 0)) badtype(lambda: setattr(u, 'node', 0)) + # Comparison with a non-UUID object + badtype(lambda: u < object()) + badtype(lambda: u > object()) + def test_getnode(self): node1 = uuid.getnode() self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 12:06:56 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 17:06:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2MjY3?= =?utf-8?q?=3A_Improve_uuid=2EUUID_documentation?= Message-ID: <20161231170655.54949.85557.0887B3C5@psf.io> https://hg.python.org/cpython/rev/1a25c639f81e changeset: 105906:1a25c639f81e branch: 3.5 parent: 105900:1e1e24629218 user: Berker Peksag date: Sat Dec 31 20:08:16 2016 +0300 summary: Issue #26267: Improve uuid.UUID documentation * Document how comparison of UUID objects work * Document str(uuid) returns the braceless standard form * Add a test for comparison of a UUID object with a non-UUID object Patch by Ammar Askar. files: Doc/library/uuid.rst | 7 +++++++ Lib/test/test_uuid.py | 4 ++++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst --- a/Doc/library/uuid.rst +++ b/Doc/library/uuid.rst @@ -45,6 +45,13 @@ variant and version number set according to RFC 4122, overriding bits in the given *hex*, *bytes*, *bytes_le*, *fields*, or *int*. + Comparison of UUID objects are made by way of comparing their + :attr:`UUID.int` attributes. Comparison with a non-UUID object + raises a :exc:`TypeError`. + + ``str(uuid)`` returns a string in the form + ``12345678-1234-5678-1234-567812345678`` where the 32 hexadecimal digits + represent the UUID. :class:`UUID` instances have these read-only attributes: diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py --- a/Lib/test/test_uuid.py +++ b/Lib/test/test_uuid.py @@ -292,6 +292,10 @@ badtype(lambda: setattr(u, 'clock_seq_low', 0)) badtype(lambda: setattr(u, 'node', 0)) + # Comparison with a non-UUID object + badtype(lambda: u < object()) + badtype(lambda: u > object()) + def test_getnode(self): node1 = uuid.getnode() self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:03:25 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 31 Dec 2016 19:03:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161231190325.9625.54271.6C89F0DC@psf.io> https://hg.python.org/cpython/rev/c3a6e5fdfdc6 changeset: 105911:c3a6e5fdfdc6 parent: 105908:8b19c2a1b197 parent: 105910:1b4b00b370f7 user: Raymond Hettinger date: Sat Dec 31 12:03:16 2016 -0700 summary: merge files: Lib/collections/__init__.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -189,6 +189,7 @@ link = self.__map[key] link_prev = link.prev link_next = link.next + soft_link = link_next.prev link_prev.next = link_next link_next.prev = link_prev root = self.__root @@ -196,12 +197,14 @@ last = root.prev link.prev = last link.next = root - last.next = root.prev = link + root.prev = soft_link + last.next = link else: first = root.next link.prev = root link.next = first - root.next = first.prev = link + first.prev = soft_link + root.next = link def __sizeof__(self): sizeof = _sys.getsizeof -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:03:25 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 31 Dec 2016 19:03:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTE5?= =?utf-8?q?=3A_Fix_weakref_in_OrderedDict=2Emove=5Fto=5Fend=28=29=2E_Work_?= =?utf-8?q?by_Andra_Bogildea=2E?= Message-ID: <20161231190325.28640.20150.4DF21373@psf.io> https://hg.python.org/cpython/rev/19376765d7c3 changeset: 105909:19376765d7c3 branch: 3.5 parent: 105906:1a25c639f81e user: Raymond Hettinger date: Sat Dec 31 12:01:59 2016 -0700 summary: Issue #29119: Fix weakref in OrderedDict.move_to_end(). Work by Andra Bogildea. files: Lib/collections/__init__.py | 7 +++++-- Misc/ACKS | 1 + Misc/NEWS | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -189,6 +189,7 @@ link = self.__map[key] link_prev = link.prev link_next = link.next + soft_link = link_next.prev link_prev.next = link_next link_next.prev = link_prev root = self.__root @@ -196,12 +197,14 @@ last = root.prev link.prev = last link.next = root - last.next = root.prev = link + root.prev = soft_link + last.next = link else: first = root.next link.prev = root link.next = first - root.next = first.prev = link + first.prev = soft_link + root.next = link def __sizeof__(self): sizeof = _sys.getsizeof diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -156,6 +156,7 @@ Paul Boddie Matthew Boedicker Robin Boerdijk +Andra Bogildea David Bolen Wouter Bolsterlee Gawain Bolton diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -143,6 +143,10 @@ - Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. +- Issue #29119: Fix weakrefs in the pure python version of + collections.OrderedDict move_to_end() method. + Contributed by Andra Bogildea. + - Issue #9770: curses.ascii predicates now work correctly with negative integers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:03:25 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 31 Dec 2016 19:03:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_merge?= Message-ID: <20161231190325.10198.88195.E8AF73AF@psf.io> https://hg.python.org/cpython/rev/1b4b00b370f7 changeset: 105910:1b4b00b370f7 branch: 3.6 parent: 105907:c9e944cc6301 parent: 105909:19376765d7c3 user: Raymond Hettinger date: Sat Dec 31 12:02:42 2016 -0700 summary: merge files: Lib/collections/__init__.py | 7 +++++-- Misc/NEWS | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -189,6 +189,7 @@ link = self.__map[key] link_prev = link.prev link_next = link.next + soft_link = link_next.prev link_prev.next = link_next link_next.prev = link_prev root = self.__root @@ -196,12 +197,14 @@ last = root.prev link.prev = last link.next = root - last.next = root.prev = link + root.prev = soft_link + last.next = link else: first = root.next link.prev = root link.next = first - root.next = first.prev = link + first.prev = soft_link + root.next = link def __sizeof__(self): sizeof = _sys.getsizeof diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -51,6 +51,10 @@ - Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox. Based on patch by Tycho Andersen. +- Issue #29119: Fix weakrefs in the pure python version of + collections.OrderedDict move_to_end() method. + Contributed by Andra Bogildea. + - Issue #9770: curses.ascii predicates now work correctly with negative integers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:08:28 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 31 Dec 2016 19:08:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MTE5?= =?utf-8?q?=3A__Merge_in_ACK_from_3=2E5_branch?= Message-ID: <20161231190828.55068.10407.D3B818C1@psf.io> https://hg.python.org/cpython/rev/cd811b867393 changeset: 105912:cd811b867393 branch: 3.6 parent: 105910:1b4b00b370f7 user: Raymond Hettinger date: Sat Dec 31 12:08:00 2016 -0700 summary: Issue #29119: Merge in ACK from 3.5 branch files: Misc/ACKS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -157,6 +157,7 @@ Paul Boddie Matthew Boedicker Robin Boerdijk +Andra Bogildea Nikolay Bogoychev David Bolen Wouter Bolsterlee -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:08:28 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 31 Dec 2016 19:08:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20161231190828.9862.64836.1FD9433D@psf.io> https://hg.python.org/cpython/rev/4172e0a4e07a changeset: 105913:4172e0a4e07a parent: 105911:c3a6e5fdfdc6 parent: 105912:cd811b867393 user: Raymond Hettinger date: Sat Dec 31 12:08:19 2016 -0700 summary: merge files: Misc/ACKS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -157,6 +157,7 @@ Paul Boddie Matthew Boedicker Robin Boerdijk +Andra Bogildea Nikolay Bogoychev David Bolen Wouter Bolsterlee -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:47:37 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 19:47:37 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329123=3A_Merge_from_3=2E5?= Message-ID: <20161231194736.124258.1169.6294F820@psf.io> https://hg.python.org/cpython/rev/0331420d6cba changeset: 105915:0331420d6cba branch: 3.6 parent: 105912:cd811b867393 parent: 105914:bb64ae455490 user: Berker Peksag date: Sat Dec 31 22:49:31 2016 +0300 summary: Issue #29123: Merge from 3.5 files: Lib/sqlite3/test/types.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -382,8 +382,7 @@ @unittest.skipIf(sqlite.sqlite_version_info < (3, 1), 'the date functions are available on 3.1 or later') def CheckSqlTimestamp(self): - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. - now = datetime.datetime.now() + now = datetime.datetime.utcnow() self.cur.execute("insert into test(ts) values (current_timestamp)") self.cur.execute("select ts from test") ts = self.cur.fetchone()[0] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:47:37 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 19:47:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329123=3A_Merge_from_3=2E6?= Message-ID: <20161231194737.124544.13905.3A188DFB@psf.io> https://hg.python.org/cpython/rev/ad06f9acff92 changeset: 105916:ad06f9acff92 parent: 105913:4172e0a4e07a parent: 105915:0331420d6cba user: Berker Peksag date: Sat Dec 31 22:49:56 2016 +0300 summary: Issue #29123: Merge from 3.6 files: Lib/sqlite3/test/types.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -382,8 +382,7 @@ @unittest.skipIf(sqlite.sqlite_version_info < (3, 1), 'the date functions are available on 3.1 or later') def CheckSqlTimestamp(self): - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. - now = datetime.datetime.now() + now = datetime.datetime.utcnow() self.cur.execute("insert into test(ts) values (current_timestamp)") self.cur.execute("select ts from test") ts = self.cur.fetchone()[0] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 14:47:36 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 19:47:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTIz?= =?utf-8?q?=3A_Make_CheckSqlTimestamp_more_robust?= Message-ID: <20161231194736.25558.85861.83EF815A@psf.io> https://hg.python.org/cpython/rev/bb64ae455490 changeset: 105914:bb64ae455490 branch: 3.5 parent: 105909:19376765d7c3 user: Berker Peksag date: Sat Dec 31 22:48:55 2016 +0300 summary: Issue #29123: Make CheckSqlTimestamp more robust files: Lib/sqlite3/test/types.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -382,8 +382,7 @@ @unittest.skipIf(sqlite.sqlite_version_info < (3, 1), 'the date functions are available on 3.1 or later') def CheckSqlTimestamp(self): - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. - now = datetime.datetime.now() + now = datetime.datetime.utcnow() self.cur.execute("insert into test(ts) values (current_timestamp)") self.cur.execute("select ts from test") ts = self.cur.fetchone()[0] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Dec 31 18:49:23 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 31 Dec 2016 23:49:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MTIz?= =?utf-8?q?=3A_Make_CheckSqlTimestamp_more_robust?= Message-ID: <20161231234923.21354.79410.7EA0C975@psf.io> https://hg.python.org/cpython/rev/1d5b4426fe87 changeset: 105917:1d5b4426fe87 branch: 2.7 parent: 105890:0d20da97a6a0 user: Berker Peksag date: Sun Jan 01 02:51:46 2017 +0300 summary: Issue #29123: Make CheckSqlTimestamp more robust files: Lib/sqlite3/test/types.py | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -383,8 +383,7 @@ if sqlite.sqlite_version_info < (3, 1): return - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. - now = datetime.datetime.now() + now = datetime.datetime.utcnow() self.cur.execute("insert into test(ts) values (current_timestamp)") self.cur.execute("select ts from test") ts = self.cur.fetchone()[0] -- Repository URL: https://hg.python.org/cpython