Bug 1547730 - Stop using some cases of types.NoneType. r=#build
☠☠ backed out by ee4b88439111 ☠ ☠
authorJustin Wood <Callek@gmail.com>
Mon, 13 May 2019 15:29:30 -0400
changeset 533015 2d6ba80390c8d4f09a53b89936836982baebd31f
parent 533014 75879e53727cca39ce05eb638b60a8516c5eb029
child 533016 61b8fcc639e087ced07e6dacf77fb66c1bb5f178
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1547730
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547730 - Stop using some cases of types.NoneType. r=#build Differential Revision: https://phabricator.services.mozilla.com/D30966
python/mozbuild/mozbuild/configure/options.py
python/mozbuild/mozbuild/util.py
--- a/python/mozbuild/mozbuild/configure/options.py
+++ b/python/mozbuild/mozbuild/configure/options.py
@@ -2,17 +2,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 import six
 import sys
-import types
 from collections import OrderedDict
 
 
 def istupleofstrings(obj):
     return isinstance(obj, tuple) and len(obj) and all(
         isinstance(o, six.string_types) for o in obj)
 
 
@@ -184,17 +183,17 @@ class Option(object):
             if not env.isupper():
                 raise InvalidOptionError(
                     'Environment variable name must be all uppercase')
         if nargs not in (None, '?', '*', '+') and not (
                 isinstance(nargs, int) and nargs >= 0):
             raise InvalidOptionError(
                 "nargs must be a positive integer, '?', '*' or '+'")
         if (not isinstance(default, six.string_types) and
-                not isinstance(default, (bool, types.NoneType)) and
+                not isinstance(default, (bool, type(None))) and
                 not istupleofstrings(default)):
             raise InvalidOptionError(
                 'default must be a bool, a string or a tuple of strings')
         if choices and not istupleofstrings(choices):
             raise InvalidOptionError(
                 'choices must be a tuple of strings')
         if not help:
             raise InvalidOptionError('A help string must be provided')
--- a/python/mozbuild/mozbuild/util.py
+++ b/python/mozbuild/mozbuild/util.py
@@ -16,17 +16,16 @@ import functools
 import hashlib
 import itertools
 import os
 import re
 import six
 import stat
 import sys
 import time
-import types
 
 from collections import (
     Iterable,
     OrderedDict,
 )
 from io import (
     StringIO,
     BytesIO,
@@ -380,26 +379,26 @@ class ListMixin(object):
         if not isinstance(sequence, list):
             raise ValueError('List can only be sliced with other list instances.')
 
         return super(ListMixin, self).__setslice__(i, j, sequence)
 
     def __add__(self, other):
         # Allow None and EmptyValue is a special case because it makes undefined
         # variable references in moz.build behave better.
-        other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other
+        other = [] if isinstance(other, (type(None), EmptyValue)) else other
         if not isinstance(other, list):
             raise ValueError('Only lists can be appended to lists.')
 
         new_list = self.__class__(self, **self._kwargs)
         new_list.extend(other)
         return new_list
 
     def __iadd__(self, other):
-        other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other
+        other = [] if isinstance(other, (type(None), EmptyValue)) else other
         if not isinstance(other, list):
             raise ValueError('Only lists can be appended to lists.')
 
         return super(ListMixin, self).__iadd__(other)
 
 
 class List(ListMixin, list):
     """A list specialized for moz.build environments.