From 50bd27cd46a630d2ffda452e2ce2e6da6be3b986 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Mon, 4 Dec 2017 19:12:37 +0530 Subject: [PATCH 01/39] issue #32035: Update zipfile doc --- Doc/library/zipfile.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 5b8c776ed648cd2..d753c927e371db4 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,9 +385,9 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write the string *data* to the archive; *zinfo_or_arcname* is either the file - name it will be given in the archive, or a :class:`ZipInfo` instance. If it's - an instance, at least the filename, date, and time must be given. If it's a + Write the string or bytes *data* to the archive; if it is a *str*, it should be encoded as UTF-8. + *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. + If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. From 21255fc3932a60c064f85c0fe68f2840f390ebe4 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 4 Dec 2017 14:48:25 -0500 Subject: [PATCH 02/39] bpo-30928: Update idlelib/NEWS.txt to 2017 Dec 3. (#4701) Patches are in 3.7.0a3 even if this update is not. --- Lib/idlelib/NEWS.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index a7a1e9f61e1afa1..71b7976ab8a69c1 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,22 @@ Released on 2018-06-18? ======================== +bpo-32164: Delete unused file idlelib/tabbedpages.py. +Use of TabbedPageSet in configdialog was replaced by ttk.Notebook. + +bpo-32100: Fix old and new bugs in pathbrowser; improve tests. +Patch mostly by Cheryl Sabella. + +bpo-31860: The font sample in the settings dialog is now editable. +Edits persist while IDLE remains open. +Patch by Serhiy Storchake and Terry Jan Reedy. + +bpo-31858: Restrict shell prompt manipulaton to the shell. +Editor and output windows only see an empty last prompt line. This +simplifies the code and fixes a minor bug when newline is inserted. +Sys.ps1, if present, is read on Shell start-up, but is not set or changed. +Patch by Terry Jan Reedy. + bpo-28603: Fix a TypeError that caused a shell restart when printing a traceback that includes an exception that is unhashable. Patch by Zane Bitter. From 1e2fcac4972530aa2c963d7e4011021df5ba866e Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 4 Dec 2017 16:16:18 -0500 Subject: [PATCH 03/39] bpo-32207: Improve tk event exception tracebacks in IDLE. (#4703) When tk event handling is driven by IDLE's run loop, a confusing and distracting queue.EMPTY traceback context is no longer added to tk event exception tracebacks. The traceback is now the same as when event handling is driven by user code. Patch based on a suggestion by Serhiy Storchaka. --- Lib/idlelib/run.py | 14 +++++++++----- .../IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst | 6 ++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 6440e673bf51638..176fe3db743bd45 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -134,13 +134,17 @@ def main(del_exitfunc=False): # exiting but got an extra KBI? Try again! continue try: - seq, request = rpc.request_queue.get(block=True, timeout=0.05) + request = rpc.request_queue.get(block=True, timeout=0.05) except queue.Empty: + request = None + # Issue 32207: calling handle_tk_events here adds spurious + # queue.Empty traceback to event handling exceptions. + if request: + seq, (method, args, kwargs) = request + ret = method(*args, **kwargs) + rpc.response_queue.put((seq, ret)) + else: handle_tk_events() - continue - method, args, kwargs = request - ret = method(*args, **kwargs) - rpc.response_queue.put((seq, ret)) except KeyboardInterrupt: if quitting: exit_now = True diff --git a/Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst b/Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst new file mode 100644 index 000000000000000..e521c9b0bbdc814 --- /dev/null +++ b/Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst @@ -0,0 +1,6 @@ +Improve tk event exception tracebacks in IDLE. +When tk event handling is driven by IDLE's run loop, a confusing +and distracting queue.EMPTY traceback context is no longer added +to tk event exception tracebacks. The traceback is now the same +as when event handling is driven by user code. Patch based on a +suggestion by Serhiy Storchaka. From f0db54a0a1823534606ed5ce5a772365ba694c41 Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Mon, 4 Dec 2017 16:58:55 -0500 Subject: [PATCH 04/39] bpo-32214: Implement PEP 557: Data Classes (#4704) --- Lib/dataclasses.py | 776 ++++++ Lib/test/test_dataclasses.py | 2076 +++++++++++++++++ .../2017-12-04-15-51-57.bpo-32214.uozdNj.rst | 2 + 3 files changed, 2854 insertions(+) create mode 100644 Lib/dataclasses.py create mode 100755 Lib/test/test_dataclasses.py create mode 100644 Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py new file mode 100644 index 000000000000000..7a725dfb5208bbc --- /dev/null +++ b/Lib/dataclasses.py @@ -0,0 +1,776 @@ +import sys +import types +from copy import deepcopy +import collections +import inspect + +__all__ = ['dataclass', + 'field', + 'FrozenInstanceError', + 'InitVar', + + # Helper functions. + 'fields', + 'asdict', + 'astuple', + 'make_dataclass', + 'replace', + ] + +# Raised when an attempt is made to modify a frozen class. +class FrozenInstanceError(AttributeError): pass + +# A sentinel object for default values to signal that a +# default-factory will be used. +# This is given a nice repr() which will appear in the function +# signature of dataclasses' constructors. +class _HAS_DEFAULT_FACTORY_CLASS: + def __repr__(self): + return '' +_HAS_DEFAULT_FACTORY = _HAS_DEFAULT_FACTORY_CLASS() + +# A sentinel object to detect if a parameter is supplied or not. +class _MISSING_FACTORY: + def __repr__(self): + return '' +_MISSING = _MISSING_FACTORY() + +# Since most per-field metadata will be unused, create an empty +# read-only proxy that can be shared among all fields. +_EMPTY_METADATA = types.MappingProxyType({}) + +# Markers for the various kinds of fields and pseudo-fields. +_FIELD = object() # An actual field. +_FIELD_CLASSVAR = object() # Not a field, but a ClassVar. +_FIELD_INITVAR = object() # Not a field, but an InitVar. + +# The name of an attribute on the class where we store the Field +# objects. Also used to check if a class is a Data Class. +_MARKER = '__dataclass_fields__' + +# The name of the function, that if it exists, is called at the end of +# __init__. +_POST_INIT_NAME = '__post_init__' + + +class _InitVarMeta(type): + def __getitem__(self, params): + return self + +class InitVar(metaclass=_InitVarMeta): + pass + + +# Instances of Field are only ever created from within this module, +# and only from the field() function, although Field instances are +# exposed externally as (conceptually) read-only objects. +# name and type are filled in after the fact, not in __init__. They're +# not known at the time this class is instantiated, but it's +# convenient if they're available later. +# When cls._MARKER is filled in with a list of Field objects, the name +# and type fields will have been populated. +class Field: + __slots__ = ('name', + 'type', + 'default', + 'default_factory', + 'repr', + 'hash', + 'init', + 'compare', + 'metadata', + '_field_type', # Private: not to be used by user code. + ) + + def __init__(self, default, default_factory, init, repr, hash, compare, + metadata): + self.name = None + self.type = None + self.default = default + self.default_factory = default_factory + self.init = init + self.repr = repr + self.hash = hash + self.compare = compare + self.metadata = (_EMPTY_METADATA + if metadata is None or len(metadata) == 0 else + types.MappingProxyType(metadata)) + self._field_type = None + + def __repr__(self): + return ('Field(' + f'name={self.name!r},' + f'type={self.type},' + f'default={self.default},' + f'default_factory={self.default_factory},' + f'init={self.init},' + f'repr={self.repr},' + f'hash={self.hash},' + f'compare={self.compare},' + f'metadata={self.metadata}' + ')') + + +# This function is used instead of exposing Field creation directly, +# so that a type checker can be told (via overloads) that this is a +# function whose type depends on its parameters. +def field(*, default=_MISSING, default_factory=_MISSING, init=True, repr=True, + hash=None, compare=True, metadata=None): + """Return an object to identify dataclass fields. + + default is the default value of the field. default_factory is a + 0-argument function called to initialize a field's value. If init + is True, the field will be a parameter to the class's __init__() + function. If repr is True, the field will be included in the + object's repr(). If hash is True, the field will be included in + the object's hash(). If compare is True, the field will be used in + comparison functions. metadata, if specified, must be a mapping + which is stored but not otherwise examined by dataclass. + + It is an error to specify both default and default_factory. + """ + + if default is not _MISSING and default_factory is not _MISSING: + raise ValueError('cannot specify both default and default_factory') + return Field(default, default_factory, init, repr, hash, compare, + metadata) + + +def _tuple_str(obj_name, fields): + # Return a string representing each field of obj_name as a tuple + # member. So, if fields is ['x', 'y'] and obj_name is "self", + # return "(self.x,self.y)". + + # Special case for the 0-tuple. + if len(fields) == 0: + return '()' + # Note the trailing comma, needed if this turns out to be a 1-tuple. + return f'({",".join([f"{obj_name}.{f.name}" for f in fields])},)' + + +def _create_fn(name, args, body, globals=None, locals=None, + return_type=_MISSING): + # Note that we mutate locals when exec() is called. Caller beware! + if locals is None: + locals = {} + return_annotation = '' + if return_type is not _MISSING: + locals['_return_type'] = return_type + return_annotation = '->_return_type' + args = ','.join(args) + body = '\n'.join(f' {b}' for b in body) + + txt = f'def {name}({args}){return_annotation}:\n{body}' + + exec(txt, globals, locals) + return locals[name] + + +def _field_assign(frozen, name, value, self_name): + # If we're a frozen class, then assign to our fields in __init__ + # via object.__setattr__. Otherwise, just use a simple + # assignment. + # self_name is what "self" is called in this function: don't + # hard-code "self", since that might be a field name. + if frozen: + return f'object.__setattr__({self_name},{name!r},{value})' + return f'{self_name}.{name}={value}' + + +def _field_init(f, frozen, globals, self_name): + # Return the text of the line in the body of __init__ that will + # initialize this field. + + default_name = f'_dflt_{f.name}' + if f.default_factory is not _MISSING: + if f.init: + # This field has a default factory. If a parameter is + # given, use it. If not, call the factory. + globals[default_name] = f.default_factory + value = (f'{default_name}() ' + f'if {f.name} is _HAS_DEFAULT_FACTORY ' + f'else {f.name}') + else: + # This is a field that's not in the __init__ params, but + # has a default factory function. It needs to be + # initialized here by calling the factory function, + # because there's no other way to initialize it. + + # For a field initialized with a default=defaultvalue, the + # class dict just has the default value + # (cls.fieldname=defaultvalue). But that won't work for a + # default factory, the factory must be called in __init__ + # and we must assign that to self.fieldname. We can't + # fall back to the class dict's value, both because it's + # not set, and because it might be different per-class + # (which, after all, is why we have a factory function!). + + globals[default_name] = f.default_factory + value = f'{default_name}()' + else: + # No default factory. + if f.init: + if f.default is _MISSING: + # There's no default, just do an assignment. + value = f.name + elif f.default is not _MISSING: + globals[default_name] = f.default + value = f.name + else: + # This field does not need initialization. Signify that to + # the caller by returning None. + return None + + # Only test this now, so that we can create variables for the + # default. However, return None to signify that we're not going + # to actually do the assignment statement for InitVars. + if f._field_type == _FIELD_INITVAR: + return None + + # Now, actually generate the field assignment. + return _field_assign(frozen, f.name, value, self_name) + + +def _init_param(f): + # Return the __init__ parameter string for this field. + # For example, the equivalent of 'x:int=3' (except instead of 'int', + # reference a variable set to int, and instead of '3', reference a + # variable set to 3). + if f.default is _MISSING and f.default_factory is _MISSING: + # There's no default, and no default_factory, just + # output the variable name and type. + default = '' + elif f.default is not _MISSING: + # There's a default, this will be the name that's used to look it up. + default = f'=_dflt_{f.name}' + elif f.default_factory is not _MISSING: + # There's a factory function. Set a marker. + default = '=_HAS_DEFAULT_FACTORY' + return f'{f.name}:_type_{f.name}{default}' + + +def _init_fn(fields, frozen, has_post_init, self_name): + # fields contains both real fields and InitVar pseudo-fields. + + # Make sure we don't have fields without defaults following fields + # with defaults. This actually would be caught when exec-ing the + # function source code, but catching it here gives a better error + # message, and future-proofs us in case we build up the function + # using ast. + seen_default = False + for f in fields: + # Only consider fields in the __init__ call. + if f.init: + if not (f.default is _MISSING and f.default_factory is _MISSING): + seen_default = True + elif seen_default: + raise TypeError(f'non-default argument {f.name!r} ' + 'follows default argument') + + globals = {'_MISSING': _MISSING, + '_HAS_DEFAULT_FACTORY': _HAS_DEFAULT_FACTORY} + + body_lines = [] + for f in fields: + # Do not initialize the pseudo-fields, only the real ones. + line = _field_init(f, frozen, globals, self_name) + if line is not None: + # line is None means that this field doesn't require + # initialization. Just skip it. + body_lines.append(line) + + # Does this class have a post-init function? + if has_post_init: + params_str = ','.join(f.name for f in fields + if f._field_type is _FIELD_INITVAR) + body_lines += [f'{self_name}.{_POST_INIT_NAME}({params_str})'] + + # If no body lines, use 'pass'. + if len(body_lines) == 0: + body_lines = ['pass'] + + locals = {f'_type_{f.name}': f.type for f in fields} + return _create_fn('__init__', + [self_name] +[_init_param(f) for f in fields if f.init], + body_lines, + locals=locals, + globals=globals, + return_type=None) + + +def _repr_fn(fields): + return _create_fn('__repr__', + ['self'], + ['return self.__class__.__qualname__ + f"(' + + ', '.join([f"{f.name}={{self.{f.name}!r}}" + for f in fields]) + + ')"']) + + +def _frozen_setattr(self, name, value): + raise FrozenInstanceError(f'cannot assign to field {name!r}') + + +def _frozen_delattr(self, name): + raise FrozenInstanceError(f'cannot delete field {name!r}') + + +def _cmp_fn(name, op, self_tuple, other_tuple): + # Create a comparison function. If the fields in the object are + # named 'x' and 'y', then self_tuple is the string + # '(self.x,self.y)' and other_tuple is the string + # '(other.x,other.y)'. + + return _create_fn(name, + ['self', 'other'], + [ 'if other.__class__ is self.__class__:', + f' return {self_tuple}{op}{other_tuple}', + 'return NotImplemented']) + + +def _set_eq_fns(cls, fields): + # Create and set the equality comparison methods on cls. + # Pre-compute self_tuple and other_tuple, then re-use them for + # each function. + self_tuple = _tuple_str('self', fields) + other_tuple = _tuple_str('other', fields) + for name, op in [('__eq__', '=='), + ('__ne__', '!='), + ]: + _set_attribute(cls, name, _cmp_fn(name, op, self_tuple, other_tuple)) + + +def _set_order_fns(cls, fields): + # Create and set the ordering methods on cls. + # Pre-compute self_tuple and other_tuple, then re-use them for + # each function. + self_tuple = _tuple_str('self', fields) + other_tuple = _tuple_str('other', fields) + for name, op in [('__lt__', '<'), + ('__le__', '<='), + ('__gt__', '>'), + ('__ge__', '>='), + ]: + _set_attribute(cls, name, _cmp_fn(name, op, self_tuple, other_tuple)) + + +def _hash_fn(fields): + self_tuple = _tuple_str('self', fields) + return _create_fn('__hash__', + ['self'], + [f'return hash({self_tuple})']) + + +def _get_field(cls, a_name, a_type): + # Return a Field object, for this field name and type. ClassVars + # and InitVars are also returned, but marked as such (see + # f._field_type). + + # If the default value isn't derived from field, then it's + # only a normal default value. Convert it to a Field(). + default = getattr(cls, a_name, _MISSING) + if isinstance(default, Field): + f = default + else: + f = field(default=default) + + # Assume it's a normal field until proven otherwise. + f._field_type = _FIELD + + # Only at this point do we know the name and the type. Set them. + f.name = a_name + f.type = a_type + + # If typing has not been imported, then it's impossible for + # any annotation to be a ClassVar. So, only look for ClassVar + # if typing has been imported. + typing = sys.modules.get('typing') + if typing is not None: + # This test uses a typing internal class, but it's the best + # way to test if this is a ClassVar. + if type(a_type) is typing._ClassVar: + # This field is a ClassVar, so it's not a field. + f._field_type = _FIELD_CLASSVAR + + if f._field_type is _FIELD: + # Check if this is an InitVar. + if a_type is InitVar: + # InitVars are not fields, either. + f._field_type = _FIELD_INITVAR + + # Validations for fields. This is delayed until now, instead of + # in the Field() constructor, since only here do we know the field + # name, which allows better error reporting. + + # Special restrictions for ClassVar and InitVar. + if f._field_type in (_FIELD_CLASSVAR, _FIELD_INITVAR): + if f.default_factory is not _MISSING: + raise TypeError(f'field {f.name} cannot have a ' + 'default factory') + # Should I check for other field settings? default_factory + # seems the most serious to check for. Maybe add others. For + # example, how about init=False (or really, + # init=)? It makes no sense for + # ClassVar and InitVar to specify init=. + + # For real fields, disallow mutable defaults for known types. + if f._field_type is _FIELD and isinstance(f.default, (list, dict, set)): + raise ValueError(f'mutable default {type(f.default)} for field ' + f'{f.name} is not allowed: use default_factory') + + return f + + +def _find_fields(cls): + # Return a list of Field objects, in order, for this class (and no + # base classes). Fields are found from __annotations__ (which is + # guaranteed to be ordered). Default values are from class + # attributes, if a field has a default. If the default value is + # a Field(), then it contains additional info beyond (and + # possibly including) the actual default value. Pseudo-fields + # ClassVars and InitVars are included, despite the fact that + # they're not real fields. That's deal with later. + + annotations = getattr(cls, '__annotations__', {}) + + return [_get_field(cls, a_name, a_type) + for a_name, a_type in annotations.items()] + + +def _set_attribute(cls, name, value): + # Raise TypeError if an attribute by this name already exists. + if name in cls.__dict__: + raise TypeError(f'Cannot overwrite attribute {name} ' + f'in {cls.__name__}') + setattr(cls, name, value) + + +def _process_class(cls, repr, eq, order, hash, init, frozen): + # Use an OrderedDict because: + # - Order matters! + # - Derived class fields overwrite base class fields, but the + # order is defined by the base class, which is found first. + fields = collections.OrderedDict() + + # Find our base classes in reverse MRO order, and exclude + # ourselves. In reversed order so that more derived classes + # override earlier field definitions in base classes. + for b in cls.__mro__[-1:0:-1]: + # Only process classes that have been processed by our + # decorator. That is, they have a _MARKER attribute. + base_fields = getattr(b, _MARKER, None) + if base_fields: + for f in base_fields.values(): + fields[f.name] = f + + # Now find fields in our class. While doing so, validate some + # things, and set the default values (as class attributes) + # where we can. + for f in _find_fields(cls): + fields[f.name] = f + + # If the class attribute (which is the default value for + # this field) exists and is of type 'Field', replace it + # with the real default. This is so that normal class + # introspection sees a real default value, not a Field. + if isinstance(getattr(cls, f.name, None), Field): + if f.default is _MISSING: + # If there's no default, delete the class attribute. + # This happens if we specify field(repr=False), for + # example (that is, we specified a field object, but + # no default value). Also if we're using a default + # factory. The class attribute should not be set at + # all in the post-processed class. + delattr(cls, f.name) + else: + setattr(cls, f.name, f.default) + + # Remember all of the fields on our class (including bases). This + # marks this class as being a dataclass. + setattr(cls, _MARKER, fields) + + # We also need to check if a parent class is frozen: frozen has to + # be inherited down. + is_frozen = frozen or cls.__setattr__ is _frozen_setattr + + # If we're generating ordering methods, we must be generating + # the eq methods. + if order and not eq: + raise ValueError('eq must be true if order is true') + + if init: + # Does this class have a post-init function? + has_post_init = hasattr(cls, _POST_INIT_NAME) + + # Include InitVars and regular fields (so, not ClassVars). + _set_attribute(cls, '__init__', + _init_fn(list(filter(lambda f: f._field_type + in (_FIELD, _FIELD_INITVAR), + fields.values())), + is_frozen, + has_post_init, + # The name to use for the "self" param + # in __init__. Use "self" if possible. + '__dataclass_self__' if 'self' in fields + else 'self', + )) + + # Get the fields as a list, and include only real fields. This is + # used in all of the following methods. + field_list = list(filter(lambda f: f._field_type is _FIELD, + fields.values())) + + if repr: + _set_attribute(cls, '__repr__', + _repr_fn(list(filter(lambda f: f.repr, field_list)))) + + if is_frozen: + _set_attribute(cls, '__setattr__', _frozen_setattr) + _set_attribute(cls, '__delattr__', _frozen_delattr) + + generate_hash = False + if hash is None: + if eq and frozen: + # Generate a hash function. + generate_hash = True + elif eq and not frozen: + # Not hashable. + _set_attribute(cls, '__hash__', None) + elif not eq: + # Otherwise, use the base class definition of hash(). That is, + # don't set anything on this class. + pass + else: + assert "can't get here" + else: + generate_hash = hash + if generate_hash: + _set_attribute(cls, '__hash__', + _hash_fn(list(filter(lambda f: f.compare + if f.hash is None + else f.hash, + field_list)))) + + if eq: + # Create and __eq__ and __ne__ methods. + _set_eq_fns(cls, list(filter(lambda f: f.compare, field_list))) + + if order: + # Create and __lt__, __le__, __gt__, and __ge__ methods. + # Create and set the comparison functions. + _set_order_fns(cls, list(filter(lambda f: f.compare, field_list))) + + if not getattr(cls, '__doc__'): + # Create a class doc-string. + cls.__doc__ = (cls.__name__ + + str(inspect.signature(cls)).replace(' -> None', '')) + + return cls + + +# _cls should never be specified by keyword, so start it with an +# underscore. The presense of _cls is used to detect if this +# decorator is being called with parameters or not. +def dataclass(_cls=None, *, init=True, repr=True, eq=True, order=False, + hash=None, frozen=False): + """Returns the same class as was passed in, with dunder methods + added based on the fields defined in the class. + + Examines PEP 526 __annotations__ to determine fields. + + If init is true, an __init__() method is added to the class. If + repr is true, a __repr__() method is added. If order is true, rich + comparison dunder methods are added. If hash is true, a __hash__() + method function is added. If frozen is true, fields may not be + assigned to after instance creation. + """ + + def wrap(cls): + return _process_class(cls, repr, eq, order, hash, init, frozen) + + # See if we're being called as @dataclass or @dataclass(). + if _cls is None: + # We're called with parens. + return wrap + + # We're called as @dataclass without parens. + return wrap(_cls) + + +def fields(class_or_instance): + """Return a tuple describing the fields of this dataclass. + + Accepts a dataclass or an instance of one. Tuple elements are of + type Field. + """ + + # Might it be worth caching this, per class? + try: + fields = getattr(class_or_instance, _MARKER) + except AttributeError: + raise TypeError('must be called with a dataclass type or instance') + + # Exclude pseudo-fields. + return tuple(f for f in fields.values() if f._field_type is _FIELD) + + +def _isdataclass(obj): + """Returns True if obj is an instance of a dataclass.""" + return not isinstance(obj, type) and hasattr(obj, _MARKER) + + +def asdict(obj, *, dict_factory=dict): + """Return the fields of a dataclass instance as a new dictionary mapping + field names to field values. + + Example usage: + + @dataclass + class C: + x: int + y: int + + c = C(1, 2) + assert asdict(c) == {'x': 1, 'y': 2} + + If given, 'dict_factory' will be used instead of built-in dict. + The function applies recursively to field values that are + dataclass instances. This will also look into built-in containers: + tuples, lists, and dicts. + """ + if not _isdataclass(obj): + raise TypeError("asdict() should be called on dataclass instances") + return _asdict_inner(obj, dict_factory) + +def _asdict_inner(obj, dict_factory): + if _isdataclass(obj): + result = [] + for f in fields(obj): + value = _asdict_inner(getattr(obj, f.name), dict_factory) + result.append((f.name, value)) + return dict_factory(result) + elif isinstance(obj, (list, tuple)): + return type(obj)(_asdict_inner(v, dict_factory) for v in obj) + elif isinstance(obj, dict): + return type(obj)((_asdict_inner(k, dict_factory), _asdict_inner(v, dict_factory)) + for k, v in obj.items()) + else: + return deepcopy(obj) + + +def astuple(obj, *, tuple_factory=tuple): + """Return the fields of a dataclass instance as a new tuple of field values. + + Example usage:: + + @dataclass + class C: + x: int + y: int + + c = C(1, 2) + assert asdtuple(c) == (1, 2) + + If given, 'tuple_factory' will be used instead of built-in tuple. + The function applies recursively to field values that are + dataclass instances. This will also look into built-in containers: + tuples, lists, and dicts. + """ + + if not _isdataclass(obj): + raise TypeError("astuple() should be called on dataclass instances") + return _astuple_inner(obj, tuple_factory) + +def _astuple_inner(obj, tuple_factory): + if _isdataclass(obj): + result = [] + for f in fields(obj): + value = _astuple_inner(getattr(obj, f.name), tuple_factory) + result.append(value) + return tuple_factory(result) + elif isinstance(obj, (list, tuple)): + return type(obj)(_astuple_inner(v, tuple_factory) for v in obj) + elif isinstance(obj, dict): + return type(obj)((_astuple_inner(k, tuple_factory), _astuple_inner(v, tuple_factory)) + for k, v in obj.items()) + else: + return deepcopy(obj) + + +def make_dataclass(cls_name, fields, *, bases=(), namespace=None): + """Return a new dynamically created dataclass. + + The dataclass name will be 'cls_name'. 'fields' is an interable + of either (name, type) or (name, type, Field) objects. Field + objects are created by calling 'field(name, type [, Field])'. + + C = make_class('C', [('a', int', ('b', int, Field(init=False))], bases=Base) + + is equivalent to: + + @dataclass + class C(Base): + a: int + b: int = field(init=False) + + For the bases and namespace paremeters, see the builtin type() function. + """ + + if namespace is None: + namespace = {} + else: + # Copy namespace since we're going to mutate it. + namespace = namespace.copy() + + anns = collections.OrderedDict((name, tp) for name, tp, *_ in fields) + namespace['__annotations__'] = anns + for item in fields: + if len(item) == 3: + name, tp, spec = item + namespace[name] = spec + cls = type(cls_name, bases, namespace) + return dataclass(cls) + + +def replace(obj, **changes): + """Return a new object replacing specified fields with new values. + + This is especially useful for frozen classes. Example usage: + + @dataclass(frozen=True) + class C: + x: int + y: int + + c = C(1, 2) + c1 = replace(c, x=3) + assert c1.x == 3 and c1.y == 2 + """ + + # We're going to mutate 'changes', but that's okay because it's a new + # dict, even if called with 'replace(obj, **my_changes)'. + + if not _isdataclass(obj): + raise TypeError("replace() should be called on dataclass instances") + + # It's an error to have init=False fields in 'changes'. + # If a field is not in 'changes', read its value from the provided obj. + + for f in getattr(obj, _MARKER).values(): + if not f.init: + # Error if this field is specified in changes. + if f.name in changes: + raise ValueError(f'field {f.name} is declared with ' + 'init=False, it cannot be specified with ' + 'replace()') + continue + + if f.name not in changes: + changes[f.name] = getattr(obj, f.name) + + # Create the new object, which calls __init__() and __post_init__ + # (if defined), using all of the init fields we've added and/or + # left in 'changes'. + # If there are values supplied in changes that aren't fields, this + # will correctly raise a TypeError. + return obj.__class__(**changes) diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py new file mode 100755 index 000000000000000..caea98a13b06b7e --- /dev/null +++ b/Lib/test/test_dataclasses.py @@ -0,0 +1,2076 @@ +from dataclasses import ( + dataclass, field, FrozenInstanceError, fields, asdict, astuple, + make_dataclass, replace, InitVar, Field +) + +import pickle +import inspect +import unittest +from unittest.mock import Mock +from typing import ClassVar, Any, List, Union, Tuple, Dict, Generic, TypeVar +from collections import deque, OrderedDict, namedtuple + +# Just any custom exception we can catch. +class CustomError(Exception): pass + +class TestCase(unittest.TestCase): + def test_no_fields(self): + @dataclass + class C: + pass + + o = C() + self.assertEqual(len(fields(C)), 0) + + def test_one_field_no_default(self): + @dataclass + class C: + x: int + + o = C(42) + self.assertEqual(o.x, 42) + + def test_named_init_params(self): + @dataclass + class C: + x: int + + o = C(x=32) + self.assertEqual(o.x, 32) + + def test_two_fields_one_default(self): + @dataclass + class C: + x: int + y: int = 0 + + o = C(3) + self.assertEqual((o.x, o.y), (3, 0)) + + # Non-defaults following defaults. + with self.assertRaisesRegex(TypeError, + "non-default argument 'y' follows " + "default argument"): + @dataclass + class C: + x: int = 0 + y: int + + # A derived class adds a non-default field after a default one. + with self.assertRaisesRegex(TypeError, + "non-default argument 'y' follows " + "default argument"): + @dataclass + class B: + x: int = 0 + + @dataclass + class C(B): + y: int + + # Override a base class field and add a default to + # a field which didn't use to have a default. + with self.assertRaisesRegex(TypeError, + "non-default argument 'y' follows " + "default argument"): + @dataclass + class B: + x: int + y: int + + @dataclass + class C(B): + x: int = 0 + + def test_overwriting_init(self): + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __init__ ' + 'in C'): + @dataclass + class C: + x: int + def __init__(self, x): + self.x = 2 * x + + @dataclass(init=False) + class C: + x: int + def __init__(self, x): + self.x = 2 * x + self.assertEqual(C(5).x, 10) + + def test_overwriting_repr(self): + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __repr__ ' + 'in C'): + @dataclass + class C: + x: int + def __repr__(self): + pass + + @dataclass(repr=False) + class C: + x: int + def __repr__(self): + return 'x' + self.assertEqual(repr(C(0)), 'x') + + def test_overwriting_cmp(self): + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __eq__ ' + 'in C'): + # This will generate the comparison functions, make sure we can't + # overwrite them. + @dataclass(hash=False, frozen=False) + class C: + x: int + def __eq__(self): + pass + + @dataclass(order=False, eq=False) + class C: + x: int + def __eq__(self, other): + return True + self.assertEqual(C(0), 'x') + + def test_overwriting_hash(self): + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __hash__ ' + 'in C'): + @dataclass(frozen=True) + class C: + x: int + def __hash__(self): + pass + + @dataclass(frozen=True,hash=False) + class C: + x: int + def __hash__(self): + return 600 + self.assertEqual(hash(C(0)), 600) + + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __hash__ ' + 'in C'): + @dataclass(frozen=True) + class C: + x: int + def __hash__(self): + pass + + @dataclass(frozen=True, hash=False) + class C: + x: int + def __hash__(self): + return 600 + self.assertEqual(hash(C(0)), 600) + + def test_overwriting_frozen(self): + # frozen uses __setattr__ and __delattr__ + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __setattr__ ' + 'in C'): + @dataclass(frozen=True) + class C: + x: int + def __setattr__(self): + pass + + with self.assertRaisesRegex(TypeError, + 'Cannot overwrite attribute __delattr__ ' + 'in C'): + @dataclass(frozen=True) + class C: + x: int + def __delattr__(self): + pass + + @dataclass(frozen=False) + class C: + x: int + def __setattr__(self, name, value): + self.__dict__['x'] = value * 2 + self.assertEqual(C(10).x, 20) + + def test_overwrite_fields_in_derived_class(self): + # Note that x from C1 replaces x in Base, but the order remains + # the same as defined in Base. + @dataclass + class Base: + x: Any = 15.0 + y: int = 0 + + @dataclass + class C1(Base): + z: int = 10 + x: int = 15 + + o = Base() + self.assertEqual(repr(o), 'TestCase.test_overwrite_fields_in_derived_class..Base(x=15.0, y=0)') + + o = C1() + self.assertEqual(repr(o), 'TestCase.test_overwrite_fields_in_derived_class..C1(x=15, y=0, z=10)') + + o = C1(x=5) + self.assertEqual(repr(o), 'TestCase.test_overwrite_fields_in_derived_class..C1(x=5, y=0, z=10)') + + def test_field_named_self(self): + @dataclass + class C: + self: str + c=C('foo') + self.assertEqual(c.self, 'foo') + + # Make sure the first parameter is not named 'self'. + sig = inspect.signature(C.__init__) + first = next(iter(sig.parameters)) + self.assertNotEqual('self', first) + + # But we do use 'self' if no field named self. + @dataclass + class C: + selfx: str + + # Make sure the first parameter is named 'self'. + sig = inspect.signature(C.__init__) + first = next(iter(sig.parameters)) + self.assertEqual('self', first) + + def test_repr(self): + @dataclass + class B: + x: int + + @dataclass + class C(B): + y: int = 10 + + o = C(4) + self.assertEqual(repr(o), 'TestCase.test_repr..C(x=4, y=10)') + + @dataclass + class D(C): + x: int = 20 + self.assertEqual(repr(D()), 'TestCase.test_repr..D(x=20, y=10)') + + @dataclass + class C: + @dataclass + class D: + i: int + @dataclass + class E: + pass + self.assertEqual(repr(C.D(0)), 'TestCase.test_repr..C.D(i=0)') + self.assertEqual(repr(C.E()), 'TestCase.test_repr..C.E()') + + def test_0_field_compare(self): + # Ensure that order=False is the default. + @dataclass + class C0: + pass + + @dataclass(order=False) + class C1: + pass + + for cls in [C0, C1]: + with self.subTest(cls=cls): + self.assertEqual(cls(), cls()) + for idx, fn in enumerate([lambda a, b: a < b, + lambda a, b: a <= b, + lambda a, b: a > b, + lambda a, b: a >= b]): + with self.subTest(idx=idx): + with self.assertRaisesRegex(TypeError, + f"not supported between instances of '{cls.__name__}' and '{cls.__name__}'"): + fn(cls(), cls()) + + @dataclass(order=True) + class C: + pass + self.assertLessEqual(C(), C()) + self.assertGreaterEqual(C(), C()) + + def test_1_field_compare(self): + # Ensure that order=False is the default. + @dataclass + class C0: + x: int + + @dataclass(order=False) + class C1: + x: int + + for cls in [C0, C1]: + with self.subTest(cls=cls): + self.assertEqual(cls(1), cls(1)) + self.assertNotEqual(cls(0), cls(1)) + for idx, fn in enumerate([lambda a, b: a < b, + lambda a, b: a <= b, + lambda a, b: a > b, + lambda a, b: a >= b]): + with self.subTest(idx=idx): + with self.assertRaisesRegex(TypeError, + f"not supported between instances of '{cls.__name__}' and '{cls.__name__}'"): + fn(cls(0), cls(0)) + + @dataclass(order=True) + class C: + x: int + self.assertLess(C(0), C(1)) + self.assertLessEqual(C(0), C(1)) + self.assertLessEqual(C(1), C(1)) + self.assertGreater(C(1), C(0)) + self.assertGreaterEqual(C(1), C(0)) + self.assertGreaterEqual(C(1), C(1)) + + def test_simple_compare(self): + # Ensure that order=False is the default. + @dataclass + class C0: + x: int + y: int + + @dataclass(order=False) + class C1: + x: int + y: int + + for cls in [C0, C1]: + with self.subTest(cls=cls): + self.assertEqual(cls(0, 0), cls(0, 0)) + self.assertEqual(cls(1, 2), cls(1, 2)) + self.assertNotEqual(cls(1, 0), cls(0, 0)) + self.assertNotEqual(cls(1, 0), cls(1, 1)) + for idx, fn in enumerate([lambda a, b: a < b, + lambda a, b: a <= b, + lambda a, b: a > b, + lambda a, b: a >= b]): + with self.subTest(idx=idx): + with self.assertRaisesRegex(TypeError, + f"not supported between instances of '{cls.__name__}' and '{cls.__name__}'"): + fn(cls(0, 0), cls(0, 0)) + + @dataclass(order=True) + class C: + x: int + y: int + + for idx, fn in enumerate([lambda a, b: a == b, + lambda a, b: a <= b, + lambda a, b: a >= b]): + with self.subTest(idx=idx): + self.assertTrue(fn(C(0, 0), C(0, 0))) + + for idx, fn in enumerate([lambda a, b: a < b, + lambda a, b: a <= b, + lambda a, b: a != b]): + with self.subTest(idx=idx): + self.assertTrue(fn(C(0, 0), C(0, 1))) + self.assertTrue(fn(C(0, 1), C(1, 0))) + self.assertTrue(fn(C(1, 0), C(1, 1))) + + for idx, fn in enumerate([lambda a, b: a > b, + lambda a, b: a >= b, + lambda a, b: a != b]): + with self.subTest(idx=idx): + self.assertTrue(fn(C(0, 1), C(0, 0))) + self.assertTrue(fn(C(1, 0), C(0, 1))) + self.assertTrue(fn(C(1, 1), C(1, 0))) + + def test_compare_subclasses(self): + # Comparisons fail for subclasses, even if no fields + # are added. + @dataclass + class B: + i: int + + @dataclass + class C(B): + pass + + for idx, (fn, expected) in enumerate([(lambda a, b: a == b, False), + (lambda a, b: a != b, True)]): + with self.subTest(idx=idx): + self.assertEqual(fn(B(0), C(0)), expected) + + for idx, fn in enumerate([lambda a, b: a < b, + lambda a, b: a <= b, + lambda a, b: a > b, + lambda a, b: a >= b]): + with self.subTest(idx=idx): + with self.assertRaisesRegex(TypeError, + "not supported between instances of 'B' and 'C'"): + fn(B(0), C(0)) + + def test_0_field_hash(self): + @dataclass(hash=True) + class C: + pass + self.assertEqual(hash(C()), hash(())) + + def test_1_field_hash(self): + @dataclass(hash=True) + class C: + x: int + self.assertEqual(hash(C(4)), hash((4,))) + self.assertEqual(hash(C(42)), hash((42,))) + + def test_hash(self): + @dataclass(hash=True) + class C: + x: int + y: str + self.assertEqual(hash(C(1, 'foo')), hash((1, 'foo'))) + + def test_no_hash(self): + @dataclass(hash=None) + class C: + x: int + with self.assertRaisesRegex(TypeError, + "unhashable type: 'C'"): + hash(C(1)) + + def test_hash_rules(self): + # There are 24 cases of: + # hash=True/False/None + # eq=True/False + # order=True/False + # frozen=True/False + for (hash, eq, order, frozen, result ) in [ + (False, False, False, False, 'absent'), + (False, False, False, True, 'absent'), + (False, False, True, False, 'exception'), + (False, False, True, True, 'exception'), + (False, True, False, False, 'absent'), + (False, True, False, True, 'absent'), + (False, True, True, False, 'absent'), + (False, True, True, True, 'absent'), + (True, False, False, False, 'fn'), + (True, False, False, True, 'fn'), + (True, False, True, False, 'exception'), + (True, False, True, True, 'exception'), + (True, True, False, False, 'fn'), + (True, True, False, True, 'fn'), + (True, True, True, False, 'fn'), + (True, True, True, True, 'fn'), + (None, False, False, False, 'absent'), + (None, False, False, True, 'absent'), + (None, False, True, False, 'exception'), + (None, False, True, True, 'exception'), + (None, True, False, False, 'none'), + (None, True, False, True, 'fn'), + (None, True, True, False, 'none'), + (None, True, True, True, 'fn'), + ]: + with self.subTest(hash=hash, eq=eq, order=order, frozen=frozen): + if result == 'exception': + with self.assertRaisesRegex(ValueError, 'eq must be true if order is true'): + @dataclass(hash=hash, eq=eq, order=order, frozen=frozen) + class C: + pass + else: + @dataclass(hash=hash, eq=eq, order=order, frozen=frozen) + class C: + pass + + # See if the result matches what's expected. + if result == 'fn': + # __hash__ contains the function we generated. + self.assertIn('__hash__', C.__dict__) + self.assertIsNotNone(C.__dict__['__hash__']) + elif result == 'absent': + # __hash__ is not present in our class. + self.assertNotIn('__hash__', C.__dict__) + elif result == 'none': + # __hash__ is set to None. + self.assertIn('__hash__', C.__dict__) + self.assertIsNone(C.__dict__['__hash__']) + else: + assert False, f'unknown result {result!r}' + + def test_eq_order(self): + for (eq, order, result ) in [ + (False, False, 'neither'), + (False, True, 'exception'), + (True, False, 'eq_only'), + (True, True, 'both'), + ]: + with self.subTest(eq=eq, order=order): + if result == 'exception': + with self.assertRaisesRegex(ValueError, 'eq must be true if order is true'): + @dataclass(eq=eq, order=order) + class C: + pass + else: + @dataclass(eq=eq, order=order) + class C: + pass + + if result == 'neither': + self.assertNotIn('__eq__', C.__dict__) + self.assertNotIn('__ne__', C.__dict__) + self.assertNotIn('__lt__', C.__dict__) + self.assertNotIn('__le__', C.__dict__) + self.assertNotIn('__gt__', C.__dict__) + self.assertNotIn('__ge__', C.__dict__) + elif result == 'both': + self.assertIn('__eq__', C.__dict__) + self.assertIn('__ne__', C.__dict__) + self.assertIn('__lt__', C.__dict__) + self.assertIn('__le__', C.__dict__) + self.assertIn('__gt__', C.__dict__) + self.assertIn('__ge__', C.__dict__) + elif result == 'eq_only': + self.assertIn('__eq__', C.__dict__) + self.assertIn('__ne__', C.__dict__) + self.assertNotIn('__lt__', C.__dict__) + self.assertNotIn('__le__', C.__dict__) + self.assertNotIn('__gt__', C.__dict__) + self.assertNotIn('__ge__', C.__dict__) + else: + assert False, f'unknown result {result!r}' + + def test_field_no_default(self): + @dataclass + class C: + x: int = field() + + self.assertEqual(C(5).x, 5) + + with self.assertRaisesRegex(TypeError, + r"__init__\(\) missing 1 required " + "positional argument: 'x'"): + C() + + def test_field_default(self): + default = object() + @dataclass + class C: + x: object = field(default=default) + + self.assertIs(C.x, default) + c = C(10) + self.assertEqual(c.x, 10) + + # If we delete the instance attribute, we should then see the + # class attribute. + del c.x + self.assertIs(c.x, default) + + self.assertIs(C().x, default) + + def test_not_in_repr(self): + @dataclass + class C: + x: int = field(repr=False) + with self.assertRaises(TypeError): + C() + c = C(10) + self.assertEqual(repr(c), 'TestCase.test_not_in_repr..C()') + + @dataclass + class C: + x: int = field(repr=False) + y: int + c = C(10, 20) + self.assertEqual(repr(c), 'TestCase.test_not_in_repr..C(y=20)') + + def test_not_in_compare(self): + @dataclass + class C: + x: int = 0 + y: int = field(compare=False, default=4) + + self.assertEqual(C(), C(0, 20)) + self.assertEqual(C(1, 10), C(1, 20)) + self.assertNotEqual(C(3), C(4, 10)) + self.assertNotEqual(C(3, 10), C(4, 10)) + + def test_hash_field_rules(self): + # Test all 6 cases of: + # hash=True/False/None + # compare=True/False + for (hash_val, compare, result ) in [ + (True, False, 'field' ), + (True, True, 'field' ), + (False, False, 'absent'), + (False, True, 'absent'), + (None, False, 'absent'), + (None, True, 'field' ), + ]: + with self.subTest(hash_val=hash_val, compare=compare): + @dataclass(hash=True) + class C: + x: int = field(compare=compare, hash=hash_val, default=5) + + if result == 'field': + # __hash__ contains the field. + self.assertEqual(C(5).__hash__(), hash((5,))) + elif result == 'absent': + # The field is not present in the hash. + self.assertEqual(C(5).__hash__(), hash(())) + else: + assert False, f'unknown result {result!r}' + + def test_init_false_no_default(self): + # If init=False and no default value, then the field won't be + # present in the instance. + @dataclass + class C: + x: int = field(init=False) + + self.assertNotIn('x', C().__dict__) + + @dataclass + class C: + x: int + y: int = 0 + z: int = field(init=False) + t: int = 10 + + self.assertNotIn('z', C(0).__dict__) + self.assertEqual(vars(C(5)), {'t': 10, 'x': 5, 'y': 0}) + + def test_class_marker(self): + @dataclass + class C: + x: int + y: str = field(init=False, default=None) + z: str = field(repr=False) + + the_fields = fields(C) + # the_fields is a tuple of 3 items, each value + # is in __annotations__. + self.assertIsInstance(the_fields, tuple) + for f in the_fields: + self.assertIs(type(f), Field) + self.assertIn(f.name, C.__annotations__) + + self.assertEqual(len(the_fields), 3) + + self.assertEqual(the_fields[0].name, 'x') + self.assertEqual(the_fields[0].type, int) + self.assertFalse(hasattr(C, 'x')) + self.assertTrue (the_fields[0].init) + self.assertTrue (the_fields[0].repr) + self.assertEqual(the_fields[1].name, 'y') + self.assertEqual(the_fields[1].type, str) + self.assertIsNone(getattr(C, 'y')) + self.assertFalse(the_fields[1].init) + self.assertTrue (the_fields[1].repr) + self.assertEqual(the_fields[2].name, 'z') + self.assertEqual(the_fields[2].type, str) + self.assertFalse(hasattr(C, 'z')) + self.assertTrue (the_fields[2].init) + self.assertFalse(the_fields[2].repr) + + def test_field_order(self): + @dataclass + class B: + a: str = 'B:a' + b: str = 'B:b' + c: str = 'B:c' + + @dataclass + class C(B): + b: str = 'C:b' + + self.assertEqual([(f.name, f.default) for f in fields(C)], + [('a', 'B:a'), + ('b', 'C:b'), + ('c', 'B:c')]) + + @dataclass + class D(B): + c: str = 'D:c' + + self.assertEqual([(f.name, f.default) for f in fields(D)], + [('a', 'B:a'), + ('b', 'B:b'), + ('c', 'D:c')]) + + @dataclass + class E(D): + a: str = 'E:a' + d: str = 'E:d' + + self.assertEqual([(f.name, f.default) for f in fields(E)], + [('a', 'E:a'), + ('b', 'B:b'), + ('c', 'D:c'), + ('d', 'E:d')]) + + def test_class_attrs(self): + # We only have a class attribute if a default value is + # specified, either directly or via a field with a default. + default = object() + @dataclass + class C: + x: int + y: int = field(repr=False) + z: object = default + t: int = field(default=100) + + self.assertFalse(hasattr(C, 'x')) + self.assertFalse(hasattr(C, 'y')) + self.assertIs (C.z, default) + self.assertEqual(C.t, 100) + + def test_disallowed_mutable_defaults(self): + # For the known types, don't allow mutable default values. + for typ, empty, non_empty in [(list, [], [1]), + (dict, {}, {0:1}), + (set, set(), set([1])), + ]: + with self.subTest(typ=typ): + # Can't use a zero-length value. + with self.assertRaisesRegex(ValueError, + f'mutable default {typ} for field ' + 'x is not allowed'): + @dataclass + class Point: + x: typ = empty + + + # Nor a non-zero-length value + with self.assertRaisesRegex(ValueError, + f'mutable default {typ} for field ' + 'y is not allowed'): + @dataclass + class Point: + y: typ = non_empty + + # Check subtypes also fail. + class Subclass(typ): pass + + with self.assertRaisesRegex(ValueError, + f"mutable default .*Subclass'>" + ' for field z is not allowed' + ): + @dataclass + class Point: + z: typ = Subclass() + + # Because this is a ClassVar, it can be mutable. + @dataclass + class C: + z: ClassVar[typ] = typ() + + # Because this is a ClassVar, it can be mutable. + @dataclass + class C: + x: ClassVar[typ] = Subclass() + + + def test_deliberately_mutable_defaults(self): + # If a mutable default isn't in the known list of + # (list, dict, set), then it's okay. + class Mutable: + def __init__(self): + self.l = [] + + @dataclass + class C: + x: Mutable + + # These 2 instances will share this value of x. + lst = Mutable() + o1 = C(lst) + o2 = C(lst) + self.assertEqual(o1, o2) + o1.x.l.extend([1, 2]) + self.assertEqual(o1, o2) + self.assertEqual(o1.x.l, [1, 2]) + self.assertIs(o1.x, o2.x) + + def test_no_options(self): + # call with dataclass() + @dataclass() + class C: + x: int + + self.assertEqual(C(42).x, 42) + + def test_not_tuple(self): + # Make sure we can't be compared to a tuple. + @dataclass + class Point: + x: int + y: int + self.assertNotEqual(Point(1, 2), (1, 2)) + + # And that we can't compare to another unrelated dataclass + @dataclass + class C: + x: int + y: int + self.assertNotEqual(Point(1, 3), C(1, 3)) + + def test_base_has_init(self): + class B: + def __init__(self): + pass + + # Make sure that declaring this class doesn't raise an error. + # The issue is that we can't override __init__ in our class, + # but it should be okay to add __init__ to us if our base has + # an __init__. + @dataclass + class C(B): + x: int = 0 + + def test_frozen(self): + @dataclass(frozen=True) + class C: + i: int + + c = C(10) + self.assertEqual(c.i, 10) + with self.assertRaises(FrozenInstanceError): + c.i = 5 + self.assertEqual(c.i, 10) + + # Check that a derived class is still frozen, even if not + # marked so. + @dataclass + class D(C): + pass + + d = D(20) + self.assertEqual(d.i, 20) + with self.assertRaises(FrozenInstanceError): + d.i = 5 + self.assertEqual(d.i, 20) + + def test_not_tuple(self): + # Test that some of the problems with namedtuple don't happen + # here. + @dataclass + class Point3D: + x: int + y: int + z: int + + @dataclass + class Date: + year: int + month: int + day: int + + self.assertNotEqual(Point3D(2017, 6, 3), Date(2017, 6, 3)) + self.assertNotEqual(Point3D(1, 2, 3), (1, 2, 3)) + + # Make sure we can't unpack + with self.assertRaisesRegex(TypeError, 'is not iterable'): + x, y, z = Point3D(4, 5, 6) + + # Maka sure another class with the same field names isn't + # equal. + @dataclass + class Point3Dv1: + x: int = 0 + y: int = 0 + z: int = 0 + self.assertNotEqual(Point3D(0, 0, 0), Point3Dv1()) + + def test_function_annotations(self): + # Some dummy class and instance to use as a default. + class F: + pass + f = F() + + def validate_class(cls): + # First, check __annotations__, even though they're not + # function annotations. + self.assertEqual(cls.__annotations__['i'], int) + self.assertEqual(cls.__annotations__['j'], str) + self.assertEqual(cls.__annotations__['k'], F) + self.assertEqual(cls.__annotations__['l'], float) + self.assertEqual(cls.__annotations__['z'], complex) + + # Verify __init__. + + signature = inspect.signature(cls.__init__) + # Check the return type, should be None + self.assertIs(signature.return_annotation, None) + + # Check each parameter. + params = iter(signature.parameters.values()) + param = next(params) + # This is testing an internal name, and probably shouldn't be tested. + self.assertEqual(param.name, 'self') + param = next(params) + self.assertEqual(param.name, 'i') + self.assertIs (param.annotation, int) + self.assertEqual(param.default, inspect.Parameter.empty) + self.assertEqual(param.kind, inspect.Parameter.POSITIONAL_OR_KEYWORD) + param = next(params) + self.assertEqual(param.name, 'j') + self.assertIs (param.annotation, str) + self.assertEqual(param.default, inspect.Parameter.empty) + self.assertEqual(param.kind, inspect.Parameter.POSITIONAL_OR_KEYWORD) + param = next(params) + self.assertEqual(param.name, 'k') + self.assertIs (param.annotation, F) + # Don't test for the default, since it's set to _MISSING + self.assertEqual(param.kind, inspect.Parameter.POSITIONAL_OR_KEYWORD) + param = next(params) + self.assertEqual(param.name, 'l') + self.assertIs (param.annotation, float) + # Don't test for the default, since it's set to _MISSING + self.assertEqual(param.kind, inspect.Parameter.POSITIONAL_OR_KEYWORD) + self.assertRaises(StopIteration, next, params) + + + @dataclass + class C: + i: int + j: str + k: F = f + l: float=field(default=None) + z: complex=field(default=3+4j, init=False) + + validate_class(C) + + # Now repeat with __hash__. + @dataclass(frozen=True, hash=True) + class C: + i: int + j: str + k: F = f + l: float=field(default=None) + z: complex=field(default=3+4j, init=False) + + validate_class(C) + + def test_dont_include_other_annotations(self): + @dataclass + class C: + i: int + def foo(self) -> int: + return 4 + @property + def bar(self) -> int: + return 5 + self.assertEqual(list(C.__annotations__), ['i']) + self.assertEqual(C(10).foo(), 4) + self.assertEqual(C(10).bar, 5) + + def test_post_init(self): + # Just make sure it gets called + @dataclass + class C: + def __post_init__(self): + raise CustomError() + with self.assertRaises(CustomError): + C() + + @dataclass + class C: + i: int = 10 + def __post_init__(self): + if self.i == 10: + raise CustomError() + with self.assertRaises(CustomError): + C() + # post-init gets called, but doesn't raise. This is just + # checking that self is used correctly. + C(5) + + # If there's not an __init__, then post-init won't get called. + @dataclass(init=False) + class C: + def __post_init__(self): + raise CustomError() + # Creating the class won't raise + C() + + @dataclass + class C: + x: int = 0 + def __post_init__(self): + self.x *= 2 + self.assertEqual(C().x, 0) + self.assertEqual(C(2).x, 4) + + # Make sure that if we'r frozen, post-init can't set + # attributes. + @dataclass(frozen=True) + class C: + x: int = 0 + def __post_init__(self): + self.x *= 2 + with self.assertRaises(FrozenInstanceError): + C() + + def test_post_init_super(self): + # Make sure super() post-init isn't called by default. + class B: + def __post_init__(self): + raise CustomError() + + @dataclass + class C(B): + def __post_init__(self): + self.x = 5 + + self.assertEqual(C().x, 5) + + # Now call super(), and it will raise + @dataclass + class C(B): + def __post_init__(self): + super().__post_init__() + + with self.assertRaises(CustomError): + C() + + # Make sure post-init is called, even if not defined in our + # class. + @dataclass + class C(B): + pass + + with self.assertRaises(CustomError): + C() + + def test_post_init_staticmethod(self): + flag = False + @dataclass + class C: + x: int + y: int + @staticmethod + def __post_init__(): + nonlocal flag + flag = True + + self.assertFalse(flag) + c = C(3, 4) + self.assertEqual((c.x, c.y), (3, 4)) + self.assertTrue(flag) + + def test_post_init_classmethod(self): + @dataclass + class C: + flag = False + x: int + y: int + @classmethod + def __post_init__(cls): + cls.flag = True + + self.assertFalse(C.flag) + c = C(3, 4) + self.assertEqual((c.x, c.y), (3, 4)) + self.assertTrue(C.flag) + + def test_class_var(self): + # Make sure ClassVars are ignored in __init__, __repr__, etc. + @dataclass + class C: + x: int + y: int = 10 + z: ClassVar[int] = 1000 + w: ClassVar[int] = 2000 + t: ClassVar[int] = 3000 + + c = C(5) + self.assertEqual(repr(c), 'TestCase.test_class_var..C(x=5, y=10)') + self.assertEqual(len(fields(C)), 2) # We have 2 fields + self.assertEqual(len(C.__annotations__), 5) # And 3 ClassVars + self.assertEqual(c.z, 1000) + self.assertEqual(c.w, 2000) + self.assertEqual(c.t, 3000) + C.z += 1 + self.assertEqual(c.z, 1001) + c = C(20) + self.assertEqual((c.x, c.y), (20, 10)) + self.assertEqual(c.z, 1001) + self.assertEqual(c.w, 2000) + self.assertEqual(c.t, 3000) + + def test_class_var_no_default(self): + # If a ClassVar has no default value, it should not be set on the class. + @dataclass + class C: + x: ClassVar[int] + + self.assertNotIn('x', C.__dict__) + + def test_class_var_default_factory(self): + # It makes no sense for a ClassVar to have a default factory. When + # would it be called? Call it yourself, since it's class-wide. + with self.assertRaisesRegex(TypeError, + 'cannot have a default factory'): + @dataclass + class C: + x: ClassVar[int] = field(default_factory=int) + + self.assertNotIn('x', C.__dict__) + + def test_class_var_with_default(self): + # If a ClassVar has a default value, it should be set on the class. + @dataclass + class C: + x: ClassVar[int] = 10 + self.assertEqual(C.x, 10) + + @dataclass + class C: + x: ClassVar[int] = field(default=10) + self.assertEqual(C.x, 10) + + def test_class_var_frozen(self): + # Make sure ClassVars work even if we're frozen. + @dataclass(frozen=True) + class C: + x: int + y: int = 10 + z: ClassVar[int] = 1000 + w: ClassVar[int] = 2000 + t: ClassVar[int] = 3000 + + c = C(5) + self.assertEqual(repr(C(5)), 'TestCase.test_class_var_frozen..C(x=5, y=10)') + self.assertEqual(len(fields(C)), 2) # We have 2 fields + self.assertEqual(len(C.__annotations__), 5) # And 3 ClassVars + self.assertEqual(c.z, 1000) + self.assertEqual(c.w, 2000) + self.assertEqual(c.t, 3000) + # We can still modify the ClassVar, it's only instances that are + # frozen. + C.z += 1 + self.assertEqual(c.z, 1001) + c = C(20) + self.assertEqual((c.x, c.y), (20, 10)) + self.assertEqual(c.z, 1001) + self.assertEqual(c.w, 2000) + self.assertEqual(c.t, 3000) + + def test_init_var_no_default(self): + # If an InitVar has no default value, it should not be set on the class. + @dataclass + class C: + x: InitVar[int] + + self.assertNotIn('x', C.__dict__) + + def test_init_var_default_factory(self): + # It makes no sense for an InitVar to have a default factory. When + # would it be called? Call it yourself, since it's class-wide. + with self.assertRaisesRegex(TypeError, + 'cannot have a default factory'): + @dataclass + class C: + x: InitVar[int] = field(default_factory=int) + + self.assertNotIn('x', C.__dict__) + + def test_init_var_with_default(self): + # If an InitVar has a default value, it should be set on the class. + @dataclass + class C: + x: InitVar[int] = 10 + self.assertEqual(C.x, 10) + + @dataclass + class C: + x: InitVar[int] = field(default=10) + self.assertEqual(C.x, 10) + + def test_init_var(self): + @dataclass + class C: + x: int = None + init_param: InitVar[int] = None + + def __post_init__(self, init_param): + if self.x is None: + self.x = init_param*2 + + c = C(init_param=10) + self.assertEqual(c.x, 20) + + def test_init_var_inheritance(self): + # Note that this deliberately tests that a dataclass need not + # have a __post_init__ function if it has an InitVar field. + # It could just be used in a derived class, as shown here. + @dataclass + class Base: + x: int + init_base: InitVar[int] + + # We can instantiate by passing the InitVar, even though + # it's not used. + b = Base(0, 10) + self.assertEqual(vars(b), {'x': 0}) + + @dataclass + class C(Base): + y: int + init_derived: InitVar[int] + + def __post_init__(self, init_base, init_derived): + self.x = self.x + init_base + self.y = self.y + init_derived + + c = C(10, 11, 50, 51) + self.assertEqual(vars(c), {'x': 21, 'y': 101}) + + def test_default_factory(self): + # Test a factory that returns a new list. + @dataclass + class C: + x: int + y: list = field(default_factory=list) + + c0 = C(3) + c1 = C(3) + self.assertEqual(c0.x, 3) + self.assertEqual(c0.y, []) + self.assertEqual(c0, c1) + self.assertIsNot(c0.y, c1.y) + self.assertEqual(astuple(C(5, [1])), (5, [1])) + + # Test a factory that returns a shared list. + l = [] + @dataclass + class C: + x: int + y: list = field(default_factory=lambda: l) + + c0 = C(3) + c1 = C(3) + self.assertEqual(c0.x, 3) + self.assertEqual(c0.y, []) + self.assertEqual(c0, c1) + self.assertIs(c0.y, c1.y) + self.assertEqual(astuple(C(5, [1])), (5, [1])) + + # Test various other field flags. + # repr + @dataclass + class C: + x: list = field(default_factory=list, repr=False) + self.assertEqual(repr(C()), 'TestCase.test_default_factory..C()') + self.assertEqual(C().x, []) + + # hash + @dataclass(hash=True) + class C: + x: list = field(default_factory=list, hash=False) + self.assertEqual(astuple(C()), ([],)) + self.assertEqual(hash(C()), hash(())) + + # init (see also test_default_factory_with_no_init) + @dataclass + class C: + x: list = field(default_factory=list, init=False) + self.assertEqual(astuple(C()), ([],)) + + # compare + @dataclass + class C: + x: list = field(default_factory=list, compare=False) + self.assertEqual(C(), C([1])) + + def test_default_factory_with_no_init(self): + # We need a factory with a side effect. + factory = Mock() + + @dataclass + class C: + x: list = field(default_factory=factory, init=False) + + # Make sure the default factory is called for each new instance. + C().x + self.assertEqual(factory.call_count, 1) + C().x + self.assertEqual(factory.call_count, 2) + + def test_default_factory_not_called_if_value_given(self): + # We need a factory that we can test if it's been called. + factory = Mock() + + @dataclass + class C: + x: int = field(default_factory=factory) + + # Make sure that if a field has a default factory function, + # it's not called if a value is specified. + C().x + self.assertEqual(factory.call_count, 1) + self.assertEqual(C(10).x, 10) + self.assertEqual(factory.call_count, 1) + C().x + self.assertEqual(factory.call_count, 2) + + def x_test_classvar_default_factory(self): + # XXX: it's an error for a ClassVar to have a factory function + @dataclass + class C: + x: ClassVar[int] = field(default_factory=int) + + self.assertIs(C().x, int) + + def test_isdataclass(self): + # There is no isdataclass() helper any more, but the PEP + # describes how to write it, so make sure that works. Note + # that this version returns True for both classes and + # instances. + def isdataclass(obj): + try: + fields(obj) + return True + except TypeError: + return False + + self.assertFalse(isdataclass(0)) + self.assertFalse(isdataclass(int)) + + @dataclass + class C: + x: int + + self.assertTrue(isdataclass(C)) + self.assertTrue(isdataclass(C(0))) + + def test_helper_fields_with_class_instance(self): + # Check that we can call fields() on either a class or instance, + # and get back the same thing. + @dataclass + class C: + x: int + y: float + + self.assertEqual(fields(C), fields(C(0, 0.0))) + + def test_helper_fields_exception(self): + # Check that TypeError is raised if not passed a dataclass or + # instance. + with self.assertRaisesRegex(TypeError, 'dataclass type or instance'): + fields(0) + + class C: pass + with self.assertRaisesRegex(TypeError, 'dataclass type or instance'): + fields(C) + with self.assertRaisesRegex(TypeError, 'dataclass type or instance'): + fields(C()) + + def test_helper_asdict(self): + # Basic tests for asdict(), it should return a new dictionary + @dataclass + class C: + x: int + y: int + c = C(1, 2) + + self.assertEqual(asdict(c), {'x': 1, 'y': 2}) + self.assertEqual(asdict(c), asdict(c)) + self.assertIsNot(asdict(c), asdict(c)) + c.x = 42 + self.assertEqual(asdict(c), {'x': 42, 'y': 2}) + self.assertIs(type(asdict(c)), dict) + + def test_helper_asdict_raises_on_classes(self): + # asdict() should raise on a class object + @dataclass + class C: + x: int + y: int + with self.assertRaisesRegex(TypeError, 'dataclass instance'): + asdict(C) + with self.assertRaisesRegex(TypeError, 'dataclass instance'): + asdict(int) + + def test_helper_asdict_copy_values(self): + @dataclass + class C: + x: int + y: List[int] = field(default_factory=list) + initial = [] + c = C(1, initial) + d = asdict(c) + self.assertEqual(d['y'], initial) + self.assertIsNot(d['y'], initial) + c = C(1) + d = asdict(c) + d['y'].append(1) + self.assertEqual(c.y, []) + + def test_helper_asdict_nested(self): + @dataclass + class UserId: + token: int + group: int + @dataclass + class User: + name: str + id: UserId + u = User('Joe', UserId(123, 1)) + d = asdict(u) + self.assertEqual(d, {'name': 'Joe', 'id': {'token': 123, 'group': 1}}) + self.assertIsNot(asdict(u), asdict(u)) + u.id.group = 2 + self.assertEqual(asdict(u), {'name': 'Joe', + 'id': {'token': 123, 'group': 2}}) + + def test_helper_asdict_builtin_containers(self): + @dataclass + class User: + name: str + id: int + @dataclass + class GroupList: + id: int + users: List[User] + @dataclass + class GroupTuple: + id: int + users: Tuple[User, ...] + @dataclass + class GroupDict: + id: int + users: Dict[str, User] + a = User('Alice', 1) + b = User('Bob', 2) + gl = GroupList(0, [a, b]) + gt = GroupTuple(0, (a, b)) + gd = GroupDict(0, {'first': a, 'second': b}) + self.assertEqual(asdict(gl), {'id': 0, 'users': [{'name': 'Alice', 'id': 1}, + {'name': 'Bob', 'id': 2}]}) + self.assertEqual(asdict(gt), {'id': 0, 'users': ({'name': 'Alice', 'id': 1}, + {'name': 'Bob', 'id': 2})}) + self.assertEqual(asdict(gd), {'id': 0, 'users': {'first': {'name': 'Alice', 'id': 1}, + 'second': {'name': 'Bob', 'id': 2}}}) + + def test_helper_asdict_builtin_containers(self): + @dataclass + class Child: + d: object + + @dataclass + class Parent: + child: Child + + self.assertEqual(asdict(Parent(Child([1]))), {'child': {'d': [1]}}) + self.assertEqual(asdict(Parent(Child({1: 2}))), {'child': {'d': {1: 2}}}) + + def test_helper_asdict_factory(self): + @dataclass + class C: + x: int + y: int + c = C(1, 2) + d = asdict(c, dict_factory=OrderedDict) + self.assertEqual(d, OrderedDict([('x', 1), ('y', 2)])) + self.assertIsNot(d, asdict(c, dict_factory=OrderedDict)) + c.x = 42 + d = asdict(c, dict_factory=OrderedDict) + self.assertEqual(d, OrderedDict([('x', 42), ('y', 2)])) + self.assertIs(type(d), OrderedDict) + + def test_helper_astuple(self): + # Basic tests for astuple(), it should return a new tuple + @dataclass + class C: + x: int + y: int = 0 + c = C(1) + + self.assertEqual(astuple(c), (1, 0)) + self.assertEqual(astuple(c), astuple(c)) + self.assertIsNot(astuple(c), astuple(c)) + c.y = 42 + self.assertEqual(astuple(c), (1, 42)) + self.assertIs(type(astuple(c)), tuple) + + def test_helper_astuple_raises_on_classes(self): + # astuple() should raise on a class object + @dataclass + class C: + x: int + y: int + with self.assertRaisesRegex(TypeError, 'dataclass instance'): + astuple(C) + with self.assertRaisesRegex(TypeError, 'dataclass instance'): + astuple(int) + + def test_helper_astuple_copy_values(self): + @dataclass + class C: + x: int + y: List[int] = field(default_factory=list) + initial = [] + c = C(1, initial) + t = astuple(c) + self.assertEqual(t[1], initial) + self.assertIsNot(t[1], initial) + c = C(1) + t = astuple(c) + t[1].append(1) + self.assertEqual(c.y, []) + + def test_helper_astuple_nested(self): + @dataclass + class UserId: + token: int + group: int + @dataclass + class User: + name: str + id: UserId + u = User('Joe', UserId(123, 1)) + t = astuple(u) + self.assertEqual(t, ('Joe', (123, 1))) + self.assertIsNot(astuple(u), astuple(u)) + u.id.group = 2 + self.assertEqual(astuple(u), ('Joe', (123, 2))) + + def test_helper_astuple_builtin_containers(self): + @dataclass + class User: + name: str + id: int + @dataclass + class GroupList: + id: int + users: List[User] + @dataclass + class GroupTuple: + id: int + users: Tuple[User, ...] + @dataclass + class GroupDict: + id: int + users: Dict[str, User] + a = User('Alice', 1) + b = User('Bob', 2) + gl = GroupList(0, [a, b]) + gt = GroupTuple(0, (a, b)) + gd = GroupDict(0, {'first': a, 'second': b}) + self.assertEqual(astuple(gl), (0, [('Alice', 1), ('Bob', 2)])) + self.assertEqual(astuple(gt), (0, (('Alice', 1), ('Bob', 2)))) + self.assertEqual(astuple(gd), (0, {'first': ('Alice', 1), 'second': ('Bob', 2)})) + + def test_helper_astuple_builtin_containers(self): + @dataclass + class Child: + d: object + + @dataclass + class Parent: + child: Child + + self.assertEqual(astuple(Parent(Child([1]))), (([1],),)) + self.assertEqual(astuple(Parent(Child({1: 2}))), (({1: 2},),)) + + def test_helper_astuple_factory(self): + @dataclass + class C: + x: int + y: int + NT = namedtuple('NT', 'x y') + def nt(lst): + return NT(*lst) + c = C(1, 2) + t = astuple(c, tuple_factory=nt) + self.assertEqual(t, NT(1, 2)) + self.assertIsNot(t, astuple(c, tuple_factory=nt)) + c.x = 42 + t = astuple(c, tuple_factory=nt) + self.assertEqual(t, NT(42, 2)) + self.assertIs(type(t), NT) + + def test_dynamic_class_creation(self): + cls_dict = {'__annotations__': OrderedDict(x=int, y=int), + } + + # Create the class. + cls = type('C', (), cls_dict) + + # Make it a dataclass. + cls1 = dataclass(cls) + + self.assertEqual(cls1, cls) + self.assertEqual(asdict(cls(1, 2)), {'x': 1, 'y': 2}) + + def test_dynamic_class_creation_using_field(self): + cls_dict = {'__annotations__': OrderedDict(x=int, y=int), + 'y': field(default=5), + } + + # Create the class. + cls = type('C', (), cls_dict) + + # Make it a dataclass. + cls1 = dataclass(cls) + + self.assertEqual(cls1, cls) + self.assertEqual(asdict(cls1(1)), {'x': 1, 'y': 5}) + + def test_init_in_order(self): + @dataclass + class C: + a: int + b: int = field() + c: list = field(default_factory=list, init=False) + d: list = field(default_factory=list) + e: int = field(default=4, init=False) + f: int = 4 + + calls = [] + def setattr(self, name, value): + calls.append((name, value)) + + C.__setattr__ = setattr + c = C(0, 1) + self.assertEqual(('a', 0), calls[0]) + self.assertEqual(('b', 1), calls[1]) + self.assertEqual(('c', []), calls[2]) + self.assertEqual(('d', []), calls[3]) + self.assertNotIn(('e', 4), calls) + self.assertEqual(('f', 4), calls[4]) + + def test_items_in_dicts(self): + @dataclass + class C: + a: int + b: list = field(default_factory=list, init=False) + c: list = field(default_factory=list) + d: int = field(default=4, init=False) + e: int = 0 + + c = C(0) + # Class dict + self.assertNotIn('a', C.__dict__) + self.assertNotIn('b', C.__dict__) + self.assertNotIn('c', C.__dict__) + self.assertIn('d', C.__dict__) + self.assertEqual(C.d, 4) + self.assertIn('e', C.__dict__) + self.assertEqual(C.e, 0) + # Instance dict + self.assertIn('a', c.__dict__) + self.assertEqual(c.a, 0) + self.assertIn('b', c.__dict__) + self.assertEqual(c.b, []) + self.assertIn('c', c.__dict__) + self.assertEqual(c.c, []) + self.assertNotIn('d', c.__dict__) + self.assertIn('e', c.__dict__) + self.assertEqual(c.e, 0) + + def test_alternate_classmethod_constructor(self): + # Since __post_init__ can't take params, use a classmethod + # alternate constructor. This is mostly an example to show how + # to use this technique. + @dataclass + class C: + x: int + @classmethod + def from_file(cls, filename): + # In a real example, create a new instance + # and populate 'x' from contents of a file. + value_in_file = 20 + return cls(value_in_file) + + self.assertEqual(C.from_file('filename').x, 20) + + def test_field_metadata_default(self): + # Make sure the default metadata is read-only and of + # zero length. + @dataclass + class C: + i: int + + self.assertFalse(fields(C)[0].metadata) + self.assertEqual(len(fields(C)[0].metadata), 0) + with self.assertRaisesRegex(TypeError, + 'does not support item assignment'): + fields(C)[0].metadata['test'] = 3 + + def test_field_metadata_mapping(self): + # Make sure only a mapping can be passed as metadata + # zero length. + with self.assertRaises(TypeError): + @dataclass + class C: + i: int = field(metadata=0) + + # Make sure an empty dict works + @dataclass + class C: + i: int = field(metadata={}) + self.assertFalse(fields(C)[0].metadata) + self.assertEqual(len(fields(C)[0].metadata), 0) + with self.assertRaisesRegex(TypeError, + 'does not support item assignment'): + fields(C)[0].metadata['test'] = 3 + + # Make sure a non-empty dict works. + @dataclass + class C: + i: int = field(metadata={'test': 10, 'bar': '42', 3: 'three'}) + self.assertEqual(len(fields(C)[0].metadata), 3) + self.assertEqual(fields(C)[0].metadata['test'], 10) + self.assertEqual(fields(C)[0].metadata['bar'], '42') + self.assertEqual(fields(C)[0].metadata[3], 'three') + with self.assertRaises(KeyError): + # Non-existent key. + fields(C)[0].metadata['baz'] + with self.assertRaisesRegex(TypeError, + 'does not support item assignment'): + fields(C)[0].metadata['test'] = 3 + + def test_field_metadata_custom_mapping(self): + # Try a custom mapping. + class SimpleNameSpace: + def __init__(self, **kw): + self.__dict__.update(kw) + + def __getitem__(self, item): + if item == 'xyzzy': + return 'plugh' + return getattr(self, item) + + def __len__(self): + return self.__dict__.__len__() + + @dataclass + class C: + i: int = field(metadata=SimpleNameSpace(a=10)) + + self.assertEqual(len(fields(C)[0].metadata), 1) + self.assertEqual(fields(C)[0].metadata['a'], 10) + with self.assertRaises(AttributeError): + fields(C)[0].metadata['b'] + # Make sure we're still talking to our custom mapping. + self.assertEqual(fields(C)[0].metadata['xyzzy'], 'plugh') + + def test_generic_dataclasses(self): + T = TypeVar('T') + + @dataclass + class LabeledBox(Generic[T]): + content: T + label: str = '' + + box = LabeledBox(42) + self.assertEqual(box.content, 42) + self.assertEqual(box.label, '') + + # subscripting the resulting class should work, etc. + Alias = List[LabeledBox[int]] + + def test_generic_extending(self): + S = TypeVar('S') + T = TypeVar('T') + + @dataclass + class Base(Generic[T, S]): + x: T + y: S + + @dataclass + class DataDerived(Base[int, T]): + new_field: str + Alias = DataDerived[str] + c = Alias(0, 'test1', 'test2') + self.assertEqual(astuple(c), (0, 'test1', 'test2')) + + class NonDataDerived(Base[int, T]): + def new_method(self): + return self.y + Alias = NonDataDerived[float] + c = Alias(10, 1.0) + self.assertEqual(c.new_method(), 1.0) + + def test_helper_replace(self): + @dataclass(frozen=True) + class C: + x: int + y: int + + c = C(1, 2) + c1 = replace(c, x=3) + self.assertEqual(c1.x, 3) + self.assertEqual(c1.y, 2) + + def test_helper_replace_frozen(self): + @dataclass(frozen=True) + class C: + x: int + y: int + z: int = field(init=False, default=10) + t: int = field(init=False, default=100) + + c = C(1, 2) + c1 = replace(c, x=3) + self.assertEqual((c.x, c.y, c.z, c.t), (1, 2, 10, 100)) + self.assertEqual((c1.x, c1.y, c1.z, c1.t), (3, 2, 10, 100)) + + + with self.assertRaisesRegex(ValueError, 'init=False'): + replace(c, x=3, z=20, t=50) + with self.assertRaisesRegex(ValueError, 'init=False'): + replace(c, z=20) + replace(c, x=3, z=20, t=50) + + # Make sure the result is still frozen. + with self.assertRaisesRegex(FrozenInstanceError, "cannot assign to field 'x'"): + c1.x = 3 + + # Make sure we can't replace an attribute that doesn't exist, + # if we're also replacing one that does exist. Test this + # here, because setting attributes on frozen instances is + # handled slightly differently from non-frozen ones. + with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected " + "keyword argument 'a'"): + c1 = replace(c, x=20, a=5) + + def test_helper_replace_invalid_field_name(self): + @dataclass(frozen=True) + class C: + x: int + y: int + + c = C(1, 2) + with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected " + "keyword argument 'z'"): + c1 = replace(c, z=3) + + def test_helper_replace_invalid_object(self): + @dataclass(frozen=True) + class C: + x: int + y: int + + with self.assertRaisesRegex(TypeError, 'dataclass instance'): + replace(C, x=3) + + with self.assertRaisesRegex(TypeError, 'dataclass instance'): + replace(0, x=3) + + def test_helper_replace_no_init(self): + @dataclass + class C: + x: int + y: int = field(init=False, default=10) + + c = C(1) + c.y = 20 + + # Make sure y gets the default value. + c1 = replace(c, x=5) + self.assertEqual((c1.x, c1.y), (5, 10)) + + # Trying to replace y is an error. + with self.assertRaisesRegex(ValueError, 'init=False'): + replace(c, x=2, y=30) + with self.assertRaisesRegex(ValueError, 'init=False'): + replace(c, y=30) + + def test_dataclassses_pickleable(self): + global P, Q, R + @dataclass + class P: + x: int + y: int = 0 + @dataclass + class Q: + x: int + y: int = field(default=0, init=False) + @dataclass + class R: + x: int + y: List[int] = field(default_factory=list) + q = Q(1) + q.y = 2 + samples = [P(1), P(1, 2), Q(1), q, R(1), R(1, [2, 3, 4])] + for sample in samples: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.subTest(sample=sample, proto=proto): + new_sample = pickle.loads(pickle.dumps(sample, proto)) + self.assertEqual(sample.x, new_sample.x) + self.assertEqual(sample.y, new_sample.y) + self.assertIsNot(sample, new_sample) + new_sample.x = 42 + another_new_sample = pickle.loads(pickle.dumps(new_sample, proto)) + self.assertEqual(new_sample.x, another_new_sample.x) + self.assertEqual(sample.y, another_new_sample.y) + + def test_helper_make_dataclass(self): + C = make_dataclass('C', + [('x', int), + ('y', int, field(default=5))], + namespace={'add_one': lambda self: self.x + 1}) + c = C(10) + self.assertEqual((c.x, c.y), (10, 5)) + self.assertEqual(c.add_one(), 11) + + + def test_helper_make_dataclass_no_mutate_namespace(self): + # Make sure a provided namespace isn't mutated. + ns = {} + C = make_dataclass('C', + [('x', int), + ('y', int, field(default=5))], + namespace=ns) + self.assertEqual(ns, {}) + + def test_helper_make_dataclass_base(self): + class Base1: + pass + class Base2: + pass + C = make_dataclass('C', + [('x', int)], + bases=(Base1, Base2)) + c = C(2) + self.assertIsInstance(c, C) + self.assertIsInstance(c, Base1) + self.assertIsInstance(c, Base2) + + def test_helper_make_dataclass_base_dataclass(self): + @dataclass + class Base1: + x: int + class Base2: + pass + C = make_dataclass('C', + [('y', int)], + bases=(Base1, Base2)) + with self.assertRaisesRegex(TypeError, 'required positional'): + c = C(2) + c = C(1, 2) + self.assertIsInstance(c, C) + self.assertIsInstance(c, Base1) + self.assertIsInstance(c, Base2) + + self.assertEqual((c.x, c.y), (1, 2)) + + def test_helper_make_dataclass_init_var(self): + def post_init(self, y): + self.x *= y + + C = make_dataclass('C', + [('x', int), + ('y', InitVar[int]), + ], + namespace={'__post_init__': post_init}, + ) + c = C(2, 3) + self.assertEqual(vars(c), {'x': 6}) + self.assertEqual(len(fields(c)), 1) + + def test_helper_make_dataclass_class_var(self): + C = make_dataclass('C', + [('x', int), + ('y', ClassVar[int], 10), + ('z', ClassVar[int], field(default=20)), + ]) + c = C(1) + self.assertEqual(vars(c), {'x': 1}) + self.assertEqual(len(fields(c)), 1) + self.assertEqual(C.y, 10) + self.assertEqual(C.z, 20) + + +class TestDocString(unittest.TestCase): + def assertDocStrEqual(self, a, b): + # Because 3.6 and 3.7 differ in how inspect.signature work + # (see bpo #32108), for the time being just compare them with + # whitespace stripped. + self.assertEqual(a.replace(' ', ''), b.replace(' ', '')) + + def test_existing_docstring_not_overridden(self): + @dataclass + class C: + """Lorem ipsum""" + x: int + + self.assertEqual(C.__doc__, "Lorem ipsum") + + def test_docstring_no_fields(self): + @dataclass + class C: + pass + + self.assertDocStrEqual(C.__doc__, "C()") + + def test_docstring_one_field(self): + @dataclass + class C: + x: int + + self.assertDocStrEqual(C.__doc__, "C(x:int)") + + def test_docstring_two_fields(self): + @dataclass + class C: + x: int + y: int + + self.assertDocStrEqual(C.__doc__, "C(x:int, y:int)") + + def test_docstring_three_fields(self): + @dataclass + class C: + x: int + y: int + z: str + + self.assertDocStrEqual(C.__doc__, "C(x:int, y:int, z:str)") + + def test_docstring_one_field_with_default(self): + @dataclass + class C: + x: int = 3 + + self.assertDocStrEqual(C.__doc__, "C(x:int=3)") + + def test_docstring_one_field_with_default_none(self): + @dataclass + class C: + x: Union[int, type(None)] = None + + self.assertDocStrEqual(C.__doc__, "C(x:Union[int, NoneType]=None)") + + def test_docstring_list_field(self): + @dataclass + class C: + x: List[int] + + self.assertDocStrEqual(C.__doc__, "C(x:List[int])") + + def test_docstring_list_field_with_default_factory(self): + @dataclass + class C: + x: List[int] = field(default_factory=list) + + self.assertDocStrEqual(C.__doc__, "C(x:List[int]=)") + + def test_docstring_deque_field(self): + @dataclass + class C: + x: deque + + self.assertDocStrEqual(C.__doc__, "C(x:collections.deque)") + + def test_docstring_deque_field_with_default_factory(self): + @dataclass + class C: + x: deque = field(default_factory=deque) + + self.assertDocStrEqual(C.__doc__, "C(x:collections.deque=)") + + +if __name__ == '__main__': + unittest.main() diff --git a/Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst b/Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst new file mode 100644 index 000000000000000..fd9c4d4eed83b56 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst @@ -0,0 +1,2 @@ +PEP 557, Data Classes. Provides a decorator which adds boilerplate methods +to classes which use type annotations so specify fields. From 2c0c68d927bfa557f98bac26644f5b64c4b135a7 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 4 Dec 2017 17:04:15 -0500 Subject: [PATCH 05/39] bpo-30928: update idlelib/NEWS.txt. (#4706) --- Lib/idlelib/NEWS.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 71b7976ab8a69c1..be68adf667083b5 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,13 @@ Released on 2018-06-18? ======================== +bpo-32207: Improve tk event exception tracebacks in IDLE. +When tk event handling is driven by IDLE's run loop, a confusing +and distracting queue.EMPTY traceback context is no longer added +to tk event exception tracebacks. The traceback is now the same +as when event handling is driven by user code. Patch based on +a suggestion by Serhiy Storchaka. + bpo-32164: Delete unused file idlelib/tabbedpages.py. Use of TabbedPageSet in configdialog was replaced by ttk.Notebook. From ca7562a7fea61646c1b40ace04deecf9903d34a1 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Mon, 4 Dec 2017 18:04:49 -0800 Subject: [PATCH 06/39] bpo-28791: Update macOS installer to use SQLite 3.21.0. (#4245) --- Mac/BuildScript/build-installer.py | 6 +++--- .../next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 4cb7e3214cd40a0..3b8cf69d7576ffe 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -315,9 +315,9 @@ def library_recipes(): ), ), dict( - name="SQLite 3.14.2", - url="https://www.sqlite.org/2016/sqlite-autoconf-3140200.tar.gz", - checksum='90c53cacb811db27f990b8292bd96159', + name="SQLite 3.21.0", + url="https://www.sqlite.org/2017/sqlite-autoconf-3210000.tar.gz", + checksum='7913de4c3126ba3c24689cb7a199ea31', extra_cflags=('-Os ' '-DSQLITE_ENABLE_FTS5 ' '-DSQLITE_ENABLE_FTS4 ' diff --git a/Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst b/Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst new file mode 100644 index 000000000000000..ef9bc0f6cccf9da --- /dev/null +++ b/Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst @@ -0,0 +1 @@ +Update OS X installer to use SQLite 3.21.0. From 29bc19321018ec6e58f9f4da9c18c42e9a9c580e Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Tue, 5 Dec 2017 03:43:58 +0100 Subject: [PATCH 07/39] [bpo-28556] Minor fixes for typing module (#4710) --- Lib/test/test_typing.py | 50 ++++++++++++++++++- Lib/typing.py | 12 ++--- .../2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst | 3 ++ 3 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index a3b6eb933935e2a..4ae1ebf05f324b6 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -37,6 +37,9 @@ from test import mod_generics_cache +PY36 = sys.version_info[:2] >= (3, 6) + + class BaseTestCase(TestCase): def assertIsSubclass(self, cls, class_or_tuple, msg=None): @@ -633,6 +636,27 @@ def test_init(self): with self.assertRaises(TypeError): Generic[T, S, T] + @skipUnless(PY36, "__init_subclass__ support required") + def test_init_subclass(self): + class X(typing.Generic[T]): + def __init_subclass__(cls, **kwargs): + super().__init_subclass__(**kwargs) + cls.attr = 42 + class Y(X): + pass + self.assertEqual(Y.attr, 42) + with self.assertRaises(AttributeError): + X.attr + X.attr = 1 + Y.attr = 2 + class Z(Y): + pass + class W(X[int]): + pass + self.assertEqual(Y.attr, 2) + self.assertEqual(Z.attr, 42) + self.assertEqual(W.attr, 42) + def test_repr(self): self.assertEqual(repr(SimpleMapping), __name__ + '.' + 'SimpleMapping') @@ -1080,6 +1104,30 @@ class Node(Generic[T]): ... self.assertTrue(t is copy(t)) self.assertTrue(t is deepcopy(t)) + def test_copy_generic_instances(self): + T = TypeVar('T') + class C(Generic[T]): + def __init__(self, attr: T) -> None: + self.attr = attr + + c = C(42) + self.assertEqual(copy(c).attr, 42) + self.assertEqual(deepcopy(c).attr, 42) + self.assertIsNot(copy(c), c) + self.assertIsNot(deepcopy(c), c) + c.attr = 1 + self.assertEqual(copy(c).attr, 1) + self.assertEqual(deepcopy(c).attr, 1) + ci = C[int](42) + self.assertEqual(copy(ci).attr, 42) + self.assertEqual(deepcopy(ci).attr, 42) + self.assertIsNot(copy(ci), ci) + self.assertIsNot(deepcopy(ci), ci) + ci.attr = 1 + self.assertEqual(copy(ci).attr, 1) + self.assertEqual(deepcopy(ci).attr, 1) + self.assertEqual(ci.__orig_class__, C[int]) + def test_weakref_all(self): T = TypeVar('T') things = [Any, Union[T, int], Callable[..., T], Tuple[Any, Any], @@ -1580,8 +1628,6 @@ async def __aexit__(self, etype, eval, tb): asyncio = None AwaitableWrapper = AsyncIteratorWrapper = ACM = object -PY36 = sys.version_info[:2] >= (3, 6) - PY36_TESTS = """ from test import ann_module, ann_module2, ann_module3 from typing import AsyncContextManager diff --git a/Lib/typing.py b/Lib/typing.py index c00a3a10e1fae1b..b5564cc29a2d830 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -973,7 +973,8 @@ def __new__(cls, name, bases, namespace, # remove bare Generic from bases if there are other generic bases if any(isinstance(b, GenericMeta) and b is not Generic for b in bases): bases = tuple(b for b in bases if b is not Generic) - namespace.update({'__origin__': origin, '__extra__': extra}) + namespace.update({'__origin__': origin, '__extra__': extra, + '_gorg': None if not origin else origin._gorg}) self = super().__new__(cls, name, bases, namespace, _root=True) super(GenericMeta, self).__setattr__('_gorg', self if not origin else origin._gorg) @@ -1160,17 +1161,12 @@ def __instancecheck__(self, instance): # classes are supposed to be rare anyways. return issubclass(instance.__class__, self) - def __copy__(self): - return self.__class__(self.__name__, self.__bases__, - _no_slots_copy(self.__dict__), - self.__parameters__, self.__args__, self.__origin__, - self.__extra__, self.__orig_bases__) - def __setattr__(self, attr, value): # We consider all the subscripted generics as proxies for original class if ( attr.startswith('__') and attr.endswith('__') or - attr.startswith('_abc_') + attr.startswith('_abc_') or + self._gorg is None # The class is not fully created, see #typing/506 ): super(GenericMeta, self).__setattr__(attr, value) else: diff --git a/Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst b/Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst new file mode 100644 index 000000000000000..8f3a89549704a34 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst @@ -0,0 +1,3 @@ +Two minor fixes for ``typing`` module: allow shallow copying instances of +generic classes, improve interaction of ``__init_subclass__`` with generics. +Original PRs by Ivan Levkivskyi. From 9625bf520e08828e36bc3b1d043af679eb5f993d Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 4 Dec 2017 21:50:29 -0500 Subject: [PATCH 08/39] Enable SQLite JSON functions for macOS installer build (#4712) --- Mac/BuildScript/build-installer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 3b8cf69d7576ffe..674f025db3e160d 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -322,6 +322,7 @@ def library_recipes(): '-DSQLITE_ENABLE_FTS5 ' '-DSQLITE_ENABLE_FTS4 ' '-DSQLITE_ENABLE_FTS3_PARENTHESIS ' + '-DSQLITE_ENABLE_JSON1 ' '-DSQLITE_ENABLE_RTREE ' '-DSQLITE_TCL=0 ' '%s' % ('','-DSQLITE_WITHOUT_ZONEMALLOC ')[LT_10_5]), From 8837dd092fe5ad5184889104e8036811ed839f98 Mon Sep 17 00:00:00 2001 From: Neil Schemenauer Date: Mon, 4 Dec 2017 18:58:12 -0800 Subject: [PATCH 09/39] bpo-19610: Warn if distutils is provided something other than a list to some fields (#4685) * Rather than raise TypeError, warn and call list() on the value. * Fix tests, revise NEWS and whatsnew text. * Revise documentation, a string is okay as well. * Ensure 'requires' and 'obsoletes' are real lists. * Test that requires and obsoletes are turned to lists. --- Doc/distutils/apiref.rst | 6 +-- Doc/whatsnew/3.7.rst | 6 +-- Lib/distutils/dist.py | 46 ++++++++---------- Lib/distutils/tests/test_dist.py | 48 +++++++++++++++---- .../2017-11-23-16-15-55.bpo-19610.Dlca2P.rst | 7 ++- 5 files changed, 66 insertions(+), 47 deletions(-) diff --git a/Doc/distutils/apiref.rst b/Doc/distutils/apiref.rst index ced8837d37363f1..9fce46ad266962b 100644 --- a/Doc/distutils/apiref.rst +++ b/Doc/distutils/apiref.rst @@ -286,9 +286,9 @@ the full reference. Distribution constructor. :func:`setup` creates a Distribution instance. .. versionchanged:: 3.7 - :class:`~distutils.core.Distribution` now raises a :exc:`TypeError` if - ``classifiers``, ``keywords`` and ``platforms`` fields are not specified - as a list. + :class:`~distutils.core.Distribution` now warns if ``classifiers``, + ``keywords`` and ``platforms`` fields are not specified as a list or + a string. .. class:: Command diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 3d23aa773d77c76..9363730bf1fd643 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -298,10 +298,8 @@ README.rst is now included in the list of distutils standard READMEs and therefore included in source distributions. (Contributed by Ryan Gonzalez in :issue:`11913`.) -:class:`distutils.core.setup` now raises a :exc:`TypeError` if -``classifiers``, ``keywords`` and ``platforms`` fields are not specified -as a list. However, to minimize backwards incompatibility concerns, -``keywords`` and ``platforms`` fields still accept a comma separated string. +:class:`distutils.core.setup` now warns if the ``classifiers``, ``keywords`` +and ``platforms`` fields are not specified as a list or a string. (Contributed by Berker Peksag in :issue:`19610`.) http.client diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 78c29ede6c2c4e3..6cf0a0d6632dc75 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -27,6 +27,20 @@ command_re = re.compile(r'^[a-zA-Z]([a-zA-Z0-9_]*)$') +def _ensure_list(value, fieldname): + if isinstance(value, str): + # a string containing comma separated values is okay. It will + # be converted to a list by Distribution.finalize_options(). + pass + elif not isinstance(value, list): + # passing a tuple or an iterator perhaps, warn and convert + typename = type(value).__name__ + msg = f"Warning: '{fieldname}' should be a list, got type '{typename}'" + log.log(log.WARN, msg) + value = list(value) + return value + + class Distribution: """The core of the Distutils. Most of the work hiding behind 'setup' is really done within a Distribution instance, which farms the work out @@ -257,10 +271,7 @@ def __init__(self, attrs=None): setattr(self, key, val) else: msg = "Unknown distribution option: %s" % repr(key) - if warnings is not None: - warnings.warn(msg) - else: - sys.stderr.write(msg + "\n") + warnings.warn(msg) # no-user-cfg is handled before other command line args # because other args override the config files, and this @@ -1189,36 +1200,19 @@ def get_keywords(self): return self.keywords or [] def set_keywords(self, value): - # If 'keywords' is a string, it will be converted to a list - # by Distribution.finalize_options(). To maintain backwards - # compatibility, do not raise an exception if 'keywords' is - # a string. - if not isinstance(value, (list, str)): - msg = "'keywords' should be a 'list', not %r" - raise TypeError(msg % type(value).__name__) - self.keywords = value + self.keywords = _ensure_list(value, 'keywords') def get_platforms(self): return self.platforms or ["UNKNOWN"] def set_platforms(self, value): - # If 'platforms' is a string, it will be converted to a list - # by Distribution.finalize_options(). To maintain backwards - # compatibility, do not raise an exception if 'platforms' is - # a string. - if not isinstance(value, (list, str)): - msg = "'platforms' should be a 'list', not %r" - raise TypeError(msg % type(value).__name__) - self.platforms = value + self.platforms = _ensure_list(value, 'platforms') def get_classifiers(self): return self.classifiers or [] def set_classifiers(self, value): - if not isinstance(value, list): - msg = "'classifiers' should be a 'list', not %r" - raise TypeError(msg % type(value).__name__) - self.classifiers = value + self.classifiers = _ensure_list(value, 'classifiers') def get_download_url(self): return self.download_url or "UNKNOWN" @@ -1231,7 +1225,7 @@ def set_requires(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) - self.requires = value + self.requires = list(value) def get_provides(self): return self.provides or [] @@ -1250,7 +1244,7 @@ def set_obsoletes(self, value): import distutils.versionpredicate for v in value: distutils.versionpredicate.VersionPredicate(v) - self.obsoletes = value + self.obsoletes = list(value) def fix_help_options(options): """Convert a 4-tuple 'help_options' list as found in various command diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 50b456ec9471c7f..0a19f0fb6274cb6 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -11,7 +11,9 @@ from distutils.dist import Distribution, fix_help_options, DistributionMetadata from distutils.cmd import Command -from test.support import TESTFN, captured_stdout, run_unittest +from test.support import ( + TESTFN, captured_stdout, captured_stderr, run_unittest +) from distutils.tests import support from distutils import log @@ -319,6 +321,13 @@ def test_requires_illegal(self): "version": "1.0", "requires": ["my.pkg (splat)"]}) + def test_requires_to_list(self): + attrs = {"name": "package", + "requires": iter(["other"])} + dist = Distribution(attrs) + self.assertIsInstance(dist.metadata.requires, list) + + def test_obsoletes(self): attrs = {"name": "package", "version": "1.0", @@ -341,6 +350,12 @@ def test_obsoletes_illegal(self): "version": "1.0", "obsoletes": ["my.pkg (splat)"]}) + def test_obsoletes_to_list(self): + attrs = {"name": "package", + "obsoletes": iter(["other"])} + dist = Distribution(attrs) + self.assertIsInstance(dist.metadata.obsoletes, list) + def test_classifier(self): attrs = {'name': 'Boa', 'version': '3.0', 'classifiers': ['Programming Language :: Python :: 3']} @@ -353,9 +368,14 @@ def test_classifier(self): def test_classifier_invalid_type(self): attrs = {'name': 'Boa', 'version': '3.0', 'classifiers': ('Programming Language :: Python :: 3',)} - msg = "'classifiers' should be a 'list', not 'tuple'" - with self.assertRaises(TypeError, msg=msg): - Distribution(attrs) + with captured_stderr() as error: + d = Distribution(attrs) + # should have warning about passing a non-list + self.assertIn('should be a list', error.getvalue()) + # should be converted to a list + self.assertIsInstance(d.metadata.classifiers, list) + self.assertEqual(d.metadata.classifiers, + list(attrs['classifiers'])) def test_keywords(self): attrs = {'name': 'Monty', 'version': '1.0', @@ -367,9 +387,13 @@ def test_keywords(self): def test_keywords_invalid_type(self): attrs = {'name': 'Monty', 'version': '1.0', 'keywords': ('spam', 'eggs', 'life of brian')} - msg = "'keywords' should be a 'list', not 'tuple'" - with self.assertRaises(TypeError, msg=msg): - Distribution(attrs) + with captured_stderr() as error: + d = Distribution(attrs) + # should have warning about passing a non-list + self.assertIn('should be a list', error.getvalue()) + # should be converted to a list + self.assertIsInstance(d.metadata.keywords, list) + self.assertEqual(d.metadata.keywords, list(attrs['keywords'])) def test_platforms(self): attrs = {'name': 'Monty', 'version': '1.0', @@ -381,9 +405,13 @@ def test_platforms(self): def test_platforms_invalid_types(self): attrs = {'name': 'Monty', 'version': '1.0', 'platforms': ('GNU/Linux', 'Some Evil Platform')} - msg = "'platforms' should be a 'list', not 'tuple'" - with self.assertRaises(TypeError, msg=msg): - Distribution(attrs) + with captured_stderr() as error: + d = Distribution(attrs) + # should have warning about passing a non-list + self.assertIn('should be a list', error.getvalue()) + # should be converted to a list + self.assertIsInstance(d.metadata.platforms, list) + self.assertEqual(d.metadata.platforms, list(attrs['platforms'])) def test_download_url(self): attrs = {'name': 'Boa', 'version': '3.0', diff --git a/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst b/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst index 5ea87a45722c0ef..514740b433f38d6 100644 --- a/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst +++ b/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst @@ -1,5 +1,4 @@ -``setup()`` now raises :exc:`TypeError` for invalid types. +``setup()`` now warns about invalid types for some fields. -The ``distutils.dist.Distribution`` class now explicitly raises an exception -when ``classifiers``, ``keywords`` and ``platforms`` fields are not -specified as a list. +The ``distutils.dist.Distribution`` class now warns when ``classifiers``, +``keywords`` and ``platforms`` fields are not specified as a list or a string. From 1761a3980434f6d7ec5e9de2a41be4988b0ffecf Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Tue, 5 Dec 2017 08:34:20 +0530 Subject: [PATCH 10/39] bpo-32035: Updated zipfile doc1 --- Doc/library/zipfile.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index d753c927e371db4..4f5cc9da96f7e74 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,9 +385,8 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write the string or bytes *data* to the archive; if it is a *str*, it should be encoded as UTF-8. - *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. - If it's an instance, at least the filename, date, and time must be given. If it's a + Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; if it is a + *str*, it is encoded as UTF-8. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. From 3d6b76a20468b0d43e8fdb6ceb754e18cc1e3459 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Tue, 5 Dec 2017 08:41:54 +0530 Subject: [PATCH 11/39] bpo-32035: Updated zipfile doc2 --- Doc/library/zipfile.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 4f5cc9da96f7e74..8dd23b857806fa8 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,9 +385,11 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; if it is a - *str*, it is encoded as UTF-8. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a - name, the date and time is set to the current date and time. + Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; + if it is a *str*, it is encoded as UTF-8. + *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. + If it's an instance, at least the filename, date, and time must be given. + If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. If given, *compress_type* overrides the value given for the *compression* From 24e046987b8e34bb4f1f3fd9bd31f1d605e347dc Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 4 Dec 2017 22:24:41 -0500 Subject: [PATCH 12/39] bpo-31392: Update macOS installer to use OpenSSL 1.0.2m (#4715) --- Mac/BuildScript/build-installer.py | 7 +++---- .../next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 674f025db3e160d..dbe5ffd104b80e7 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -213,9 +213,9 @@ def library_recipes(): result.extend([ dict( - name="OpenSSL 1.0.2k", - url="https://www.openssl.org/source/openssl-1.0.2k.tar.gz", - checksum='f965fc0bf01bf882b31314b61391ae65', + name="OpenSSL 1.0.2m", + url="https://www.openssl.org/source/openssl-1.0.2m.tar.gz", + checksum='10e9e37f492094b9ef296f68f24a7666', patches=[ "openssl_sdk_makedepend.patch", ], @@ -845,7 +845,6 @@ def build_openssl_arch(archbase, arch): "enable-tlsext", "no-ssl2", "no-ssl3", - "no-ssl3-method", # "enable-unit-test", "shared", "--install_prefix=%s"%shellQuote(archbase), diff --git a/Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst b/Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst new file mode 100644 index 000000000000000..555b3812c6a1136 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst @@ -0,0 +1 @@ +Update macOS installer to use OpenSSL 1.0.2m From e6f8a7378d701823c6821217bf7ac8a540ab143b Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 4 Dec 2017 22:55:20 -0500 Subject: [PATCH 13/39] Update macOS installer to XZ 5.2.3 (#4718) --- Mac/BuildScript/build-installer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index dbe5ffd104b80e7..cc6241f817a2716 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -270,9 +270,9 @@ def library_recipes(): if PYTHON_3: result.extend([ dict( - name="XZ 5.2.2", - url="http://tukaani.org/xz/xz-5.2.2.tar.gz", - checksum='7cf6a8544a7dae8e8106fdf7addfa28c', + name="XZ 5.2.3", + url="http://tukaani.org/xz/xz-5.2.3.tar.gz", + checksum='ef68674fb47a8b8e741b34e429d86e9d', configure_pre=[ '--disable-dependency-tracking', ] From b3edde8dd44c878e9f039a2165d00ff075157d4b Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 4 Dec 2017 23:42:02 -0500 Subject: [PATCH 14/39] bpo-31380: Skip test_httpservers test_undecodable_file on macOS. (#4720) The undecodable file name cannot be created on macOS APFS file systems. --- Lib/test/test_httpservers.py | 3 ++- .../NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 20e6f66766f676f..cc829a522b88bc3 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -384,7 +384,8 @@ def close_conn(): reader.close() return body - @support.requires_mac_ver(10, 5) + @unittest.skipIf(sys.platform == 'darwin', + 'undecodable name cannot always be decoded on macOS') @unittest.skipIf(sys.platform == 'win32', 'undecodable name cannot be decoded on win32') @unittest.skipUnless(support.TESTFN_UNDECODABLE, diff --git a/Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst b/Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst new file mode 100644 index 000000000000000..2baecf5adcf7d5f --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst @@ -0,0 +1 @@ +Skip test_httpservers test_undecodable_file on macOS: fails on APFS. From ae342cf7deebdcf2035f4064609b32b2102dadcf Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Tue, 5 Dec 2017 06:05:33 +0100 Subject: [PATCH 15/39] Add a missing space in tkinter documentation. (GH-4692) --- Doc/library/tkinter.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index 3e1faed8c7b8d5d..f51add2b41fe46b 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -154,7 +154,7 @@ background material, while the second half can be taken to the keyboard as a handy reference. When trying to answer questions of the form "how do I do blah", it is often best -to find out how to do"blah" in straight Tk, and then convert this back into the +to find out how to do "blah" in straight Tk, and then convert this back into the corresponding :mod:`tkinter` call. Python programmers can often guess at the correct Python command by looking at the Tk documentation. This means that in order to use Tkinter, you will have to know a little bit about Tk. This document From 65390acdb33c1e19195e857ebcbf1666b8cb5581 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Tue, 5 Dec 2017 10:48:16 +0530 Subject: [PATCH 16/39] bpo-32035: Updated zipfile doc fix travis fail --- Doc/library/zipfile.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 8dd23b857806fa8..a7591e100241ddb 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,10 +385,10 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; - if it is a *str*, it is encoded as UTF-8. - *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. - If it's an instance, at least the filename, date, and time must be given. + Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; + if it is a *str*, it is encoded as UTF-8. + *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. + If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. From d4d2b563025747c2e73ed970c633126a5438044e Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Tue, 5 Dec 2017 02:45:57 -0500 Subject: [PATCH 17/39] Tidy NEWS entry. --- .../next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst b/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst index b5b6da76d2a4859..99d4dfd71b5ceb3 100644 --- a/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst +++ b/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst @@ -1,15 +1,8 @@ Use non-Latin characters in the IDLE's Font settings sample. - Even if one selects a font that defines a limited subset of the unicode - Basic Multilingual Plane, tcl/tk will use other fonts that define a - character. The expanded example give users of non-Latin characters - a better idea of what they might see in IDLE's shell and editors. - - To make room for the expanded sample, frames on the Font tab are - re-arranged. The Font/Tabs help explains a bit about the additions. From 3f9a728d955579373f45dac1dd89f5b3e4f36a1c Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Tue, 5 Dec 2017 03:17:33 -0500 Subject: [PATCH 18/39] Update NEWS and pydoc topics. --- Lib/pydoc_data/topics.py | 21 +- Misc/NEWS.d/3.7.0a3.rst | 1630 +++++++++++++++++ .../2017-10-24-23-21-13.bpo-31866.MkNO66.rst | 1 - .../2017-11-01-14-16-27.bpo-28643.9iPKJy.rst | 1 - .../2017-11-02-20-13-46.bpo-28791.STt3jL.rst | 1 - .../2017-11-02-20-30-57.bpo-28791.VaE3o8.rst | 1 - .../2017-11-03-10-07-14.bpo-31926.57wE98.rst | 2 - .../2017-11-03-15-17-50.bpo-31934.8bUlpv.rst | 1 - .../2017-11-04-15-35-08.bpo-31609.k7_nBR.rst | 1 - .../2017-11-06-11-53-39.bpo-31957.S_1jFK.rst | 1 - .../2017-11-18-11-19-28.bpo-32059.a0Hxgp.rst | 2 - .../2017-11-21-16-56-24.bpo-29040.14lCSr.rst | 2 - .../2017-11-21-17-12-24.bpo-28762.R6uu8w.rst | 1 - .../2017-11-21-17-27-59.bpo-28538.DsNBS7.rst | 2 - .../2017-06-30-11-58-01.bpo-30697.Q3T_8n.rst | 4 - .../2017-10-19-15-27-04.bpo-23699.-noVVc.rst | 2 - .../2017-10-22-13-12-28.bpo-25612.1jnWKT.rst | 3 - .../2017-11-24-21-25-43.bpo-32125.K8zWgn.rst | 2 - .../2017-11-30-18-13-45.bpo-20891.wBnMdF.rst | 3 - .../2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst | 2 - .../2017-10-01-15-48-03.bpo-31626.reLPxY.rst | 2 - .../2017-10-12-22-21-01.bpo-30399.45f1gv.rst | 2 - .../2017-10-13-20-01-47.bpo-31781.cXE9SM.rst | 2 - .../2017-10-15-23-44-57.bpo-31786.XwdEP4.rst | 3 - .../2017-10-17-13-29-19.bpo-28603._-oia3.rst | 3 - .../2017-10-18-19-41-12.bpo-31618.liLDiS.rst | 7 - .../2017-10-20-14-07-46.bpo-31825.gJvmGW.rst | 2 - .../2017-10-23-23-39-26.bpo-28936.C288Jh.rst | 2 - .../2017-10-24-21-27-32.bpo-31845.8OS-k3.rst | 1 - .../2017-10-25-15-51-37.bpo-21720.BwIKLP.rst | 3 - .../2017-10-28-19-11-05.bpo-20047.GuNAto.rst | 3 - .../2017-10-28-22-06-03.bpo-30696.lhC3HE.rst | 1 - .../2017-11-05-16-11-07.bpo-31949.2yNC_z.rst | 9 - .../2017-11-12-11-44-22.bpo-28180.HQX000.rst | 4 - .../2017-11-13-00-37-11.bpo-32012.Kprjqe.rst | 4 - .../2017-11-15-10-49-35.bpo-32023.XnCGT5.rst | 3 - .../2017-11-16-03-44-08.bpo-32043.AAzwpZ.rst | 2 - .../2017-11-24-01-13-58.bpo-32096.CQTHXJ.rst | 4 - .../2017-11-26-14-36-30.bpo-32137.Stj5nL.rst | 2 - .../2017-11-27-08-37-34.bpo-10544.07nioT.rst | 3 - .../2017-12-02-21-37-22.bpo-32176.Wt25-N.rst | 5 - .../2017-11-21-10-54-16.bpo-32105.91mhWm.rst | 1 - .../2017-10-12-00-51-29.bpo-13802.VwjZRD.rst | 8 - .../2017-10-17-13-26-13.bpo-28603.TMEQfp.rst | 2 - .../2017-10-21-15-41-53.bpo-31836.fheLME.rst | 4 - .../2017-10-24-16-21-50.bpo-31860.gECuWx.rst | 2 - .../2017-10-26-20-20-19.bpo-31858.VuSA_e.rst | 4 - .../2017-11-21-08-26-08.bpo-32100.P43qx2.rst | 2 - .../2017-11-28-21-47-15.bpo-32164.2T2Na8.rst | 2 - .../2017-12-04-15-04-43.bpo-32207.IzyAJo.rst | 6 - .../2017-07-05-14-48-26.bpo-30553.Oupsxo.rst | 2 - .../2017-08-22-11-05-35.bpo-31245.AniZuz.rst | 1 - .../2017-08-30-17-59-36.bpo-31308.KbexyC.rst | 2 - .../2017-08-30-18-23-54.bpo-31310.7D1UNt.rst | 1 - .../2017-09-04-00-22-31.bpo-31334.9WYRfi.rst | 3 - .../2017-09-07-12-50-28.bpo-31307.AVBiNY.rst | 2 - .../2017-09-29-19-19-36.bpo-15037.ykimLK.rst | 1 - .../2017-10-04-11-37-14.bpo-31632.LiOC3C.rst | 2 - .../2017-10-04-20-36-28.bpo-31664.4VDUzo.rst | 1 - .../2017-10-05-12-45-29.bpo-30349.6zKJsF.rst | 3 - .../2017-10-05-15-14-46.bpo-31690.f0XteV.rst | 2 - .../2017-10-06-04-35-31.bpo-31620.gksLA1.rst | 2 - .../2017-10-11-00-45-01.bpo-31752.DhWevN.rst | 1 - .../2017-10-11-22-18-04.bpo-31764.EMyIkK.rst | 2 - .../2017-10-12-18-45-38.bpo-31770.GV3MPx.rst | 2 - .../2017-10-12-19-05-54.bpo-30143.25_hU1.rst | 2 - .../2017-10-13-23-35-47.bpo-31784.6e57bd.rst | 5 - .../2017-10-17-12-04-37.bpo-30541.q3BM6C.rst | 2 - .../2017-10-17-12-29-18.bpo-28603.tGuX2C.rst | 3 - .../2017-10-17-20-08-19.bpo-31800.foOSCi.rst | 3 - .../2017-10-17-22-55-13.bpo-31803.YLL1gJ.rst | 2 - .../2017-10-17-23-27-03.bpo-31806.TzphdL.rst | 4 - .../2017-10-18-16-48-09.bpo-31457._ovmzp.rst | 1 - .../2017-10-18-19-05-17.bpo-31457.KlE6r8.rst | 2 - .../2017-10-19-20-03-13.bpo-31819.mw2wF9.rst | 1 - .../2017-10-20-12-57-52.bpo-31756.IxCvGB.rst | 3 - .../2017-10-20-16-12-01.bpo-31827.7R8s8s.rst | 3 - .../2017-10-21-09-13-16.bpo-20825.-1MBEy.rst | 3 - .../2017-10-22-11-06-02.bpo-28326.rxh7L4.rst | 1 - .../2017-10-22-12-43-03.bpo-31653.ttfGvq.rst | 2 - .../2017-10-23-12-05-33.bpo-28416.Ldnw8X.rst | 3 - .../2017-10-23-16-22-54.bpo-28564.Tx-l-I.rst | 2 - .../2017-10-23-20-03-36.bpo-28292.1Gkim2.rst | 5 - .../2017-10-23-23-27-52.bpo-31834.InwC6O.rst | 2 - .../Library/2017-10-23.bpo-31854.fh8334f.rst | 1 - .../2017-10-24-12-00-16.bpo-30768.Om8Yj_.rst | 3 - .../2017-10-24-12-24-56.bpo-30639.ptNM9a.rst | 2 - .../2017-10-24-21-10-44.bpo-31702.SfwJDI.rst | 2 - .../2017-10-26-14-54-38.bpo-28281.7ZN5FG.rst | 3 - .../Library/2017-10-27.bpo-31884.bjhre9.rst | 1 - .../2017-10-29-11-23-24.bpo-31891.9kAPha.rst | 1 - .../2017-10-29-13-51-01.bpo-31893.8LZKEz.rst | 2 - .../2017-10-29-17-52-40.bpo-25720.vSvb5h.rst | 2 - .../2017-10-30-11-04-56.bpo-31897.yjwdEb.rst | 2 - .../2017-11-01-03-28-24.bpo-31917.DYQL0g.rst | 2 - .../2017-11-01-18-13-42.bpo-27666.j2zRnF.rst | 3 - .../2017-11-02-18-26-40.bpo-31927.40K6kp.rst | 3 - .../2017-11-02-22-26-16.bpo-21423.hw5mEh.rst | 1 - .../2017-11-03-08-36-03.bpo-31933.UrtoMP.rst | 2 - .../2017-11-03-19-11-43.bpo-30057.NCaijI.rst | 1 - .../2017-11-03-22-05-47.bpo-9678.oD51q6.rst | 6 - .../2017-11-04-19-28-08.bpo-31943.bxw5gM.rst | 1 - .../2017-11-05-01-17-12.bpo-31945.TLPBtS.rst | 3 - .../2017-11-07-00-37-50.bpo-31843.lM2gkR.rst | 2 - .../2017-11-07-14-20-09.bpo-31970.x4EN_9.rst | 1 - .../2017-11-07-15-19-52.bpo-21862.RwietE.rst | 2 - .../2017-11-08-16-51-52.bpo-31985.dE_fOB.rst | 4 - .../2017-11-09-21-36-32.bpo-31976.EOA7qY.rst | 2 - .../2017-11-10-16-27-26.bpo-28369.IS74nd.rst | 4 - .../2017-11-12-20-47-59.bpo-32011.NzVDdZ.rst | 2 - .../2017-11-13-17-48-33.bpo-32015.4nqRTD.rst | 2 - .../2017-11-15-13-44-28.bpo-32034.uHAOmu.rst | 1 - .../2017-11-15-19-04-22.bpo-32037.r8-5Nk.rst | 4 - .../2017-11-15-20-03-45.bpo-32025.lnIKYT.rst | 1 - .../2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst | 2 - .../2017-11-16-20-09-45.bpo-32046.9sGDtw.rst | 2 - .../2017-11-17-18-28-53.bpo-32066.OMQFLH.rst | 2 - .../2017-11-18-17-09-01.bpo-32069.S0wyy4.rst | 1 - .../2017-11-18-21-13-52.bpo-32072.nwDV8L.rst | 6 - .../2017-11-20-01-01-01.bpo-25054.rOlRV6.rst | 1 - ...2017-11-20-01-29-46.bpo-1647489.-ZNNkh.rst | 3 - .../2017-11-20-15-28-31.bpo-32088.mV-4Nu.rst | 3 - .../2017-11-21-16-05-35.bpo-27535.JLhcNz.rst | 4 - .../2017-11-22-09-44-15.bpo-32110.VJa9bo.rst | 3 - .../2017-11-22-12-54-46.bpo-28684.NLiDKZ.rst | 5 - .../2017-11-22-17-21-01.bpo-10049.ttsBqb.rst | 3 - .../2017-11-22-19-52-17.bpo-32071.4WNhUH.rst | 2 - .../2017-11-23-16-15-55.bpo-19610.Dlca2P.rst | 4 - .../2017-11-23-21-47-36.bpo-12382.xWT9k0.rst | 2 - .../2017-11-23-22-12-11.bpo-31325.8jAUxN.rst | 5 - .../2017-11-24-00-59-12.bpo-32121.ePbmwC.rst | 6 - .../2017-11-24-11-50-41.bpo-28334.3gGGlt.rst | 3 - .../2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst | 2 - .../2017-11-26-17-00-52.bpo-23033.YGXRWT.rst | 3 - .../2017-11-26-18-48-17.bpo-32107.h2ph2K.rst | 5 - .../2017-11-27-11-29-34.bpo-32089.6ydDYv.rst | 3 - .../2017-11-28-15-27-10.bpo-32154.kDox7L.rst | 5 - .../2017-11-29-00-42-47.bpo-321010.-axD5l.rst | 1 - .../2017-11-30-20-38-16.bpo-32186.O42bVe.rst | 3 - .../2017-12-02-16-06-00.bpo-27240.Kji34M.rst | 3 - .../2017-12-04-15-51-57.bpo-32214.uozdNj.rst | 2 - .../2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst | 3 - .../2017-10-24-11-36-10.bpo-31174.xCvXcr.rst | 3 - .../2017-11-24-18-15-12.bpo-32126.PLmNLn.rst | 2 - .../2017-11-25-14-53-29.bpo-28668.Y1G6pA.rst | 3 - .../2017-11-26-17-11-27.bpo-32136.Y11luJ.rst | 3 - .../2017-11-27-16-18-58.bpo-32138.QsTvf-.rst | 2 - .../2017-11-30-12-27-10.bpo-31705.yULW7O.rst | 3 - .../2017-12-04-23-19-16.bpo-31380.VlMmHW.rst | 1 - .../2017-10-23-19-45-52.bpo-30722.ioRlAu.rst | 9 - .../2017-11-28-21-24-41.bpo-32159.RSl4QK.rst | 3 - .../2017-10-23-18-35-50.bpo-31857.YwhEvc.rst | 2 - .../2017-10-26-23-02-57.bpo-20486.3IdsZ1.rst | 2 - .../2017-11-04-15-29-47.bpo-31944.0Bx8tZ.rst | 1 - .../2017-11-19-09-46-27.bpo-1102.NY-g1F.rst | 4 - .../2017-12-04-21-57-43.bpo-31392.f8huBC.rst | 1 - 156 files changed, 1640 insertions(+), 409 deletions(-) create mode 100644 Misc/NEWS.d/3.7.0a3.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-10-24-23-21-13.bpo-31866.MkNO66.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-01-14-16-27.bpo-28643.9iPKJy.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-02-20-30-57.bpo-28791.VaE3o8.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-03-10-07-14.bpo-31926.57wE98.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-03-15-17-50.bpo-31934.8bUlpv.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-04-15-35-08.bpo-31609.k7_nBR.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-06-11-53-39.bpo-31957.S_1jFK.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-18-11-19-28.bpo-32059.a0Hxgp.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-21-17-12-24.bpo-28762.R6uu8w.rst delete mode 100644 Misc/NEWS.d/next/Build/2017-11-21-17-27-59.bpo-28538.DsNBS7.rst delete mode 100644 Misc/NEWS.d/next/C API/2017-06-30-11-58-01.bpo-30697.Q3T_8n.rst delete mode 100644 Misc/NEWS.d/next/C API/2017-10-19-15-27-04.bpo-23699.-noVVc.rst delete mode 100644 Misc/NEWS.d/next/C API/2017-10-22-13-12-28.bpo-25612.1jnWKT.rst delete mode 100644 Misc/NEWS.d/next/C API/2017-11-24-21-25-43.bpo-32125.K8zWgn.rst delete mode 100644 Misc/NEWS.d/next/C API/2017-11-30-18-13-45.bpo-20891.wBnMdF.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-01-15-48-03.bpo-31626.reLPxY.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-13-20-01-47.bpo-31781.cXE9SM.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-15-23-44-57.bpo-31786.XwdEP4.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-17-13-29-19.bpo-28603._-oia3.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-18-19-41-12.bpo-31618.liLDiS.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-20-14-07-46.bpo-31825.gJvmGW.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-23-23-39-26.bpo-28936.C288Jh.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-24-21-27-32.bpo-31845.8OS-k3.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-25-15-51-37.bpo-21720.BwIKLP.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-28-19-11-05.bpo-20047.GuNAto.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-28-22-06-03.bpo-30696.lhC3HE.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-05-16-11-07.bpo-31949.2yNC_z.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-12-11-44-22.bpo-28180.HQX000.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-13-00-37-11.bpo-32012.Kprjqe.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-15-10-49-35.bpo-32023.XnCGT5.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-16-03-44-08.bpo-32043.AAzwpZ.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-24-01-13-58.bpo-32096.CQTHXJ.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-26-14-36-30.bpo-32137.Stj5nL.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-11-27-08-37-34.bpo-10544.07nioT.rst delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-12-02-21-37-22.bpo-32176.Wt25-N.rst delete mode 100644 Misc/NEWS.d/next/Documentation/2017-11-21-10-54-16.bpo-32105.91mhWm.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-10-17-13-26-13.bpo-28603.TMEQfp.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-10-24-16-21-50.bpo-31860.gECuWx.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-10-26-20-20-19.bpo-31858.VuSA_e.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-11-21-08-26-08.bpo-32100.P43qx2.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-11-28-21-47-15.bpo-32164.2T2Na8.rst delete mode 100644 Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-07-05-14-48-26.bpo-30553.Oupsxo.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-08-22-11-05-35.bpo-31245.AniZuz.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-08-30-17-59-36.bpo-31308.KbexyC.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-08-30-18-23-54.bpo-31310.7D1UNt.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-09-04-00-22-31.bpo-31334.9WYRfi.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-09-07-12-50-28.bpo-31307.AVBiNY.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-09-29-19-19-36.bpo-15037.ykimLK.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-04-11-37-14.bpo-31632.LiOC3C.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-04-20-36-28.bpo-31664.4VDUzo.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-05-12-45-29.bpo-30349.6zKJsF.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-05-15-14-46.bpo-31690.f0XteV.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-06-04-35-31.bpo-31620.gksLA1.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-11-00-45-01.bpo-31752.DhWevN.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-11-22-18-04.bpo-31764.EMyIkK.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-12-18-45-38.bpo-31770.GV3MPx.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-12-19-05-54.bpo-30143.25_hU1.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-13-23-35-47.bpo-31784.6e57bd.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-17-12-04-37.bpo-30541.q3BM6C.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-17-12-29-18.bpo-28603.tGuX2C.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-17-20-08-19.bpo-31800.foOSCi.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-17-22-55-13.bpo-31803.YLL1gJ.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-17-23-27-03.bpo-31806.TzphdL.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-18-16-48-09.bpo-31457._ovmzp.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-18-19-05-17.bpo-31457.KlE6r8.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-19-20-03-13.bpo-31819.mw2wF9.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-20-12-57-52.bpo-31756.IxCvGB.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-20-16-12-01.bpo-31827.7R8s8s.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-21-09-13-16.bpo-20825.-1MBEy.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-22-11-06-02.bpo-28326.rxh7L4.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-22-12-43-03.bpo-31653.ttfGvq.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-23-12-05-33.bpo-28416.Ldnw8X.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-23-16-22-54.bpo-28564.Tx-l-I.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-23-20-03-36.bpo-28292.1Gkim2.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-23-23-27-52.bpo-31834.InwC6O.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-23.bpo-31854.fh8334f.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-24-12-00-16.bpo-30768.Om8Yj_.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-24-12-24-56.bpo-30639.ptNM9a.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-24-21-10-44.bpo-31702.SfwJDI.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-26-14-54-38.bpo-28281.7ZN5FG.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-29-11-23-24.bpo-31891.9kAPha.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-29-13-51-01.bpo-31893.8LZKEz.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-29-17-52-40.bpo-25720.vSvb5h.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-10-30-11-04-56.bpo-31897.yjwdEb.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-01-03-28-24.bpo-31917.DYQL0g.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-01-18-13-42.bpo-27666.j2zRnF.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-02-18-26-40.bpo-31927.40K6kp.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-02-22-26-16.bpo-21423.hw5mEh.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-03-08-36-03.bpo-31933.UrtoMP.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-03-22-05-47.bpo-9678.oD51q6.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-04-19-28-08.bpo-31943.bxw5gM.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-05-01-17-12.bpo-31945.TLPBtS.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-07-00-37-50.bpo-31843.lM2gkR.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-07-14-20-09.bpo-31970.x4EN_9.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-07-15-19-52.bpo-21862.RwietE.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-08-16-51-52.bpo-31985.dE_fOB.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-09-21-36-32.bpo-31976.EOA7qY.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-10-16-27-26.bpo-28369.IS74nd.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-12-20-47-59.bpo-32011.NzVDdZ.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-13-17-48-33.bpo-32015.4nqRTD.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-15-13-44-28.bpo-32034.uHAOmu.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-15-19-04-22.bpo-32037.r8-5Nk.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-15-20-03-45.bpo-32025.lnIKYT.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-16-20-09-45.bpo-32046.9sGDtw.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-17-18-28-53.bpo-32066.OMQFLH.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-18-17-09-01.bpo-32069.S0wyy4.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-18-21-13-52.bpo-32072.nwDV8L.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-20-01-01-01.bpo-25054.rOlRV6.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-20-01-29-46.bpo-1647489.-ZNNkh.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-20-15-28-31.bpo-32088.mV-4Nu.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-21-16-05-35.bpo-27535.JLhcNz.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-22-09-44-15.bpo-32110.VJa9bo.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-22-12-54-46.bpo-28684.NLiDKZ.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-22-17-21-01.bpo-10049.ttsBqb.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-22-19-52-17.bpo-32071.4WNhUH.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-23-21-47-36.bpo-12382.xWT9k0.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-23-22-12-11.bpo-31325.8jAUxN.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-24-00-59-12.bpo-32121.ePbmwC.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-24-11-50-41.bpo-28334.3gGGlt.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-26-17-00-52.bpo-23033.YGXRWT.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-26-18-48-17.bpo-32107.h2ph2K.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-27-11-29-34.bpo-32089.6ydDYv.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-28-15-27-10.bpo-32154.kDox7L.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-29-00-42-47.bpo-321010.-axD5l.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-11-30-20-38-16.bpo-32186.O42bVe.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-12-02-16-06-00.bpo-27240.Kji34M.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst delete mode 100644 Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-10-24-11-36-10.bpo-31174.xCvXcr.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-11-24-18-15-12.bpo-32126.PLmNLn.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-11-25-14-53-29.bpo-28668.Y1G6pA.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-11-26-17-11-27.bpo-32136.Y11luJ.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-11-27-16-18-58.bpo-32138.QsTvf-.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-11-30-12-27-10.bpo-31705.yULW7O.rst delete mode 100644 Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst delete mode 100644 Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst delete mode 100644 Misc/NEWS.d/next/Tools-Demos/2017-11-28-21-24-41.bpo-32159.RSl4QK.rst delete mode 100644 Misc/NEWS.d/next/Windows/2017-10-23-18-35-50.bpo-31857.YwhEvc.rst delete mode 100644 Misc/NEWS.d/next/Windows/2017-10-26-23-02-57.bpo-20486.3IdsZ1.rst delete mode 100644 Misc/NEWS.d/next/Windows/2017-11-04-15-29-47.bpo-31944.0Bx8tZ.rst delete mode 100644 Misc/NEWS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst delete mode 100644 Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 2c52b54840925ce..bb9c1efbd0d6310 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon Oct 16 23:39:41 2017 +# Autogenerated by Sphinx on Tue Dec 5 03:14:53 2017 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -2686,7 +2686,6 @@ ' mgr = (EXPR)\n' ' aexit = type(mgr).__aexit__\n' ' aenter = type(mgr).__aenter__(mgr)\n' - ' exc = True\n' '\n' ' VAR = await aenter\n' ' try:\n' @@ -3424,11 +3423,11 @@ ' 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). If given, "header" is printed to the console just ' + ' fails). If given, *header* is printed to the console just ' 'before\n' ' debugging begins.\n' '\n' - ' New in version 3.7: The keyword-only argument "header".\n' + ' Changed in version 3.7: The keyword-only argument *header*.\n' '\n' 'pdb.post_mortem(traceback=None)\n' '\n' @@ -5669,13 +5668,13 @@ 'They must\n' 'be spelled exactly as written here:\n' '\n' - ' False class finally is return\n' - ' None continue for lambda try\n' - ' True def from nonlocal while\n' - ' and del global not with\n' - ' as elif if or yield\n' - ' assert else import pass\n' - ' break except in raise\n' + ' False await else import pass\n' + ' None break except in raise\n' + ' True class finally is return\n' + ' and continue for lambda try\n' + ' as def from nonlocal while\n' + ' assert del global not with\n' + ' async elif if or yield\n' '\n' '\n' 'Reserved classes of identifiers\n' diff --git a/Misc/NEWS.d/3.7.0a3.rst b/Misc/NEWS.d/3.7.0a3.rst new file mode 100644 index 000000000000000..516e41e48ecae35 --- /dev/null +++ b/Misc/NEWS.d/3.7.0a3.rst @@ -0,0 +1,1630 @@ +.. bpo: 32176 +.. date: 2017-12-02-21-37-22 +.. nonce: Wt25-N +.. release date: 2017-12-05 +.. section: Core and Builtins + +co_flags.CO_NOFREE is now always set correctly by the code object +constructor based on freevars and cellvars, rather than needing to be set +correctly by the caller. This ensures it will be cleared automatically when +additional cell references are injected into a modified code object and +function. + +.. + +.. bpo: 10544 +.. date: 2017-11-27-08-37-34 +.. nonce: 07nioT +.. section: Core and Builtins + +Yield expressions are now deprecated in comprehensions and generator +expressions. They are still permitted in the definition of the outermost +iterable, as that is evaluated directly in the enclosing scope. + +.. + +.. bpo: 32137 +.. date: 2017-11-26-14-36-30 +.. nonce: Stj5nL +.. section: Core and Builtins + +The repr of deeply nested dict now raises a RecursionError instead of +crashing due to a stack overflow. + +.. + +.. bpo: 32096 +.. date: 2017-11-24-01-13-58 +.. nonce: CQTHXJ +.. section: Core and Builtins + +Revert memory allocator changes in the C API: move structures back from +_PyRuntime to Objects/obmalloc.c. The memory allocators are once again +initialized statically, and so PyMem_RawMalloc() and Py_DecodeLocale() can +be called before _PyRuntime_Initialize(). + +.. + +.. bpo: 32043 +.. date: 2017-11-16-03-44-08 +.. nonce: AAzwpZ +.. section: Core and Builtins + +Add a new "developer mode": new "-X dev" command line option to enable debug +checks at runtime. + +.. + +.. bpo: 32023 +.. date: 2017-11-15-10-49-35 +.. nonce: XnCGT5 +.. section: Core and Builtins + +SyntaxError is now correctly raised when a generator expression without +parenthesis is used instead of an inheritance list in a class definition. +The duplication of the parentheses can be omitted only on calls. + +.. + +.. bpo: 32012 +.. date: 2017-11-13-00-37-11 +.. nonce: Kprjqe +.. section: Core and Builtins + +SyntaxError is now correctly raised when a generator expression without +parenthesis is passed as an argument, but followed by a trailing comma. A +generator expression always needs to be directly inside a set of parentheses +and cannot have a comma on either side. + +.. + +.. bpo: 28180 +.. date: 2017-11-12-11-44-22 +.. nonce: HQX000 +.. section: Core and Builtins + +A new internal ``_Py_SetLocaleFromEnv(category)`` helper function has been +added in order to improve the consistency of behaviour across different +``libc`` implementations (e.g. Android doesn't support setting the locale +from the environment by default). + +.. + +.. bpo: 31949 +.. date: 2017-11-05-16-11-07 +.. nonce: 2yNC_z +.. section: Core and Builtins + +Fixed several issues in printing tracebacks (PyTraceBack_Print()). + +* Setting sys.tracebacklimit to 0 or less now suppresses printing tracebacks. +* Setting sys.tracebacklimit to None now causes using the default limit. +* Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using + the limit LONG_MAX rather than the default limit. +* Fixed integer overflows in the case of more than 2**31 traceback items on + Windows. +* Fixed output errors handling. + +.. + +.. bpo: 30696 +.. date: 2017-10-28-22-06-03 +.. nonce: lhC3HE +.. section: Core and Builtins + +Fix the interactive interpreter looping endlessly when no memory. + +.. + +.. bpo: 20047 +.. date: 2017-10-28-19-11-05 +.. nonce: GuNAto +.. section: Core and Builtins + +Bytearray methods partition() and rpartition() now accept only bytes-like +objects as separator, as documented. In particular they now raise TypeError +rather of returning a bogus result when an integer is passed as a separator. + +.. + +.. bpo: 21720 +.. date: 2017-10-25-15-51-37 +.. nonce: BwIKLP +.. section: Core and Builtins + +BytesWarning no longer emitted when the *fromlist* argument of +``__import__()`` or the ``__all__`` attribute of the module contain bytes +instances. + +.. + +.. bpo: 31845 +.. date: 2017-10-24-21-27-32 +.. nonce: 8OS-k3 +.. section: Core and Builtins + +Environment variables are once more read correctly at interpreter startup. + +.. + +.. bpo: 28936 +.. date: 2017-10-23-23-39-26 +.. nonce: C288Jh +.. section: Core and Builtins + +Ensure that lexically first syntax error involving a parameter and +``global`` or ``nonlocal`` is detected first at a given scope. Patch by Ivan +Levkivskyi. + +.. + +.. bpo: 31825 +.. date: 2017-10-20-14-07-46 +.. nonce: gJvmGW +.. section: Core and Builtins + +Fixed OverflowError in the 'unicode-escape' codec and in +codecs.escape_decode() when decode an escaped non-ascii byte. + +.. + +.. bpo: 31618 +.. date: 2017-10-18-19-41-12 +.. nonce: liLDiS +.. section: Core and Builtins + +The per-frame tracing logic added in 3.7a1 has been altered so that +``frame->f_lineno`` is updated before either ``"line"`` or ``"opcode"`` +events are emitted. Previously, opcode events were emitted first, and +therefore would occasionally see stale line numbers on the frame. The +behavior of this feature has changed slightly as a result: when both +``f_trace_lines`` and ``f_trace_opcodes`` are enabled, line events now occur +first. + +.. + +.. bpo: 28603 +.. date: 2017-10-17-13-29-19 +.. nonce: _-oia3 +.. section: Core and Builtins + +Print the full context/cause chain of exceptions on interpreter exit, even +if an exception in the chain is unhashable or compares equal to later ones. +Patch by Zane Bitter. + +.. + +.. bpo: 31786 +.. date: 2017-10-15-23-44-57 +.. nonce: XwdEP4 +.. section: Core and Builtins + +Fix timeout rounding in the select module to round correctly negative +timeouts between -1.0 and 0.0. The functions now block waiting for events as +expected. Previously, the call was incorrectly non-blocking. Patch by Pablo +Galindo. + +.. + +.. bpo: 31781 +.. date: 2017-10-13-20-01-47 +.. nonce: cXE9SM +.. section: Core and Builtins + +Prevent crashes when calling methods of an uninitialized +``zipimport.zipimporter`` object. Patch by Oren Milman. + +.. + +.. bpo: 30399 +.. date: 2017-10-12-22-21-01 +.. nonce: 45f1gv +.. section: Core and Builtins + +Standard repr() of BaseException with a single argument no longer contains +redundant trailing comma. + +.. + +.. bpo: 31626 +.. date: 2017-10-01-15-48-03 +.. nonce: reLPxY +.. section: Core and Builtins + +Fixed a bug in debug memory allocator. There was a write to freed memory +after shrinking a memory block. + +.. + +.. bpo: 30817 +.. date: 2017-07-01-15-11-13 +.. nonce: j7ZvN_ +.. section: Core and Builtins + +`PyErr_PrintEx()` clears now the ignored exception that may be raised by +`_PySys_SetObjectId()`, for example when no memory. + +.. + +.. bpo: 28556 +.. date: 2017-12-05-02-03-07 +.. nonce: 9Z_PsJ +.. section: Library + +Two minor fixes for ``typing`` module: allow shallow copying instances of +generic classes, improve interaction of ``__init_subclass__`` with generics. +Original PRs by Ivan Levkivskyi. + +.. + +.. bpo: 32214 +.. date: 2017-12-04-15-51-57 +.. nonce: uozdNj +.. section: Library + +PEP 557, Data Classes. Provides a decorator which adds boilerplate methods +to classes which use type annotations so specify fields. + +.. + +.. bpo: 27240 +.. date: 2017-12-02-16-06-00 +.. nonce: Kji34M +.. section: Library + +The header folding algorithm for the new email policies has been rewritten, +which also fixes bpo-30788, bpo-31831, and bpo-32182. In particular, +RFC2231 folding is now done correctly. + +.. + +.. bpo: 32186 +.. date: 2017-11-30-20-38-16 +.. nonce: O42bVe +.. section: Library + +io.FileIO.readall() and io.FileIO.read() now release the GIL when getting +the file size. Fixed hang of all threads with inaccessible NFS server. Patch +by Nir Soffer. + +.. + +.. bpo: 321010 +.. date: 2017-11-29-00-42-47 +.. nonce: -axD5l +.. section: Library + +Add :attr:`sys.flags.dev_mode` flag + +.. + +.. bpo: 32154 +.. date: 2017-11-28-15-27-10 +.. nonce: kDox7L +.. section: Library + +The ``asyncio.windows_utils.socketpair()`` function has been removed: use +directly :func:`socket.socketpair` which is available on all platforms since +Python 3.5 (before, it wasn't available on Windows). +``asyncio.windows_utils.socketpair()`` was just an alias to +``socket.socketpair`` on Python 3.5 and newer. + +.. + +.. bpo: 32089 +.. date: 2017-11-27-11-29-34 +.. nonce: 6ydDYv +.. section: Library + +warnings: In development (-X dev) and debug mode (pydebug build), use the +"default" action for ResourceWarning, rather than the "always" action, in +the default warnings filters. + +.. + +.. bpo: 32107 +.. date: 2017-11-26-18-48-17 +.. nonce: h2ph2K +.. section: Library + +``uuid.getnode()`` now preferentially returns universally administered MAC +addresses if available, over locally administered MAC addresses. This makes +a better guarantee for global uniqueness of UUIDs returned from +``uuid.uuid1()``. If only locally administered MAC addresses are available, +the first such one found is returned. + +.. + +.. bpo: 23033 +.. date: 2017-11-26-17-00-52 +.. nonce: YGXRWT +.. section: Library + +Wildcard is now supported in hostname when it is one and only character in +the left most segment of hostname in second argument of +:meth:`ssl.match_hostname`. Patch by Mandeep Singh. + +.. + +.. bpo: 12239 +.. date: 2017-11-24-14-07-55 +.. nonce: Nj3A0x +.. section: Library + +Make :meth:`msilib.SummaryInformation.GetProperty` return ``None`` when the +value of property is ``VT_EMPTY``. Initial patch by Mark Mc Mahon. + +.. + +.. bpo: 28334 +.. date: 2017-11-24-11-50-41 +.. nonce: 3gGGlt +.. section: Library + +Use :func:`os.path.expanduser` to find the ``~/.netrc`` file in +:class:`netrc.netrc`. If it does not exist, :exc:`FileNotFoundError` is +raised. Patch by Dimitri Merejkowsky. + +.. + +.. bpo: 32121 +.. date: 2017-11-24-00-59-12 +.. nonce: ePbmwC +.. section: Library + +Made ``tracemalloc.Traceback`` behave more like the traceback module, +sorting the frames from oldest to most recent. ``Traceback.format()`` now +accepts negative *limit*, truncating the result to the ``abs(limit)`` oldest +frames. To get the old behaviour, one can use the new *most_recent_first* +argument to ``Traceback.format()``. (Patch by Jesse Bakker.) + +.. + +.. bpo: 31325 +.. date: 2017-11-23-22-12-11 +.. nonce: 8jAUxN +.. section: Library + +Fix wrong usage of :func:`collections.namedtuple` in the +:meth:`RobotFileParser.parse() ` +method. + +Initial patch by Robin Wellner. + +.. + +.. bpo: 12382 +.. date: 2017-11-23-21-47-36 +.. nonce: xWT9k0 +.. section: Library + +:func:`msilib.OpenDatabase` now raises a better exception message when it +couldn't open or create an MSI file. Initial patch by William Tisäter. + +.. + +.. bpo: 19610 +.. date: 2017-11-23-16-15-55 +.. nonce: Dlca2P +.. section: Library + +``setup()`` now warns about invalid types for some fields. + +The ``distutils.dist.Distribution`` class now warns when ``classifiers``, +``keywords`` and ``platforms`` fields are not specified as a list or a +string. + +.. + +.. bpo: 32071 +.. date: 2017-11-22-19-52-17 +.. nonce: 4WNhUH +.. section: Library + +Added the ``-k`` command-line option to ``python -m unittest`` to run only +tests that match the given pattern(s). + +.. + +.. bpo: 10049 +.. date: 2017-11-22-17-21-01 +.. nonce: ttsBqb +.. section: Library + +Added *nullcontext* no-op context manager to contextlib. This provides a +simpler and faster alternative to ExitStack() when handling optional context +managers. + +.. + +.. bpo: 28684 +.. date: 2017-11-22-12-54-46 +.. nonce: NLiDKZ +.. section: Library + +The new test.support.skip_unless_bind_unix_socket() decorator is used here +to skip asyncio tests that fail because the platform lacks a functional +bind() function for unix domain sockets (as it is the case for non root +users on the recent Android versions that run now SELinux in enforcing +mode). + +.. + +.. bpo: 32110 +.. date: 2017-11-22-09-44-15 +.. nonce: VJa9bo +.. section: Library + +``codecs.StreamReader.read(n)`` now returns not more than *n* +characters/bytes for non-negative *n*. This makes it compatible with +``read()`` methods of other file-like objects. + +.. + +.. bpo: 27535 +.. date: 2017-11-21-16-05-35 +.. nonce: JLhcNz +.. section: Library + +The warnings module doesn't leak memory anymore in the hidden warnings +registry for the "ignore" action of warnings filters. warn_explicit() +function doesn't add the warning key to the registry anymore for the +"ignore" action. + +.. + +.. bpo: 32088 +.. date: 2017-11-20-15-28-31 +.. nonce: mV-4Nu +.. section: Library + +warnings: When Python is build is debug mode (``Py_DEBUG``), +:exc:`DeprecationWarning`, :exc:`PendingDeprecationWarning` and +:exc:`ImportWarning` warnings are now displayed by default. + +.. + +.. bpo: 1647489 +.. date: 2017-11-20-01-29-46 +.. nonce: -ZNNkh +.. section: Library + +Fixed searching regular expression patterns that could match an empty +string. Non-empty string can now be correctly found after matching an empty +string. + +.. + +.. bpo: 25054 +.. date: 2017-11-20-01-01-01 +.. nonce: rOlRV6 +.. section: Library + +Added support of splitting on a pattern that could match an empty string. + +.. + +.. bpo: 32072 +.. date: 2017-11-18-21-13-52 +.. nonce: nwDV8L +.. section: Library + +Fixed issues with binary plists: + +* Fixed saving bytearrays. +* Identical objects will be saved only once. +* Equal references will be load as identical objects. +* Added support for saving and loading recursive data structures. + +.. + +.. bpo: 32069 +.. date: 2017-11-18-17-09-01 +.. nonce: S0wyy4 +.. section: Library + +Drop legacy SSL transport from asyncio, ssl.MemoryBIO is always used anyway. + +.. + +.. bpo: 32066 +.. date: 2017-11-17-18-28-53 +.. nonce: OMQFLH +.. section: Library + +asyncio: Support pathlib.Path in create_unix_connection; sock arg should be +optional + +.. + +.. bpo: 32046 +.. date: 2017-11-16-20-09-45 +.. nonce: 9sGDtw +.. section: Library + +Updates 2to3 to convert from operator.isCallable(obj) to callable(obj). +Patch by Dong-hee Na. + +.. + +.. bpo: 32018 +.. date: 2017-11-16-02-32-41 +.. nonce: YMQ7Q2 +.. section: Library + +inspect.signature should follow PEP 8, if the parameter has an annotation +and a default value. Patch by Dong-hee Na. + +.. + +.. bpo: 32025 +.. date: 2017-11-15-20-03-45 +.. nonce: lnIKYT +.. section: Library + +Add time.thread_time() and time.thread_time_ns() + +.. + +.. bpo: 32037 +.. date: 2017-11-15-19-04-22 +.. nonce: r8-5Nk +.. section: Library + +Integers that fit in a signed 32-bit integer will be now pickled with +protocol 0 using the INT opcode. This will decrease the size of a pickle, +speed up pickling and unpickling, and make these integers be unpickled as +int instances in Python 2. + +.. + +.. bpo: 32034 +.. date: 2017-11-15-13-44-28 +.. nonce: uHAOmu +.. section: Library + +Make asyncio.IncompleteReadError and LimitOverrunError pickleable. + +.. + +.. bpo: 32015 +.. date: 2017-11-13-17-48-33 +.. nonce: 4nqRTD +.. section: Library + +Fixed the looping of asyncio in the case of reconnection the socket during +waiting async read/write from/to the socket. + +.. + +.. bpo: 32011 +.. date: 2017-11-12-20-47-59 +.. nonce: NzVDdZ +.. section: Library + +Restored support of loading marshal files with the TYPE_INT64 code. These +files can be produced in Python 2.7. + +.. + +.. bpo: 28369 +.. date: 2017-11-10-16-27-26 +.. nonce: IS74nd +.. section: Library + +Enhance add_reader/writer check that socket is not used by some transport. +Before, only cases when add_reader/writer were called with an int FD were +supported. Now the check is implemented correctly for all file-like +objects. + +.. + +.. bpo: 31976 +.. date: 2017-11-09-21-36-32 +.. nonce: EOA7qY +.. section: Library + +Fix race condition when flushing a file is slow, which can cause a segfault +if closing the file from another thread. + +.. + +.. bpo: 31985 +.. date: 2017-11-08-16-51-52 +.. nonce: dE_fOB +.. section: Library + +Formally deprecated aifc.openfp, sunau.openfp, and wave.openfp. Since change +7bc817d5ba917528e8bd07ec461c635291e7b06a in 1993, openfp in each of the +three modules had been pointing to that module's open funciton as a matter +of backwards compatibility, though it had been both untested and +undocumented. + +.. + +.. bpo: 21862 +.. date: 2017-11-07-15-19-52 +.. nonce: RwietE +.. section: Library + +cProfile command line now accepts `-m module_name` as an alternative to +script path. Patch by Sanyam Khurana. + +.. + +.. bpo: 31970 +.. date: 2017-11-07-14-20-09 +.. nonce: x4EN_9 +.. section: Library + +Reduce performance overhead of asyncio debug mode. + +.. + +.. bpo: 31843 +.. date: 2017-11-07-00-37-50 +.. nonce: lM2gkR +.. section: Library + +*database* argument of sqlite3.connect() now accepts a :term:`path-like +object`, instead of just a string. + +.. + +.. bpo: 31945 +.. date: 2017-11-05-01-17-12 +.. nonce: TLPBtS +.. section: Library + +Add Configurable *blocksize* to ``HTTPConnection`` and ``HTTPSConnection`` +for improved upload throughput. Patch by Nir Soffer. + +.. + +.. bpo: 31943 +.. date: 2017-11-04-19-28-08 +.. nonce: bxw5gM +.. section: Library + +Add a ``cancelled()`` method to :class:`asyncio.Handle`. Patch by Marat +Sharafutdinov. + +.. + +.. bpo: 9678 +.. date: 2017-11-03-22-05-47 +.. nonce: oD51q6 +.. section: Library + +Fixed determining the MAC address in the uuid module: + +* Using ifconfig on NetBSD and OpenBSD. +* Using arp on Linux, FreeBSD, NetBSD and OpenBSD. + +Based on patch by Takayuki Shimizukawa. + +.. + +.. bpo: 30057 +.. date: 2017-11-03-19-11-43 +.. nonce: NCaijI +.. section: Library + +Fix potential missed signal in signal.signal(). + +.. + +.. bpo: 31933 +.. date: 2017-11-03-08-36-03 +.. nonce: UrtoMP +.. section: Library + +Fix Blake2 params leaf_size and node_offset on big endian platforms. Patch +by Jack O'Connor. + +.. + +.. bpo: 21423 +.. date: 2017-11-02-22-26-16 +.. nonce: hw5mEh +.. section: Library + +Add an initializer argument to {Process,Thread}PoolExecutor + +.. + +.. bpo: 31927 +.. date: 2017-11-02-18-26-40 +.. nonce: 40K6kp +.. section: Library + +Fixed compilation of the socket module on NetBSD 8. Fixed assertion failure +or reading arbitrary data when parse a AF_BLUETOOTH address on NetBSD and +DragonFly BSD. + +.. + +.. bpo: 27666 +.. date: 2017-11-01-18-13-42 +.. nonce: j2zRnF +.. section: Library + +Fixed stack corruption in curses.box() and curses.ungetmouse() when the size +of types chtype or mmask_t is less than the size of C long. curses.box() +now accepts characters as arguments. Based on patch by Steve Fink. + +.. + +.. bpo: 31917 +.. date: 2017-11-01-03-28-24 +.. nonce: DYQL0g +.. section: Library + +Add 3 new clock identifiers: :data:`time.CLOCK_BOOTTIME`, +:data:`time.CLOCK_PROF` and :data:`time.CLOCK_UPTIME`. + +.. + +.. bpo: 31897 +.. date: 2017-10-30-11-04-56 +.. nonce: yjwdEb +.. section: Library + +plistlib now catches more errors when read binary plists and raises +InvalidFileException instead of unexpected exceptions. + +.. + +.. bpo: 25720 +.. date: 2017-10-29-17-52-40 +.. nonce: vSvb5h +.. section: Library + +Fix the method for checking pad state of curses WINDOW. Patch by Masayuki +Yamamoto. + +.. + +.. bpo: 31893 +.. date: 2017-10-29-13-51-01 +.. nonce: 8LZKEz +.. section: Library + +Fixed the layout of the kqueue_event structure on OpenBSD and NetBSD. Fixed +the comparison of the kqueue_event objects. + +.. + +.. bpo: 31891 +.. date: 2017-10-29-11-23-24 +.. nonce: 9kAPha +.. section: Library + +Fixed building the curses module on NetBSD. + +.. + +.. bpo: 31884 +.. date: 2017-10-27 +.. nonce: bjhre9 +.. section: Library + +added required constants to subprocess module for setting priotity on +windows + +.. + +.. bpo: 28281 +.. date: 2017-10-26-14-54-38 +.. nonce: 7ZN5FG +.. section: Library + +Remove year (1-9999) limits on the Calendar.weekday() function. + +Patch by Mark Gollahon. + +.. + +.. bpo: 31702 +.. date: 2017-10-24-21-10-44 +.. nonce: SfwJDI +.. section: Library + +crypt.mksalt() now allows to specify the number of rounds for SHA-256 and +SHA-512 hashing. + +.. + +.. bpo: 30639 +.. date: 2017-10-24-12-24-56 +.. nonce: ptNM9a +.. section: Library + +:func:`inspect.getfile` no longer computes the repr of unknown objects to +display in an error message, to protect against badly behaved custom reprs. + +.. + +.. bpo: 30768 +.. date: 2017-10-24-12-00-16 +.. nonce: Om8Yj_ +.. section: Library + +Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() +when called with timeout > 0 and intr_flag=0: recompute the timeout if +sem_timedwait() is interrupted by a signal (EINTR). See also the :pep:`475`. + +.. + +.. bpo: 31854 +.. date: 2017-10-23 +.. nonce: fh8334f +.. section: Library + +Add ``mmap.ACCESS_DEFAULT`` constant. + +.. + +.. bpo: 31834 +.. date: 2017-10-23-23-27-52 +.. nonce: InwC6O +.. section: Library + +Use optimized code for BLAKE2 only with SSSE3+. The pure SSE2 implementation +is slower than the pure C reference implementation. + +.. + +.. bpo: 28292 +.. date: 2017-10-23-20-03-36 +.. nonce: 1Gkim2 +.. section: Library + +Calendar.itermonthdates() will now consistently raise an exception when a +date falls outside of the 0001-01-01 through 9999-12-31 range. To support +applications that cannot tolerate such exceptions, the new methods +itermonthdays3() and itermonthdays4() are added. The new methods return +tuples and are not restricted by the range supported by datetime.date. + +.. + +.. bpo: 28564 +.. date: 2017-10-23-16-22-54 +.. nonce: Tx-l-I +.. section: Library + +The shutil.rmtree() function has been sped up to 20--40%. This was done +using the os.scandir() function. + +.. + +.. bpo: 28416 +.. date: 2017-10-23-12-05-33 +.. nonce: Ldnw8X +.. section: Library + +Instances of pickle.Pickler subclass with the persistent_id() method and +pickle.Unpickler subclass with the persistent_load() method no longer create +reference cycles. + +.. + +.. bpo: 31653 +.. date: 2017-10-22-12-43-03 +.. nonce: ttfGvq +.. section: Library + +Don't release the GIL if we can acquire a multiprocessing semaphore +immediately. + +.. + +.. bpo: 28326 +.. date: 2017-10-22-11-06-02 +.. nonce: rxh7L4 +.. section: Library + +Fix multiprocessing.Process when stdout and/or stderr is closed or None. + +.. + +.. bpo: 20825 +.. date: 2017-10-21-09-13-16 +.. nonce: -1MBEy +.. section: Library + +Add `subnet_of` and `superset_of` containment tests to +:class:`ipaddress.IPv6Network` and :class:`ipaddress.IPv4Network`. Patch by +Michel Albert and Cheryl Sabella. + +.. + +.. bpo: 31827 +.. date: 2017-10-20-16-12-01 +.. nonce: 7R8s8s +.. section: Library + +Remove the os.stat_float_times() function. It was introduced in Python 2.3 +for backward compatibility with Python 2.2, and was deprecated since Python +3.1. + +.. + +.. bpo: 31756 +.. date: 2017-10-20-12-57-52 +.. nonce: IxCvGB +.. section: Library + +Add a ``subprocess.Popen(text=False)`` keyword argument to `subprocess` +functions to be more explicit about when the library should attempt to +decode outputs into text. Patch by Andrew Clegg. + +.. + +.. bpo: 31819 +.. date: 2017-10-19-20-03-13 +.. nonce: mw2wF9 +.. section: Library + +Add AbstractEventLoop.sock_recv_into(). + +.. + +.. bpo: 31457 +.. date: 2017-10-18-19-05-17 +.. nonce: KlE6r8 +.. section: Library + +If nested log adapters are used, the inner ``process()`` methods are no +longer omitted. + +.. + +.. bpo: 31457 +.. date: 2017-10-18-16-48-09 +.. nonce: _ovmzp +.. section: Library + +The ``manager`` property on LoggerAdapter objects is now properly settable. + +.. + +.. bpo: 31806 +.. date: 2017-10-17-23-27-03 +.. nonce: TzphdL +.. section: Library + +Fix timeout rounding in time.sleep(), threading.Lock.acquire() and +socket.socket.settimeout() to round correctly negative timeouts between -1.0 +and 0.0. The functions now block waiting for events as expected. Previously, +the call was incorrectly non-blocking. Patch by Pablo Galindo. + +.. + +.. bpo: 31803 +.. date: 2017-10-17-22-55-13 +.. nonce: YLL1gJ +.. section: Library + +time.clock() and time.get_clock_info('clock') now emit a DeprecationWarning +warning. + +.. + +.. bpo: 31800 +.. date: 2017-10-17-20-08-19 +.. nonce: foOSCi +.. section: Library + +Extended support for parsing UTC offsets. strptime '%z' can now parse the +output generated by datetime.isoformat, including seconds and microseconds. + +.. + +.. bpo: 28603 +.. date: 2017-10-17-12-29-18 +.. nonce: tGuX2C +.. section: Library + +traceback: Fix a TypeError that occurred during printing of exception +tracebacks when either the current exception or an exception in its +context/cause chain is unhashable. Patch by Zane Bitter. + +.. + +.. bpo: 30541 +.. date: 2017-10-17-12-04-37 +.. nonce: q3BM6C +.. section: Library + +Add new function to seal a mock and prevent the automatically creation of +child mocks. Patch by Mario Corchero. + +.. + +.. bpo: 31784 +.. date: 2017-10-13-23-35-47 +.. nonce: 6e57bd +.. section: Library + +Implement the :pep:`564`, add new 6 new functions with nanosecond resolution +to the :mod:`time` module: :func:`~time.clock_gettime_ns`, +:func:`~time.clock_settime_ns`, :func:`~time.monotonic_ns`, +:func:`~time.perf_counter_ns`, :func:`~time.process_time_ns`, +:func:`~time.time_ns`. + +.. + +.. bpo: 30143 +.. date: 2017-10-12-19-05-54 +.. nonce: 25_hU1 +.. section: Library + +2to3 now generates a code that uses abstract collection classes from +collections.abc rather than collections. + +.. + +.. bpo: 31770 +.. date: 2017-10-12-18-45-38 +.. nonce: GV3MPx +.. section: Library + +Prevent a crash when calling the ``__init__()`` method of a +``sqlite3.Cursor`` object more than once. Patch by Oren Milman. + +.. + +.. bpo: 31764 +.. date: 2017-10-11-22-18-04 +.. nonce: EMyIkK +.. section: Library + +Prevent a crash in ``sqlite3.Cursor.close()`` in case the ``Cursor`` object +is uninitialized. Patch by Oren Milman. + +.. + +.. bpo: 31752 +.. date: 2017-10-11-00-45-01 +.. nonce: DhWevN +.. section: Library + +Fix possible crash in timedelta constructor called with custom integers. + +.. + +.. bpo: 31620 +.. date: 2017-10-06-04-35-31 +.. nonce: gksLA1 +.. section: Library + +an empty asyncio.Queue now doesn't leak memory when queue.get pollers +timeout + +.. + +.. bpo: 31690 +.. date: 2017-10-05-15-14-46 +.. nonce: f0XteV +.. section: Library + +Allow the flags re.ASCII, re.LOCALE, and re.UNICODE to be used as group +flags for regular expressions. + +.. + +.. bpo: 30349 +.. date: 2017-10-05-12-45-29 +.. nonce: 6zKJsF +.. section: Library + +FutureWarning is now emitted if a regular expression contains character set +constructs that will change semantically in the future (nested sets and set +operations). + +.. + +.. bpo: 31664 +.. date: 2017-10-04-20-36-28 +.. nonce: 4VDUzo +.. section: Library + +Added support for the Blowfish hashing in the crypt module. + +.. + +.. bpo: 31632 +.. date: 2017-10-04-11-37-14 +.. nonce: LiOC3C +.. section: Library + +Fix method set_protocol() of class _SSLProtocolTransport in asyncio module. +This method was previously modifying a wrong reference to the protocol. + +.. + +.. bpo: 15037 +.. date: 2017-09-29-19-19-36 +.. nonce: ykimLK +.. section: Library + +Added a workaround for getkey() in curses for ncurses 5.7 and earlier. + +.. + +.. bpo: 31307 +.. date: 2017-09-07-12-50-28 +.. nonce: AVBiNY +.. section: Library + +Allow use of bytes objects for arguments to +:meth:`configparser.ConfigParser.read`. Patch by Vincent Michel. + +.. + +.. bpo: 31334 +.. date: 2017-09-04-00-22-31 +.. nonce: 9WYRfi +.. section: Library + +Fix ``poll.poll([timeout])`` in the ``select`` module for arbitrary negative +timeouts on all OSes where it can only be a non-negative integer or -1. +Patch by Riccardo Coccioli. + +.. + +.. bpo: 31310 +.. date: 2017-08-30-18-23-54 +.. nonce: 7D1UNt +.. section: Library + +multiprocessing's semaphore tracker should be launched again if crashed. + +.. + +.. bpo: 31308 +.. date: 2017-08-30-17-59-36 +.. nonce: KbexyC +.. section: Library + +Make multiprocessing's forkserver process immune to Ctrl-C and other user +interruptions. If it crashes, restart it when necessary. + +.. + +.. bpo: 31245 +.. date: 2017-08-22-11-05-35 +.. nonce: AniZuz +.. section: Library + +Added support for AF_UNIX socket in asyncio `create_datagram_endpoint`. + +.. + +.. bpo: 30553 +.. date: 2017-07-05-14-48-26 +.. nonce: Oupsxo +.. section: Library + +Add HTTP/2 status code 421 (Misdirected Request) to +:class:`http.HTTPStatus`. Patch by Vitor Pereira. + +.. + +.. bpo: 32105 +.. date: 2017-11-21-10-54-16 +.. nonce: 91mhWm +.. section: Documentation + +Added asyncio.BaseEventLoop.connect_accepted_socket versionaddded marker. + +.. + +.. bpo: 31380 +.. date: 2017-12-04-23-19-16 +.. nonce: VlMmHW +.. section: Tests + +Skip test_httpservers test_undecodable_file on macOS: fails on APFS. + +.. + +.. bpo: 31705 +.. date: 2017-11-30-12-27-10 +.. nonce: yULW7O +.. section: Tests + +Skip test_socket.test_sha256() on Linux kernel older than 4.5. The test +fails with ENOKEY on kernel 3.10 (on ppc64le). A fix was merged into the +kernel 4.5. + +.. + +.. bpo: 32138 +.. date: 2017-11-27-16-18-58 +.. nonce: QsTvf- +.. section: Tests + +Skip on Android test_faulthandler tests that raise SIGSEGV and remove the +test.support.requires_android_level decorator. + +.. + +.. bpo: 32136 +.. date: 2017-11-26-17-11-27 +.. nonce: Y11luJ +.. section: Tests + +The runtime embedding tests have been split out from +``Lib/test/test_capi.py`` into a new ``Lib/test/test_embed.py`` file. + +.. + +.. bpo: 28668 +.. date: 2017-11-25-14-53-29 +.. nonce: Y1G6pA +.. section: Tests + +test.support.requires_multiprocessing_queue is removed. Skip tests with +test.support.import_module('multiprocessing.synchronize') instead when the +semaphore implementation is broken or missing. + +.. + +.. bpo: 32126 +.. date: 2017-11-24-18-15-12 +.. nonce: PLmNLn +.. section: Tests + +Skip test_get_event_loop_new_process in test.test_asyncio.test_events when +sem_open() is not functional. + +.. + +.. bpo: 31174 +.. date: 2017-10-24-11-36-10 +.. nonce: xCvXcr +.. section: Tests + +Fix test_tools.test_unparse: DirectoryTestCase now stores the names sample +to always test the same files. It prevents false alarms when hunting +reference leaks. + +.. + +.. bpo: 28538 +.. date: 2017-11-21-17-27-59 +.. nonce: DsNBS7 +.. section: Build + +Revert the previous changes, the if_nameindex structure is defined by +Unified Headers. + +.. + +.. bpo: 28762 +.. date: 2017-11-21-17-12-24 +.. nonce: R6uu8w +.. section: Build + +Revert the last commit, the F_LOCK macro is defined by Android Unified +Headers. + +.. + +.. bpo: 29040 +.. date: 2017-11-21-16-56-24 +.. nonce: 14lCSr +.. section: Build + +Support building Android with Unified Headers. The first NDK release to +support Unified Headers is android-ndk-r14. + +.. + +.. bpo: 32059 +.. date: 2017-11-18-11-19-28 +.. nonce: a0Hxgp +.. section: Build + +``detect_modules()`` in ``setup.py`` now also searches the sysroot paths +when cross-compiling. + +.. + +.. bpo: 31957 +.. date: 2017-11-06-11-53-39 +.. nonce: S_1jFK +.. section: Build + +Fixes Windows SDK version detection when building for Windows. + +.. + +.. bpo: 31609 +.. date: 2017-11-04-15-35-08 +.. nonce: k7_nBR +.. section: Build + +Fixes quotes in PCbuild/clean.bat + +.. + +.. bpo: 31934 +.. date: 2017-11-03-15-17-50 +.. nonce: 8bUlpv +.. section: Build + +Abort the build when building out of a not clean source tree. + +.. + +.. bpo: 31926 +.. date: 2017-11-03-10-07-14 +.. nonce: 57wE98 +.. section: Build + +Fixed Argument Clinic sometimes causing compilation errors when there was +more than one function and/or method in a .c file with the same name. + +.. + +.. bpo: 28791 +.. date: 2017-11-02-20-30-57 +.. nonce: VaE3o8 +.. section: Build + +Update Windows builds to use SQLite 3.21.0. + +.. + +.. bpo: 28791 +.. date: 2017-11-02-20-13-46 +.. nonce: STt3jL +.. section: Build + +Update OS X installer to use SQLite 3.21.0. + +.. + +.. bpo: 28643 +.. date: 2017-11-01-14-16-27 +.. nonce: 9iPKJy +.. section: Build + +Record profile-opt build progress with stamp files. + +.. + +.. bpo: 31866 +.. date: 2017-10-24-23-21-13 +.. nonce: MkNO66 +.. section: Build + +Finish removing support for AtheOS. + +.. + +.. bpo: 1102 +.. date: 2017-11-19-09-46-27 +.. nonce: NY-g1F +.. section: Windows + +Return ``None`` when ``View.Fetch()`` returns ``ERROR_NO_MORE_ITEMS`` +instead of raising ``MSIError``. + +Initial patch by Anthony Tuininga. + +.. + +.. bpo: 31944 +.. date: 2017-11-04-15-29-47 +.. nonce: 0Bx8tZ +.. section: Windows + +Fixes Modify button in Apps and Features dialog. + +.. + +.. bpo: 20486 +.. date: 2017-10-26-23-02-57 +.. nonce: 3IdsZ1 +.. section: Windows + +Implement the ``Database.Close()`` method to help closing MSI database +objects. + +.. + +.. bpo: 31857 +.. date: 2017-10-23-18-35-50 +.. nonce: YwhEvc +.. section: Windows + +Make the behavior of USE_STACKCHECK deterministic in a multi-threaded +environment. + +.. + +.. bpo: 31392 +.. date: 2017-12-04-21-57-43 +.. nonce: f8huBC +.. section: macOS + +Update macOS installer to use OpenSSL 1.0.2m + +.. + +.. bpo: 32207 +.. date: 2017-12-04-15-04-43 +.. nonce: IzyAJo +.. section: IDLE + +Improve tk event exception tracebacks in IDLE. When tk event handling is +driven by IDLE's run loop, a confusing and distracting queue.EMPTY traceback +context is no longer added to tk event exception tracebacks. The traceback +is now the same as when event handling is driven by user code. Patch based +on a suggestion by Serhiy Storchaka. + +.. + +.. bpo: 32164 +.. date: 2017-11-28-21-47-15 +.. nonce: 2T2Na8 +.. section: IDLE + +Delete unused file idlelib/tabbedpages.py. Use of TabbedPageSet in +configdialog was replaced by ttk.Notebook. + +.. + +.. bpo: 32100 +.. date: 2017-11-21-08-26-08 +.. nonce: P43qx2 +.. section: IDLE + +IDLE: Fix old and new bugs in pathbrowser; improve tests. Patch mostly by +Cheryl Sabella. + +.. + +.. bpo: 31858 +.. date: 2017-10-26-20-20-19 +.. nonce: VuSA_e +.. section: IDLE + +IDLE -- Restrict shell prompt manipulaton to the shell. Editor and output +windows only see an empty last prompt line. This simplifies the code and +fixes a minor bug when newline is inserted. Sys.ps1, if present, is read on +Shell start-up, but is not set or changed. + +.. + +.. bpo: 31860 +.. date: 2017-10-24-16-21-50 +.. nonce: gECuWx +.. section: IDLE + +The font sample in the IDLE configuration dialog is now editable. Changes +persist while IDLE remains open + +.. + +.. bpo: 31836 +.. date: 2017-10-21-15-41-53 +.. nonce: fheLME +.. section: IDLE + +Test_code_module now passes if run after test_idle, which sets ps1. + +The code module uses sys.ps1 if present or sets it to '>>> ' if not. +Test_code_module now properly tests both behaviors. Ditto for ps2. + +.. + +.. bpo: 28603 +.. date: 2017-10-17-13-26-13 +.. nonce: TMEQfp +.. section: IDLE + +Fix a TypeError that caused a shell restart when printing a traceback that +includes an exception that is unhashable. Patch by Zane Bitter. + +.. + +.. bpo: 13802 +.. date: 2017-10-12-00-51-29 +.. nonce: VwjZRD +.. section: IDLE + +Use non-Latin characters in the IDLE's Font settings sample. Even if one +selects a font that defines a limited subset of the unicode Basic +Multilingual Plane, tcl/tk will use other fonts that define a character. The +expanded example give users of non-Latin characters a better idea of what +they might see in IDLE's shell and editors. + +To make room for the expanded sample, frames on the Font tab are re- +arranged. The Font/Tabs help explains a bit about the additions. + +.. + +.. bpo: 32159 +.. date: 2017-11-28-21-24-41 +.. nonce: RSl4QK +.. section: Tools/Demos + +Remove CVS and Subversion tools: remove svneol.py and treesync.py scripts. +CPython migrated from CVS to Subversion, to Mercurial, and then to Git. CVS +and Subversion are no longer used to develop CPython. + +.. + +.. bpo: 30722 +.. date: 2017-10-23-19-45-52 +.. nonce: ioRlAu +.. section: Tools/Demos + +Make redemo work with Python 3.6 and newer versions. + +In Python 3.6, flags like re.DOTALL became members of an enum.IntFlag so +usages like ``getattr(re, 'DOTALL')`` are invalid. + +Also, remove the ``LOCALE`` option since it doesn't work with string +patterns in Python 3. + +Patch by Christoph Sarnowski. + +.. + +.. bpo: 20891 +.. date: 2017-11-30-18-13-45 +.. nonce: wBnMdF +.. section: C API + +Fix PyGILState_Ensure(). When PyGILState_Ensure() is called in a non-Python +thread before PyEval_InitThreads(), only call PyEval_InitThreads() after +calling PyThreadState_New() to fix a crash. + +.. + +.. bpo: 32125 +.. date: 2017-11-24-21-25-43 +.. nonce: K8zWgn +.. section: C API + +The ``Py_UseClassExceptionsFlag`` flag has been removed. It was deprecated +and wasn't used anymore since Python 2.0. + +.. + +.. bpo: 25612 +.. date: 2017-10-22-13-12-28 +.. nonce: 1jnWKT +.. section: C API + +Move the current exception state from the frame object to the co-routine. +This simplifies the interpreter and fixes a couple of obscure bugs caused by +having swap exception state when entering or exiting a generator. + +.. + +.. bpo: 23699 +.. date: 2017-10-19-15-27-04 +.. nonce: -noVVc +.. section: C API + +Add Py_RETURN_RICHCOMPARE macro to reduce boilerplate code in rich +comparison functions. + +.. + +.. bpo: 30697 +.. date: 2017-06-30-11-58-01 +.. nonce: Q3T_8n +.. section: C API + +The `PyExc_RecursionErrorInst` singleton is removed and +`PyErr_NormalizeException()` does not use it anymore. This singleton is +persistent and its members being never cleared may cause a segfault during +finalization of the interpreter. See also issue #22898. diff --git a/Misc/NEWS.d/next/Build/2017-10-24-23-21-13.bpo-31866.MkNO66.rst b/Misc/NEWS.d/next/Build/2017-10-24-23-21-13.bpo-31866.MkNO66.rst deleted file mode 100644 index bc99382a418a85e..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-10-24-23-21-13.bpo-31866.MkNO66.rst +++ /dev/null @@ -1 +0,0 @@ -Finish removing support for AtheOS. diff --git a/Misc/NEWS.d/next/Build/2017-11-01-14-16-27.bpo-28643.9iPKJy.rst b/Misc/NEWS.d/next/Build/2017-11-01-14-16-27.bpo-28643.9iPKJy.rst deleted file mode 100644 index 87f6d5825d28869..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-01-14-16-27.bpo-28643.9iPKJy.rst +++ /dev/null @@ -1 +0,0 @@ -Record profile-opt build progress with stamp files. diff --git a/Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst b/Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst deleted file mode 100644 index ef9bc0f6cccf9da..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-02-20-13-46.bpo-28791.STt3jL.rst +++ /dev/null @@ -1 +0,0 @@ -Update OS X installer to use SQLite 3.21.0. diff --git a/Misc/NEWS.d/next/Build/2017-11-02-20-30-57.bpo-28791.VaE3o8.rst b/Misc/NEWS.d/next/Build/2017-11-02-20-30-57.bpo-28791.VaE3o8.rst deleted file mode 100644 index b25b0e0e9f36d57..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-02-20-30-57.bpo-28791.VaE3o8.rst +++ /dev/null @@ -1 +0,0 @@ -Update Windows builds to use SQLite 3.21.0. diff --git a/Misc/NEWS.d/next/Build/2017-11-03-10-07-14.bpo-31926.57wE98.rst b/Misc/NEWS.d/next/Build/2017-11-03-10-07-14.bpo-31926.57wE98.rst deleted file mode 100644 index 2a42104868737de..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-03-10-07-14.bpo-31926.57wE98.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed Argument Clinic sometimes causing compilation errors when there was -more than one function and/or method in a .c file with the same name. diff --git a/Misc/NEWS.d/next/Build/2017-11-03-15-17-50.bpo-31934.8bUlpv.rst b/Misc/NEWS.d/next/Build/2017-11-03-15-17-50.bpo-31934.8bUlpv.rst deleted file mode 100644 index deaa74046e96891..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-03-15-17-50.bpo-31934.8bUlpv.rst +++ /dev/null @@ -1 +0,0 @@ -Abort the build when building out of a not clean source tree. diff --git a/Misc/NEWS.d/next/Build/2017-11-04-15-35-08.bpo-31609.k7_nBR.rst b/Misc/NEWS.d/next/Build/2017-11-04-15-35-08.bpo-31609.k7_nBR.rst deleted file mode 100644 index 0e950e32a193446..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-04-15-35-08.bpo-31609.k7_nBR.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes quotes in PCbuild/clean.bat diff --git a/Misc/NEWS.d/next/Build/2017-11-06-11-53-39.bpo-31957.S_1jFK.rst b/Misc/NEWS.d/next/Build/2017-11-06-11-53-39.bpo-31957.S_1jFK.rst deleted file mode 100644 index ffee9025a7bf548..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-06-11-53-39.bpo-31957.S_1jFK.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes Windows SDK version detection when building for Windows. diff --git a/Misc/NEWS.d/next/Build/2017-11-18-11-19-28.bpo-32059.a0Hxgp.rst b/Misc/NEWS.d/next/Build/2017-11-18-11-19-28.bpo-32059.a0Hxgp.rst deleted file mode 100644 index a071bd8b3250483..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-18-11-19-28.bpo-32059.a0Hxgp.rst +++ /dev/null @@ -1,2 +0,0 @@ -``detect_modules()`` in ``setup.py`` now also searches the sysroot paths -when cross-compiling. diff --git a/Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst b/Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst deleted file mode 100644 index 60f05db8d4f0438..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst +++ /dev/null @@ -1,2 +0,0 @@ -Support building Android with Unified Headers. The first NDK release to -support Unified Headers is android-ndk-r14. diff --git a/Misc/NEWS.d/next/Build/2017-11-21-17-12-24.bpo-28762.R6uu8w.rst b/Misc/NEWS.d/next/Build/2017-11-21-17-12-24.bpo-28762.R6uu8w.rst deleted file mode 100644 index 0c57e33c0a5221b..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-21-17-12-24.bpo-28762.R6uu8w.rst +++ /dev/null @@ -1 +0,0 @@ -Revert the last commit, the F_LOCK macro is defined by Android Unified Headers. diff --git a/Misc/NEWS.d/next/Build/2017-11-21-17-27-59.bpo-28538.DsNBS7.rst b/Misc/NEWS.d/next/Build/2017-11-21-17-27-59.bpo-28538.DsNBS7.rst deleted file mode 100644 index db435b008f724c6..000000000000000 --- a/Misc/NEWS.d/next/Build/2017-11-21-17-27-59.bpo-28538.DsNBS7.rst +++ /dev/null @@ -1,2 +0,0 @@ -Revert the previous changes, the if_nameindex structure is defined by -Unified Headers. diff --git a/Misc/NEWS.d/next/C API/2017-06-30-11-58-01.bpo-30697.Q3T_8n.rst b/Misc/NEWS.d/next/C API/2017-06-30-11-58-01.bpo-30697.Q3T_8n.rst deleted file mode 100644 index ccd9605d2472377..000000000000000 --- a/Misc/NEWS.d/next/C API/2017-06-30-11-58-01.bpo-30697.Q3T_8n.rst +++ /dev/null @@ -1,4 +0,0 @@ -The `PyExc_RecursionErrorInst` singleton is removed and -`PyErr_NormalizeException()` does not use it anymore. This singleton is -persistent and its members being never cleared may cause a segfault during -finalization of the interpreter. See also issue #22898. diff --git a/Misc/NEWS.d/next/C API/2017-10-19-15-27-04.bpo-23699.-noVVc.rst b/Misc/NEWS.d/next/C API/2017-10-19-15-27-04.bpo-23699.-noVVc.rst deleted file mode 100644 index d873666eab2741b..000000000000000 --- a/Misc/NEWS.d/next/C API/2017-10-19-15-27-04.bpo-23699.-noVVc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add Py_RETURN_RICHCOMPARE macro to reduce boilerplate code in rich -comparison functions. diff --git a/Misc/NEWS.d/next/C API/2017-10-22-13-12-28.bpo-25612.1jnWKT.rst b/Misc/NEWS.d/next/C API/2017-10-22-13-12-28.bpo-25612.1jnWKT.rst deleted file mode 100644 index 102c2e325510558..000000000000000 --- a/Misc/NEWS.d/next/C API/2017-10-22-13-12-28.bpo-25612.1jnWKT.rst +++ /dev/null @@ -1,3 +0,0 @@ -Move the current exception state from the frame object to the co-routine. -This simplifies the interpreter and fixes a couple of obscure bugs caused by -having swap exception state when entering or exiting a generator. diff --git a/Misc/NEWS.d/next/C API/2017-11-24-21-25-43.bpo-32125.K8zWgn.rst b/Misc/NEWS.d/next/C API/2017-11-24-21-25-43.bpo-32125.K8zWgn.rst deleted file mode 100644 index d71c66415d3e00c..000000000000000 --- a/Misc/NEWS.d/next/C API/2017-11-24-21-25-43.bpo-32125.K8zWgn.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``Py_UseClassExceptionsFlag`` flag has been removed. It was deprecated -and wasn't used anymore since Python 2.0. diff --git a/Misc/NEWS.d/next/C API/2017-11-30-18-13-45.bpo-20891.wBnMdF.rst b/Misc/NEWS.d/next/C API/2017-11-30-18-13-45.bpo-20891.wBnMdF.rst deleted file mode 100644 index e89cf1292afa8ad..000000000000000 --- a/Misc/NEWS.d/next/C API/2017-11-30-18-13-45.bpo-20891.wBnMdF.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix PyGILState_Ensure(). When PyGILState_Ensure() is called in a non-Python -thread before PyEval_InitThreads(), only call PyEval_InitThreads() after -calling PyThreadState_New() to fix a crash. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst b/Misc/NEWS.d/next/Core and Builtins/2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst deleted file mode 100644 index f50aeefa84725d2..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-07-01-15-11-13.bpo-30817.j7ZvN_.rst +++ /dev/null @@ -1,2 +0,0 @@ -`PyErr_PrintEx()` clears now the ignored exception that may be raised by -`_PySys_SetObjectId()`, for example when no memory. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-01-15-48-03.bpo-31626.reLPxY.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-01-15-48-03.bpo-31626.reLPxY.rst deleted file mode 100644 index 51026a31914844f..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-01-15-48-03.bpo-31626.reLPxY.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed a bug in debug memory allocator. There was a write to freed memory -after shrinking a memory block. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst deleted file mode 100644 index ccd1575ec949a74..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-12-22-21-01.bpo-30399.45f1gv.rst +++ /dev/null @@ -1,2 +0,0 @@ -Standard repr() of BaseException with a single argument no longer contains -redundant trailing comma. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-13-20-01-47.bpo-31781.cXE9SM.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-13-20-01-47.bpo-31781.cXE9SM.rst deleted file mode 100644 index 79898cfd3d73932..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-13-20-01-47.bpo-31781.cXE9SM.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent crashes when calling methods of an uninitialized -``zipimport.zipimporter`` object. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-15-23-44-57.bpo-31786.XwdEP4.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-15-23-44-57.bpo-31786.XwdEP4.rst deleted file mode 100644 index f0326e30ecd77d1..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-15-23-44-57.bpo-31786.XwdEP4.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix timeout rounding in the select module to round correctly negative timeouts between -1.0 and 0.0. -The functions now block waiting for events as expected. Previously, the call was incorrectly non-blocking. -Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-17-13-29-19.bpo-28603._-oia3.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-17-13-29-19.bpo-28603._-oia3.rst deleted file mode 100644 index a3542accd5f7bb6..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-17-13-29-19.bpo-28603._-oia3.rst +++ /dev/null @@ -1,3 +0,0 @@ -Print the full context/cause chain of exceptions on interpreter exit, even -if an exception in the chain is unhashable or compares equal to later ones. -Patch by Zane Bitter. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-18-19-41-12.bpo-31618.liLDiS.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-18-19-41-12.bpo-31618.liLDiS.rst deleted file mode 100644 index 5a8d3418a79c8f2..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-18-19-41-12.bpo-31618.liLDiS.rst +++ /dev/null @@ -1,7 +0,0 @@ -The per-frame tracing logic added in 3.7a1 has been altered so that -``frame->f_lineno`` is updated before either ``"line"`` or ``"opcode"`` -events are emitted. Previously, opcode events were emitted first, and -therefore would occasionally see stale line numbers on the frame. The -behavior of this feature has changed slightly as a result: when both -``f_trace_lines`` and ``f_trace_opcodes`` are enabled, line events now occur -first. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-20-14-07-46.bpo-31825.gJvmGW.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-20-14-07-46.bpo-31825.gJvmGW.rst deleted file mode 100644 index 18e81afa1f8ac14..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-20-14-07-46.bpo-31825.gJvmGW.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed OverflowError in the 'unicode-escape' codec and in -codecs.escape_decode() when decode an escaped non-ascii byte. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-23-23-39-26.bpo-28936.C288Jh.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-23-23-39-26.bpo-28936.C288Jh.rst deleted file mode 100644 index 8ebdf32e5bea631..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-23-23-39-26.bpo-28936.C288Jh.rst +++ /dev/null @@ -1,2 +0,0 @@ -Ensure that lexically first syntax error involving a parameter and ``global`` -or ``nonlocal`` is detected first at a given scope. Patch by Ivan Levkivskyi. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-24-21-27-32.bpo-31845.8OS-k3.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-24-21-27-32.bpo-31845.8OS-k3.rst deleted file mode 100644 index ddaf6306386effc..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-24-21-27-32.bpo-31845.8OS-k3.rst +++ /dev/null @@ -1 +0,0 @@ -Environment variables are once more read correctly at interpreter startup. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-25-15-51-37.bpo-21720.BwIKLP.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-25-15-51-37.bpo-21720.BwIKLP.rst deleted file mode 100644 index 02afea2420060bc..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-25-15-51-37.bpo-21720.BwIKLP.rst +++ /dev/null @@ -1,3 +0,0 @@ -BytesWarning no longer emitted when the *fromlist* argument of -``__import__()`` or the ``__all__`` attribute of the module contain bytes -instances. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-28-19-11-05.bpo-20047.GuNAto.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-28-19-11-05.bpo-20047.GuNAto.rst deleted file mode 100644 index 3594bacd368e316..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-28-19-11-05.bpo-20047.GuNAto.rst +++ /dev/null @@ -1,3 +0,0 @@ -Bytearray methods partition() and rpartition() now accept only bytes-like -objects as separator, as documented. In particular they now raise TypeError -rather of returning a bogus result when an integer is passed as a separator. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-28-22-06-03.bpo-30696.lhC3HE.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-28-22-06-03.bpo-30696.lhC3HE.rst deleted file mode 100644 index 76bc683488017df..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-10-28-22-06-03.bpo-30696.lhC3HE.rst +++ /dev/null @@ -1 +0,0 @@ -Fix the interactive interpreter looping endlessly when no memory. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-05-16-11-07.bpo-31949.2yNC_z.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-05-16-11-07.bpo-31949.2yNC_z.rst deleted file mode 100644 index 029cb57939ff03b..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-05-16-11-07.bpo-31949.2yNC_z.rst +++ /dev/null @@ -1,9 +0,0 @@ -Fixed several issues in printing tracebacks (PyTraceBack_Print()). - -* Setting sys.tracebacklimit to 0 or less now suppresses printing tracebacks. -* Setting sys.tracebacklimit to None now causes using the default limit. -* Setting sys.tracebacklimit to an integer larger than LONG_MAX now means using - the limit LONG_MAX rather than the default limit. -* Fixed integer overflows in the case of more than 2**31 traceback items on - Windows. -* Fixed output errors handling. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-12-11-44-22.bpo-28180.HQX000.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-12-11-44-22.bpo-28180.HQX000.rst deleted file mode 100644 index edf4581c6114d84..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-12-11-44-22.bpo-28180.HQX000.rst +++ /dev/null @@ -1,4 +0,0 @@ -A new internal ``_Py_SetLocaleFromEnv(category)`` helper function has been -added in order to improve the consistency of behaviour across different -``libc`` implementations (e.g. Android doesn't support setting the locale from -the environment by default). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-13-00-37-11.bpo-32012.Kprjqe.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-13-00-37-11.bpo-32012.Kprjqe.rst deleted file mode 100644 index 776a261013478ef..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-13-00-37-11.bpo-32012.Kprjqe.rst +++ /dev/null @@ -1,4 +0,0 @@ -SyntaxError is now correctly raised when a generator expression without -parenthesis is passed as an argument, but followed by a trailing comma. -A generator expression always needs to be directly inside a set of parentheses -and cannot have a comma on either side. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-15-10-49-35.bpo-32023.XnCGT5.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-15-10-49-35.bpo-32023.XnCGT5.rst deleted file mode 100644 index d4a84380521958a..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-15-10-49-35.bpo-32023.XnCGT5.rst +++ /dev/null @@ -1,3 +0,0 @@ -SyntaxError is now correctly raised when a generator expression without -parenthesis is used instead of an inheritance list in a class definition. -The duplication of the parentheses can be omitted only on calls. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-16-03-44-08.bpo-32043.AAzwpZ.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-16-03-44-08.bpo-32043.AAzwpZ.rst deleted file mode 100644 index 21d59e0d61edac1..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-16-03-44-08.bpo-32043.AAzwpZ.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add a new "developer mode": new "-X dev" command line option to enable debug -checks at runtime. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-24-01-13-58.bpo-32096.CQTHXJ.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-24-01-13-58.bpo-32096.CQTHXJ.rst deleted file mode 100644 index d2a770b9375fa0b..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-24-01-13-58.bpo-32096.CQTHXJ.rst +++ /dev/null @@ -1,4 +0,0 @@ -Revert memory allocator changes in the C API: move structures back from -_PyRuntime to Objects/obmalloc.c. The memory allocators are once again initialized -statically, and so PyMem_RawMalloc() and Py_DecodeLocale() can be -called before _PyRuntime_Initialize(). diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-26-14-36-30.bpo-32137.Stj5nL.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-26-14-36-30.bpo-32137.Stj5nL.rst deleted file mode 100644 index f8f4ab93c9e2e86..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-26-14-36-30.bpo-32137.Stj5nL.rst +++ /dev/null @@ -1,2 +0,0 @@ -The repr of deeply nested dict now raises a RecursionError instead of -crashing due to a stack overflow. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-11-27-08-37-34.bpo-10544.07nioT.rst b/Misc/NEWS.d/next/Core and Builtins/2017-11-27-08-37-34.bpo-10544.07nioT.rst deleted file mode 100644 index 555c94ebaee23aa..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-11-27-08-37-34.bpo-10544.07nioT.rst +++ /dev/null @@ -1,3 +0,0 @@ -Yield expressions are now deprecated in comprehensions and generator -expressions. They are still permitted in the definition of the outermost -iterable, as that is evaluated directly in the enclosing scope. diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-12-02-21-37-22.bpo-32176.Wt25-N.rst b/Misc/NEWS.d/next/Core and Builtins/2017-12-02-21-37-22.bpo-32176.Wt25-N.rst deleted file mode 100644 index 9d567112866f8f1..000000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2017-12-02-21-37-22.bpo-32176.Wt25-N.rst +++ /dev/null @@ -1,5 +0,0 @@ -co_flags.CO_NOFREE is now always set correctly by the code object -constructor based on freevars and cellvars, rather than needing to be set -correctly by the caller. This ensures it will be cleared automatically when -additional cell references are injected into a modified code object and -function. diff --git a/Misc/NEWS.d/next/Documentation/2017-11-21-10-54-16.bpo-32105.91mhWm.rst b/Misc/NEWS.d/next/Documentation/2017-11-21-10-54-16.bpo-32105.91mhWm.rst deleted file mode 100644 index 6f95b1e9da18cd9..000000000000000 --- a/Misc/NEWS.d/next/Documentation/2017-11-21-10-54-16.bpo-32105.91mhWm.rst +++ /dev/null @@ -1 +0,0 @@ -Added asyncio.BaseEventLoop.connect_accepted_socket versionaddded marker. diff --git a/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst b/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst deleted file mode 100644 index 99d4dfd71b5ceb3..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-10-12-00-51-29.bpo-13802.VwjZRD.rst +++ /dev/null @@ -1,8 +0,0 @@ -Use non-Latin characters in the IDLE's Font settings sample. -Even if one selects a font that defines a limited subset of the unicode -Basic Multilingual Plane, tcl/tk will use other fonts that define a -character. The expanded example give users of non-Latin characters -a better idea of what they might see in IDLE's shell and editors. - -To make room for the expanded sample, frames on the Font tab are -re-arranged. The Font/Tabs help explains a bit about the additions. diff --git a/Misc/NEWS.d/next/IDLE/2017-10-17-13-26-13.bpo-28603.TMEQfp.rst b/Misc/NEWS.d/next/IDLE/2017-10-17-13-26-13.bpo-28603.TMEQfp.rst deleted file mode 100644 index e69f7f67219020a..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-10-17-13-26-13.bpo-28603.TMEQfp.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a TypeError that caused a shell restart when printing a traceback that -includes an exception that is unhashable. Patch by Zane Bitter. diff --git a/Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst b/Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst deleted file mode 100644 index a5c9153e36584e4..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-10-21-15-41-53.bpo-31836.fheLME.rst +++ /dev/null @@ -1,4 +0,0 @@ -Test_code_module now passes if run after test_idle, which sets ps1. - -The code module uses sys.ps1 if present or sets it to '>>> ' if not. -Test_code_module now properly tests both behaviors. Ditto for ps2. diff --git a/Misc/NEWS.d/next/IDLE/2017-10-24-16-21-50.bpo-31860.gECuWx.rst b/Misc/NEWS.d/next/IDLE/2017-10-24-16-21-50.bpo-31860.gECuWx.rst deleted file mode 100644 index a1c115e3f78bc05..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-10-24-16-21-50.bpo-31860.gECuWx.rst +++ /dev/null @@ -1,2 +0,0 @@ -The font sample in the IDLE configuration dialog is now editable. -Changes persist while IDLE remains open diff --git a/Misc/NEWS.d/next/IDLE/2017-10-26-20-20-19.bpo-31858.VuSA_e.rst b/Misc/NEWS.d/next/IDLE/2017-10-26-20-20-19.bpo-31858.VuSA_e.rst deleted file mode 100644 index 2ad9dc9662fa1a1..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-10-26-20-20-19.bpo-31858.VuSA_e.rst +++ /dev/null @@ -1,4 +0,0 @@ -IDLE -- Restrict shell prompt manipulaton to the shell. Editor and output -windows only see an empty last prompt line. This simplifies the code and -fixes a minor bug when newline is inserted. Sys.ps1, if present, is read on -Shell start-up, but is not set or changed. diff --git a/Misc/NEWS.d/next/IDLE/2017-11-21-08-26-08.bpo-32100.P43qx2.rst b/Misc/NEWS.d/next/IDLE/2017-11-21-08-26-08.bpo-32100.P43qx2.rst deleted file mode 100644 index c5ee6736a845655..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-11-21-08-26-08.bpo-32100.P43qx2.rst +++ /dev/null @@ -1,2 +0,0 @@ -IDLE: Fix old and new bugs in pathbrowser; improve tests. -Patch mostly by Cheryl Sabella. diff --git a/Misc/NEWS.d/next/IDLE/2017-11-28-21-47-15.bpo-32164.2T2Na8.rst b/Misc/NEWS.d/next/IDLE/2017-11-28-21-47-15.bpo-32164.2T2Na8.rst deleted file mode 100644 index 1db575c3c6d3e46..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-11-28-21-47-15.bpo-32164.2T2Na8.rst +++ /dev/null @@ -1,2 +0,0 @@ -Delete unused file idlelib/tabbedpages.py. Use of TabbedPageSet in -configdialog was replaced by ttk.Notebook. diff --git a/Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst b/Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst deleted file mode 100644 index e521c9b0bbdc814..000000000000000 --- a/Misc/NEWS.d/next/IDLE/2017-12-04-15-04-43.bpo-32207.IzyAJo.rst +++ /dev/null @@ -1,6 +0,0 @@ -Improve tk event exception tracebacks in IDLE. -When tk event handling is driven by IDLE's run loop, a confusing -and distracting queue.EMPTY traceback context is no longer added -to tk event exception tracebacks. The traceback is now the same -as when event handling is driven by user code. Patch based on a -suggestion by Serhiy Storchaka. diff --git a/Misc/NEWS.d/next/Library/2017-07-05-14-48-26.bpo-30553.Oupsxo.rst b/Misc/NEWS.d/next/Library/2017-07-05-14-48-26.bpo-30553.Oupsxo.rst deleted file mode 100644 index 51f0d5b9922a747..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-07-05-14-48-26.bpo-30553.Oupsxo.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add HTTP/2 status code 421 (Misdirected Request) to -:class:`http.HTTPStatus`. Patch by Vitor Pereira. diff --git a/Misc/NEWS.d/next/Library/2017-08-22-11-05-35.bpo-31245.AniZuz.rst b/Misc/NEWS.d/next/Library/2017-08-22-11-05-35.bpo-31245.AniZuz.rst deleted file mode 100644 index ce495ea0ba37832..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-08-22-11-05-35.bpo-31245.AniZuz.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for AF_UNIX socket in asyncio `create_datagram_endpoint`. diff --git a/Misc/NEWS.d/next/Library/2017-08-30-17-59-36.bpo-31308.KbexyC.rst b/Misc/NEWS.d/next/Library/2017-08-30-17-59-36.bpo-31308.KbexyC.rst deleted file mode 100644 index 6068b7fd32e7c87..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-08-30-17-59-36.bpo-31308.KbexyC.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make multiprocessing's forkserver process immune to Ctrl-C and other user interruptions. -If it crashes, restart it when necessary. diff --git a/Misc/NEWS.d/next/Library/2017-08-30-18-23-54.bpo-31310.7D1UNt.rst b/Misc/NEWS.d/next/Library/2017-08-30-18-23-54.bpo-31310.7D1UNt.rst deleted file mode 100644 index 4d340f07364019d..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-08-30-18-23-54.bpo-31310.7D1UNt.rst +++ /dev/null @@ -1 +0,0 @@ -multiprocessing's semaphore tracker should be launched again if crashed. diff --git a/Misc/NEWS.d/next/Library/2017-09-04-00-22-31.bpo-31334.9WYRfi.rst b/Misc/NEWS.d/next/Library/2017-09-04-00-22-31.bpo-31334.9WYRfi.rst deleted file mode 100644 index 1cbfd2531bc83b8..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-09-04-00-22-31.bpo-31334.9WYRfi.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix ``poll.poll([timeout])`` in the ``select`` module for arbitrary negative -timeouts on all OSes where it can only be a non-negative integer or -1. -Patch by Riccardo Coccioli. diff --git a/Misc/NEWS.d/next/Library/2017-09-07-12-50-28.bpo-31307.AVBiNY.rst b/Misc/NEWS.d/next/Library/2017-09-07-12-50-28.bpo-31307.AVBiNY.rst deleted file mode 100644 index 7e649aa9d6ef3d7..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-09-07-12-50-28.bpo-31307.AVBiNY.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow use of bytes objects for arguments to -:meth:`configparser.ConfigParser.read`. Patch by Vincent Michel. diff --git a/Misc/NEWS.d/next/Library/2017-09-29-19-19-36.bpo-15037.ykimLK.rst b/Misc/NEWS.d/next/Library/2017-09-29-19-19-36.bpo-15037.ykimLK.rst deleted file mode 100644 index a1e90ac37392507..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-09-29-19-19-36.bpo-15037.ykimLK.rst +++ /dev/null @@ -1 +0,0 @@ -Added a workaround for getkey() in curses for ncurses 5.7 and earlier. diff --git a/Misc/NEWS.d/next/Library/2017-10-04-11-37-14.bpo-31632.LiOC3C.rst b/Misc/NEWS.d/next/Library/2017-10-04-11-37-14.bpo-31632.LiOC3C.rst deleted file mode 100644 index 6178d0633ee1c37..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-04-11-37-14.bpo-31632.LiOC3C.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix method set_protocol() of class _SSLProtocolTransport in asyncio module. -This method was previously modifying a wrong reference to the protocol. diff --git a/Misc/NEWS.d/next/Library/2017-10-04-20-36-28.bpo-31664.4VDUzo.rst b/Misc/NEWS.d/next/Library/2017-10-04-20-36-28.bpo-31664.4VDUzo.rst deleted file mode 100644 index bd8474977d87d95..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-04-20-36-28.bpo-31664.4VDUzo.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for the Blowfish hashing in the crypt module. diff --git a/Misc/NEWS.d/next/Library/2017-10-05-12-45-29.bpo-30349.6zKJsF.rst b/Misc/NEWS.d/next/Library/2017-10-05-12-45-29.bpo-30349.6zKJsF.rst deleted file mode 100644 index 6862e02502ab802..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-05-12-45-29.bpo-30349.6zKJsF.rst +++ /dev/null @@ -1,3 +0,0 @@ -FutureWarning is now emitted if a regular expression contains character set -constructs that will change semantically in the future (nested sets and set -operations). diff --git a/Misc/NEWS.d/next/Library/2017-10-05-15-14-46.bpo-31690.f0XteV.rst b/Misc/NEWS.d/next/Library/2017-10-05-15-14-46.bpo-31690.f0XteV.rst deleted file mode 100644 index 1505615d270ea1e..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-05-15-14-46.bpo-31690.f0XteV.rst +++ /dev/null @@ -1,2 +0,0 @@ -Allow the flags re.ASCII, re.LOCALE, and re.UNICODE to be used as group flags -for regular expressions. diff --git a/Misc/NEWS.d/next/Library/2017-10-06-04-35-31.bpo-31620.gksLA1.rst b/Misc/NEWS.d/next/Library/2017-10-06-04-35-31.bpo-31620.gksLA1.rst deleted file mode 100644 index 7874befaaa2972f..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-06-04-35-31.bpo-31620.gksLA1.rst +++ /dev/null @@ -1,2 +0,0 @@ -an empty asyncio.Queue now doesn't leak memory when queue.get pollers -timeout diff --git a/Misc/NEWS.d/next/Library/2017-10-11-00-45-01.bpo-31752.DhWevN.rst b/Misc/NEWS.d/next/Library/2017-10-11-00-45-01.bpo-31752.DhWevN.rst deleted file mode 100644 index 4ec140b536181a8..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-11-00-45-01.bpo-31752.DhWevN.rst +++ /dev/null @@ -1 +0,0 @@ -Fix possible crash in timedelta constructor called with custom integers. diff --git a/Misc/NEWS.d/next/Library/2017-10-11-22-18-04.bpo-31764.EMyIkK.rst b/Misc/NEWS.d/next/Library/2017-10-11-22-18-04.bpo-31764.EMyIkK.rst deleted file mode 100644 index a5a4ce548e0df21..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-11-22-18-04.bpo-31764.EMyIkK.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent a crash in ``sqlite3.Cursor.close()`` in case the ``Cursor`` object is -uninitialized. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Library/2017-10-12-18-45-38.bpo-31770.GV3MPx.rst b/Misc/NEWS.d/next/Library/2017-10-12-18-45-38.bpo-31770.GV3MPx.rst deleted file mode 100644 index 86c7b804bdaca3d..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-12-18-45-38.bpo-31770.GV3MPx.rst +++ /dev/null @@ -1,2 +0,0 @@ -Prevent a crash when calling the ``__init__()`` method of a -``sqlite3.Cursor`` object more than once. Patch by Oren Milman. diff --git a/Misc/NEWS.d/next/Library/2017-10-12-19-05-54.bpo-30143.25_hU1.rst b/Misc/NEWS.d/next/Library/2017-10-12-19-05-54.bpo-30143.25_hU1.rst deleted file mode 100644 index a1f83128542532d..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-12-19-05-54.bpo-30143.25_hU1.rst +++ /dev/null @@ -1,2 +0,0 @@ -2to3 now generates a code that uses abstract collection classes from -collections.abc rather than collections. diff --git a/Misc/NEWS.d/next/Library/2017-10-13-23-35-47.bpo-31784.6e57bd.rst b/Misc/NEWS.d/next/Library/2017-10-13-23-35-47.bpo-31784.6e57bd.rst deleted file mode 100644 index 560c82a0ae056c3..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-13-23-35-47.bpo-31784.6e57bd.rst +++ /dev/null @@ -1,5 +0,0 @@ -Implement the :pep:`564`, add new 6 new functions with nanosecond resolution to -the :mod:`time` module: :func:`~time.clock_gettime_ns`, -:func:`~time.clock_settime_ns`, :func:`~time.monotonic_ns`, -:func:`~time.perf_counter_ns`, :func:`~time.process_time_ns`, -:func:`~time.time_ns`. diff --git a/Misc/NEWS.d/next/Library/2017-10-17-12-04-37.bpo-30541.q3BM6C.rst b/Misc/NEWS.d/next/Library/2017-10-17-12-04-37.bpo-30541.q3BM6C.rst deleted file mode 100644 index 7eb5e16faa0c842..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-17-12-04-37.bpo-30541.q3BM6C.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add new function to seal a mock and prevent the automatically creation of -child mocks. Patch by Mario Corchero. diff --git a/Misc/NEWS.d/next/Library/2017-10-17-12-29-18.bpo-28603.tGuX2C.rst b/Misc/NEWS.d/next/Library/2017-10-17-12-29-18.bpo-28603.tGuX2C.rst deleted file mode 100644 index 1a5fb0aa67b46c7..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-17-12-29-18.bpo-28603.tGuX2C.rst +++ /dev/null @@ -1,3 +0,0 @@ -traceback: Fix a TypeError that occurred during printing of exception -tracebacks when either the current exception or an exception in its -context/cause chain is unhashable. Patch by Zane Bitter. diff --git a/Misc/NEWS.d/next/Library/2017-10-17-20-08-19.bpo-31800.foOSCi.rst b/Misc/NEWS.d/next/Library/2017-10-17-20-08-19.bpo-31800.foOSCi.rst deleted file mode 100644 index 1580440a595d5bb..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-17-20-08-19.bpo-31800.foOSCi.rst +++ /dev/null @@ -1,3 +0,0 @@ -Extended support for parsing UTC offsets. strptime '%z' can now -parse the output generated by datetime.isoformat, including seconds and -microseconds. diff --git a/Misc/NEWS.d/next/Library/2017-10-17-22-55-13.bpo-31803.YLL1gJ.rst b/Misc/NEWS.d/next/Library/2017-10-17-22-55-13.bpo-31803.YLL1gJ.rst deleted file mode 100644 index 10a88ba03d7bf45..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-17-22-55-13.bpo-31803.YLL1gJ.rst +++ /dev/null @@ -1,2 +0,0 @@ -time.clock() and time.get_clock_info('clock') now emit a DeprecationWarning -warning. diff --git a/Misc/NEWS.d/next/Library/2017-10-17-23-27-03.bpo-31806.TzphdL.rst b/Misc/NEWS.d/next/Library/2017-10-17-23-27-03.bpo-31806.TzphdL.rst deleted file mode 100644 index 941e77d51970ff0..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-17-23-27-03.bpo-31806.TzphdL.rst +++ /dev/null @@ -1,4 +0,0 @@ -Fix timeout rounding in time.sleep(), threading.Lock.acquire() and -socket.socket.settimeout() to round correctly negative timeouts between -1.0 and -0.0. The functions now block waiting for events as expected. Previously, the -call was incorrectly non-blocking. Patch by Pablo Galindo. diff --git a/Misc/NEWS.d/next/Library/2017-10-18-16-48-09.bpo-31457._ovmzp.rst b/Misc/NEWS.d/next/Library/2017-10-18-16-48-09.bpo-31457._ovmzp.rst deleted file mode 100644 index 1a59dce39a50d98..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-18-16-48-09.bpo-31457._ovmzp.rst +++ /dev/null @@ -1 +0,0 @@ -The ``manager`` property on LoggerAdapter objects is now properly settable. diff --git a/Misc/NEWS.d/next/Library/2017-10-18-19-05-17.bpo-31457.KlE6r8.rst b/Misc/NEWS.d/next/Library/2017-10-18-19-05-17.bpo-31457.KlE6r8.rst deleted file mode 100644 index 49463c4fd15b4e0..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-18-19-05-17.bpo-31457.KlE6r8.rst +++ /dev/null @@ -1,2 +0,0 @@ -If nested log adapters are used, the inner ``process()`` methods are no -longer omitted. diff --git a/Misc/NEWS.d/next/Library/2017-10-19-20-03-13.bpo-31819.mw2wF9.rst b/Misc/NEWS.d/next/Library/2017-10-19-20-03-13.bpo-31819.mw2wF9.rst deleted file mode 100644 index 7bdb0d9f88ae5e8..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-19-20-03-13.bpo-31819.mw2wF9.rst +++ /dev/null @@ -1 +0,0 @@ -Add AbstractEventLoop.sock_recv_into(). diff --git a/Misc/NEWS.d/next/Library/2017-10-20-12-57-52.bpo-31756.IxCvGB.rst b/Misc/NEWS.d/next/Library/2017-10-20-12-57-52.bpo-31756.IxCvGB.rst deleted file mode 100644 index 99064e8cb76a22a..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-20-12-57-52.bpo-31756.IxCvGB.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add a ``subprocess.Popen(text=False)`` keyword argument to `subprocess` -functions to be more explicit about when the library should attempt to -decode outputs into text. Patch by Andrew Clegg. diff --git a/Misc/NEWS.d/next/Library/2017-10-20-16-12-01.bpo-31827.7R8s8s.rst b/Misc/NEWS.d/next/Library/2017-10-20-16-12-01.bpo-31827.7R8s8s.rst deleted file mode 100644 index ae007234d3333f0..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-20-16-12-01.bpo-31827.7R8s8s.rst +++ /dev/null @@ -1,3 +0,0 @@ -Remove the os.stat_float_times() function. It was introduced in Python 2.3 -for backward compatibility with Python 2.2, and was deprecated since Python -3.1. diff --git a/Misc/NEWS.d/next/Library/2017-10-21-09-13-16.bpo-20825.-1MBEy.rst b/Misc/NEWS.d/next/Library/2017-10-21-09-13-16.bpo-20825.-1MBEy.rst deleted file mode 100644 index c1d23ec664b7f0a..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-21-09-13-16.bpo-20825.-1MBEy.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add `subnet_of` and `superset_of` containment tests to -:class:`ipaddress.IPv6Network` and :class:`ipaddress.IPv4Network`. -Patch by Michel Albert and Cheryl Sabella. diff --git a/Misc/NEWS.d/next/Library/2017-10-22-11-06-02.bpo-28326.rxh7L4.rst b/Misc/NEWS.d/next/Library/2017-10-22-11-06-02.bpo-28326.rxh7L4.rst deleted file mode 100644 index bcf43bc84c9e60d..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-22-11-06-02.bpo-28326.rxh7L4.rst +++ /dev/null @@ -1 +0,0 @@ -Fix multiprocessing.Process when stdout and/or stderr is closed or None. diff --git a/Misc/NEWS.d/next/Library/2017-10-22-12-43-03.bpo-31653.ttfGvq.rst b/Misc/NEWS.d/next/Library/2017-10-22-12-43-03.bpo-31653.ttfGvq.rst deleted file mode 100644 index 0587a087924f9dc..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-22-12-43-03.bpo-31653.ttfGvq.rst +++ /dev/null @@ -1,2 +0,0 @@ -Don't release the GIL if we can acquire a multiprocessing semaphore -immediately. diff --git a/Misc/NEWS.d/next/Library/2017-10-23-12-05-33.bpo-28416.Ldnw8X.rst b/Misc/NEWS.d/next/Library/2017-10-23-12-05-33.bpo-28416.Ldnw8X.rst deleted file mode 100644 index b1014827af62219..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-23-12-05-33.bpo-28416.Ldnw8X.rst +++ /dev/null @@ -1,3 +0,0 @@ -Instances of pickle.Pickler subclass with the persistent_id() method and -pickle.Unpickler subclass with the persistent_load() method no longer create -reference cycles. diff --git a/Misc/NEWS.d/next/Library/2017-10-23-16-22-54.bpo-28564.Tx-l-I.rst b/Misc/NEWS.d/next/Library/2017-10-23-16-22-54.bpo-28564.Tx-l-I.rst deleted file mode 100644 index 0889119db35145c..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-23-16-22-54.bpo-28564.Tx-l-I.rst +++ /dev/null @@ -1,2 +0,0 @@ -The shutil.rmtree() function has been sped up to 20--40%. This was done -using the os.scandir() function. diff --git a/Misc/NEWS.d/next/Library/2017-10-23-20-03-36.bpo-28292.1Gkim2.rst b/Misc/NEWS.d/next/Library/2017-10-23-20-03-36.bpo-28292.1Gkim2.rst deleted file mode 100644 index e0eb53ea51c2974..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-23-20-03-36.bpo-28292.1Gkim2.rst +++ /dev/null @@ -1,5 +0,0 @@ -Calendar.itermonthdates() will now consistently raise an exception when a -date falls outside of the 0001-01-01 through 9999-12-31 range. To support -applications that cannot tolerate such exceptions, the new methods -itermonthdays3() and itermonthdays4() are added. The new methods return -tuples and are not restricted by the range supported by datetime.date. diff --git a/Misc/NEWS.d/next/Library/2017-10-23-23-27-52.bpo-31834.InwC6O.rst b/Misc/NEWS.d/next/Library/2017-10-23-23-27-52.bpo-31834.InwC6O.rst deleted file mode 100644 index 0fe3950e69d7346..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-23-23-27-52.bpo-31834.InwC6O.rst +++ /dev/null @@ -1,2 +0,0 @@ -Use optimized code for BLAKE2 only with SSSE3+. The pure SSE2 implementation -is slower than the pure C reference implementation. diff --git a/Misc/NEWS.d/next/Library/2017-10-23.bpo-31854.fh8334f.rst b/Misc/NEWS.d/next/Library/2017-10-23.bpo-31854.fh8334f.rst deleted file mode 100644 index 63131486619f37e..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-23.bpo-31854.fh8334f.rst +++ /dev/null @@ -1 +0,0 @@ -Add ``mmap.ACCESS_DEFAULT`` constant. diff --git a/Misc/NEWS.d/next/Library/2017-10-24-12-00-16.bpo-30768.Om8Yj_.rst b/Misc/NEWS.d/next/Library/2017-10-24-12-00-16.bpo-30768.Om8Yj_.rst deleted file mode 100644 index 77bff97a7ee3d8f..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-24-12-00-16.bpo-30768.Om8Yj_.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() when -called with timeout > 0 and intr_flag=0: recompute the timeout if -sem_timedwait() is interrupted by a signal (EINTR). See also the :pep:`475`. diff --git a/Misc/NEWS.d/next/Library/2017-10-24-12-24-56.bpo-30639.ptNM9a.rst b/Misc/NEWS.d/next/Library/2017-10-24-12-24-56.bpo-30639.ptNM9a.rst deleted file mode 100644 index c6aeb2356f62004..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-24-12-24-56.bpo-30639.ptNM9a.rst +++ /dev/null @@ -1,2 +0,0 @@ -:func:`inspect.getfile` no longer computes the repr of unknown objects to -display in an error message, to protect against badly behaved custom reprs. diff --git a/Misc/NEWS.d/next/Library/2017-10-24-21-10-44.bpo-31702.SfwJDI.rst b/Misc/NEWS.d/next/Library/2017-10-24-21-10-44.bpo-31702.SfwJDI.rst deleted file mode 100644 index 3505cbd78c7ca00..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-24-21-10-44.bpo-31702.SfwJDI.rst +++ /dev/null @@ -1,2 +0,0 @@ -crypt.mksalt() now allows to specify the number of rounds for SHA-256 and -SHA-512 hashing. diff --git a/Misc/NEWS.d/next/Library/2017-10-26-14-54-38.bpo-28281.7ZN5FG.rst b/Misc/NEWS.d/next/Library/2017-10-26-14-54-38.bpo-28281.7ZN5FG.rst deleted file mode 100644 index e7681dd4e8f4904..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-26-14-54-38.bpo-28281.7ZN5FG.rst +++ /dev/null @@ -1,3 +0,0 @@ -Remove year (1-9999) limits on the Calendar.weekday() function. - -Patch by Mark Gollahon. diff --git a/Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst b/Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst deleted file mode 100644 index cbadb051bf3fa5a..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-27.bpo-31884.bjhre9.rst +++ /dev/null @@ -1 +0,0 @@ -added required constants to subprocess module for setting priotity on windows diff --git a/Misc/NEWS.d/next/Library/2017-10-29-11-23-24.bpo-31891.9kAPha.rst b/Misc/NEWS.d/next/Library/2017-10-29-11-23-24.bpo-31891.9kAPha.rst deleted file mode 100644 index 77b00e56906af2b..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-29-11-23-24.bpo-31891.9kAPha.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed building the curses module on NetBSD. diff --git a/Misc/NEWS.d/next/Library/2017-10-29-13-51-01.bpo-31893.8LZKEz.rst b/Misc/NEWS.d/next/Library/2017-10-29-13-51-01.bpo-31893.8LZKEz.rst deleted file mode 100644 index 46be7fb373114da..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-29-13-51-01.bpo-31893.8LZKEz.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed the layout of the kqueue_event structure on OpenBSD and NetBSD. Fixed -the comparison of the kqueue_event objects. diff --git a/Misc/NEWS.d/next/Library/2017-10-29-17-52-40.bpo-25720.vSvb5h.rst b/Misc/NEWS.d/next/Library/2017-10-29-17-52-40.bpo-25720.vSvb5h.rst deleted file mode 100644 index a405cd4b544128f..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-29-17-52-40.bpo-25720.vSvb5h.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix the method for checking pad state of curses WINDOW. Patch by Masayuki -Yamamoto. diff --git a/Misc/NEWS.d/next/Library/2017-10-30-11-04-56.bpo-31897.yjwdEb.rst b/Misc/NEWS.d/next/Library/2017-10-30-11-04-56.bpo-31897.yjwdEb.rst deleted file mode 100644 index 229472cb4898dad..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-10-30-11-04-56.bpo-31897.yjwdEb.rst +++ /dev/null @@ -1,2 +0,0 @@ -plistlib now catches more errors when read binary plists and raises -InvalidFileException instead of unexpected exceptions. diff --git a/Misc/NEWS.d/next/Library/2017-11-01-03-28-24.bpo-31917.DYQL0g.rst b/Misc/NEWS.d/next/Library/2017-11-01-03-28-24.bpo-31917.DYQL0g.rst deleted file mode 100644 index dbfe92ab0b08241..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-01-03-28-24.bpo-31917.DYQL0g.rst +++ /dev/null @@ -1,2 +0,0 @@ -Add 3 new clock identifiers: :data:`time.CLOCK_BOOTTIME`, -:data:`time.CLOCK_PROF` and :data:`time.CLOCK_UPTIME`. diff --git a/Misc/NEWS.d/next/Library/2017-11-01-18-13-42.bpo-27666.j2zRnF.rst b/Misc/NEWS.d/next/Library/2017-11-01-18-13-42.bpo-27666.j2zRnF.rst deleted file mode 100644 index a74f0adfa16bce1..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-01-18-13-42.bpo-27666.j2zRnF.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed stack corruption in curses.box() and curses.ungetmouse() when the size -of types chtype or mmask_t is less than the size of C long. curses.box() -now accepts characters as arguments. Based on patch by Steve Fink. diff --git a/Misc/NEWS.d/next/Library/2017-11-02-18-26-40.bpo-31927.40K6kp.rst b/Misc/NEWS.d/next/Library/2017-11-02-18-26-40.bpo-31927.40K6kp.rst deleted file mode 100644 index 49f8cdf2983eb7b..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-02-18-26-40.bpo-31927.40K6kp.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed compilation of the socket module on NetBSD 8. Fixed assertion failure -or reading arbitrary data when parse a AF_BLUETOOTH address on NetBSD and -DragonFly BSD. diff --git a/Misc/NEWS.d/next/Library/2017-11-02-22-26-16.bpo-21423.hw5mEh.rst b/Misc/NEWS.d/next/Library/2017-11-02-22-26-16.bpo-21423.hw5mEh.rst deleted file mode 100644 index e11f15f90f15a04..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-02-22-26-16.bpo-21423.hw5mEh.rst +++ /dev/null @@ -1 +0,0 @@ -Add an initializer argument to {Process,Thread}PoolExecutor diff --git a/Misc/NEWS.d/next/Library/2017-11-03-08-36-03.bpo-31933.UrtoMP.rst b/Misc/NEWS.d/next/Library/2017-11-03-08-36-03.bpo-31933.UrtoMP.rst deleted file mode 100644 index c4ee1d249801bbb..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-03-08-36-03.bpo-31933.UrtoMP.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix Blake2 params leaf_size and node_offset on big endian platforms. Patch -by Jack O'Connor. diff --git a/Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst b/Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst deleted file mode 100644 index 5740eb2500f26d2..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst +++ /dev/null @@ -1 +0,0 @@ -Fix potential missed signal in signal.signal(). diff --git a/Misc/NEWS.d/next/Library/2017-11-03-22-05-47.bpo-9678.oD51q6.rst b/Misc/NEWS.d/next/Library/2017-11-03-22-05-47.bpo-9678.oD51q6.rst deleted file mode 100644 index 683a2de89bfddec..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-03-22-05-47.bpo-9678.oD51q6.rst +++ /dev/null @@ -1,6 +0,0 @@ -Fixed determining the MAC address in the uuid module: - -* Using ifconfig on NetBSD and OpenBSD. -* Using arp on Linux, FreeBSD, NetBSD and OpenBSD. - -Based on patch by Takayuki Shimizukawa. diff --git a/Misc/NEWS.d/next/Library/2017-11-04-19-28-08.bpo-31943.bxw5gM.rst b/Misc/NEWS.d/next/Library/2017-11-04-19-28-08.bpo-31943.bxw5gM.rst deleted file mode 100644 index a26aca37b5f1532..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-04-19-28-08.bpo-31943.bxw5gM.rst +++ /dev/null @@ -1 +0,0 @@ -Add a ``cancelled()`` method to :class:`asyncio.Handle`. Patch by Marat Sharafutdinov. diff --git a/Misc/NEWS.d/next/Library/2017-11-05-01-17-12.bpo-31945.TLPBtS.rst b/Misc/NEWS.d/next/Library/2017-11-05-01-17-12.bpo-31945.TLPBtS.rst deleted file mode 100644 index 49b8395f287e9ea..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-05-01-17-12.bpo-31945.TLPBtS.rst +++ /dev/null @@ -1,3 +0,0 @@ -Add Configurable *blocksize* to ``HTTPConnection`` and -``HTTPSConnection`` for improved upload throughput. Patch by Nir -Soffer. diff --git a/Misc/NEWS.d/next/Library/2017-11-07-00-37-50.bpo-31843.lM2gkR.rst b/Misc/NEWS.d/next/Library/2017-11-07-00-37-50.bpo-31843.lM2gkR.rst deleted file mode 100644 index c3142f053587388..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-07-00-37-50.bpo-31843.lM2gkR.rst +++ /dev/null @@ -1,2 +0,0 @@ -*database* argument of sqlite3.connect() now accepts a -:term:`path-like object`, instead of just a string. diff --git a/Misc/NEWS.d/next/Library/2017-11-07-14-20-09.bpo-31970.x4EN_9.rst b/Misc/NEWS.d/next/Library/2017-11-07-14-20-09.bpo-31970.x4EN_9.rst deleted file mode 100644 index d0c0fb45e3ecb15..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-07-14-20-09.bpo-31970.x4EN_9.rst +++ /dev/null @@ -1 +0,0 @@ -Reduce performance overhead of asyncio debug mode. diff --git a/Misc/NEWS.d/next/Library/2017-11-07-15-19-52.bpo-21862.RwietE.rst b/Misc/NEWS.d/next/Library/2017-11-07-15-19-52.bpo-21862.RwietE.rst deleted file mode 100644 index 6623d1950df3cad..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-07-15-19-52.bpo-21862.RwietE.rst +++ /dev/null @@ -1,2 +0,0 @@ -cProfile command line now accepts `-m module_name` as an alternative to -script path. Patch by Sanyam Khurana. diff --git a/Misc/NEWS.d/next/Library/2017-11-08-16-51-52.bpo-31985.dE_fOB.rst b/Misc/NEWS.d/next/Library/2017-11-08-16-51-52.bpo-31985.dE_fOB.rst deleted file mode 100644 index 9f55ef5d9ce4f3b..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-08-16-51-52.bpo-31985.dE_fOB.rst +++ /dev/null @@ -1,4 +0,0 @@ -Formally deprecated aifc.openfp, sunau.openfp, and wave.openfp. Since change -7bc817d5ba917528e8bd07ec461c635291e7b06a in 1993, openfp in each of the three -modules had been pointing to that module's open funciton as a matter of -backwards compatibility, though it had been both untested and undocumented. diff --git a/Misc/NEWS.d/next/Library/2017-11-09-21-36-32.bpo-31976.EOA7qY.rst b/Misc/NEWS.d/next/Library/2017-11-09-21-36-32.bpo-31976.EOA7qY.rst deleted file mode 100644 index 1dd54e35b37b1c0..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-09-21-36-32.bpo-31976.EOA7qY.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix race condition when flushing a file is slow, which can cause a -segfault if closing the file from another thread. diff --git a/Misc/NEWS.d/next/Library/2017-11-10-16-27-26.bpo-28369.IS74nd.rst b/Misc/NEWS.d/next/Library/2017-11-10-16-27-26.bpo-28369.IS74nd.rst deleted file mode 100644 index 111c9612f6c6f4a..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-10-16-27-26.bpo-28369.IS74nd.rst +++ /dev/null @@ -1,4 +0,0 @@ -Enhance add_reader/writer check that socket is not used by some transport. -Before, only cases when add_reader/writer were called with an int FD were -supported. Now the check is implemented correctly for all file-like -objects. diff --git a/Misc/NEWS.d/next/Library/2017-11-12-20-47-59.bpo-32011.NzVDdZ.rst b/Misc/NEWS.d/next/Library/2017-11-12-20-47-59.bpo-32011.NzVDdZ.rst deleted file mode 100644 index e2ba502c6571bb3..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-12-20-47-59.bpo-32011.NzVDdZ.rst +++ /dev/null @@ -1,2 +0,0 @@ -Restored support of loading marshal files with the TYPE_INT64 code. These -files can be produced in Python 2.7. diff --git a/Misc/NEWS.d/next/Library/2017-11-13-17-48-33.bpo-32015.4nqRTD.rst b/Misc/NEWS.d/next/Library/2017-11-13-17-48-33.bpo-32015.4nqRTD.rst deleted file mode 100644 index 6117e5625d7edbf..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-13-17-48-33.bpo-32015.4nqRTD.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixed the looping of asyncio in the case of reconnection the socket during -waiting async read/write from/to the socket. diff --git a/Misc/NEWS.d/next/Library/2017-11-15-13-44-28.bpo-32034.uHAOmu.rst b/Misc/NEWS.d/next/Library/2017-11-15-13-44-28.bpo-32034.uHAOmu.rst deleted file mode 100644 index 828e8cde5713838..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-15-13-44-28.bpo-32034.uHAOmu.rst +++ /dev/null @@ -1 +0,0 @@ -Make asyncio.IncompleteReadError and LimitOverrunError pickleable. diff --git a/Misc/NEWS.d/next/Library/2017-11-15-19-04-22.bpo-32037.r8-5Nk.rst b/Misc/NEWS.d/next/Library/2017-11-15-19-04-22.bpo-32037.r8-5Nk.rst deleted file mode 100644 index d077d0e21105dd7..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-15-19-04-22.bpo-32037.r8-5Nk.rst +++ /dev/null @@ -1,4 +0,0 @@ -Integers that fit in a signed 32-bit integer will be now pickled with -protocol 0 using the INT opcode. This will decrease the size of a pickle, -speed up pickling and unpickling, and make these integers be unpickled as -int instances in Python 2. diff --git a/Misc/NEWS.d/next/Library/2017-11-15-20-03-45.bpo-32025.lnIKYT.rst b/Misc/NEWS.d/next/Library/2017-11-15-20-03-45.bpo-32025.lnIKYT.rst deleted file mode 100644 index f3fe3b5a96d1348..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-15-20-03-45.bpo-32025.lnIKYT.rst +++ /dev/null @@ -1 +0,0 @@ -Add time.thread_time() and time.thread_time_ns() diff --git a/Misc/NEWS.d/next/Library/2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst b/Misc/NEWS.d/next/Library/2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst deleted file mode 100644 index aa8a47cb382e8c0..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-16-02-32-41.bpo-32018.YMQ7Q2.rst +++ /dev/null @@ -1,2 +0,0 @@ -inspect.signature should follow PEP 8, if the parameter has an annotation and a -default value. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/2017-11-16-20-09-45.bpo-32046.9sGDtw.rst b/Misc/NEWS.d/next/Library/2017-11-16-20-09-45.bpo-32046.9sGDtw.rst deleted file mode 100644 index a6fc3c46fc36c48..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-16-20-09-45.bpo-32046.9sGDtw.rst +++ /dev/null @@ -1,2 +0,0 @@ -Updates 2to3 to convert from operator.isCallable(obj) to callable(obj). -Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/2017-11-17-18-28-53.bpo-32066.OMQFLH.rst b/Misc/NEWS.d/next/Library/2017-11-17-18-28-53.bpo-32066.OMQFLH.rst deleted file mode 100644 index cbe070542463644..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-17-18-28-53.bpo-32066.OMQFLH.rst +++ /dev/null @@ -1,2 +0,0 @@ -asyncio: Support pathlib.Path in create_unix_connection; sock arg should be -optional diff --git a/Misc/NEWS.d/next/Library/2017-11-18-17-09-01.bpo-32069.S0wyy4.rst b/Misc/NEWS.d/next/Library/2017-11-18-17-09-01.bpo-32069.S0wyy4.rst deleted file mode 100644 index 2d695391e201c8d..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-18-17-09-01.bpo-32069.S0wyy4.rst +++ /dev/null @@ -1 +0,0 @@ -Drop legacy SSL transport from asyncio, ssl.MemoryBIO is always used anyway. diff --git a/Misc/NEWS.d/next/Library/2017-11-18-21-13-52.bpo-32072.nwDV8L.rst b/Misc/NEWS.d/next/Library/2017-11-18-21-13-52.bpo-32072.nwDV8L.rst deleted file mode 100644 index 6da5bb427d4cb97..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-18-21-13-52.bpo-32072.nwDV8L.rst +++ /dev/null @@ -1,6 +0,0 @@ -Fixed issues with binary plists: - -* Fixed saving bytearrays. -* Identical objects will be saved only once. -* Equal references will be load as identical objects. -* Added support for saving and loading recursive data structures. diff --git a/Misc/NEWS.d/next/Library/2017-11-20-01-01-01.bpo-25054.rOlRV6.rst b/Misc/NEWS.d/next/Library/2017-11-20-01-01-01.bpo-25054.rOlRV6.rst deleted file mode 100644 index d30bdbeeb7d8628..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-20-01-01-01.bpo-25054.rOlRV6.rst +++ /dev/null @@ -1 +0,0 @@ -Added support of splitting on a pattern that could match an empty string. diff --git a/Misc/NEWS.d/next/Library/2017-11-20-01-29-46.bpo-1647489.-ZNNkh.rst b/Misc/NEWS.d/next/Library/2017-11-20-01-29-46.bpo-1647489.-ZNNkh.rst deleted file mode 100644 index 7c741ad0762684c..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-20-01-29-46.bpo-1647489.-ZNNkh.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fixed searching regular expression patterns that could match an empty -string. Non-empty string can now be correctly found after matching an empty -string. diff --git a/Misc/NEWS.d/next/Library/2017-11-20-15-28-31.bpo-32088.mV-4Nu.rst b/Misc/NEWS.d/next/Library/2017-11-20-15-28-31.bpo-32088.mV-4Nu.rst deleted file mode 100644 index fda75d7745e16ce..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-20-15-28-31.bpo-32088.mV-4Nu.rst +++ /dev/null @@ -1,3 +0,0 @@ -warnings: When Python is build is debug mode (``Py_DEBUG``), -:exc:`DeprecationWarning`, :exc:`PendingDeprecationWarning` and -:exc:`ImportWarning` warnings are now displayed by default. diff --git a/Misc/NEWS.d/next/Library/2017-11-21-16-05-35.bpo-27535.JLhcNz.rst b/Misc/NEWS.d/next/Library/2017-11-21-16-05-35.bpo-27535.JLhcNz.rst deleted file mode 100644 index 51bcfb7d76953bb..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-21-16-05-35.bpo-27535.JLhcNz.rst +++ /dev/null @@ -1,4 +0,0 @@ -The warnings module doesn't leak memory anymore in the hidden warnings -registry for the "ignore" action of warnings filters. warn_explicit() -function doesn't add the warning key to the registry anymore for the -"ignore" action. diff --git a/Misc/NEWS.d/next/Library/2017-11-22-09-44-15.bpo-32110.VJa9bo.rst b/Misc/NEWS.d/next/Library/2017-11-22-09-44-15.bpo-32110.VJa9bo.rst deleted file mode 100644 index b57ff1acafffc03..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-22-09-44-15.bpo-32110.VJa9bo.rst +++ /dev/null @@ -1,3 +0,0 @@ -``codecs.StreamReader.read(n)`` now returns not more than *n* -characters/bytes for non-negative *n*. This makes it compatible with -``read()`` methods of other file-like objects. diff --git a/Misc/NEWS.d/next/Library/2017-11-22-12-54-46.bpo-28684.NLiDKZ.rst b/Misc/NEWS.d/next/Library/2017-11-22-12-54-46.bpo-28684.NLiDKZ.rst deleted file mode 100644 index 9d8e4da822f3773..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-22-12-54-46.bpo-28684.NLiDKZ.rst +++ /dev/null @@ -1,5 +0,0 @@ -The new test.support.skip_unless_bind_unix_socket() decorator is used here to -skip asyncio tests that fail because the platform lacks a functional bind() -function for unix domain sockets (as it is the case for non root users on the -recent Android versions that run now SELinux in enforcing mode). - diff --git a/Misc/NEWS.d/next/Library/2017-11-22-17-21-01.bpo-10049.ttsBqb.rst b/Misc/NEWS.d/next/Library/2017-11-22-17-21-01.bpo-10049.ttsBqb.rst deleted file mode 100644 index b6153c235d0cc48..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-22-17-21-01.bpo-10049.ttsBqb.rst +++ /dev/null @@ -1,3 +0,0 @@ -Added *nullcontext* no-op context manager to contextlib. This provides a -simpler and faster alternative to ExitStack() when handling optional context -managers. diff --git a/Misc/NEWS.d/next/Library/2017-11-22-19-52-17.bpo-32071.4WNhUH.rst b/Misc/NEWS.d/next/Library/2017-11-22-19-52-17.bpo-32071.4WNhUH.rst deleted file mode 100644 index 2f0f54041cbf6af..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-22-19-52-17.bpo-32071.4WNhUH.rst +++ /dev/null @@ -1,2 +0,0 @@ -Added the ``-k`` command-line option to ``python -m unittest`` to run only -tests that match the given pattern(s). diff --git a/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst b/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst deleted file mode 100644 index 514740b433f38d6..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-23-16-15-55.bpo-19610.Dlca2P.rst +++ /dev/null @@ -1,4 +0,0 @@ -``setup()`` now warns about invalid types for some fields. - -The ``distutils.dist.Distribution`` class now warns when ``classifiers``, -``keywords`` and ``platforms`` fields are not specified as a list or a string. diff --git a/Misc/NEWS.d/next/Library/2017-11-23-21-47-36.bpo-12382.xWT9k0.rst b/Misc/NEWS.d/next/Library/2017-11-23-21-47-36.bpo-12382.xWT9k0.rst deleted file mode 100644 index d9b54259cc6ce30..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-23-21-47-36.bpo-12382.xWT9k0.rst +++ /dev/null @@ -1,2 +0,0 @@ -:func:`msilib.OpenDatabase` now raises a better exception message when it -couldn't open or create an MSI file. Initial patch by William Tisäter. diff --git a/Misc/NEWS.d/next/Library/2017-11-23-22-12-11.bpo-31325.8jAUxN.rst b/Misc/NEWS.d/next/Library/2017-11-23-22-12-11.bpo-31325.8jAUxN.rst deleted file mode 100644 index 89a193c9ef5b8b7..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-23-22-12-11.bpo-31325.8jAUxN.rst +++ /dev/null @@ -1,5 +0,0 @@ -Fix wrong usage of :func:`collections.namedtuple` in -the :meth:`RobotFileParser.parse() ` -method. - -Initial patch by Robin Wellner. diff --git a/Misc/NEWS.d/next/Library/2017-11-24-00-59-12.bpo-32121.ePbmwC.rst b/Misc/NEWS.d/next/Library/2017-11-24-00-59-12.bpo-32121.ePbmwC.rst deleted file mode 100644 index 7701c86aa477102..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-24-00-59-12.bpo-32121.ePbmwC.rst +++ /dev/null @@ -1,6 +0,0 @@ -Made ``tracemalloc.Traceback`` behave more like the traceback module, -sorting the frames from oldest to most recent. ``Traceback.format()`` -now accepts negative *limit*, truncating the result to the ``abs(limit)`` -oldest frames. To get the old behaviour, one can use the new -*most_recent_first* argument to ``Traceback.format()``. -(Patch by Jesse Bakker.) diff --git a/Misc/NEWS.d/next/Library/2017-11-24-11-50-41.bpo-28334.3gGGlt.rst b/Misc/NEWS.d/next/Library/2017-11-24-11-50-41.bpo-28334.3gGGlt.rst deleted file mode 100644 index 074036b1d31e369..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-24-11-50-41.bpo-28334.3gGGlt.rst +++ /dev/null @@ -1,3 +0,0 @@ -Use :func:`os.path.expanduser` to find the ``~/.netrc`` file in -:class:`netrc.netrc`. If it does not exist, :exc:`FileNotFoundError` -is raised. Patch by Dimitri Merejkowsky. diff --git a/Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst b/Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst deleted file mode 100644 index 20d94779e4453aa..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-24-14-07-55.bpo-12239.Nj3A0x.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make :meth:`msilib.SummaryInformation.GetProperty` return ``None`` when the -value of property is ``VT_EMPTY``. Initial patch by Mark Mc Mahon. diff --git a/Misc/NEWS.d/next/Library/2017-11-26-17-00-52.bpo-23033.YGXRWT.rst b/Misc/NEWS.d/next/Library/2017-11-26-17-00-52.bpo-23033.YGXRWT.rst deleted file mode 100644 index cecc10aebb99124..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-26-17-00-52.bpo-23033.YGXRWT.rst +++ /dev/null @@ -1,3 +0,0 @@ -Wildcard is now supported in hostname when it is one and only character in -the left most segment of hostname in second argument of -:meth:`ssl.match_hostname`. Patch by Mandeep Singh. diff --git a/Misc/NEWS.d/next/Library/2017-11-26-18-48-17.bpo-32107.h2ph2K.rst b/Misc/NEWS.d/next/Library/2017-11-26-18-48-17.bpo-32107.h2ph2K.rst deleted file mode 100644 index b26daa7b1b3bfad..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-26-18-48-17.bpo-32107.h2ph2K.rst +++ /dev/null @@ -1,5 +0,0 @@ -``uuid.getnode()`` now preferentially returns universally administered MAC -addresses if available, over locally administered MAC addresses. This makes a -better guarantee for global uniqueness of UUIDs returned from -``uuid.uuid1()``. If only locally administered MAC addresses are available, -the first such one found is returned. diff --git a/Misc/NEWS.d/next/Library/2017-11-27-11-29-34.bpo-32089.6ydDYv.rst b/Misc/NEWS.d/next/Library/2017-11-27-11-29-34.bpo-32089.6ydDYv.rst deleted file mode 100644 index 02d87536e6a6f94..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-27-11-29-34.bpo-32089.6ydDYv.rst +++ /dev/null @@ -1,3 +0,0 @@ -warnings: In development (-X dev) and debug mode (pydebug build), use the -"default" action for ResourceWarning, rather than the "always" action, in -the default warnings filters. diff --git a/Misc/NEWS.d/next/Library/2017-11-28-15-27-10.bpo-32154.kDox7L.rst b/Misc/NEWS.d/next/Library/2017-11-28-15-27-10.bpo-32154.kDox7L.rst deleted file mode 100644 index 67c63062a69c132..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-28-15-27-10.bpo-32154.kDox7L.rst +++ /dev/null @@ -1,5 +0,0 @@ -The ``asyncio.windows_utils.socketpair()`` function has been removed: use -directly :func:`socket.socketpair` which is available on all platforms since -Python 3.5 (before, it wasn't available on Windows). -``asyncio.windows_utils.socketpair()`` was just an alias to -``socket.socketpair`` on Python 3.5 and newer. diff --git a/Misc/NEWS.d/next/Library/2017-11-29-00-42-47.bpo-321010.-axD5l.rst b/Misc/NEWS.d/next/Library/2017-11-29-00-42-47.bpo-321010.-axD5l.rst deleted file mode 100644 index 715a269a5c0a008..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-29-00-42-47.bpo-321010.-axD5l.rst +++ /dev/null @@ -1 +0,0 @@ -Add :attr:`sys.flags.dev_mode` flag diff --git a/Misc/NEWS.d/next/Library/2017-11-30-20-38-16.bpo-32186.O42bVe.rst b/Misc/NEWS.d/next/Library/2017-11-30-20-38-16.bpo-32186.O42bVe.rst deleted file mode 100644 index ea696c6098a1d22..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-11-30-20-38-16.bpo-32186.O42bVe.rst +++ /dev/null @@ -1,3 +0,0 @@ -io.FileIO.readall() and io.FileIO.read() now release the GIL when -getting the file size. Fixed hang of all threads with inaccessible NFS -server. Patch by Nir Soffer. diff --git a/Misc/NEWS.d/next/Library/2017-12-02-16-06-00.bpo-27240.Kji34M.rst b/Misc/NEWS.d/next/Library/2017-12-02-16-06-00.bpo-27240.Kji34M.rst deleted file mode 100644 index c933ee7d91687c5..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-12-02-16-06-00.bpo-27240.Kji34M.rst +++ /dev/null @@ -1,3 +0,0 @@ -The header folding algorithm for the new email policies has been rewritten, -which also fixes bpo-30788, bpo-31831, and bpo-32182. In particular, RFC2231 -folding is now done correctly. diff --git a/Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst b/Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst deleted file mode 100644 index fd9c4d4eed83b56..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-12-04-15-51-57.bpo-32214.uozdNj.rst +++ /dev/null @@ -1,2 +0,0 @@ -PEP 557, Data Classes. Provides a decorator which adds boilerplate methods -to classes which use type annotations so specify fields. diff --git a/Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst b/Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst deleted file mode 100644 index 8f3a89549704a34..000000000000000 --- a/Misc/NEWS.d/next/Library/2017-12-05-02-03-07.bpo-28556.9Z_PsJ.rst +++ /dev/null @@ -1,3 +0,0 @@ -Two minor fixes for ``typing`` module: allow shallow copying instances of -generic classes, improve interaction of ``__init_subclass__`` with generics. -Original PRs by Ivan Levkivskyi. diff --git a/Misc/NEWS.d/next/Tests/2017-10-24-11-36-10.bpo-31174.xCvXcr.rst b/Misc/NEWS.d/next/Tests/2017-10-24-11-36-10.bpo-31174.xCvXcr.rst deleted file mode 100644 index e0980649087047d..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-10-24-11-36-10.bpo-31174.xCvXcr.rst +++ /dev/null @@ -1,3 +0,0 @@ -Fix test_tools.test_unparse: DirectoryTestCase now stores the names sample -to always test the same files. It prevents false alarms when hunting -reference leaks. diff --git a/Misc/NEWS.d/next/Tests/2017-11-24-18-15-12.bpo-32126.PLmNLn.rst b/Misc/NEWS.d/next/Tests/2017-11-24-18-15-12.bpo-32126.PLmNLn.rst deleted file mode 100644 index b5ba9d574e35b49..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-11-24-18-15-12.bpo-32126.PLmNLn.rst +++ /dev/null @@ -1,2 +0,0 @@ -Skip test_get_event_loop_new_process in test.test_asyncio.test_events when -sem_open() is not functional. diff --git a/Misc/NEWS.d/next/Tests/2017-11-25-14-53-29.bpo-28668.Y1G6pA.rst b/Misc/NEWS.d/next/Tests/2017-11-25-14-53-29.bpo-28668.Y1G6pA.rst deleted file mode 100644 index e80516d984e8a98..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-11-25-14-53-29.bpo-28668.Y1G6pA.rst +++ /dev/null @@ -1,3 +0,0 @@ -test.support.requires_multiprocessing_queue is removed. Skip tests with -test.support.import_module('multiprocessing.synchronize') instead when the -semaphore implementation is broken or missing. diff --git a/Misc/NEWS.d/next/Tests/2017-11-26-17-11-27.bpo-32136.Y11luJ.rst b/Misc/NEWS.d/next/Tests/2017-11-26-17-11-27.bpo-32136.Y11luJ.rst deleted file mode 100644 index b7138c4bba52b10..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-11-26-17-11-27.bpo-32136.Y11luJ.rst +++ /dev/null @@ -1,3 +0,0 @@ -The runtime embedding tests have been split out from -``Lib/test/test_capi.py`` into a new ``Lib/test/test_embed.py`` -file. diff --git a/Misc/NEWS.d/next/Tests/2017-11-27-16-18-58.bpo-32138.QsTvf-.rst b/Misc/NEWS.d/next/Tests/2017-11-27-16-18-58.bpo-32138.QsTvf-.rst deleted file mode 100644 index 2430aa7f106b5fd..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-11-27-16-18-58.bpo-32138.QsTvf-.rst +++ /dev/null @@ -1,2 +0,0 @@ -Skip on Android test_faulthandler tests that raise SIGSEGV and remove the -test.support.requires_android_level decorator. diff --git a/Misc/NEWS.d/next/Tests/2017-11-30-12-27-10.bpo-31705.yULW7O.rst b/Misc/NEWS.d/next/Tests/2017-11-30-12-27-10.bpo-31705.yULW7O.rst deleted file mode 100644 index aa2d30c3d6beb63..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-11-30-12-27-10.bpo-31705.yULW7O.rst +++ /dev/null @@ -1,3 +0,0 @@ -Skip test_socket.test_sha256() on Linux kernel older than 4.5. The test -fails with ENOKEY on kernel 3.10 (on ppc64le). A fix was merged into the -kernel 4.5. diff --git a/Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst b/Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst deleted file mode 100644 index 2baecf5adcf7d5f..000000000000000 --- a/Misc/NEWS.d/next/Tests/2017-12-04-23-19-16.bpo-31380.VlMmHW.rst +++ /dev/null @@ -1 +0,0 @@ -Skip test_httpservers test_undecodable_file on macOS: fails on APFS. diff --git a/Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst b/Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst deleted file mode 100644 index 2d20c4ba9910427..000000000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2017-10-23-19-45-52.bpo-30722.ioRlAu.rst +++ /dev/null @@ -1,9 +0,0 @@ -Make redemo work with Python 3.6 and newer versions. - -In Python 3.6, flags like re.DOTALL became members of an enum.IntFlag so -usages like ``getattr(re, 'DOTALL')`` are invalid. - -Also, remove the ``LOCALE`` option since it doesn't work with string -patterns in Python 3. - -Patch by Christoph Sarnowski. diff --git a/Misc/NEWS.d/next/Tools-Demos/2017-11-28-21-24-41.bpo-32159.RSl4QK.rst b/Misc/NEWS.d/next/Tools-Demos/2017-11-28-21-24-41.bpo-32159.RSl4QK.rst deleted file mode 100644 index 29b3545739189c2..000000000000000 --- a/Misc/NEWS.d/next/Tools-Demos/2017-11-28-21-24-41.bpo-32159.RSl4QK.rst +++ /dev/null @@ -1,3 +0,0 @@ -Remove CVS and Subversion tools: remove svneol.py and treesync.py scripts. -CPython migrated from CVS to Subversion, to Mercurial, and then to Git. CVS -and Subversion are no longer used to develop CPython. diff --git a/Misc/NEWS.d/next/Windows/2017-10-23-18-35-50.bpo-31857.YwhEvc.rst b/Misc/NEWS.d/next/Windows/2017-10-23-18-35-50.bpo-31857.YwhEvc.rst deleted file mode 100644 index 13a4978077602fa..000000000000000 --- a/Misc/NEWS.d/next/Windows/2017-10-23-18-35-50.bpo-31857.YwhEvc.rst +++ /dev/null @@ -1,2 +0,0 @@ -Make the behavior of USE_STACKCHECK deterministic in a multi-threaded -environment. diff --git a/Misc/NEWS.d/next/Windows/2017-10-26-23-02-57.bpo-20486.3IdsZ1.rst b/Misc/NEWS.d/next/Windows/2017-10-26-23-02-57.bpo-20486.3IdsZ1.rst deleted file mode 100644 index d65971ec65f4fe2..000000000000000 --- a/Misc/NEWS.d/next/Windows/2017-10-26-23-02-57.bpo-20486.3IdsZ1.rst +++ /dev/null @@ -1,2 +0,0 @@ -Implement the ``Database.Close()`` method to help closing MSI database -objects. diff --git a/Misc/NEWS.d/next/Windows/2017-11-04-15-29-47.bpo-31944.0Bx8tZ.rst b/Misc/NEWS.d/next/Windows/2017-11-04-15-29-47.bpo-31944.0Bx8tZ.rst deleted file mode 100644 index 767e70d997e40c5..000000000000000 --- a/Misc/NEWS.d/next/Windows/2017-11-04-15-29-47.bpo-31944.0Bx8tZ.rst +++ /dev/null @@ -1 +0,0 @@ -Fixes Modify button in Apps and Features dialog. diff --git a/Misc/NEWS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst b/Misc/NEWS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst deleted file mode 100644 index 6a6618e96925585..000000000000000 --- a/Misc/NEWS.d/next/Windows/2017-11-19-09-46-27.bpo-1102.NY-g1F.rst +++ /dev/null @@ -1,4 +0,0 @@ -Return ``None`` when ``View.Fetch()`` returns ``ERROR_NO_MORE_ITEMS`` -instead of raising ``MSIError``. - -Initial patch by Anthony Tuininga. diff --git a/Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst b/Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst deleted file mode 100644 index 555b3812c6a1136..000000000000000 --- a/Misc/NEWS.d/next/macOS/2017-12-04-21-57-43.bpo-31392.f8huBC.rst +++ /dev/null @@ -1 +0,0 @@ -Update macOS installer to use OpenSSL 1.0.2m From 90a6785f6328bd27d307ce20202d6b34aa0cc10b Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Tue, 5 Dec 2017 03:27:19 -0500 Subject: [PATCH 19/39] Bump to 3.7.0a3 --- Include/patchlevel.h | 4 ++-- README.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 64c518e97da7daa..103fac5301c902b 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_SERIAL 3 /* Version as a string */ -#define PY_VERSION "3.7.0a2+" +#define PY_VERSION "3.7.0a3" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/README.rst b/README.rst index a660fcb9ec2f0ab..4a63965b53a05bc 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -This is Python version 3.7.0 alpha 2 +This is Python version 3.7.0 alpha 3 ==================================== .. image:: https://travis-ci.org/python/cpython.svg?branch=master From 33c377ed9b6cb3b9493005314c4e0cfa7517ea65 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 5 Dec 2017 15:12:41 +0100 Subject: [PATCH 20/39] bpo-32030: Simplify _PyCoreConfig_INIT macro (#4728) * Simplify _PyCoreConfig_INIT, _PyMainInterpreterConfig_INIT, _PyPathConfig_INIT macros: no need to set fields to 0/NULL, it's redundant (the C language sets them to 0/NULL for us). * Fix typo: pymain_run_statup() => pymain_run_startup() * Remove a few XXX/TODO --- Include/internal/pystate.h | 20 +++----------------- Include/pystate.h | 22 ++++------------------ Modules/main.c | 12 +++--------- Python/pylifecycle.c | 9 ++------- 4 files changed, 12 insertions(+), 51 deletions(-) diff --git a/Include/internal/pystate.h b/Include/internal/pystate.h index b93342120477f37..6b527fbe2144eeb 100644 --- a/Include/internal/pystate.h +++ b/Include/internal/pystate.h @@ -54,23 +54,8 @@ typedef struct { wchar_t *home; } _PyPathConfig; -#ifdef MS_WINDOWS -#define _PyPathConfig_INIT \ - {.program_full_path = NULL, \ - .prefix = NULL, \ - .dll_path = NULL, \ - .module_search_path = NULL, \ - .program_name = NULL, \ - .home = NULL} -#else -#define _PyPathConfig_INIT \ - {.program_full_path = NULL, \ - .prefix = NULL, \ - .exec_prefix = NULL, \ - .module_search_path = NULL, \ - .program_name = NULL, \ - .home = NULL} -#endif +#define _PyPathConfig_INIT {.module_search_path = NULL} +/* Note: _PyPathConfig_INIT sets other fields to 0/NULL */ PyAPI_DATA(_PyPathConfig) _Py_path_config; @@ -116,6 +101,7 @@ typedef struct pyruntimestate { } _PyRuntimeState; #define _PyRuntimeState_INIT {.initialized = 0, .core_initialized = 0} +/* Note: _PyRuntimeState_INIT sets other fields to 0/NULL */ PyAPI_DATA(_PyRuntimeState) _PyRuntime; PyAPI_FUNC(_PyInitError) _PyRuntimeState_Init(_PyRuntimeState *); diff --git a/Include/pystate.h b/Include/pystate.h index 1d8aab6d83f742e..cf45b059977a5be 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -38,19 +38,8 @@ typedef struct { int show_alloc_count; /* -X showalloccount */ } _PyCoreConfig; -#define _PyCoreConfig_INIT \ - (_PyCoreConfig){\ - .ignore_environment = 0, \ - .use_hash_seed = -1, \ - .hash_seed = 0, \ - ._disable_importlib = 0, \ - .allocator = NULL, \ - .dev_mode = 0, \ - .faulthandler = 0, \ - .tracemalloc = 0, \ - .import_time = 0, \ - .show_ref_count = 0, \ - .show_alloc_count = 0} +#define _PyCoreConfig_INIT (_PyCoreConfig){.use_hash_seed = -1} +/* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */ /* Placeholders while working on the new configuration API * @@ -69,11 +58,8 @@ typedef struct { } _PyMainInterpreterConfig; #define _PyMainInterpreterConfig_INIT \ - (_PyMainInterpreterConfig){\ - .install_signal_handlers = -1, \ - .module_search_path_env = NULL, \ - .home = NULL, \ - .program_name = NULL} + (_PyMainInterpreterConfig){.install_signal_handlers = -1} +/* Note: _PyMainInterpreterConfig_INIT sets other fields to 0/NULL */ typedef struct _is { diff --git a/Modules/main.c b/Modules/main.c index 4095259b88c7624..e2ca72c7dc1a46a 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -160,7 +160,7 @@ pymain_get_env_var(const char *name) static void -pymain_run_statup(PyCompilerFlags *cf) +pymain_run_startup(PyCompilerFlags *cf) { char *startup = Py_GETENV("PYTHONSTARTUP"); if (startup == NULL || startup[0] == '\0') { @@ -367,8 +367,6 @@ pymain_run_file(FILE *fp, const wchar_t *filename, PyCompilerFlags *p_cf) /* Main program */ -/*TODO: Add arg processing to PEP 432 as a new configuration setup API - */ typedef struct { size_t len; wchar_t **options; @@ -949,8 +947,6 @@ pymain_get_program_name(_PyMain *pymain) * * Replaces previous call to Py_Initialize() * - * TODO: Move environment queries (etc) into Py_ReadConfig - * * Return 0 on success. * Set pymain->err and return -1 on error. */ @@ -1121,10 +1117,9 @@ pymain_run_filename(_PyMain *pymain) if (cmdline->filename == NULL && pymain->stdin_is_interactive) { Py_InspectFlag = 0; /* do exit on SystemExit */ - pymain_run_statup(&pymain->cf); + pymain_run_startup(&pymain->cf); pymain_run_interactive_hook(); } - /* XXX */ if (pymain->main_importer_path != NULL) { pymain->status = pymain_run_main_from_importer(pymain); @@ -1162,7 +1157,7 @@ pymain_repl(_PyMain *pymain) Py_InspectFlag = 0; pymain_run_interactive_hook(); - /* XXX */ + int res = PyRun_AnyFileFlags(stdin, "", &pymain->cf); pymain->status = (res != 0); } @@ -1630,7 +1625,6 @@ pymain_init(_PyMain *pymain) } pymain->core_config._disable_importlib = 0; - /* TODO: Moar config options! */ pymain->config.install_signal_handlers = 1; orig_argc = pymain->argc; /* For Py_GetArgcArgv() */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 523397f1269f74f..b615c799989364d 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -606,10 +606,6 @@ _Py_SetLocaleFromEnv(int category) * safe to call without calling Py_Initialize first) */ -/* TODO: Progressively move functionality from Py_BeginInitialization to - * Py_ReadConfig and Py_EndInitialization - */ - _PyInitError _Py_InitializeCore(const _PyCoreConfig *config) { @@ -881,10 +877,9 @@ _Py_InitializeMainInterpreter(const _PyMainInterpreterConfig *config) return _Py_INIT_OK(); } - /* TODO: Report exceptions rather than fatal errors below here */ - - if (_PyTime_Init() < 0) + if (_PyTime_Init() < 0) { return _Py_INIT_ERR("can't initialize time"); + } /* GetPath may initialize state that _PySys_EndInit locks in, and so has to be called first. */ From 2582f6f24e895d60c35857095706b2a1942c1bed Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Tue, 5 Dec 2017 15:52:19 -0500 Subject: [PATCH 21/39] Add dataclasses to CODEOWNERS. (GH-4730) --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8e0647fdc1fba19..5506ca781013c16 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -50,4 +50,6 @@ Python/bootstrap_hash.c @python/crypto-team **/*functools* @ncoghlan @rhettinger **/*decimal* @rhettinger @skrah +**/*dataclasses* @ericvsmith + **/*idlelib* @terryjreedy From 5e8cbcc4f25dcdc02651414f792dc4a546ba199b Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 5 Dec 2017 13:56:39 -0800 Subject: [PATCH 22/39] Add Guido and Ivan as owners for typing.py (#4729) --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5506ca781013c16..3511dcf94a1a7e7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -53,3 +53,5 @@ Python/bootstrap_hash.c @python/crypto-team **/*dataclasses* @ericvsmith **/*idlelib* @terryjreedy + +**/*typing* @gvanrossum @ilevkivskyi From a2a25eb03762680b98bb8cd090e43d0994a72c49 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Tue, 5 Dec 2017 21:06:12 -0500 Subject: [PATCH 23/39] Bump to 3.7.0a3+ --- Include/patchlevel.h | 2 +- README.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h index 103fac5301c902b..dd0fd8213d8a6b5 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 3 /* Version as a string */ -#define PY_VERSION "3.7.0a3" +#define PY_VERSION "3.7.0a3+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/README.rst b/README.rst index 4a63965b53a05bc..d60fcac35d553d4 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -This is Python version 3.7.0 alpha 3 -==================================== +This is Python version 3.7.0 alpha 3+ +===================================== .. image:: https://travis-ci.org/python/cpython.svg?branch=master :alt: CPython build status on Travis CI From 672b6baa71010f236ee8c8ce912e98cb542385c6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 6 Dec 2017 17:25:50 +0100 Subject: [PATCH 24/39] bpo-32030: pass interp to _PyImport_Init() (#4736) Remove also the initstr variable, unused since the commit e69f0df45b709c25ac80617c41bbae16f56870fb pushed in 2012: "bpo-13959: Re-implement imp.find_module() in Lib/imp.py" --- Include/pylifecycle.h | 2 +- Python/import.c | 10 +--------- Python/pylifecycle.c | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index fa751692a6670a3..4c87428a23a5de2 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -127,7 +127,7 @@ PyAPI_FUNC(const char *) _Py_gitversion(void); PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); PyAPI_FUNC(_PyInitError) _PySys_BeginInit(PyObject **sysmod); PyAPI_FUNC(int) _PySys_EndInit(PyObject *sysdict); -PyAPI_FUNC(_PyInitError) _PyImport_Init(void); +PyAPI_FUNC(_PyInitError) _PyImport_Init(PyInterpreterState *interp); PyAPI_FUNC(void) _PyExc_Init(PyObject * bltinmod); PyAPI_FUNC(_PyInitError) _PyImportHooks_Init(void); PyAPI_FUNC(int) _PyFrame_Init(void); diff --git a/Python/import.c b/Python/import.c index 57521e4920715c6..9a9857385cb981b 100644 --- a/Python/import.c +++ b/Python/import.c @@ -31,8 +31,6 @@ extern struct _inittab _PyImport_Inittab[]; struct _inittab *PyImport_Inittab = _PyImport_Inittab; -static PyObject *initstr = NULL; - /*[clinic input] module _imp [clinic start generated code]*/ @@ -43,14 +41,8 @@ module _imp /* Initialize things */ _PyInitError -_PyImport_Init(void) +_PyImport_Init(PyInterpreterState *interp) { - PyInterpreterState *interp = PyThreadState_Get()->interp; - initstr = PyUnicode_InternFromString("__init__"); - if (initstr == NULL) { - return _Py_INIT_ERR("Can't initialize import variables"); - } - interp->builtins_copy = PyDict_Copy(interp->builtins); if (interp->builtins_copy == NULL) { return _Py_INIT_ERR("Can't backup builtins dict"); diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index b615c799989364d..504036c3ef84eeb 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -751,7 +751,7 @@ _Py_InitializeCore(const _PyCoreConfig *config) PySys_SetObject("__stderr__", pstderr); Py_DECREF(pstderr); - err = _PyImport_Init(); + err = _PyImport_Init(interp); if (_Py_INIT_FAILED(err)) { return err; } From 6bf992a1ac6f3f4d0f83ead9c6403a76afdbe6eb Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 6 Dec 2017 17:26:10 +0100 Subject: [PATCH 25/39] bpo-32030: Add pymain_get_global_config() (#4735) * Py_Main() now starts by reading Py_xxx configuration variables to only work on its own private structure, and then later writes back the configuration into these variables. * Replace Py_GETENV() with pymain_get_env_var() which ignores empty variables. * Add _PyCoreConfig.dump_refs * Add _PyCoreConfig.malloc_stats * _PyObject_DebugMallocStats() is now responsible to check if debug hooks are installed. The function returns 1 if stats were written, or 0 if the hooks are disabled. Mark _PyMem_PymallocEnabled() as static. --- Include/objimpl.h | 2 +- Include/pymem.h | 4 - Include/pystate.h | 10 ++- Modules/main.c | 170 ++++++++++++++++++++++++++++--------------- Objects/obmalloc.c | 12 ++- Python/pylifecycle.c | 18 +++-- Python/sysmodule.c | 3 +- 7 files changed, 142 insertions(+), 77 deletions(-) diff --git a/Include/objimpl.h b/Include/objimpl.h index 746f9c921344f71..ed9e7a9680668dd 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -109,7 +109,7 @@ PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void); /* Macros */ #ifdef WITH_PYMALLOC #ifndef Py_LIMITED_API -PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out); +PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out); #endif /* #ifndef Py_LIMITED_API */ #endif diff --git a/Include/pymem.h b/Include/pymem.h index 09d15020e0e4a6a..8ee0efddca7d753 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -24,10 +24,6 @@ PyAPI_FUNC(int) _PyMem_SetupAllocators(const char *opt); /* Try to get the allocators name set by _PyMem_SetupAllocators(). */ PyAPI_FUNC(const char*) _PyMem_GetAllocatorsName(void); -#ifdef WITH_PYMALLOC -PyAPI_FUNC(int) _PyMem_PymallocEnabled(void); -#endif - /* Track an allocated memory block in the tracemalloc module. Return 0 on success, return -1 on error (failed to allocate memory to store the trace). diff --git a/Include/pystate.h b/Include/pystate.h index cf45b059977a5be..d149aeb2aff2795 100644 --- a/Include/pystate.h +++ b/Include/pystate.h @@ -36,6 +36,8 @@ typedef struct { int import_time; /* -X importtime */ int show_ref_count; /* -X showrefcount */ int show_alloc_count; /* -X showalloccount */ + int dump_refs; /* PYTHONDUMPREFS */ + int malloc_stats; /* PYTHONMALLOCSTATS */ } _PyCoreConfig; #define _PyCoreConfig_INIT (_PyCoreConfig){.use_hash_seed = -1} @@ -111,7 +113,7 @@ typedef struct _is { PyObject *after_forkers_child; #endif } PyInterpreterState; -#endif +#endif /* !Py_LIMITED_API */ /* State unique per thread */ @@ -133,7 +135,7 @@ typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); #define PyTrace_C_EXCEPTION 5 #define PyTrace_C_RETURN 6 #define PyTrace_OPCODE 7 -#endif +#endif /* Py_LIMITED_API */ #ifdef Py_LIMITED_API typedef struct _ts PyThreadState; @@ -238,7 +240,7 @@ typedef struct _ts { /* XXX signal handlers should also be here */ } PyThreadState; -#endif +#endif /* !Py_LIMITED_API */ PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); @@ -363,7 +365,7 @@ PyAPI_FUNC(int) PyGILState_Check(void); Return NULL before _PyGILState_Init() is called and after _PyGILState_Fini() is called. */ PyAPI_FUNC(PyInterpreterState *) _PyGILState_GetInterpreterStateUnsafe(void); -#endif +#endif /* !Py_LIMITED_API */ /* The implementation of sys._current_frames() Returns a dict mapping diff --git a/Modules/main.c b/Modules/main.c index e2ca72c7dc1a46a..6d53c56e356f666 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -162,8 +162,8 @@ pymain_get_env_var(const char *name) static void pymain_run_startup(PyCompilerFlags *cf) { - char *startup = Py_GETENV("PYTHONSTARTUP"); - if (startup == NULL || startup[0] == '\0') { + char *startup = pymain_get_env_var("PYTHONSTARTUP"); + if (startup == NULL) { return; } @@ -377,23 +377,28 @@ typedef struct { wchar_t *command; /* -c argument */ wchar_t *module; /* -m argument */ _Py_OptList warning_options; /* -W options */ - PyObject *extra_options; /* -X options */ int print_help; /* -h, -? options */ int print_version; /* -V option */ - int bytes_warning; /* Py_BytesWarningFlag */ - int debug; /* Py_DebugFlag */ - int inspect; /* Py_InspectFlag */ - int interactive; /* Py_InteractiveFlag */ - int isolated; /* Py_IsolatedFlag */ - int optimization_level; /* Py_OptimizeFlag */ - int dont_write_bytecode; /* Py_DontWriteBytecodeFlag */ - int no_user_site_directory; /* Py_NoUserSiteDirectory */ - int no_site_import; /* Py_NoSiteFlag */ - int use_unbuffered_io; /* Py_UnbufferedStdioFlag */ - int verbosity; /* Py_VerboseFlag */ - int quiet_flag; /* Py_QuietFlag */ + int bytes_warning; /* Py_BytesWarningFlag, -b */ + int debug; /* Py_DebugFlag, -b, PYTHONDEBUG */ + int inspect; /* Py_InspectFlag, -i, PYTHONINSPECT */ + int interactive; /* Py_InteractiveFlag, -i */ + int isolated; /* Py_IsolatedFlag, -I */ + int optimization_level; /* Py_OptimizeFlag, -O, PYTHONOPTIMIZE */ + int dont_write_bytecode; /* Py_DontWriteBytecodeFlag, -B, PYTHONDONTWRITEBYTECODE */ + int no_user_site_directory; /* Py_NoUserSiteDirectory, -I, -s, PYTHONNOUSERSITE */ + int no_site_import; /* Py_NoSiteFlag, -S */ + int use_unbuffered_io; /* Py_UnbufferedStdioFlag, -u, PYTHONUNBUFFERED */ + int verbosity; /* Py_VerboseFlag, -v, PYTHONVERBOSE */ + int quiet_flag; /* Py_QuietFlag, -q */ int skip_first_line; /* -x option */ _Py_OptList xoptions; /* -X options */ +#ifdef MS_WINDOWS + int legacy_windows_fs_encoding; /* Py_LegacyWindowsFSEncodingFlag, + PYTHONLEGACYWINDOWSFSENCODING */ + int legacy_windows_stdio; /* Py_LegacyWindowsStdioFlag, + PYTHONLEGACYWINDOWSSTDIO */ +#endif } _Py_CommandLineDetails; /* Structure used by Py_Main() to pass data to subfunctions */ @@ -695,19 +700,6 @@ pymain_parse_cmdline_impl(_PyMain *pymain) } -static void -maybe_set_flag(int *flag, int value) -{ - /* Helper to set flag variables from command line options - * - uses the higher of the two values if they're both set - * - otherwise leaves the flag unset - */ - if (*flag < value) { - *flag = value; - } -} - - static int pymain_add_xoptions(_PyMain *pymain) { @@ -790,9 +782,8 @@ pymain_warnings_envvar(_PyMain *pymain) PyMem_RawFree(buf); } #else - char *p; - - if ((p = Py_GETENV("PYTHONWARNINGS")) && *p != '\0') { + char *p = pymain_get_env_var("PYTHONWARNINGS"); + if (p != NULL) { char *buf, *oldloc; /* settle for strtok here as there's no one standard @@ -885,7 +876,6 @@ config_get_program_name(_PyMainInterpreterConfig *config) } #ifdef __APPLE__ - char *p; /* On MacOS X, when the Python interpreter is embedded in an application bundle, it gets executed by a bootstrapping script that does os.execve() with an argv[0] that's different from the @@ -895,7 +885,8 @@ config_get_program_name(_PyMainInterpreterConfig *config) so the actual executable path is passed in an environment variable. See Lib/plat-mac/bundlebuiler.py for details about the bootstrap script. */ - if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') { + char *p = pymain_get_env_var("PYTHONEXECUTABLE"); + if (p != NULL) { size_t len; wchar_t* program_name = Py_DecodeLocale(p, &len); if (program_name == NULL) { @@ -1015,25 +1006,76 @@ pymain_set_argv(_PyMain *pymain) } +static void +pymain_get_flag(int flag, int *value) +{ + if (flag) { + *value = flag; + } +} + +static void +pymain_set_flag(int *flag, int value) +{ + /* Helper to set flag variables from command line options + * - uses the higher of the two values if they're both set + * - otherwise leaves the flag unset + */ + if (*flag < value) { + *flag = value; + } +} + + +/* Get Py_xxx global configuration variables */ +static void +pymain_get_global_config(_PyMain *pymain) +{ + _Py_CommandLineDetails *cmdline = &pymain->cmdline; + pymain_get_flag(Py_BytesWarningFlag, &cmdline->bytes_warning); + pymain_get_flag(Py_DebugFlag, &cmdline->debug); + pymain_get_flag(Py_InspectFlag, &cmdline->inspect); + pymain_get_flag(Py_InteractiveFlag, &cmdline->interactive); + pymain_get_flag(Py_IsolatedFlag, &cmdline->isolated); + pymain_get_flag(Py_OptimizeFlag, &cmdline->optimization_level); + pymain_get_flag(Py_DontWriteBytecodeFlag, &cmdline->dont_write_bytecode); + pymain_get_flag(Py_NoUserSiteDirectory, &cmdline->no_user_site_directory); + pymain_get_flag(Py_NoSiteFlag, &cmdline->no_site_import); + pymain_get_flag(Py_UnbufferedStdioFlag, &cmdline->use_unbuffered_io); + pymain_get_flag(Py_VerboseFlag, &cmdline->verbosity); + pymain_get_flag(Py_QuietFlag, &cmdline->quiet_flag); +#ifdef MS_WINDOWS + pymain_get_flag(Py_LegacyWindowsFSEncodingFlag, &cmdline->legacy_windows_fs_encoding); + pymain_get_flag(Py_LegacyWindowsStdioFlag, &cmdline->legacy_windows_stdio); +#endif + + pymain_get_flag(Py_IgnoreEnvironmentFlag, &pymain->core_config.ignore_environment); +} + + /* Set Py_XXX global configuration variables */ static void pymain_set_global_config(_PyMain *pymain) { _Py_CommandLineDetails *cmdline = &pymain->cmdline; - maybe_set_flag(&Py_BytesWarningFlag, cmdline->bytes_warning); - maybe_set_flag(&Py_DebugFlag, cmdline->debug); - maybe_set_flag(&Py_InspectFlag, cmdline->inspect); - maybe_set_flag(&Py_InteractiveFlag, cmdline->interactive); - maybe_set_flag(&Py_IsolatedFlag, cmdline->isolated); - maybe_set_flag(&Py_OptimizeFlag, cmdline->optimization_level); - maybe_set_flag(&Py_DontWriteBytecodeFlag, cmdline->dont_write_bytecode); - maybe_set_flag(&Py_NoUserSiteDirectory, cmdline->no_user_site_directory); - maybe_set_flag(&Py_NoSiteFlag, cmdline->no_site_import); - maybe_set_flag(&Py_UnbufferedStdioFlag, cmdline->use_unbuffered_io); - maybe_set_flag(&Py_VerboseFlag, cmdline->verbosity); - maybe_set_flag(&Py_QuietFlag, cmdline->quiet_flag); - - maybe_set_flag(&Py_IgnoreEnvironmentFlag, pymain->core_config.ignore_environment); + pymain_set_flag(&Py_BytesWarningFlag, cmdline->bytes_warning); + pymain_set_flag(&Py_DebugFlag, cmdline->debug); + pymain_set_flag(&Py_InspectFlag, cmdline->inspect); + pymain_set_flag(&Py_InteractiveFlag, cmdline->interactive); + pymain_set_flag(&Py_IsolatedFlag, cmdline->isolated); + pymain_set_flag(&Py_OptimizeFlag, cmdline->optimization_level); + pymain_set_flag(&Py_DontWriteBytecodeFlag, cmdline->dont_write_bytecode); + pymain_set_flag(&Py_NoUserSiteDirectory, cmdline->no_user_site_directory); + pymain_set_flag(&Py_NoSiteFlag, cmdline->no_site_import); + pymain_set_flag(&Py_UnbufferedStdioFlag, cmdline->use_unbuffered_io); + pymain_set_flag(&Py_VerboseFlag, cmdline->verbosity); + pymain_set_flag(&Py_QuietFlag, cmdline->quiet_flag); +#ifdef MS_WINDOWS + pymain_set_flag(&Py_LegacyWindowsFSEncodingFlag, cmdline->legacy_windows_fs_encoding); + pymain_set_flag(&Py_LegacyWindowsStdioFlag, cmdline->legacy_windows_stdio); +#endif + + pymain_set_flag(&Py_IgnoreEnvironmentFlag, pymain->core_config.ignore_environment); } @@ -1330,24 +1372,25 @@ pymain_set_flag_from_env(int *flag, const char *name) static void pymain_set_flags_from_env(_PyMain *pymain) { - pymain_set_flag_from_env(&Py_DebugFlag, + _Py_CommandLineDetails *cmdline = &pymain->cmdline; + pymain_set_flag_from_env(&cmdline->debug, "PYTHONDEBUG"); - pymain_set_flag_from_env(&Py_VerboseFlag, + pymain_set_flag_from_env(&cmdline->verbosity, "PYTHONVERBOSE"); - pymain_set_flag_from_env(&Py_OptimizeFlag, + pymain_set_flag_from_env(&cmdline->optimization_level, "PYTHONOPTIMIZE"); - pymain_set_flag_from_env(&Py_InspectFlag, + pymain_set_flag_from_env(&cmdline->inspect, "PYTHONINSPECT"); - pymain_set_flag_from_env(&Py_DontWriteBytecodeFlag, + pymain_set_flag_from_env(&cmdline->dont_write_bytecode, "PYTHONDONTWRITEBYTECODE"); - pymain_set_flag_from_env(&Py_NoUserSiteDirectory, + pymain_set_flag_from_env(&cmdline->no_user_site_directory, "PYTHONNOUSERSITE"); - pymain_set_flag_from_env(&Py_UnbufferedStdioFlag, + pymain_set_flag_from_env(&cmdline->use_unbuffered_io, "PYTHONUNBUFFERED"); #ifdef MS_WINDOWS - pymain_set_flag_from_env(&Py_LegacyWindowsFSEncodingFlag, + pymain_set_flag_from_env(&cmdline->legacy_windows_fs_encoding, "PYTHONLEGACYWINDOWSFSENCODING"); - pymain_set_flag_from_env(&Py_LegacyWindowsStdioFlag, + pymain_set_flag_from_env(&cmdline->legacy_windows_stdio, "PYTHONLEGACYWINDOWSSTDIO"); #endif } @@ -1485,7 +1528,7 @@ pymain_parse_envvars(_PyMain *pymain) return -1; } - core_config->allocator = Py_GETENV("PYTHONMALLOC"); + core_config->allocator = pymain_get_env_var("PYTHONMALLOC"); /* -X options */ if (pymain_get_xoption(pymain, L"showrefcount")) { @@ -1514,6 +1557,14 @@ pymain_parse_envvars(_PyMain *pymain) core_config->faulthandler = 1; core_config->allocator = "debug"; } + if (pymain_get_env_var("PYTHONDUMPREFS")) { + pymain->core_config.dump_refs = 1; + } + if (pymain_get_env_var("PYTHONMALLOCSTATS")) { + pymain->core_config.malloc_stats = 1; + } + + return 0; } @@ -1535,6 +1586,7 @@ pymain_parse_cmdline_envvars_impl(_PyMain *pymain) return 1; } + /* Set Py_IgnoreEnvironmentFlag needed by Py_GETENV() */ pymain_set_global_config(pymain); if (pymain_parse_envvars(pymain) < 0) { @@ -1568,6 +1620,8 @@ pymain_parse_cmdline_envvars(_PyMain *pymain) static int pymain_init_python(_PyMain *pymain) { + pymain_set_global_config(pymain); + pymain_init_stdio(pymain); pymain->err = _Py_InitializeCore(&pymain->core_config); @@ -1641,6 +1695,8 @@ pymain_impl(_PyMain *pymain) return -1; } + pymain_get_global_config(pymain); + res = pymain_parse_cmdline_envvars(pymain); if (res < 0) { return -1; diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 7911028ad83f6ab..c065541458b2579 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -379,7 +379,7 @@ _PyMem_DebugEnabled(void) return (_PyObject.malloc == _PyMem_DebugMalloc); } -int +static int _PyMem_PymallocEnabled(void) { if (_PyMem_DebugEnabled()) { @@ -2467,10 +2467,17 @@ pool_is_in_list(const poolp target, poolp list) /* Print summary info to "out" about the state of pymalloc's structures. * In Py_DEBUG mode, also perform some expensive internal consistency * checks. + * + * Return 0 if the memory debug hooks are not installed or no statistics was + * writen into out, return 1 otherwise. */ -void +int _PyObject_DebugMallocStats(FILE *out) { + if (!_PyMem_PymallocEnabled()) { + return 0; + } + uint i; const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT; /* # of pools, allocated blocks, and free blocks per class index */ @@ -2603,6 +2610,7 @@ _PyObject_DebugMallocStats(FILE *out) total += printone(out, "# bytes lost to quantization", quantization); total += printone(out, "# bytes lost to arena alignment", arena_alignment); (void)printone(out, "Total", total); + return 1; } #endif /* #ifdef WITH_PYMALLOC */ diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 504036c3ef84eeb..0b3aa98ba2e1245 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -1103,6 +1103,10 @@ Py_FinalizeEx(void) tstate = PyThreadState_GET(); interp = tstate->interp; + /* Copy the core config to be able to use it even + after PyInterpreterState_Delete() */ + _PyCoreConfig core_config = interp->core_config; + /* Remaining threads (e.g. daemon threads) will automatically exit after taking the GIL (in PyEval_RestoreThread()). */ _PyRuntime.finalizing = tstate; @@ -1186,7 +1190,7 @@ Py_FinalizeEx(void) _PyHash_Fini(); #ifdef Py_REF_DEBUG - if (interp->core_config.show_ref_count) { + if (core_config.show_ref_count) { _PyDebug_PrintTotalRefs(); } #endif @@ -1197,8 +1201,9 @@ Py_FinalizeEx(void) * Alas, a lot of stuff may still be alive now that will be cleaned * up later. */ - if (Py_GETENV("PYTHONDUMPREFS")) + if (core_config.dump_refs) { _Py_PrintReferences(stderr); + } #endif /* Py_TRACE_REFS */ /* Clear interpreter state and all thread states. */ @@ -1260,14 +1265,13 @@ Py_FinalizeEx(void) * An address can be used to find the repr of the object, printed * above by _Py_PrintReferences. */ - if (Py_GETENV("PYTHONDUMPREFS")) + if (core_config.dump_refs) { _Py_PrintReferenceAddresses(stderr); + } #endif /* Py_TRACE_REFS */ #ifdef WITH_PYMALLOC - if (_PyMem_PymallocEnabled()) { - char *opt = Py_GETENV("PYTHONMALLOCSTATS"); - if (opt != NULL && *opt != '\0') - _PyObject_DebugMallocStats(stderr); + if (core_config.malloc_stats) { + _PyObject_DebugMallocStats(stderr); } #endif diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 64bc14e9c3d7339..eeeaa7240e7c603 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1368,8 +1368,7 @@ static PyObject * sys_debugmallocstats(PyObject *self, PyObject *args) { #ifdef WITH_PYMALLOC - if (_PyMem_PymallocEnabled()) { - _PyObject_DebugMallocStats(stderr); + if (_PyObject_DebugMallocStats(stderr)) { fputc('\n', stderr); } #endif From 1b4587a2462fc05a14be87123083322103a1f55b Mon Sep 17 00:00:00 2001 From: Sanyam Khurana <8039608+CuriousLearner@users.noreply.github.com> Date: Wed, 6 Dec 2017 22:09:33 +0530 Subject: [PATCH 26/39] bpo-25910: Fixes redirection from http to https (#4674) --- Doc/bugs.rst | 2 +- Doc/faq/design.rst | 2 +- Doc/faq/gui.rst | 6 +++--- Doc/faq/library.rst | 2 +- Doc/faq/programming.rst | 2 +- Doc/faq/windows.rst | 4 ++-- Doc/glossary.rst | 2 +- Doc/howto/curses.rst | 2 +- Doc/howto/pyporting.rst | 2 +- Doc/howto/unicode.rst | 4 ++-- Doc/library/email.generator.rst | 4 ++-- Doc/library/hashlib.rst | 4 ++-- Doc/library/othergui.rst | 6 +++--- Doc/library/secrets.rst | 4 ++-- Doc/library/select.rst | 2 +- Doc/library/sqlite3.rst | 2 +- Doc/library/ssl.rst | 2 +- Doc/library/tkinter.rst | 4 ++-- Doc/library/unittest.rst | 2 +- Doc/tutorial/interactive.rst | 2 +- Doc/using/mac.rst | 2 +- Doc/using/windows.rst | 6 +++--- Doc/whatsnew/2.7.rst | 6 +++--- Doc/whatsnew/3.6.rst | 4 ++-- 24 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Doc/bugs.rst b/Doc/bugs.rst index bc1d10f379cb350..109e9eb202d8ea9 100644 --- a/Doc/bugs.rst +++ b/Doc/bugs.rst @@ -68,7 +68,7 @@ taken on the bug. .. seealso:: - `How to Report Bugs Effectively `_ + `How to Report Bugs Effectively `_ Article which goes into some detail about how to create a useful bug report. This describes what kind of information is useful and why it is useful. diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 1bd800b1a81babc..2e56fbc2f425ecd 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -343,7 +343,7 @@ each Python stack frame. Also, extensions can call back into Python at almost random moments. Therefore, a complete threads implementation requires thread support for C. -Answer 2: Fortunately, there is `Stackless Python `_, +Answer 2: Fortunately, there is `Stackless Python `_, which has a completely redesigned interpreter loop that avoids the C stack. diff --git a/Doc/faq/gui.rst b/Doc/faq/gui.rst index 38e1796267ff3a7..4f9979bf55ed3a2 100644 --- a/Doc/faq/gui.rst +++ b/Doc/faq/gui.rst @@ -43,7 +43,7 @@ number of platforms, with Windows, Mac OS X, GTK, X11, all listed as current stable targets. Language bindings are available for a number of languages including Python, Perl, Ruby, etc. -wxPython (http://www.wxpython.org) is the Python binding for +`wxPython `_ is the Python binding for wxwidgets. While it often lags slightly behind the official wxWidgets releases, it also offers a number of features via pure Python extensions that are not available in other language bindings. There @@ -72,9 +72,9 @@ Gtk+ The `GObject introspection bindings `_ for Python allow you to write GTK+ 3 applications. There is also a -`Python GTK+ 3 Tutorial `_. +`Python GTK+ 3 Tutorial `_. -The older PyGtk bindings for the `Gtk+ 2 toolkit `_ have +The older PyGtk bindings for the `Gtk+ 2 toolkit `_ have been implemented by James Henstridge; see . Kivy diff --git a/Doc/faq/library.rst b/Doc/faq/library.rst index b5fdfa42cdb0823..f84feadd7802345 100644 --- a/Doc/faq/library.rst +++ b/Doc/faq/library.rst @@ -419,7 +419,7 @@ Python program effectively only uses one CPU, due to the insistence that Back in the days of Python 1.5, Greg Stein actually implemented a comprehensive patch set (the "free threading" patches) that removed the GIL and replaced it with fine-grained locking. Adam Olsen recently did a similar experiment -in his `python-safethread `_ +in his `python-safethread `_ project. Unfortunately, both experiments exhibited a sharp drop in single-thread performance (at least 30% slower), due to the amount of fine-grained locking necessary to compensate for the removal of the GIL. diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 1022373d3871ec5..1a2f582a31ad178 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -100,7 +100,7 @@ which don't. One is Thomas Heller's py2exe (Windows only) at http://www.py2exe.org/ -Another tool is Anthony Tuininga's `cx_Freeze `_. +Another tool is Anthony Tuininga's `cx_Freeze `_. Are there coding standards or a style guide for Python programs? diff --git a/Doc/faq/windows.rst b/Doc/faq/windows.rst index 6ac83e45d2e8152..d703f2862221a66 100644 --- a/Doc/faq/windows.rst +++ b/Doc/faq/windows.rst @@ -170,8 +170,8 @@ offender. How do I make an executable from a Python script? ------------------------------------------------- -See http://cx-freeze.sourceforge.net/ for a distutils extension that allows you -to create console and GUI executables from Python code. +See `cx_Freeze `_ for a distutils extension +that allows you to create console and GUI executables from Python code. `py2exe `_, the most popular extension for building Python 2.x-based executables, does not yet support Python 3 but a version that does is in development. diff --git a/Doc/glossary.rst b/Doc/glossary.rst index b947520b96b6651..ba4d300c0e92079 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -126,7 +126,7 @@ Glossary BDFL Benevolent Dictator For Life, a.k.a. `Guido van Rossum - `_, Python's creator. + `_, Python's creator. binary file A :term:`file object` able to read and write diff --git a/Doc/howto/curses.rst b/Doc/howto/curses.rst index 1d3bfb87dc04744..19d65d6996b7f87 100644 --- a/Doc/howto/curses.rst +++ b/Doc/howto/curses.rst @@ -543,7 +543,7 @@ learn more about submitting patches to Python. * `Writing Programs with NCURSES `_: a lengthy tutorial for C programmers. -* `The ncurses man page `_ +* `The ncurses man page `_ * `The ncurses FAQ `_ * `"Use curses... don't swear" `_: video of a PyCon 2013 talk on controlling terminals using curses or Urwid. diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst index 8562d2373749f08..bec6a3d72ce548a 100644 --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -449,4 +449,4 @@ to make sure everything functions as expected in both versions of Python. .. _"What's New": https://docs.python.org/3/whatsnew/index.html -.. _Why Python 3 exists: http://www.snarky.ca/why-python-3-exists +.. _Why Python 3 exists: https://snarky.ca/why-python-3-exists diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index 9649b9c609c255a..a83e5a21895c2a6 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -217,7 +217,7 @@ To help understand the standard, Jukka Korpela has written `an introductory guide `_ to reading the Unicode character tables. -Another `good introductory article `_ +Another `good introductory article `_ was written by Joel Spolsky. If this introduction didn't make things clear to you, you should try reading this alternate article before continuing. @@ -487,7 +487,7 @@ References Some good alternative discussions of Python's Unicode support are: * `Processing Text Files in Python 3 `_, by Nick Coghlan. -* `Pragmatic Unicode `_, a PyCon 2012 presentation by Ned Batchelder. +* `Pragmatic Unicode `_, a PyCon 2012 presentation by Ned Batchelder. The :class:`str` type is described in the Python library reference at :ref:`textseq`. diff --git a/Doc/library/email.generator.rst b/Doc/library/email.generator.rst index 1e64e1066c7da58..cc8e8225a203ab9 100644 --- a/Doc/library/email.generator.rst +++ b/Doc/library/email.generator.rst @@ -53,7 +53,7 @@ over channels that are not "8 bit clean". :data:`~email.policy.compat32` policy and ``False`` for all others). *mangle_from_* is intended for use when messages are stored in unix mbox format (see :mod:`mailbox` and `WHY THE CONTENT-LENGTH FORMAT IS BAD - `_). + `_). If *maxheaderlen* is not ``None``, refold any header lines that are longer than *maxheaderlen*, or if ``0``, do not rewrap any headers. If @@ -154,7 +154,7 @@ to be using :class:`BytesGenerator`, and not :class:`Generator`. :data:`~email.policy.compat32` policy and ``False`` for all others). *mangle_from_* is intended for use when messages are stored in unix mbox format (see :mod:`mailbox` and `WHY THE CONTENT-LENGTH FORMAT IS BAD - `_). + `_). If *maxheaderlen* is not ``None``, refold any header lines that are longer than *maxheaderlen*, or if ``0``, do not rewrap any headers. If diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst index 452705f4d2ae787..d4916914f79ce74 100644 --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -482,7 +482,7 @@ Keyed hashing Keyed hashing can be used for authentication as a faster and simpler replacement for `Hash-based message authentication code -`_ (HMAC). +`_ (HMAC). BLAKE2 can be securely used in prefix-MAC mode thanks to the indifferentiability property inherited from BLAKE. @@ -699,7 +699,7 @@ implementation, extension code, and this documentation: You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see - http://creativecommons.org/publicdomain/zero/1.0/. + https://creativecommons.org/publicdomain/zero/1.0/. The following people have helped with development or contributed their changes to the project and the public domain according to the Creative Commons Public diff --git a/Doc/library/othergui.rst b/Doc/library/othergui.rst index d40abe167653b71..4548459f8e261d7 100644 --- a/Doc/library/othergui.rst +++ b/Doc/library/othergui.rst @@ -11,9 +11,9 @@ available for Python: `PyGObject `_ PyGObject provides introspection bindings for C libraries using `GObject `_. One of - these libraries is the `GTK+ 3 `_ widget set. + these libraries is the `GTK+ 3 `_ widget set. GTK+ comes with many more widgets than Tkinter provides. An online - `Python GTK+ 3 Tutorial `_ + `Python GTK+ 3 Tutorial `_ is available. `PyGTK `_ @@ -35,7 +35,7 @@ available for Python: Compared to PyQt, its licensing scheme is friendlier to non-open source applications. - `wxPython `_ + `wxPython `_ wxPython is a cross-platform GUI toolkit for Python that is built around the popular `wxWidgets `_ (formerly wxWindows) C++ toolkit. It provides a native look and feel for applications on diff --git a/Doc/library/secrets.rst b/Doc/library/secrets.rst index 9bf848f91143599..28ce472c7e7e168 100644 --- a/Doc/library/secrets.rst +++ b/Doc/library/secrets.rst @@ -130,7 +130,7 @@ Other functions Return ``True`` if strings *a* and *b* are equal, otherwise ``False``, in such a way as to reduce the risk of - `timing attacks `_. + `timing attacks `_. See :func:`hmac.compare_digest` for additional details. @@ -173,7 +173,7 @@ three digits: break -Generate an `XKCD-style passphrase `_: +Generate an `XKCD-style passphrase `_: .. testcode:: diff --git a/Doc/library/select.rst b/Doc/library/select.rst index bd5442c6a27aa09..e252e7adb9246ac 100644 --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -264,7 +264,7 @@ object. Edge and Level Trigger Polling (epoll) Objects ---------------------------------------------- - http://linux.die.net/man/4/epoll + https://linux.die.net/man/4/epoll *eventmask* diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index c7b9af4037f801b..e7676a9f3a50821 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -107,7 +107,7 @@ This example uses the iterator form:: The SQLite web page; the documentation describes the syntax and the available data types for the supported SQL dialect. - http://www.w3schools.com/sql/ + https://www.w3schools.com/sql/ Tutorial, reference and examples for learning SQL syntax. :pep:`249` - Database API Specification 2.0 diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst index 45bb65ff0715e33..6122af18ede6592 100644 --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -1590,7 +1590,7 @@ to speed up repeated connections from the same clients. .. versionadded:: 3.3 .. seealso:: - `SSL/TLS & Perfect Forward Secrecy `_ + `SSL/TLS & Perfect Forward Secrecy `_ Vincent Bernat. .. method:: SSLContext.wrap_socket(sock, server_side=False, \ diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst index f51add2b41fe46b..f222fe6f8b20536 100644 --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -38,7 +38,7 @@ this should open a window demonstrating a simple Tk interface. `Programming Python `_ Book by Mark Lutz, has excellent coverage of Tkinter. - `Modern Tkinter for Busy Python Developers `_ + `Modern Tkinter for Busy Python Developers `_ Book by Mark Rozerman about building attractive and modern graphical user interfaces with Python and Tkinter. `Python and Tkinter Programming `_ @@ -183,7 +183,7 @@ documentation that exists. Here are some hints: `ActiveState Tcl Home Page `_ The Tk/Tcl development is largely taking place at ActiveState. - `Tcl and the Tk Toolkit `_ + `Tcl and the Tk Toolkit `_ The book by John Ousterhout, the inventor of Tcl. `Practical Programming in Tcl and Tk `_ diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 4755488d91db061..93ccd0fd61139c3 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -56,7 +56,7 @@ test runner Kent Beck's original paper on testing frameworks using the pattern shared by :mod:`unittest`. - `Nose `_ and `py.test `_ + `Nose `_ and `py.test `_ Third-party unittest frameworks with a lighter-weight syntax for writing tests. For example, ``assert func(10) == 42``. diff --git a/Doc/tutorial/interactive.rst b/Doc/tutorial/interactive.rst index d73cfeb34f19468..c0eb1feec4eb4d1 100644 --- a/Doc/tutorial/interactive.rst +++ b/Doc/tutorial/interactive.rst @@ -51,4 +51,4 @@ bpython_. .. _GNU Readline: https://tiswww.case.edu/php/chet/readline/rltop.html .. _IPython: https://ipython.org/ -.. _bpython: http://www.bpython-interpreter.org/ +.. _bpython: https://www.bpython-interpreter.org/ diff --git a/Doc/using/mac.rst b/Doc/using/mac.rst index 8f1ac3f3fd3a97e..b89c98709ea3795 100644 --- a/Doc/using/mac.rst +++ b/Doc/using/mac.rst @@ -149,7 +149,7 @@ X by Apple, and the latest version can be downloaded and installed from https://www.activestate.com; it can also be built from source. *wxPython* is another popular cross-platform GUI toolkit that runs natively on -Mac OS X. Packages and documentation are available from http://www.wxpython.org. +Mac OS X. Packages and documentation are available from https://www.wxpython.org. *PyQt* is another popular cross-platform GUI toolkit that runs natively on Mac OS X. More information can be found at diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst index 3d47d7c51543bb6..cc560d968a1de9a 100644 --- a/Doc/using/windows.rst +++ b/Doc/using/windows.rst @@ -291,9 +291,9 @@ for detailed information about platforms with pre-compiled installers. by Mark Pilgrim, 2004, ISBN 1-59059-356-1 - `For Windows users `_ + `For Windows users `_ in "Installing Python" - in "`A Byte of Python `_" + in "`A Byte of Python `_" by Swaroop C H, 2003 @@ -871,7 +871,7 @@ shipped with PyWin32. It is an embeddable IDE with a built-in debugger. cx_Freeze --------- -`cx_Freeze `_ is a :mod:`distutils` +`cx_Freeze `_ is a :mod:`distutils` extension (see :ref:`extending-distutils`) which wraps Python scripts into executable Windows programs (:file:`{*}.exe` files). When you have done this, you can distribute your application without requiring your users to install diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 55392fc2be08729..eec8984539573cf 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -1809,7 +1809,7 @@ wish to read the Tcl/Tk manual page describing the Ttk theme engine, available at https://www.tcl.tk/man/tcl8.5/TkCmd/ttk_intro.htm. Some screenshots of the Python/Ttk code in use are at -http://code.google.com/p/python-ttk/wiki/Screenshots. +https://code.google.com/archive/p/python-ttk/wikis/Screenshots.wiki. The :mod:`ttk` module was written by Guilherme Polo and added in :issue:`2983`. An alternate version called ``Tile.py``, written by @@ -1832,8 +1832,8 @@ https://pypi.python.org/pypi/unittest2. When used from the command line, the module can automatically discover tests. It's not as fancy as `py.test `__ or -`nose `__, but provides a simple way -to run tests kept within a set of package directories. For example, +`nose `__, but provides a +simple way to run tests kept within a set of package directories. For example, the following command will search the :file:`test/` subdirectory for any importable test files named ``test*.py``:: diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index 60469cd1d365197..67c86df02076bb7 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -238,8 +238,8 @@ and the ``__annotations__`` attribute. and Guido van Rossum. Implemented by Ivan Levkivskyi. Tools that use or will use the new syntax: - `mypy `_, - `pytype `_, PyCharm, etc. + `mypy `_, + `pytype `_, PyCharm, etc. .. _whatsnew36-pep515: From 92a3c6f493ad411e4cf0acdf305ef4876aa90669 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 6 Dec 2017 18:12:59 +0100 Subject: [PATCH 27/39] bpo-32030: Add _PyImport_Fini2() (#4737) PyImport_ExtendInittab() now uses PyMem_RawRealloc() rather than PyMem_Realloc(). PyImport_ExtendInittab() can be called before Py_Initialize() whereas only the PyMem_Raw allocator is supposed to be used before Py_Initialize(). Add _PyImport_Fini2() to release the memory allocated by PyImport_ExtendInittab() at exit. PyImport_ExtendInittab() now forces the usage of the default raw allocator, to be able to release memory in _PyImport_Fini2(). Don't export these functions anymore to be C API, only to Py_BUILD_CORE: * _PyExc_Fini() * _PyImport_Fini() * _PyGC_DumpShutdownStats() * _PyGC_Fini() * _PyType_Fini() * _Py_HashRandomization_Fini() --- Include/pylifecycle.h | 17 +++++++++----- Modules/main.c | 44 +++++++++++++++++++++--------------- Python/import.c | 52 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 78 insertions(+), 35 deletions(-) diff --git a/Include/pylifecycle.h b/Include/pylifecycle.h index 4c87428a23a5de2..bda51f84c3cbcec 100644 --- a/Include/pylifecycle.h +++ b/Include/pylifecycle.h @@ -137,9 +137,18 @@ PyAPI_FUNC(_PyInitError) _Py_HashRandomization_Init(_PyCoreConfig *core_config); #endif /* Various internal finalizers */ -#ifndef Py_LIMITED_API + +#ifdef Py_BUILD_CORE PyAPI_FUNC(void) _PyExc_Fini(void); PyAPI_FUNC(void) _PyImport_Fini(void); +PyAPI_FUNC(void) _PyImport_Fini2(void); +PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void); +PyAPI_FUNC(void) _PyGC_Fini(void); +PyAPI_FUNC(void) _PyType_Fini(void); +PyAPI_FUNC(void) _Py_HashRandomization_Fini(void); +#endif /* Py_BUILD_CORE */ + +#ifndef Py_LIMITED_API PyAPI_FUNC(void) PyMethod_Fini(void); PyAPI_FUNC(void) PyFrame_Fini(void); PyAPI_FUNC(void) PyCFunction_Fini(void); @@ -151,15 +160,11 @@ PyAPI_FUNC(void) PyBytes_Fini(void); PyAPI_FUNC(void) PyByteArray_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); -PyAPI_FUNC(void) _PyGC_DumpShutdownStats(void); -PyAPI_FUNC(void) _PyGC_Fini(void); PyAPI_FUNC(void) PySlice_Fini(void); -PyAPI_FUNC(void) _PyType_Fini(void); -PyAPI_FUNC(void) _Py_HashRandomization_Fini(void); PyAPI_FUNC(void) PyAsyncGen_Fini(void); PyAPI_FUNC(int) _Py_IsFinalizing(void); -#endif +#endif /* !Py_LIMITED_API */ /* Signals */ typedef void (*PyOS_sighandler_t)(int); diff --git a/Modules/main.c b/Modules/main.c index 6d53c56e356f666..4ab1ff29fac0d26 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -446,17 +446,18 @@ pymain_optlist_clear(_Py_OptList *list) list->options = NULL; } -static void -pymain_free_impl(_PyMain *pymain) -{ - _Py_CommandLineDetails *cmdline = &pymain->cmdline; - pymain_optlist_clear(&cmdline->warning_options); - pymain_optlist_clear(&cmdline->xoptions); - PyMem_RawFree(cmdline->command); - pymain_optlist_clear(&pymain->env_warning_options); - Py_CLEAR(pymain->main_importer_path); +/* Free global variables which cannot be freed in Py_Finalize(): + configuration options set before Py_Initialize() which should + remain valid after Py_Finalize(), since Py_Initialize()/Py_Finalize() can + be called multiple times. + Called with the current memory allocators. */ +static void +pymain_free_globals(_PyMain *pymain) +{ + _PyPathConfig_Clear(&_Py_path_config); + _PyImport_Fini2(); _PyMainInterpreterConfig_Clear(&pymain->config); #ifdef __INSURE__ @@ -473,6 +474,20 @@ pymain_free_impl(_PyMain *pymain) #endif /* __INSURE__ */ } + +static void +pymain_free_pymain(_PyMain *pymain) +{ + _Py_CommandLineDetails *cmdline = &pymain->cmdline; + pymain_optlist_clear(&cmdline->warning_options); + pymain_optlist_clear(&cmdline->xoptions); + PyMem_RawFree(cmdline->command); + + pymain_optlist_clear(&pymain->env_warning_options); + Py_CLEAR(pymain->main_importer_path); + +} + static void pymain_free(_PyMain *pymain) { @@ -480,12 +495,12 @@ pymain_free(_PyMain *pymain) PyMemAllocatorEx old_alloc; _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); - pymain_free_impl(pymain); + pymain_free_pymain(pymain); + pymain_free_globals(pymain); PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); } - static int pymain_run_main_from_importer(_PyMain *pymain) { @@ -1719,13 +1734,6 @@ pymain_impl(_PyMain *pymain) pymain->status = 120; } - /* _PyPathConfig_Clear() cannot be called in Py_FinalizeEx(). - Py_Initialize() and Py_Finalize() can be called multiple times, but it - must not "forget" parameters set by Py_SetProgramName(), Py_SetPath() or - Py_SetPythonHome(), whereas _PyPathConfig_Clear() clear all these - parameters. */ - _PyPathConfig_Clear(&_Py_path_config); - return 0; } diff --git a/Python/import.c b/Python/import.c index 9a9857385cb981b..cc7417ba84e1c75 100644 --- a/Python/import.c +++ b/Python/import.c @@ -30,6 +30,7 @@ static PyObject *extensions = NULL; extern struct _inittab _PyImport_Inittab[]; struct _inittab *PyImport_Inittab = _PyImport_Inittab; +static struct _inittab *inittab_copy = NULL; /*[clinic input] module _imp @@ -285,6 +286,19 @@ _PyImport_Fini(void) } } +void +_PyImport_Fini2(void) +{ + /* Use the same memory allocator than PyImport_ExtendInittab(). */ + PyMemAllocatorEx old_alloc; + _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + + /* Free memory allocated by PyImport_ExtendInittab() */ + PyMem_RawFree(inittab_copy); + + PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); +} + /* Helper for sys */ PyObject * @@ -2233,9 +2247,9 @@ PyInit_imp(void) int PyImport_ExtendInittab(struct _inittab *newtab) { - static struct _inittab *our_copy = NULL; struct _inittab *p; - int i, n; + Py_ssize_t i, n; + int res = 0; /* Count the number of entries in both tables */ for (n = 0; newtab[n].name != NULL; n++) @@ -2245,19 +2259,35 @@ PyImport_ExtendInittab(struct _inittab *newtab) for (i = 0; PyImport_Inittab[i].name != NULL; i++) ; + /* Force default raw memory allocator to get a known allocator to be able + to release the memory in _PyImport_Fini2() */ + PyMemAllocatorEx old_alloc; + _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + /* Allocate new memory for the combined table */ - p = our_copy; - PyMem_RESIZE(p, struct _inittab, i+n+1); - if (p == NULL) - return -1; + if ((i + n + 1) <= PY_SSIZE_T_MAX / sizeof(struct _inittab)) { + size_t size = sizeof(struct _inittab) * (i + n + 1); + p = PyMem_RawRealloc(inittab_copy, size); + } + else { + p = NULL; + } + if (p == NULL) { + res = -1; + goto done; + } - /* Copy the tables into the new memory */ - if (our_copy != PyImport_Inittab) + /* Copy the tables into the new memory at the first call + to PyImport_ExtendInittab(). */ + if (inittab_copy != PyImport_Inittab) { memcpy(p, PyImport_Inittab, (i+1) * sizeof(struct _inittab)); - PyImport_Inittab = our_copy = p; - memcpy(p+i, newtab, (n+1) * sizeof(struct _inittab)); + } + memcpy(p + i, newtab, (n + 1) * sizeof(struct _inittab)); + PyImport_Inittab = inittab_copy = p; - return 0; +done: + PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + return res; } /* Shorthand to add a single entry given a name and a function */ From bd4ed77f73d37df325fc8f1e193b3ce6bc08094d Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Wed, 6 Dec 2017 18:24:17 +0100 Subject: [PATCH 28/39] bpo-32233: Fix build with --with-system-libmpdec. (#4739) --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c22de17f9533964..09e35e50609429e 100644 --- a/setup.py +++ b/setup.py @@ -2069,6 +2069,7 @@ def _decimal_ext(self): 'Modules', '_decimal', 'libmpdec'))] + libraries = ['m'] sources = [ '_decimal/_decimal.c', '_decimal/libmpdec/basearith.c', @@ -2164,7 +2165,7 @@ def _decimal_ext(self): ext = Extension ( '_decimal', include_dirs=include_dirs, - libraries=['m'], + libraries=libraries, define_macros=define_macros, undef_macros=undef_macros, extra_compile_args=extra_compile_args, From 9d25bd11ca121cfc76e5bf31c265e72956208598 Mon Sep 17 00:00:00 2001 From: Rob Boehne Date: Wed, 6 Dec 2017 11:58:17 -0600 Subject: [PATCH 29/39] Modify configure to link with the compiler driver under HP-UX when not using gcc. (#2519) --- configure | 3 ++- configure.ac | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d02675742d27d91..20d8095c252dded 100755 --- a/configure +++ b/configure @@ -9124,7 +9124,8 @@ then LDSHARED='$(CC) -shared' LDCXXSHARED='$(CXX) -shared' else - LDSHARED='ld -b' + LDSHARED='$(CC) -b' + LDCXXSHARED='$(CXX) -shared' fi ;; Darwin/1.3*) LDSHARED='$(CC) -bundle' diff --git a/configure.ac b/configure.ac index 68a95c3be6af4a3..828dadb56c4ab2e 100644 --- a/configure.ac +++ b/configure.ac @@ -2442,7 +2442,8 @@ then LDSHARED='$(CC) -shared' LDCXXSHARED='$(CXX) -shared' else - LDSHARED='ld -b' + LDSHARED='$(CC) -b' + LDCXXSHARED='$(CXX) -b' fi ;; Darwin/1.3*) LDSHARED='$(CC) -bundle' From 24e77f92658c7d258e2a3cf9868f3f4658932b40 Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Wed, 6 Dec 2017 14:00:34 -0500 Subject: [PATCH 30/39] Use raw strings for regex to avoid invalid escape sequences. (GH-4741) --- Lib/test/test_dataclasses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py index caea98a13b06b7e..9d08a2d4c916fe1 100755 --- a/Lib/test/test_dataclasses.py +++ b/Lib/test/test_dataclasses.py @@ -1831,7 +1831,7 @@ class C: # if we're also replacing one that does exist. Test this # here, because setting attributes on frozen instances is # handled slightly differently from non-frozen ones. - with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected " + with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected " "keyword argument 'a'"): c1 = replace(c, x=20, a=5) @@ -1842,7 +1842,7 @@ class C: y: int c = C(1, 2) - with self.assertRaisesRegex(TypeError, "__init__\(\) got an unexpected " + with self.assertRaisesRegex(TypeError, r"__init__\(\) got an unexpected " "keyword argument 'z'"): c1 = replace(c, z=3) From 9ab11b3a029fba36c1a7e869be87fb4f31ebcf24 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 6 Dec 2017 11:33:15 -0800 Subject: [PATCH 31/39] Allows non-critical upload steps to fail (#4742) --- Tools/msi/uploadrelease.proj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/msi/uploadrelease.proj b/Tools/msi/uploadrelease.proj index 881b825e10711d8..96b99a4ff6352c9 100644 --- a/Tools/msi/uploadrelease.proj +++ b/Tools/msi/uploadrelease.proj @@ -52,11 +52,11 @@ - + - + - + From fb77e0d855e841f42c3fa504efe79eefca9efafb Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 7 Dec 2017 06:55:44 +0000 Subject: [PATCH 32/39] Fix hardcoded value in test_os.py (#4744) --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 96ee3ee577fb9e3..22412569092228b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1321,7 +1321,7 @@ def get_urandom_subprocess(self, count): 'sys.stdout.buffer.flush()')) out = assert_python_ok('-c', code) stdout = out[1] - self.assertEqual(len(stdout), 16) + self.assertEqual(len(stdout), count) return stdout def test_urandom_subprocess(self): From ec3057ebc03ef1c10bb7631199cd6111845575a0 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Mon, 4 Dec 2017 19:12:37 +0530 Subject: [PATCH 33/39] issue #32035: Update zipfile doc --- Doc/library/zipfile.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 5b8c776ed648cd2..d753c927e371db4 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,9 +385,9 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write the string *data* to the archive; *zinfo_or_arcname* is either the file - name it will be given in the archive, or a :class:`ZipInfo` instance. If it's - an instance, at least the filename, date, and time must be given. If it's a + Write the string or bytes *data* to the archive; if it is a *str*, it should be encoded as UTF-8. + *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. + If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. From 2a9f863519ce99d8f63d93c9beb6c3fb909b3bd0 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Tue, 5 Dec 2017 08:34:20 +0530 Subject: [PATCH 34/39] bpo-32035: Updated zipfile doc1 --- Doc/library/zipfile.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index d753c927e371db4..4f5cc9da96f7e74 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,9 +385,8 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write the string or bytes *data* to the archive; if it is a *str*, it should be encoded as UTF-8. - *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. - If it's an instance, at least the filename, date, and time must be given. If it's a + Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; if it is a + *str*, it is encoded as UTF-8. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. From ba77575cf64712f35616cc0b5f993c90516fb8b6 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Tue, 5 Dec 2017 08:41:54 +0530 Subject: [PATCH 35/39] bpo-32035: Updated zipfile doc2 --- Doc/library/zipfile.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 4f5cc9da96f7e74..8dd23b857806fa8 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,9 +385,11 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; if it is a - *str*, it is encoded as UTF-8. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a - name, the date and time is set to the current date and time. + Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; + if it is a *str*, it is encoded as UTF-8. + *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. + If it's an instance, at least the filename, date, and time must be given. + If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. If given, *compress_type* overrides the value given for the *compression* From 7c092d9ac859c9d0987ce581b5356918ed6e2a27 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Tue, 5 Dec 2017 10:48:16 +0530 Subject: [PATCH 36/39] bpo-32035: Updated zipfile doc fix travis fail --- Doc/library/zipfile.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 8dd23b857806fa8..a7591e100241ddb 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,10 +385,10 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; - if it is a *str*, it is encoded as UTF-8. - *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. - If it's an instance, at least the filename, date, and time must be given. + Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; + if it is a *str*, it is encoded as UTF-8. + *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. + If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``. From af68b0d12cab53c4e188b110c09fa9a6b7af6620 Mon Sep 17 00:00:00 2001 From: "Chirag Rathod (Srce Cde)" Date: Thu, 7 Dec 2017 18:28:38 +0530 Subject: [PATCH 37/39] Updated zipfile doc3 --- Doc/library/zipfile.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index a7591e100241ddb..9871515dcdfd4f8 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,8 +385,7 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write a file into archive. The content is *data* which may be either a *str* or a *bytes* instance; - if it is a *str*, it is encoded as UTF-8. + `ZipFile.write()` writes a file into archive. `ZipFile.writestr()` writes a bytes data or a string. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. From 4829bb3980a74d7022d5fd71782f11d02832be6b Mon Sep 17 00:00:00 2001 From: "Chirag Rathod (Srce Cde)" Date: Fri, 8 Dec 2017 15:09:23 +0530 Subject: [PATCH 38/39] Updated zipfile doc4 --- Doc/library/zipfile.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 9871515dcdfd4f8..1d06a0284d2b76e 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,7 +385,7 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - `ZipFile.write()` writes a file into archive. `ZipFile.writestr()` writes a bytes data or a string. + Writes a file into archive. The content is `data`; It can be a `bytes` or a `str` data. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. From ef8abed72964cf62149a56edf5a4adfd4e810674 Mon Sep 17 00:00:00 2001 From: Srce Cde Date: Fri, 8 Dec 2017 15:26:38 +0530 Subject: [PATCH 39/39] Updated zipfile doc4 travis fix --- Doc/library/zipfile.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 1d06a0284d2b76e..2da2bed6c168ee8 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -385,7 +385,7 @@ ZipFile Objects .. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Writes a file into archive. The content is `data`; It can be a `bytes` or a `str` data. + Writes a file into archive. The content is `data`; it can be a `bytes` or a `str` data. *zinfo_or_arcname* is either the name of the file in the archive or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time.