diff --git a/.hgtags b/.hgtags index ab6ce659e25..b1aa75d67e3 100644 --- a/.hgtags +++ b/.hgtags @@ -153,3 +153,4 @@ b4cbecbc0781e89a309d03b60a1f75f8499250e6 v3.4.3 0035fcd9b9243ae52c2e830204fd9c1f7d528534 v3.5.0b3 c0d64105463581f85d0e368e8d6e59b7fd8f12b1 v3.5.0b4 1a58b1227501e046eee13d90f113417b60843301 v3.5.0rc1 +cc15d736d860303b9da90d43cd32db39bab048df v3.5.0rc2 diff --git a/Include/patchlevel.h b/Include/patchlevel.h index b454c9b6747..9e81990dce6 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 5 #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.5.0rc1+" +#define PY_VERSION "3.5.0rc2+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 931754e1544..6f62bb35fef 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -745,7 +745,7 @@ class BuiltinImporter: @classmethod def exec_module(self, module): """Exec a built-in module""" - _call_with_frames_removed(_imp.exec_dynamic, module) + _call_with_frames_removed(_imp.exec_builtin, module) @classmethod @_requires_builtin diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 8b70dcfdad0..5083977a4e4 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sun Aug 9 03:32:48 2015 +# Autogenerated by Sphinx on Mon Aug 24 20:29:23 2015 topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be a sequence\n with at least as many items as there are targets in the target\n list, minus one. The first items of the sequence are assigned,\n from left to right, to the targets before the starred target. The\n final items of the sequence are assigned to the targets after the\n starred target. A list of the remaining items in the sequence is\n then assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultanenous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', diff --git a/Misc/NEWS b/Misc/NEWS index 0d7ae1d44ca..dcd2c37c6dc 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -6,47 +6,11 @@ Python News What's New in Python 3.5.1 ========================== - Release date: TBA - Core and Builtins ----------------- - -Library -------- - -- Issue #20362: Honour TestCase.longMessage correctly in assertRegex. - Patch from Ilia Kurenkov. - -- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk. - -- Issue #23572: Fixed functools.singledispatch on classes with falsy - metaclasses. Patch by Ethan Furman. - - -Documentation -------------- - -- Issue #24808: Update the types of some PyTypeObject fields. Patch by - Joseph Weston. - -- Issue #22812: Fix unittest discovery examples. - Patch from Pam McA'Nulty. - - -What's New in Python 3.5.0 release candidate 2? -=============================================== - -Release date: 2015-08-23 - -Core and Builtins ------------------ - -- Issue #21167: NAN operations are now handled correctly when python is - compiled with ICC even if -fp-model strict is not specified. - Library ------- @@ -59,11 +23,11 @@ Library - Issue #21159: Improve message in configparser.InterpolationMissingOptionError. Patch from Łukasz Langa. -- Issue #24847: Fixes tcltk installer layout of VC runtime DLL +- Issue #20362: Honour TestCase.longMessage correctly in assertRegex. + Patch from Ilia Kurenkov. -- Issue #24839: platform._syscmd_ver raises DeprecationWarning - -- Issue #24867: Fix Task.get_stack() for 'async def' coroutines +- Issue #23572: Fixed functools.singledispatch on classes with falsy + metaclasses. Patch by Ethan Furman. Documentation ------------- @@ -71,6 +35,41 @@ Documentation - Issue #23725: Overhaul tempfile docs. Note deprecated status of mktemp. Patch from Zbigniew Jędrzejewski-Szmek. +- Issue #24808: Update the types of some PyTypeObject fields. Patch by + Joseph Weston. + +- Issue #22812: Fix unittest discovery examples. + Patch from Pam McA'Nulty. + + +What's New in Python 3.5.0 release candidate 2? +=============================================== + +Release date: 2015-08-25 + +Core and Builtins +----------------- + +- Issue #24769: Interpreter now starts properly when dynamic loading + is disabled. Patch by Petr Viktorin. + +- Issue #21167: NAN operations are now handled correctly when python is + compiled with ICC even if -fp-model strict is not specified. + +- Issue #24492: A "package" lacking a __name__ attribute when trying to perform + a ``from .. import ...`` statement will trigger an ImportError instead of an + AttributeError. + +Library +------- + +- Issue #24847: Removes vcruntime140.dll dependency from Tcl/Tk. + +- Issue #24839: platform._syscmd_ver raises DeprecationWarning + +- Issue #24867: Fix Task.get_stack() for 'async def' coroutines + + What's New in Python 3.5.0 release candidate 1? =============================================== @@ -79,10 +78,6 @@ Release date: 2015-08-09 Core and Builtins ----------------- -- Issue #24492: A "package" lacking a __name__ attribute when trying to perform - a ``from .. import ...`` statement will trigger an ImportError instead of an - AttributeError. - - Issue #24667: Resize odict in all cases that the underlying dict resizes. Library @@ -136,7 +131,7 @@ IDLE - Issue #23672: Allow Idle to edit and run files with astral chars in name. Patch by Mohd Sanad Zaki Rizvi. -- Issue 24745: Idle editor default font. Switch from Courier to +- Issue #24745: Idle editor default font. Switch from Courier to platform-sensitive TkFixedFont. This should not affect current customized font selections. If there is a problem, edit $HOME/.idlerc/config-main.cfg and remove 'fontxxx' entries from [Editor Window]. Patch by Mark Roseman. @@ -467,14 +462,14 @@ Library - Issue #14373: Added C implementation of functools.lru_cache(). Based on patches by Matt Joiner and Alexey Kachayev. -- Issue 24230: The tempfile module now accepts bytes for prefix, suffix and dir +- Issue #24230: The tempfile module now accepts bytes for prefix, suffix and dir parameters and returns bytes in such situations (matching the os module APIs). - Issue #22189: collections.UserString now supports __getnewargs__(), __rmod__(), casefold(), format_map(), isprintable(), and maketrans(). Patch by Joe Jevnik. -- Issue 24244: Prevents termination when an invalid format string is +- Issue #24244: Prevents termination when an invalid format string is encountered on Windows in strftime. - Issue #23973: PEP 484: Add the typing module. @@ -612,26 +607,26 @@ Library - asyncio: async() function is deprecated in favour of ensure_future(). -- Issue 24178: asyncio.Lock, Condition, Semaphore, and BoundedSemaphore +- Issue #24178: asyncio.Lock, Condition, Semaphore, and BoundedSemaphore support new 'async with' syntax. Contributed by Yury Selivanov. -- Issue 24179: Support 'async for' for asyncio.StreamReader. +- Issue #24179: Support 'async for' for asyncio.StreamReader. Contributed by Yury Selivanov. -- Issue 24184: Add AsyncIterator and AsyncIterable ABCs to +- Issue #24184: Add AsyncIterator and AsyncIterable ABCs to collections.abc. Contributed by Yury Selivanov. -- Issue 22547: Implement informative __repr__ for inspect.BoundArguments. +- Issue #22547: Implement informative __repr__ for inspect.BoundArguments. Contributed by Yury Selivanov. -- Issue 24190: Implement inspect.BoundArgument.apply_defaults() method. +- Issue #24190: Implement inspect.BoundArgument.apply_defaults() method. Contributed by Yury Selivanov. -- Issue 20691: Add 'follow_wrapped' argument to +- Issue #20691: Add 'follow_wrapped' argument to inspect.Signature.from_callable() and inspect.signature(). Contributed by Yury Selivanov. -- Issue 24248: Deprecate inspect.Signature.from_function() and +- Issue #24248: Deprecate inspect.Signature.from_function() and inspect.Signature.from_builtin(). - Issue #23898: Fix inspect.classify_class_attrs() to support attributes @@ -733,7 +728,7 @@ Library - Issue #4254: Adds _curses.update_lines_cols() Patch by Arnon Yaari -- Issue 19933: Provide default argument for ndigits in round. Patch by +- Issue #19933: Provide default argument for ndigits in round. Patch by Vajrasky Kok. - Issue #23193: Add a numeric_owner parameter to @@ -2549,7 +2544,7 @@ Library - Issue #13936: Remove the ability of datetime.time instances to be considered false in boolean contexts. -- Issue 18931: selectors module now supports /dev/poll on Solaris. +- Issue #18931: selectors module now supports /dev/poll on Solaris. Patch by Giampaolo Rodola'. - Issue #19977: When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h index 53b5b171eef..247766519e1 100644 --- a/Python/clinic/import.c.h +++ b/Python/clinic/import.c.h @@ -318,6 +318,33 @@ exit: #endif /* defined(HAVE_DYNAMIC_LOADING) */ +PyDoc_STRVAR(_imp_exec_builtin__doc__, +"exec_builtin($module, mod, /)\n" +"--\n" +"\n" +"Initialize a built-in module."); + +#define _IMP_EXEC_BUILTIN_METHODDEF \ + {"exec_builtin", (PyCFunction)_imp_exec_builtin, METH_O, _imp_exec_builtin__doc__}, + +static int +_imp_exec_builtin_impl(PyModuleDef *module, PyObject *mod); + +static PyObject * +_imp_exec_builtin(PyModuleDef *module, PyObject *mod) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = _imp_exec_builtin_impl(module, mod); + if ((_return_value == -1) && PyErr_Occurred()) + goto exit; + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} + #ifndef _IMP_CREATE_DYNAMIC_METHODDEF #define _IMP_CREATE_DYNAMIC_METHODDEF #endif /* !defined(_IMP_CREATE_DYNAMIC_METHODDEF) */ @@ -325,4 +352,4 @@ exit: #ifndef _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=0f1059766dd58f88 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=32324a5e46cdfc4b input=a9049054013a1b77]*/ diff --git a/Python/import.c b/Python/import.c index 44aae809907..edf030d87ae 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1943,6 +1943,34 @@ _imp_is_frozen_impl(PyModuleDef *module, PyObject *name) return PyBool_FromLong((long) (p == NULL ? 0 : p->size)); } +/* Common implementation for _imp.exec_dynamic and _imp.exec_builtin */ +static int +exec_builtin_or_dynamic(PyObject *mod) { + PyModuleDef *def; + void *state; + + if (!PyModule_Check(mod)) { + return 0; + } + + def = PyModule_GetDef(mod); + if (def == NULL) { + if (PyErr_Occurred()) { + return -1; + } + return 0; + } + state = PyModule_GetState(mod); + if (PyErr_Occurred()) { + return -1; + } + if (state) { + /* Already initialized; skip reload */ + return 0; + } + return PyModule_ExecDef(mod, def); +} + #ifdef HAVE_DYNAMIC_LOADING /*[clinic input] @@ -2014,34 +2042,28 @@ static int _imp_exec_dynamic_impl(PyModuleDef *module, PyObject *mod) /*[clinic end generated code: output=4b84f1301b22d4bd input=9fdbfcb250280d3a]*/ { - PyModuleDef *def; - void *state; - - if (!PyModule_Check(mod)) { - return 0; - } - - def = PyModule_GetDef(mod); - if (def == NULL) { - if (PyErr_Occurred()) { - return -1; - } - return 0; - } - state = PyModule_GetState(mod); - if (PyErr_Occurred()) { - return -1; - } - if (state) { - /* Already initialized; skip reload */ - return 0; - } - return PyModule_ExecDef(mod, def); + return exec_builtin_or_dynamic(mod); } #endif /* HAVE_DYNAMIC_LOADING */ +/*[clinic input] +_imp.exec_builtin -> int + + mod: object + / + +Initialize a built-in module. +[clinic start generated code]*/ + +static int +_imp_exec_builtin_impl(PyModuleDef *module, PyObject *mod) +/*[clinic end generated code: output=215e99876a27e284 input=7beed5a2f12a60ca]*/ +{ + return exec_builtin_or_dynamic(mod); +} + /*[clinic input] dump buffer [clinic start generated code]*/ @@ -2064,6 +2086,7 @@ static PyMethodDef imp_methods[] = { _IMP_IS_FROZEN_METHODDEF _IMP_CREATE_DYNAMIC_METHODDEF _IMP_EXEC_DYNAMIC_METHODDEF + _IMP_EXEC_BUILTIN_METHODDEF _IMP__FIX_CO_FILENAME_METHODDEF {NULL, NULL} /* sentinel */ }; diff --git a/Python/importlib.h b/Python/importlib.h index d5d34066927..a4daf621e24 100644 --- a/Python/importlib.h +++ b/Python/importlib.h @@ -1304,7 +1304,7 @@ const unsigned char _Py_M__importlib[] = { 0,1,100,1,0,83,41,2,122,22,69,120,101,99,32,97, 32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101, 78,41,3,114,65,0,0,0,114,57,0,0,0,90,12,101, - 120,101,99,95,100,121,110,97,109,105,99,41,2,114,19,0, + 120,101,99,95,98,117,105,108,116,105,110,41,2,114,19,0, 0,0,114,89,0,0,0,114,10,0,0,0,114,10,0,0, 0,114,11,0,0,0,114,139,0,0,0,233,2,0,0,115, 2,0,0,0,0,3,122,27,66,117,105,108,116,105,110,73, diff --git a/README b/README index f81f62a7340..16c109c07af 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.5.0 release candidate 1 +This is Python version 3.5.0 release candidate 2 ================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,