diff options
Diffstat (limited to 'Lib')
46 files changed, 4072 insertions, 470 deletions
diff --git a/Lib/bsddb/dbshelve.py b/Lib/bsddb/dbshelve.py index 87be3d1..8264f2d 100644 --- a/Lib/bsddb/dbshelve.py +++ b/Lib/bsddb/dbshelve.py @@ -30,11 +30,21 @@ storage. #------------------------------------------------------------------------ import pickle -try: +import sys + +#At version 2.3 cPickle switched to using protocol instead of bin and +#DictMixin was added +if sys.version_info[:3] >= (2, 3, 0): + HIGHEST_PROTOCOL = pickle.HIGHEST_PROTOCOL + def _dumps(object, protocol): + return pickle.dumps(object, protocol=protocol) from UserDict import DictMixin -except ImportError: - # DictMixin is new in Python 2.3 +else: + HIGHEST_PROTOCOL = None + def _dumps(object, protocol): + return pickle.dumps(object, bin=protocol) class DictMixin: pass + from . import db _unspecified = object() @@ -87,7 +97,10 @@ class DBShelf(DictMixin): def __init__(self, dbenv=None): self.db = db.DB(dbenv) self._closed = True - self.binary = 1 + if HIGHEST_PROTOCOL: + self.protocol = HIGHEST_PROTOCOL + else: + self.protocol = 1 def __del__(self): @@ -114,7 +127,7 @@ class DBShelf(DictMixin): def __setitem__(self, key, value): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) self.db[key] = data @@ -169,7 +182,7 @@ class DBShelf(DictMixin): # Other methods def __append(self, value, txn=None): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) return self.db.append(data, txn) def append(self, value, txn=None): @@ -200,19 +213,19 @@ class DBShelf(DictMixin): return pickle.loads(data) def get_both(self, key, value, txn=None, flags=0): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) data = self.db.get(key, data, txn, flags) return pickle.loads(data) def cursor(self, txn=None, flags=0): c = DBShelfCursor(self.db.cursor(txn, flags)) - c.binary = self.binary + c.protocol = self.protocol return c def put(self, key, value, txn=None, flags=0): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) return self.db.put(key, data, txn, flags) @@ -252,11 +265,13 @@ class DBShelfCursor: #---------------------------------------------- def dup(self, flags=0): - return DBShelfCursor(self.dbc.dup(flags)) + c = DBShelfCursor(self.dbc.dup(flags)) + c.protocol = self.protocol + return c def put(self, key, value, flags=0): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) return self.dbc.put(key, data, flags) @@ -274,7 +289,7 @@ class DBShelfCursor: return self._extract(rec) def get_3(self, key, value, flags): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) rec = self.dbc.get(key, flags) return self._extract(rec) @@ -291,7 +306,7 @@ class DBShelfCursor: def get_both(self, key, value, flags=0): - data = pickle.dumps(value, self.binary) + data = _dumps(value, self.protocol) rec = self.dbc.get_both(key, flags) return self._extract(rec) diff --git a/Lib/bsddb/test/test_misc.py b/Lib/bsddb/test/test_misc.py index 15098b7..5223180 100644 --- a/Lib/bsddb/test/test_misc.py +++ b/Lib/bsddb/test/test_misc.py @@ -28,10 +28,10 @@ class MiscTestCase(unittest.TestCase): pass shutil.rmtree(self.homeDir) - def test01_badpointer(self): - dbs = dbshelve.open(self.filename) - dbs.close() - self.assertRaises(db.DBError, dbs.get, "foo") +## def test01_badpointer(self): +## dbs = dbshelve.open(self.filename) +## dbs.close() +## self.assertRaises(db.DBError, dbs.get, "foo") def test02_db_home(self): env = db.DBEnv() @@ -46,6 +46,26 @@ class MiscTestCase(unittest.TestCase): rp = repr(db) self.assertEquals(rp, "{}") + # http://sourceforge.net/tracker/index.php?func=detail&aid=1708868&group_id=13900&atid=313900 + # + # See the bug report for details. + # + # The problem was that make_key_dbt() was not allocating a copy of + # string keys but FREE_DBT() was always being told to free it when the + # database was opened with DB_THREAD. +## def test04_double_free_make_key_dbt(self): +## try: +## db1 = db.DB() +## db1.open(self.filename, None, db.DB_BTREE, +## db.DB_CREATE | db.DB_THREAD) + +## curs = db1.cursor() +## t = curs.get(b"/foo", db.DB_SET) +## # double free happened during exit from DBC_get +## finally: +## db1.close() +## os.unlink(self.filename) + #---------------------------------------------------------------------- diff --git a/Lib/collections.py b/Lib/collections.py index 70fa903..90ed776 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -1,7 +1,8 @@ -__all__ = ['deque', 'defaultdict', 'NamedTuple'] +__all__ = ['deque', 'defaultdict', 'namedtuple'] from _collections import deque, defaultdict from operator import itemgetter as _itemgetter +from keyword import iskeyword as _iskeyword import sys as _sys # For bootstrapping reasons, the collection ABCs are defined in _abcoll.py. @@ -10,11 +11,10 @@ from _abcoll import * import _abcoll __all__ += _abcoll.__all__ - -def NamedTuple(typename, s, verbose=False): +def namedtuple(typename, field_names, verbose=False): """Returns a new subclass of tuple with named fields. - >>> Point = NamedTuple('Point', 'x y') + >>> Point = namedtuple('Point', 'x y') >>> Point.__doc__ # docstring for the new class 'Point(x, y)' >>> p = Point(11, y=22) # instantiate with positional args or keywords @@ -25,19 +25,36 @@ def NamedTuple(typename, s, verbose=False): (11, 22) >>> p.x + p.y # fields also accessable by name 33 - >>> p # readable __repr__ with name=value style + >>> d = p.__asdict__() # convert to a dictionary + >>> d['x'] + 11 + >>> Point(**d) # convert from a dictionary Point(x=11, y=22) >>> p.__replace__('x', 100) # __replace__() is like str.replace() but targets a named field Point(x=100, y=22) - >>> d = dict(zip(p.__fields__, p)) # use __fields__ to make a dictionary - >>> d['x'] - 11 """ - field_names = tuple(s.replace(',', ' ').split()) # names separated by spaces and/or commas - if not ''.join((typename,) + field_names).replace('_', '').isalnum(): - raise ValueError('Type names and field names can only contain alphanumeric characters and underscores') + # Parse and validate the field names + if isinstance(field_names, str): + field_names = field_names.replace(',', ' ').split() # names separated by whitespace and/or commas + field_names = tuple(field_names) + for name in (typename,) + field_names: + if not name.replace('_', '').isalnum(): + raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r' % name) + if _iskeyword(name): + raise ValueError('Type names and field names cannot be a keyword: %r' % name) + if name[0].isdigit(): + raise ValueError('Type names and field names cannot start with a number: %r' % name) + seen_names = set() + for name in field_names: + if name.startswith('__') and name.endswith('__'): + raise ValueError('Field names cannot start and end with double underscores: %r' % name) + if name in seen_names: + raise ValueError('Encountered duplicate field name: %r' % name) + seen_names.add(name) + + # Create and fill-in the class template argtxt = repr(field_names).replace("'", "")[1:-1] # tuple repr without parens or quotes reprtxt = ', '.join('%s=%%r' % name for name in field_names) template = '''class %(typename)s(tuple): @@ -48,18 +65,31 @@ def NamedTuple(typename, s, verbose=False): return tuple.__new__(cls, (%(argtxt)s)) def __repr__(self): return '%(typename)s(%(reprtxt)s)' %% self - def __replace__(self, field, value): + def __asdict__(self, dict=dict, zip=zip): + 'Return a new dict mapping field names to their values' + return dict(zip(%(field_names)r, self)) + def __replace__(self, field, value, dict=dict, zip=zip): 'Return a new %(typename)s object replacing one field with a new value' return %(typename)s(**dict(list(zip(%(field_names)r, self)) + [(field, value)])) \n''' % locals() for i, name in enumerate(field_names): template += ' %s = property(itemgetter(%d))\n' % (name, i) if verbose: print(template) - m = dict(itemgetter=_itemgetter) - exec(template, m) - result = m[typename] + + # Execute the template string in a temporary namespace + namespace = dict(itemgetter=_itemgetter) + try: + exec(template, namespace) + except SyntaxError as e: + raise SyntaxError(e.message + ':\n' + template) + result = namespace[typename] + + # For pickling to work, the __module__ variable needs to be set to the frame + # where the named tuple is created. Bypass this step in enviroments where + # sys._getframe is not defined (Jython for example). if hasattr(_sys, '_getframe'): result.__module__ = _sys._getframe(1).f_globals['__name__'] + return result @@ -69,10 +99,10 @@ def NamedTuple(typename, s, verbose=False): if __name__ == '__main__': # verify that instances can be pickled from pickle import loads, dumps - Point = NamedTuple('Point', 'x, y', True) + Point = namedtuple('Point', 'x, y', True) p = Point(x=10, y=20) assert p == loads(dumps(p)) import doctest - TestResults = NamedTuple('TestResults', 'failed attempted') + TestResults = namedtuple('TestResults', 'failed attempted') print(TestResults(*doctest.testmod())) diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index cc05e97..e1c9d84 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -21,19 +21,12 @@ if _os.name in ("nt", "ce"): DEFAULT_MODE = RTLD_LOCAL if _os.name == "posix" and _sys.platform == "darwin": - import gestalt - - # gestalt.gestalt("sysv") returns the version number of the - # currently active system file as BCD. - # On OS X 10.4.6 -> 0x1046 - # On OS X 10.2.8 -> 0x1028 - # See also http://www.rgaros.nl/gestalt/ - # # On OS X 10.3, we use RTLD_GLOBAL as default mode # because RTLD_LOCAL does not work at least on some - # libraries. + # libraries. OS X 10.3 is Darwin 7, so we check for + # that. - if gestalt.gestalt("sysv") < 0x1040: + if int(_os.uname()[2].split('.')[0]) < 8: DEFAULT_MODE = RTLD_GLOBAL from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ diff --git a/Lib/decimal.py b/Lib/decimal.py index cdb88bc..faf9bf7 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -562,20 +562,46 @@ class Decimal(object): # tuple/list conversion (possibly from as_tuple()) if isinstance(value, (list,tuple)): if len(value) != 3: - raise ValueError('Invalid arguments') - if value[0] not in (0,1): - raise ValueError('Invalid sign') - for digit in value[1]: - if not isinstance(digit, int) or digit < 0: - raise ValueError("The second value in the tuple must be " - "composed of non negative integer elements.") + raise ValueError('Invalid tuple size in creation of Decimal ' + 'from list or tuple. The list or tuple ' + 'should have exactly three elements.') + # process sign. The isinstance test rejects floats + if not (isinstance(value[0], int) and value[0] in (0,1)): + raise ValueError("Invalid sign. The first value in the tuple " + "should be an integer; either 0 for a " + "positive number or 1 for a negative number.") self._sign = value[0] - self._int = tuple(value[1]) - if value[2] in ('F','n','N'): + if value[2] == 'F': + # infinity: value[1] is ignored + self._int = (0,) self._exp = value[2] self._is_special = True else: - self._exp = int(value[2]) + # process and validate the digits in value[1] + digits = [] + for digit in value[1]: + if isinstance(digit, int) and 0 <= digit <= 9: + # skip leading zeros + if digits or digit != 0: + digits.append(digit) + else: + raise ValueError("The second value in the tuple must " + "be composed of integers in the range " + "0 through 9.") + if value[2] in ('n', 'N'): + # NaN: digits form the diagnostic + self._int = tuple(digits) + self._exp = value[2] + self._is_special = True + elif isinstance(value[2], int): + # finite number: digits give the coefficient + self._int = tuple(digits or [0]) + self._exp = value[2] + self._is_special = False + else: + raise ValueError("The third value in the tuple must " + "be an integer, or one of the " + "strings 'F', 'n', 'N'.") return self if isinstance(value, float): @@ -679,14 +705,11 @@ class Decimal(object): return 0 def __bool__(self): - """return True if the number is non-zero. + """Return True if self is nonzero; otherwise return False. - False if self == 0 - True if self != 0 + NaNs and infinities are considered nonzero. """ - if self._is_special: - return True - return sum(self._int) != 0 + return self._is_special or self._int[0] != 0 def __cmp__(self, other): other = _convert_other(other) @@ -2252,15 +2275,18 @@ class Decimal(object): return ans def same_quantum(self, other): - """Test whether self and other have the same exponent. + """Return True if self and other have the same exponent; otherwise + return False. - same as self._exp == other._exp, except NaN == sNaN + If either operand is a special value, the following rules are used: + * return True if both operands are infinities + * return True if both operands are NaNs + * otherwise, return False. """ + other = _convert_other(other, raiseit=True) if self._is_special or other._is_special: - if self._isnan() or other._isnan(): - return self._isnan() and other._isnan() and True - if self._isinfinity() or other._isinfinity(): - return self._isinfinity() and other._isinfinity() and True + return (self.is_nan() and other.is_nan() or + self.is_infinite() and other.is_infinite()) return self._exp == other._exp def _rescale(self, exp, rounding): @@ -2743,84 +2769,60 @@ class Decimal(object): return ans def is_canonical(self): - """Returns 1 if self is canonical; otherwise returns 0.""" - return Dec_p1 + """Return True if self is canonical; otherwise return False. + + Currently, the encoding of a Decimal instance is always + canonical, so this method returns True for any Decimal. + """ + return True def is_finite(self): - """Returns 1 if self is finite, otherwise returns 0. + """Return True if self is finite; otherwise return False. - For it to be finite, it must be neither infinite nor a NaN. + A Decimal instance is considered finite if it is neither + infinite nor a NaN. """ - if self._is_special: - return Dec_0 - else: - return Dec_p1 + return not self._is_special def is_infinite(self): - """Returns 1 if self is an Infinite, otherwise returns 0.""" - if self._isinfinity(): - return Dec_p1 - else: - return Dec_0 + """Return True if self is infinite; otherwise return False.""" + return self._exp == 'F' def is_nan(self): - """Returns 1 if self is qNaN or sNaN, otherwise returns 0.""" - if self._isnan(): - return Dec_p1 - else: - return Dec_0 + """Return True if self is a qNaN or sNaN; otherwise return False.""" + return self._exp in ('n', 'N') def is_normal(self, context=None): - """Returns 1 if self is a normal number, otherwise returns 0.""" - if self._is_special: - return Dec_0 - if not self: - return Dec_0 + """Return True if self is a normal number; otherwise return False.""" + if self._is_special or not self: + return False if context is None: context = getcontext() - if context.Emin <= self.adjusted() <= context.Emax: - return Dec_p1 - else: - return Dec_0 + return context.Emin <= self.adjusted() <= context.Emax def is_qnan(self): - """Returns 1 if self is a quiet NaN, otherwise returns 0.""" - if self._isnan() == 1: - return Dec_p1 - else: - return Dec_0 + """Return True if self is a quiet NaN; otherwise return False.""" + return self._exp == 'n' def is_signed(self): - """Returns 1 if self is negative, otherwise returns 0.""" - return Decimal(self._sign) + """Return True if self is negative; otherwise return False.""" + return self._sign == 1 def is_snan(self): - """Returns 1 if self is a signaling NaN, otherwise returns 0.""" - if self._isnan() == 2: - return Dec_p1 - else: - return Dec_0 + """Return True if self is a signaling NaN; otherwise return False.""" + return self._exp == 'N' def is_subnormal(self, context=None): - """Returns 1 if self is subnormal, otherwise returns 0.""" - if self._is_special: - return Dec_0 - if not self: - return Dec_0 + """Return True if self is subnormal; otherwise return False.""" + if self._is_special or not self: + return False if context is None: context = getcontext() - - r = self._exp + len(self._int) - if r <= context.Emin: - return Dec_p1 - return Dec_0 + return self.adjusted() < context.Emin def is_zero(self): - """Returns 1 if self is a zero, otherwise returns 0.""" - if self: - return Dec_0 - else: - return Dec_p1 + """Return True if self is a zero; otherwise return False.""" + return not self._is_special and self._int[0] == 0 def _ln_exp_bound(self): """Compute a lower bound for the adjusted exponent of self.ln(). @@ -3883,138 +3885,145 @@ class Context(object): return a.fma(b, c, context=self) def is_canonical(self, a): - """Returns 1 if the operand is canonical; otherwise returns 0. + """Return True if the operand is canonical; otherwise return False. + + Currently, the encoding of a Decimal instance is always + canonical, so this method returns True for any Decimal. >>> ExtendedContext.is_canonical(Decimal('2.50')) - Decimal("1") + True """ - return Dec_p1 + return a.is_canonical() def is_finite(self, a): - """Returns 1 if the operand is finite, otherwise returns 0. + """Return True if the operand is finite; otherwise return False. - For it to be finite, it must be neither infinite nor a NaN. + A Decimal instance is considered finite if it is neither + infinite nor a NaN. >>> ExtendedContext.is_finite(Decimal('2.50')) - Decimal("1") + True >>> ExtendedContext.is_finite(Decimal('-0.3')) - Decimal("1") + True >>> ExtendedContext.is_finite(Decimal('0')) - Decimal("1") + True >>> ExtendedContext.is_finite(Decimal('Inf')) - Decimal("0") + False >>> ExtendedContext.is_finite(Decimal('NaN')) - Decimal("0") + False """ return a.is_finite() def is_infinite(self, a): - """Returns 1 if the operand is an Infinite, otherwise returns 0. + """Return True if the operand is infinite; otherwise return False. >>> ExtendedContext.is_infinite(Decimal('2.50')) - Decimal("0") + False >>> ExtendedContext.is_infinite(Decimal('-Inf')) - Decimal("1") + True >>> ExtendedContext.is_infinite(Decimal('NaN')) - Decimal("0") + False """ return a.is_infinite() def is_nan(self, a): - """Returns 1 if the operand is qNaN or sNaN, otherwise returns 0. + """Return True if the operand is a qNaN or sNaN; + otherwise return False. >>> ExtendedContext.is_nan(Decimal('2.50')) - Decimal("0") + False >>> ExtendedContext.is_nan(Decimal('NaN')) - Decimal("1") + True >>> ExtendedContext.is_nan(Decimal('-sNaN')) - Decimal("1") + True """ return a.is_nan() def is_normal(self, a): - """Returns 1 if the operand is a normal number, otherwise returns 0. + """Return True if the operand is a normal number; + otherwise return False. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.is_normal(Decimal('2.50')) - Decimal("1") + True >>> c.is_normal(Decimal('0.1E-999')) - Decimal("0") + False >>> c.is_normal(Decimal('0.00')) - Decimal("0") + False >>> c.is_normal(Decimal('-Inf')) - Decimal("0") + False >>> c.is_normal(Decimal('NaN')) - Decimal("0") + False """ return a.is_normal(context=self) def is_qnan(self, a): - """Returns 1 if the operand is a quiet NaN, otherwise returns 0. + """Return True if the operand is a quiet NaN; otherwise return False. >>> ExtendedContext.is_qnan(Decimal('2.50')) - Decimal("0") + False >>> ExtendedContext.is_qnan(Decimal('NaN')) - Decimal("1") + True >>> ExtendedContext.is_qnan(Decimal('sNaN')) - Decimal("0") + False """ return a.is_qnan() def is_signed(self, a): - """Returns 1 if the operand is negative, otherwise returns 0. + """Return True if the operand is negative; otherwise return False. >>> ExtendedContext.is_signed(Decimal('2.50')) - Decimal("0") + False >>> ExtendedContext.is_signed(Decimal('-12')) - Decimal("1") + True >>> ExtendedContext.is_signed(Decimal('-0')) - Decimal("1") + True """ return a.is_signed() def is_snan(self, a): - """Returns 1 if the operand is a signaling NaN, otherwise returns 0. + """Return True if the operand is a signaling NaN; + otherwise return False. >>> ExtendedContext.is_snan(Decimal('2.50')) - Decimal("0") + False >>> ExtendedContext.is_snan(Decimal('NaN')) - Decimal("0") + False >>> ExtendedContext.is_snan(Decimal('sNaN')) - Decimal("1") + True """ return a.is_snan() def is_subnormal(self, a): - """Returns 1 if the operand is subnormal, otherwise returns 0. + """Return True if the operand is subnormal; otherwise return False. >>> c = ExtendedContext.copy() >>> c.Emin = -999 >>> c.Emax = 999 >>> c.is_subnormal(Decimal('2.50')) - Decimal("0") + False >>> c.is_subnormal(Decimal('0.1E-999')) - Decimal("1") + True >>> c.is_subnormal(Decimal('0.00')) - Decimal("0") + False >>> c.is_subnormal(Decimal('-Inf')) - Decimal("0") + False >>> c.is_subnormal(Decimal('NaN')) - Decimal("0") + False """ return a.is_subnormal(context=self) def is_zero(self, a): - """Returns 1 if the operand is a zero, otherwise returns 0. + """Return True if the operand is a zero; otherwise return False. >>> ExtendedContext.is_zero(Decimal('0')) - Decimal("1") + True >>> ExtendedContext.is_zero(Decimal('2.50')) - Decimal("0") + False >>> ExtendedContext.is_zero(Decimal('-0E+2')) - Decimal("1") + True """ return a.is_zero() @@ -4937,7 +4946,7 @@ def _dlog10(c, e, p): c = _div_nearest(c, 10**-k) log_d = _ilog(c, M) # error < 5 + 22 = 27 - log_10 = _ilog(10*M, M) # error < 15 + log_10 = _log10_digits(p) # error < 1 log_d = _div_nearest(log_d*M, log_10) log_tenpower = f*M # exact else: @@ -4975,24 +4984,58 @@ def _dlog(c, e, p): # p <= 0: just approximate the whole thing by 0; error < 2.31 log_d = 0 - # compute approximation to 10**p*f*log(10), with error < 17 + # compute approximation to f*10**p*log(10), with error < 11. if f: - sign_f = [-1, 1][f > 0] - if p >= 0: - M = 10**p * abs(f) - else: - M = _div_nearest(abs(f), 10**-p) # M = 10**p*|f|, error <= 0.5 - - if M: - f_log_ten = sign_f*_ilog(10*M, M) # M*log(10), error <= 1.2 + 15 < 17 + extra = len(str(abs(f)))-1 + if p + extra >= 0: + # error in f * _log10_digits(p+extra) < |f| * 1 = |f| + # after division, error < |f|/10**extra + 0.5 < 10 + 0.5 < 11 + f_log_ten = _div_nearest(f*_log10_digits(p+extra), 10**extra) else: f_log_ten = 0 else: f_log_ten = 0 - # error in sum < 17+27 = 44; error after division < 0.44 + 0.5 < 1 + # error in sum < 11+27 = 38; error after division < 0.38 + 0.5 < 1 return _div_nearest(f_log_ten + log_d, 100) +class _Log10Memoize(object): + """Class to compute, store, and allow retrieval of, digits of the + constant log(10) = 2.302585.... This constant is needed by + Decimal.ln, Decimal.log10, Decimal.exp and Decimal.__pow__.""" + def __init__(self): + self.digits = "23025850929940456840179914546843642076011014886" + + def getdigits(self, p): + """Given an integer p >= 0, return floor(10**p)*log(10). + + For example, self.getdigits(3) returns 2302. + """ + # digits are stored as a string, for quick conversion to + # integer in the case that we've already computed enough + # digits; the stored digits should always be correct + # (truncated, not rounded to nearest). + if p < 0: + raise ValueError("p should be nonnegative") + + if p >= len(self.digits): + # compute p+3, p+6, p+9, ... digits; continue until at + # least one of the extra digits is nonzero + extra = 3 + while True: + # compute p+extra digits, correct to within 1ulp + M = 10**(p+extra+2) + digits = str(_div_nearest(_ilog(10*M, M), 100)) + if digits[-extra:] != '0'*extra: + break + extra += 3 + # keep all reliable digits so far; remove trailing zeros + # and next nonzero digit + self.digits = digits.rstrip('0')[:-1] + return int(self.digits[:p+1]) + +_log10_digits = _Log10Memoize().getdigits + def _iexp(x, M, L=8): """Given integers x and M, M > 0, such that x/M is small in absolute value, compute an integer approximation to M*exp(x/M). For 0 <= @@ -5034,7 +5077,7 @@ def _dexp(c, e, p): """Compute an approximation to exp(c*10**e), with p decimal places of precision. - Returns d, f such that: + Returns integers d, f such that: 10**(p-1) <= d <= 10**p, and (d-1)*10**f < exp(c*10**e) < (d+1)*10**f @@ -5047,19 +5090,18 @@ def _dexp(c, e, p): # we'll call iexp with M = 10**(p+2), giving p+3 digits of precision p += 2 - # compute log10 with extra precision = adjusted exponent of c*10**e + # compute log(10) with extra precision = adjusted exponent of c*10**e extra = max(0, e + len(str(c)) - 1) q = p + extra - log10 = _dlog(10, 0, q) # error <= 1 - # compute quotient c*10**e/(log10/10**q) = c*10**(e+q)/log10, + # compute quotient c*10**e/(log(10)) = c*10**(e+q)/(log(10)*10**q), # rounding down shift = e+q if shift >= 0: cshift = c*10**shift else: cshift = c//10**-shift - quot, rem = divmod(cshift, log10) + quot, rem = divmod(cshift, _log10_digits(q)) # reduce remainder back to original precision rem = _div_nearest(rem, 10**extra) diff --git a/Lib/httplib.py b/Lib/httplib.py index 320bdf3..e891883 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -527,7 +527,7 @@ class HTTPResponse: def read(self, amt=None): if self.fp is None: - return "" + return b"" if self.chunked: return self._read_chunked(amt) @@ -553,7 +553,8 @@ class HTTPResponse: s = self.fp.read(amt) if self.length is not None: self.length -= len(s) - + if not self.length: + self.close() return s def _read_chunked(self, amt): @@ -595,7 +596,7 @@ class HTTPResponse: ### note: we shouldn't have any trailers! while True: line = self.fp.readline() - if line == "\r\n": + if line == b"\r\n": break # we read everything; close the "file" diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py index b187741..b2b1657 100644 --- a/Lib/idlelib/AutoComplete.py +++ b/Lib/idlelib/AutoComplete.py @@ -27,7 +27,7 @@ class AutoComplete: menudefs = [ ('edit', [ - ("Show completions", "<<force-open-completions>>"), + ("Show Completions", "<<force-open-completions>>"), ]) ] diff --git a/Lib/idlelib/AutoCompleteWindow.py b/Lib/idlelib/AutoCompleteWindow.py index 785979e..ca9109b 100644 --- a/Lib/idlelib/AutoCompleteWindow.py +++ b/Lib/idlelib/AutoCompleteWindow.py @@ -283,20 +283,9 @@ class AutoCompleteWindow: self._selection_changed() return "break" - elif keysym == "Return" and not state: - # If start is a prefix of the selection, or there was an indication - # that the user used the completion window, put the selected - # completion in the text, and close the list. - # Otherwise, close the window and let the event through. - cursel = int(self.listbox.curselection()[0]) - if self.completions[cursel][:len(self.start)] == self.start or \ - self.userwantswindow: - self._change_start(self.completions[cursel]) - self.hide_window() - return "break" - else: - self.hide_window() - return + elif keysym == "Return": + self.hide_window() + return elif (self.mode == COMPLETE_ATTRIBUTES and keysym in ("period", "space", "parenleft", "parenright", "bracketleft", diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index a0a7b47..0cd668a 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -386,7 +386,7 @@ class EditorWindow(object): def help_dialog(self, event=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt') - textView.TextViewer(self.top,'Help',fn) + textView.view_file(self.top,'Help',fn) def python_docs(self, event=None): if sys.platform[:3] == 'win': @@ -408,6 +408,7 @@ class EditorWindow(object): def paste(self,event): self.text.event_generate("<<Paste>>") + self.text.see("insert") return "break" def select_all(self, event=None): @@ -549,7 +550,8 @@ class EditorWindow(object): def close_hook(self): if self.flist: - self.flist.close_edit(self) + self.flist.unregister_maybe_terminate(self) + self.flist = None def set_close_hook(self, close_hook): self.close_hook = close_hook @@ -828,22 +830,21 @@ class EditorWindow(object): if self.io.filename: self.update_recent_files_list(new_file=self.io.filename) WindowList.unregister_callback(self.postwindowsmenu) - if self.close_hook: - self.close_hook() - self.flist = None - colorizing = 0 self.unload_extensions() - self.io.close(); self.io = None - self.undo = None # XXX + self.io.close() + self.io = None + self.undo = None if self.color: - colorizing = self.color.colorizing - doh = colorizing and self.top - self.color.close(doh) # Cancel colorization + self.color.close(False) + self.color = None self.text = None self.tkinter_vars = None - self.per.close(); self.per = None - if not colorizing: - self.top.destroy() + self.per.close() + self.per = None + self.top.destroy() + if self.close_hook: + # unless override: unregister from flist, terminate if last window + self.close_hook() def load_extensions(self): self.extensions = {} @@ -1501,6 +1502,7 @@ def test(): filename = None edit = EditorWindow(root=root, filename=filename) edit.set_close_hook(root.quit) + edit.text.bind("<<close-all-windows>>", edit.close_event) root.mainloop() root.destroy() diff --git a/Lib/idlelib/FileList.py b/Lib/idlelib/FileList.py index 2f5053f..53e30b4 100644 --- a/Lib/idlelib/FileList.py +++ b/Lib/idlelib/FileList.py @@ -55,7 +55,7 @@ class FileList: break return "break" - def close_edit(self, edit): + def unregister_maybe_terminate(self, edit): try: key = self.inversedict[edit] except KeyError: diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index b970dba..b4de84e 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -485,13 +485,23 @@ class IOBinding: self.text.insert("end-1c", "\n") def print_window(self, event): + m = tkMessageBox.Message( + title="Print", + message="Print to Default Printer", + icon=tkMessageBox.QUESTION, + type=tkMessageBox.OKCANCEL, + default=tkMessageBox.OK, + master=self.text) + reply = m.show() + if reply != tkMessageBox.OK: + self.text.focus_set() + return "break" tempfilename = None saved = self.get_saved() if saved: filename = self.filename # shell undo is reset after every prompt, looks saved, probably isn't if not saved or filename is None: - # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save? (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') filename = tempfilename os.close(tfd) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 460b5b5..0966152 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -30,6 +30,24 @@ What's New in IDLE 2.6a1? *Release date: XX-XXX-200X* UNRELEASED, but merged into 3.0a1 +- tabpage.py updated: tabbedPages.py now supports multiple dynamic rows + of tabs. Patch 1612746 Tal Einat. + +- Add confirmation dialog before printing. Patch 1717170 Tal Einat. + +- Show paste position if > 80 col. Patch 1659326 Tal Einat. + +- Update cursor color without restarting. Patch 1725576 Tal Einat. + +- Allow keyboard interrupt only when user code is executing in subprocess. + Patch 1225 Tal Einat (reworked from IDLE-Spoon). + +- configDialog cleanup. Patch 1730217 Tal Einat. + +- textView cleanup. Patch 1718043 Tal Einat. + +- Clean up EditorWindow close. + - Corrected some bugs in AutoComplete. Also, Page Up/Down in ACW implemented; mouse and cursor selection in ACWindow implemented; double Tab inserts current selection and closes ACW (similar to double-click and Return); scroll @@ -51,6 +69,8 @@ What's New in IDLE 2.6a1? - Bug #813342: Start the IDLE subprocess with -Qnew if the parent is started with that option. +- Honor the "Cancel" action in the save dialog (Debian bug #299092) + - Some syntax errors were being caught by tokenize during the tabnanny check, resulting in obscure error messages. Do the syntax check first. Bug 1562716, 1562719 diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 3f9f567..097818f 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -296,9 +296,6 @@ class ModifiedColorDelegator(ColorDelegator): "stdout": idleConf.GetHighlight(theme, "stdout"), "stderr": idleConf.GetHighlight(theme, "stderr"), "console": idleConf.GetHighlight(theme, "console"), - ### KBK 10Aug07: None tag doesn't seem to serve a purpose and - ### breaks in py3k. Comment out for now. - #None: idleConf.GetHighlight(theme, "normal"), }) class ModifiedUndoDelegator(UndoDelegator): diff --git a/Lib/idlelib/WidgetRedirector.py b/Lib/idlelib/WidgetRedirector.py index 459fea7..3df5a9a 100644 --- a/Lib/idlelib/WidgetRedirector.py +++ b/Lib/idlelib/WidgetRedirector.py @@ -1,17 +1,38 @@ from Tkinter import * - class WidgetRedirector: - """Support for redirecting arbitrary widget subcommands.""" + """Support for redirecting arbitrary widget subcommands. + + Some Tk operations don't normally pass through Tkinter. For example, if a + character is inserted into a Text widget by pressing a key, a default Tk + binding to the widget's 'insert' operation is activated, and the Tk library + processes the insert without calling back into Tkinter. + + Although a binding to <Key> could be made via Tkinter, what we really want + to do is to hook the Tk 'insert' operation itself. + When a widget is instantiated, a Tcl command is created whose name is the + same as the pathname widget._w. This command is used to invoke the various + widget operations, e.g. insert (for a Text widget). We are going to hook + this command and provide a facility ('register') to intercept the widget + operation. + + In IDLE, the function being registered provides access to the top of a + Percolator chain. At the bottom of the chain is a call to the original + Tk widget operation. + + """ def __init__(self, widget): - self.dict = {} - self.widget = widget - self.tk = tk = widget.tk - w = widget._w + self._operations = {} + self.widget = widget # widget instance + self.tk = tk = widget.tk # widget's root + w = widget._w # widget's (full) Tk pathname self.orig = w + "_orig" + # Rename the Tcl command within Tcl: tk.call("rename", w, self.orig) + # Create a new Tcl command whose name is the widget's pathname, and + # whose action is to dispatch on the operation passed to the widget: tk.createcommand(w, self.dispatch) def __repr__(self): @@ -19,74 +40,87 @@ class WidgetRedirector: self.widget._w) def close(self): - for name in list(self.dict.keys()): - self.unregister(name) + for operation in list(self._operations): + self.unregister(operation) widget = self.widget; del self.widget orig = self.orig; del self.orig tk = widget.tk w = widget._w tk.deletecommand(w) + # restore the original widget Tcl command: tk.call("rename", orig, w) - def register(self, name, function): - if name in self.dict: - previous = dict[name] - else: - previous = OriginalCommand(self, name) - self.dict[name] = function - setattr(self.widget, name, function) - return previous - - def unregister(self, name): - if name in self.dict: - function = self.dict[name] - del self.dict[name] - if hasattr(self.widget, name): - delattr(self.widget, name) + def register(self, operation, function): + self._operations[operation] = function + setattr(self.widget, operation, function) + return OriginalCommand(self, operation) + + def unregister(self, operation): + if operation in self._operations: + function = self._operations[operation] + del self._operations[operation] + if hasattr(self.widget, operation): + delattr(self.widget, operation) return function else: return None - def dispatch(self, cmd, *args): - m = self.dict.get(cmd) + def dispatch(self, operation, *args): + '''Callback from Tcl which runs when the widget is referenced. + + If an operation has been registered in self._operations, apply the + associated function to the args passed into Tcl. Otherwise, pass the + operation through to Tk via the original Tcl function. + + Note that if a registered function is called, the operation is not + passed through to Tk. Apply the function returned by self.register() + to *args to accomplish that. For an example, see ColorDelegator.py. + + ''' + m = self._operations.get(operation) try: if m: return m(*args) else: - return self.tk.call((self.orig, cmd) + args) + return self.tk.call((self.orig, operation) + args) except TclError: return "" class OriginalCommand: - def __init__(self, redir, name): + def __init__(self, redir, operation): self.redir = redir - self.name = name + self.operation = operation self.tk = redir.tk self.orig = redir.orig self.tk_call = self.tk.call - self.orig_and_name = (self.orig, self.name) + self.orig_and_operation = (self.orig, self.operation) def __repr__(self): - return "OriginalCommand(%r, %r)" % (self.redir, self.name) + return "OriginalCommand(%r, %r)" % (self.redir, self.operation) def __call__(self, *args): - return self.tk_call(self.orig_and_name + args) + return self.tk_call(self.orig_and_operation + args) def main(): root = Tk() + root.wm_protocol("WM_DELETE_WINDOW", root.quit) text = Text() text.pack() text.focus_set() redir = WidgetRedirector(text) - global orig_insert + global previous_tcl_fcn def my_insert(*args): print("insert", args) - orig_insert(*args) - orig_insert = redir.register("insert", my_insert) + previous_tcl_fcn(*args) + previous_tcl_fcn = redir.register("insert", my_insert) + root.mainloop() + redir.unregister("insert") # runs after first 'close window' + redir.close() root.mainloop() + root.destroy() if __name__ == "__main__": main() diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py index e0a6558..43a1313 100644 --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -111,45 +111,31 @@ class AboutDialog(Toplevel): idle_credits_b.pack(side=LEFT, padx=10, pady=10) def ShowLicense(self): - self.display_printer_text(license, 'About - License') + self.display_printer_text('About - License', license) def ShowCopyright(self): - self.display_printer_text(copyright, 'About - Copyright') + self.display_printer_text('About - Copyright', copyright) def ShowPythonCredits(self): - self.display_printer_text(credits, 'About - Python Credits') + self.display_printer_text('About - Python Credits', credits) def ShowIDLECredits(self): - self.ViewFile('About - Credits','CREDITS.txt') + self.display_file_text('About - Credits', 'CREDITS.txt', 'iso-8859-1') def ShowIDLEAbout(self): - self.ViewFile('About - Readme', 'README.txt') + self.display_file_text('About - Readme', 'README.txt') def ShowIDLENEWS(self): - self.ViewFile('About - NEWS', 'NEWS.txt') + self.display_file_text('About - NEWS', 'NEWS.txt') - def display_printer_text(self, printer, title): + def display_printer_text(self, title, printer): printer._Printer__setup() - data = '\n'.join(printer._Printer__lines) - textView.TextViewer(self, title, None, data) - - def ViewFile(self, viewTitle, viewFile, encoding=None): - fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), viewFile) - if encoding: - import codecs - try: - textFile = codecs.open(fn, 'r') - except IOError: - import tkMessageBox - tkMessageBox.showerror(title='File Load Error', - message='Unable to load file %r .' % (fn,), - parent=self) - return - else: - data = textFile.read() - else: - data = None - textView.TextViewer(self, viewTitle, fn, data=data) + text = '\n'.join(printer._Printer__lines) + textView.view_text(self, title, text) + + def display_file_text(self, title, filename, encoding=None): + fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), filename) + textView.view_file(self, title, fn, encoding) def Ok(self, event=None): self.destroy() diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py index ad3071a..d00b579 100644 --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -15,7 +15,7 @@ import copy from idlelib.configHandler import idleConf from idlelib.dynOptionMenuWidget import DynOptionMenu -from idlelib.tabpage import TabPageSet +from idlelib.tabbedpages import TabbedPageSet from idlelib.keybindingDialog import GetKeysDialog from idlelib.configSectionNameDialog import GetCfgSectionNameDialog from idlelib.configHelpSourceEdit import GetHelpSourceDialog @@ -24,6 +24,8 @@ class ConfigDialog(Toplevel): def __init__(self,parent,title): Toplevel.__init__(self, parent) + self.wm_withdraw() + self.configure(borderwidth=5) self.geometry("+%d+%d" % (parent.winfo_rootx()+20, parent.winfo_rooty()+30)) @@ -58,31 +60,37 @@ class ConfigDialog(Toplevel): #self.bind('<F1>',self.Help) #context help self.LoadConfigs() self.AttachVarCallbacks() #avoid callbacks during LoadConfigs + + self.wm_deiconify() self.wait_window() def CreateWidgets(self): - self.tabPages = TabPageSet(self, - pageNames=['Fonts/Tabs','Highlighting','Keys','General']) - self.tabPages.ChangePage()#activates default (first) page - frameActionButtons = Frame(self) + self.tabPages = TabbedPageSet(self, + page_names=['Fonts/Tabs','Highlighting','Keys','General']) + frameActionButtons = Frame(self,pady=2) #action buttons self.buttonHelp = Button(frameActionButtons,text='Help', - command=self.Help,takefocus=FALSE) + command=self.Help,takefocus=FALSE, + padx=6,pady=3) self.buttonOk = Button(frameActionButtons,text='Ok', - command=self.Ok,takefocus=FALSE) + command=self.Ok,takefocus=FALSE, + padx=6,pady=3) self.buttonApply = Button(frameActionButtons,text='Apply', - command=self.Apply,takefocus=FALSE) + command=self.Apply,takefocus=FALSE, + padx=6,pady=3) self.buttonCancel = Button(frameActionButtons,text='Cancel', - command=self.Cancel,takefocus=FALSE) + command=self.Cancel,takefocus=FALSE, + padx=6,pady=3) self.CreatePageFontTab() self.CreatePageHighlight() self.CreatePageKeys() self.CreatePageGeneral() - self.buttonHelp.pack(side=RIGHT,padx=5,pady=5) - self.buttonOk.pack(side=LEFT,padx=5,pady=5) - self.buttonApply.pack(side=LEFT,padx=5,pady=5) - self.buttonCancel.pack(side=LEFT,padx=5,pady=5) + self.buttonHelp.pack(side=RIGHT,padx=5) + self.buttonOk.pack(side=LEFT,padx=5) + self.buttonApply.pack(side=LEFT,padx=5) + self.buttonCancel.pack(side=LEFT,padx=5) frameActionButtons.pack(side=BOTTOM) + Frame(self, border=0).pack(side=BOTTOM,pady=2) self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH) def CreatePageFontTab(self): @@ -94,16 +102,17 @@ class ConfigDialog(Toplevel): self.editFont=tkFont.Font(self,('courier',10,'normal')) ##widget creation #body frame - frame=self.tabPages.pages['Fonts/Tabs']['page'] + frame=self.tabPages.pages['Fonts/Tabs'].frame #body section frames - frameFont=Frame(frame,borderwidth=2,relief=GROOVE) - frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) + frameFont=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Base Editor Font ') + frameIndent=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Indentation Width ') #frameFont - labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, - text='Font :') + text='Font Face :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) @@ -124,14 +133,13 @@ class ConfigDialog(Toplevel): labelSpaceNumTitle=Label(frameIndentSize, justify=LEFT, text='Python Standard: 4 Spaces!') self.scaleSpaceNum=Scale(frameIndentSize, variable=self.spaceNum, - label='Indentation Width', orient='horizontal', + orient='horizontal', tickinterval=2, from_=2, to=16) #widget packing #body - frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) - frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) + frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameIndent.pack(side=LEFT,padx=5,pady=5,fill=Y) #frameFont - labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) @@ -143,7 +151,7 @@ class ConfigDialog(Toplevel): frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent - frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) + frameIndentSize.pack(side=TOP,fill=X) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) return frame @@ -158,10 +166,12 @@ class ConfigDialog(Toplevel): self.highlightTarget=StringVar(self) ##widget creation #body frame - frame=self.tabPages.pages['Highlighting']['page'] + frame=self.tabPages.pages['Highlighting'].frame #body section frames - frameCustom=Frame(frame,borderwidth=2,relief=GROOVE) - frameTheme=Frame(frame,borderwidth=2,relief=GROOVE) + frameCustom=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Custom Highlighting ') + frameTheme=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Highlighting Theme ') #frameCustom self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1, font=('courier',12,''),cursor='hand2',width=21,height=10, @@ -189,7 +199,6 @@ class ConfigDialog(Toplevel): text.config(state=DISABLED) self.frameColourSet=Frame(frameCustom,relief=SOLID,borderwidth=1) frameFgBg=Frame(frameCustom) - labelCustomTitle=Label(frameCustom,text='Set Custom Highlighting') buttonSetColour=Button(self.frameColourSet,text='Choose Colour for :', command=self.GetColour,highlightthickness=0) self.optMenuHighlightTarget=DynOptionMenu(self.frameColourSet, @@ -202,7 +211,6 @@ class ConfigDialog(Toplevel): buttonSaveCustomTheme=Button(frameCustom, text='Save as New Custom Theme',command=self.SaveAsNewTheme) #frameTheme - labelThemeTitle=Label(frameTheme,text='Select a Highlighting Theme') labelTypeTitle=Label(frameTheme,text='Select : ') self.radioThemeBuiltin=Radiobutton(frameTheme,variable=self.themeIsBuiltin, value=1,command=self.SetThemeType,text='a Built-in Theme') @@ -216,10 +224,9 @@ class ConfigDialog(Toplevel): command=self.DeleteCustomTheme) ##widget packing #body - frameCustom.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) - frameTheme.pack(side=LEFT,padx=5,pady=10,fill=Y) + frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameTheme.pack(side=LEFT,padx=5,pady=5,fill=Y) #frameCustom - labelCustomTitle.pack(side=TOP,anchor=W,padx=5,pady=5) self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=X) frameFgBg.pack(side=TOP,padx=5,pady=0) self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=TRUE, @@ -230,7 +237,6 @@ class ConfigDialog(Toplevel): self.radioBg.pack(side=RIGHT,anchor=W) buttonSaveCustomTheme.pack(side=BOTTOM,fill=X,padx=5,pady=5) #frameTheme - labelThemeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) self.radioThemeBuiltin.pack(side=TOP,anchor=W,padx=5) self.radioThemeCustom.pack(side=TOP,anchor=W,padx=5,pady=2) @@ -248,13 +254,14 @@ class ConfigDialog(Toplevel): self.keyBinding=StringVar(self) ##widget creation #body frame - frame=self.tabPages.pages['Keys']['page'] + frame=self.tabPages.pages['Keys'].frame #body section frames - frameCustom=Frame(frame,borderwidth=2,relief=GROOVE) - frameKeySets=Frame(frame,borderwidth=2,relief=GROOVE) + frameCustom=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Custom Key Bindings ') + frameKeySets=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Key Set ') #frameCustom frameTarget=Frame(frameCustom) - labelCustomTitle=Label(frameCustom,text='Set Custom Key Bindings') labelTargetTitle=Label(frameTarget,text='Action - Key(s)') scrollTargetY=Scrollbar(frameTarget) scrollTargetX=Scrollbar(frameTarget,orient=HORIZONTAL) @@ -270,7 +277,6 @@ class ConfigDialog(Toplevel): buttonSaveCustomKeys=Button(frameCustom, text='Save as New Custom Key Set',command=self.SaveAsNewKeySet) #frameKeySets - labelKeysTitle=Label(frameKeySets,text='Select a Key Set') labelTypeTitle=Label(frameKeySets,text='Select : ') self.radioKeysBuiltin=Radiobutton(frameKeySets,variable=self.keysAreBuiltin, value=1,command=self.SetKeysType,text='a Built-in Key Set') @@ -287,7 +293,6 @@ class ConfigDialog(Toplevel): frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) frameKeySets.pack(side=LEFT,padx=5,pady=5,fill=Y) #frameCustom - labelCustomTitle.pack(side=TOP,anchor=W,padx=5,pady=5) buttonSaveCustomKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5) self.buttonNewKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5) frameTarget.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) @@ -299,7 +304,6 @@ class ConfigDialog(Toplevel): scrollTargetY.grid(row=1,column=1,sticky=NS) scrollTargetX.grid(row=2,column=0,sticky=EW) #frameKeySets - labelKeysTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) self.radioKeysBuiltin.pack(side=TOP,anchor=W,padx=5) self.radioKeysCustom.pack(side=TOP,anchor=W,padx=5,pady=2) @@ -320,23 +324,24 @@ class ConfigDialog(Toplevel): self.helpBrowser=StringVar(self) #widget creation #body - frame=self.tabPages.pages['General']['page'] + frame=self.tabPages.pages['General'].frame #body section frames - frameRun=Frame(frame,borderwidth=2,relief=GROOVE) - frameSave=Frame(frame,borderwidth=2,relief=GROOVE) + frameRun=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Startup Preferences ') + frameSave=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Autosave Preferences ') frameWinSize=Frame(frame,borderwidth=2,relief=GROOVE) frameParaSize=Frame(frame,borderwidth=2,relief=GROOVE) frameEncoding=Frame(frame,borderwidth=2,relief=GROOVE) - frameHelp=Frame(frame,borderwidth=2,relief=GROOVE) + frameHelp=LabelFrame(frame,borderwidth=2,relief=GROOVE, + text=' Additional Help Sources ') #frameRun - labelRunTitle=Label(frameRun,text='Startup Preferences') labelRunChoiceTitle=Label(frameRun,text='At Startup') radioStartupEdit=Radiobutton(frameRun,variable=self.startupEdit, value=1,command=self.SetKeysType,text="Open Edit Window") radioStartupShell=Radiobutton(frameRun,variable=self.startupEdit, value=0,command=self.SetKeysType,text='Open Shell Window') #frameSave - labelSaveTitle=Label(frameSave,text='Autosave Preference') labelRunSaveTitle=Label(frameSave,text='At Start of Run (F5) ') radioSaveAsk=Radiobutton(frameSave,variable=self.autoSave, value=0,command=self.SetKeysType,text="Prompt to Save") @@ -367,7 +372,6 @@ class ConfigDialog(Toplevel): #frameHelp frameHelpList=Frame(frameHelp) frameHelpListButtons=Frame(frameHelpList) - labelHelpListTitle=Label(frameHelpList,text='Additional Help Sources:') scrollHelpList=Scrollbar(frameHelpList) self.listHelp=Listbox(frameHelpList,height=5,takefocus=FALSE, exportselection=FALSE) @@ -389,12 +393,10 @@ class ConfigDialog(Toplevel): frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X) frameHelp.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) #frameRun - labelRunTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelRunChoiceTitle.pack(side=LEFT,anchor=W,padx=5,pady=5) radioStartupShell.pack(side=RIGHT,anchor=W,padx=5,pady=5) radioStartupEdit.pack(side=RIGHT,anchor=W,padx=5,pady=5) #frameSave - labelSaveTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelRunSaveTitle.pack(side=LEFT,anchor=W,padx=5,pady=5) radioSaveAuto.pack(side=RIGHT,anchor=W,padx=5,pady=5) radioSaveAsk.pack(side=RIGHT,anchor=W,padx=5,pady=5) @@ -415,7 +417,6 @@ class ConfigDialog(Toplevel): #frameHelp frameHelpListButtons.pack(side=RIGHT,padx=5,pady=5,fill=Y) frameHelpList.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) - labelHelpListTitle.pack(side=TOP,anchor=W) scrollHelpList.pack(side=RIGHT,anchor=W,fill=Y) self.listHelp.pack(side=LEFT,anchor=E,expand=TRUE,fill=BOTH) self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5) @@ -1116,12 +1117,15 @@ class ConfigDialog(Toplevel): def ActivateConfigChanges(self): "Dynamically apply configuration changes" winInstances = self.parent.instance_dict.keys() + theme = idleConf.CurrentTheme() + cursor_color = idleConf.GetHighlight(theme, 'cursor', fgBg='fg') for instance in winInstances: instance.ResetColorizer() instance.ResetFont() instance.set_notabs_indentwidth() instance.ApplyKeybindings() instance.reset_help_menu_entries() + instance.text.configure(insertbackground=cursor_color) def Cancel(self): self.destroy() diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 4ba5198..9fbe0e9 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -38,10 +38,11 @@ else: # Thread shared globals: Establish a queue between a subthread (which handles # the socket) and the main thread (which runs user code), plus global -# completion and exit flags: +# completion, exit and interruptable (the main thread) flags: exit_now = False quitting = False +interruptable = False def main(del_exitfunc=False): """Start the Python execution server in a subprocess @@ -278,9 +279,14 @@ class Executive(object): self.autocomplete = AutoComplete.AutoComplete() def runcode(self, code): + global interruptable try: self.usr_exc_info = None - exec(code, self.locals) + interruptable = True + try: + exec(code, self.locals) + finally: + interruptable = False except: self.usr_exc_info = sys.exc_info() if quitting: @@ -294,7 +300,8 @@ class Executive(object): flush_stdout() def interrupt_the_server(self): - thread.interrupt_main() + if interruptable: + thread.interrupt_main() def start_the_debugger(self, gui_adap_oid): return RemoteDebugger.start_debugger(self.rpchandler, gui_adap_oid) diff --git a/Lib/idlelib/tabbedpages.py b/Lib/idlelib/tabbedpages.py new file mode 100644 index 0000000..98f6a27 --- /dev/null +++ b/Lib/idlelib/tabbedpages.py @@ -0,0 +1,478 @@ +"""An implementation of tabbed pages using only standard Tkinter. + +Originally developed for use in IDLE. Based on tabpage.py. + +Classes exported: +TabbedPageSet -- A Tkinter implementation of a tabbed-page widget. +TabBarSet -- A widget containing tabs (buttons) in one or more rows. + +""" +from Tkinter import * + +class InvalidNameError(Exception): pass +class AlreadyExistsError(Exception): pass + + +class TabBarSet(Frame): + """A widget containing tabs (buttons) in one or more rows. + + Only one tab may be selected at a time. + + """ + def __init__(self, page_set, select_command, + tabs=None, n_rows=1, max_tabs_per_row=5, + expand_tabs=False, **kw): + """Constructor arguments: + + select_command -- A callable which will be called when a tab is + selected. It is called with the name of the selected tab as an + argument. + + tabs -- A list of strings, the names of the tabs. Should be specified in + the desired tab order. The first tab will be the default and first + active tab. If tabs is None or empty, the TabBarSet will be initialized + empty. + + n_rows -- Number of rows of tabs to be shown. If n_rows <= 0 or is + None, then the number of rows will be decided by TabBarSet. See + _arrange_tabs() for details. + + max_tabs_per_row -- Used for deciding how many rows of tabs are needed, + when the number of rows is not constant. See _arrange_tabs() for + details. + + """ + Frame.__init__(self, page_set, **kw) + self.select_command = select_command + self.n_rows = n_rows + self.max_tabs_per_row = max_tabs_per_row + self.expand_tabs = expand_tabs + self.page_set = page_set + + self._tabs = {} + self._tab2row = {} + if tabs: + self._tab_names = list(tabs) + else: + self._tab_names = [] + self._selected_tab = None + self._tab_rows = [] + + self.padding_frame = Frame(self, height=2, + borderwidth=0, relief=FLAT, + background=self.cget('background')) + self.padding_frame.pack(side=TOP, fill=X, expand=False) + + self._arrange_tabs() + + def add_tab(self, tab_name): + """Add a new tab with the name given in tab_name.""" + if not tab_name: + raise InvalidNameError("Invalid Tab name: '%s'" % tab_name) + if tab_name in self._tab_names: + raise AlreadyExistsError("Tab named '%s' already exists" %tab_name) + + self._tab_names.append(tab_name) + self._arrange_tabs() + + def remove_tab(self, tab_name): + """Remove the tab with the name given in tab_name.""" + if not tab_name in self._tab_names: + raise KeyError("No such Tab: '%s" % page_name) + + self._tab_names.remove(tab_name) + self._arrange_tabs() + + def select_tab(self, tab_name): + """Select the tab with the name given in tab_name.""" + if tab_name == self._selected_tab: + return + if tab_name is not None and tab_name not in self._tabs: + raise KeyError("No such Tab: '%s" % page_name) + + # deselect the current selected tab + if self._selected_tab is not None: + self._tabs[self._selected_tab].set_normal() + self._selected_tab = None + + if tab_name is not None: + # activate the tab named tab_name + self._selected_tab = tab_name + tab = self._tabs[tab_name] + tab.set_selected() + # move the tab row with the selected tab to the bottom + tab_row = self._tab2row[tab] + tab_row.pack_forget() + tab_row.pack(side=TOP, fill=X, expand=0) + + def _add_tab_row(self, tab_names, expand_tabs): + if not tab_names: + return + + tab_row = Frame(self) + tab_row.pack(side=TOP, fill=X, expand=0) + tab_row.tab_set = self + self._tab_rows.append(tab_row) + + for tab_name in tab_names: + def tab_command(select_command=self.select_command, + tab_name=tab_name): + return select_command(tab_name) + tab = TabBarSet.TabButton(tab_row, tab_name, tab_command) + if expand_tabs: + tab.pack(side=LEFT, fill=X, expand=True) + else: + tab.pack(side=LEFT) + self._tabs[tab_name] = tab + self._tab2row[tab] = tab_row + + tab.is_last_in_row = True + + def _reset_tab_rows(self): + while self._tab_rows: + tab_row = self._tab_rows.pop() + tab_row.destroy() + self._tab2row = {} + + def _arrange_tabs(self): + """ + Arrange the tabs in rows, in the order in which they were added. + + If n_rows >= 1, this will be the number of rows used. Otherwise the + number of rows will be calculated according to the number of tabs and + max_tabs_per_row. In this case, the number of rows may change when + adding/removing tabs. + + """ + # remove all tabs and rows + for tab_name in self._tabs.keys(): + self._tabs.pop(tab_name).destroy() + self._reset_tab_rows() + + if not self._tab_names: + return + + if self.n_rows is not None and self.n_rows > 0: + n_rows = self.n_rows + else: + # calculate the required number of rows + n_rows = (len(self._tab_names) - 1) // self.max_tabs_per_row + 1 + + i = 0 + expand_tabs = self.expand_tabs or n_rows > 1 + for row_index in xrange(n_rows): + # calculate required number of tabs in this row + n_tabs = (len(self._tab_names) - i - 1) // (n_rows - row_index) + 1 + tab_names = self._tab_names[i:i + n_tabs] + i += n_tabs + self._add_tab_row(tab_names, expand_tabs) + + # re-select selected tab so it is properly displayed + selected = self._selected_tab + self.select_tab(None) + if selected in self._tab_names: + self.select_tab(selected) + + class TabButton(Frame): + """A simple tab-like widget.""" + + bw = 2 # borderwidth + + def __init__(self, tab_row, name, command): + """Constructor arguments: + + name -- The tab's name, which will appear in its button. + + command -- The command to be called upon selection of the tab. It + is called with the tab's name as an argument. + + """ + Frame.__init__(self, tab_row, borderwidth=self.bw) + self.button = Radiobutton(self, text=name, command=command, + padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE, + highlightthickness=0, selectcolor='', borderwidth=0) + self.button.pack(side=LEFT, fill=X, expand=True) + + self.tab_set = tab_row.tab_set + + self.is_last_in_row = False + + self._init_masks() + self.set_normal() + + def set_selected(self): + """Assume selected look""" + for widget in self, self.mskl.ml, self.mskr.mr: + widget.config(relief=RAISED) + self._place_masks(selected=True) + + def set_normal(self): + """Assume normal look""" + for widget in self, self.mskl.ml, self.mskr.mr: + widget.config(relief=RAISED) + self._place_masks(selected=False) + + def _init_masks(self): + page_set = self.tab_set.page_set + background = page_set.pages_frame.cget('background') + # mask replaces the middle of the border with the background color + self.mask = Frame(page_set, borderwidth=0, relief=FLAT, + background=background) + # mskl replaces the bottom-left corner of the border with a normal + # left border + self.mskl = Frame(page_set, borderwidth=0, relief=FLAT, + background=background) + self.mskl.ml = Frame(self.mskl, borderwidth=self.bw, + relief=RAISED) + self.mskl.ml.place(x=0, y=-self.bw, + width=2*self.bw, height=self.bw*4) + # mskr replaces the bottom-right corner of the border with a normal + # right border + self.mskr = Frame(page_set, borderwidth=0, relief=FLAT, + background=background) + self.mskr.mr = Frame(self.mskr, borderwidth=self.bw, + relief=RAISED) + + def _place_masks(self, selected=False): + height = self.bw + if selected: + height += self.bw + + self.mask.place(in_=self, + relx=0.0, x=0, + rely=1.0, y=0, + relwidth=1.0, width=0, + relheight=0.0, height=height) + + self.mskl.place(in_=self, + relx=0.0, x=-self.bw, + rely=1.0, y=0, + relwidth=0.0, width=self.bw, + relheight=0.0, height=height) + + page_set = self.tab_set.page_set + if selected and ((not self.is_last_in_row) or + (self.winfo_rootx() + self.winfo_width() < + page_set.winfo_rootx() + page_set.winfo_width()) + ): + # for a selected tab, if its rightmost edge isn't on the + # rightmost edge of the page set, the right mask should be one + # borderwidth shorter (vertically) + height -= self.bw + + self.mskr.place(in_=self, + relx=1.0, x=0, + rely=1.0, y=0, + relwidth=0.0, width=self.bw, + relheight=0.0, height=height) + + self.mskr.mr.place(x=-self.bw, y=-self.bw, + width=2*self.bw, height=height + self.bw*2) + + # finally, lower the tab set so that all of the frames we just + # placed hide it + self.tab_set.lower() + +class TabbedPageSet(Frame): + """A Tkinter tabbed-pane widget. + + Constains set of 'pages' (or 'panes') with tabs above for selecting which + page is displayed. Only one page will be displayed at a time. + + Pages may be accessed through the 'pages' attribute, which is a dictionary + of pages, using the name given as the key. A page is an instance of a + subclass of Tk's Frame widget. + + The page widgets will be created (and destroyed when required) by the + TabbedPageSet. Do not call the page's pack/place/grid/destroy methods. + + Pages may be added or removed at any time using the add_page() and + remove_page() methods. + + """ + class Page(object): + """Abstract base class for TabbedPageSet's pages. + + Subclasses must override the _show() and _hide() methods. + + """ + uses_grid = False + + def __init__(self, page_set): + self.frame = Frame(page_set, borderwidth=2, relief=RAISED) + + def _show(self): + raise NotImplementedError + + def _hide(self): + raise NotImplementedError + + class PageRemove(Page): + """Page class using the grid placement manager's "remove" mechanism.""" + uses_grid = True + + def _show(self): + self.frame.grid(row=0, column=0, sticky=NSEW) + + def _hide(self): + self.frame.grid_remove() + + class PageLift(Page): + """Page class using the grid placement manager's "lift" mechanism.""" + uses_grid = True + + def __init__(self, page_set): + super(TabbedPageSet.PageLift, self).__init__(page_set) + self.frame.grid(row=0, column=0, sticky=NSEW) + self.frame.lower() + + def _show(self): + self.frame.lift() + + def _hide(self): + self.frame.lower() + + class PagePackForget(Page): + """Page class using the pack placement manager's "forget" mechanism.""" + def _show(self): + self.frame.pack(fill=BOTH, expand=True) + + def _hide(self): + self.frame.pack_forget() + + def __init__(self, parent, page_names=None, page_class=PageLift, + n_rows=1, max_tabs_per_row=5, expand_tabs=False, + **kw): + """Constructor arguments: + + page_names -- A list of strings, each will be the dictionary key to a + page's widget, and the name displayed on the page's tab. Should be + specified in the desired page order. The first page will be the default + and first active page. If page_names is None or empty, the + TabbedPageSet will be initialized empty. + + n_rows, max_tabs_per_row -- Parameters for the TabBarSet which will + manage the tabs. See TabBarSet's docs for details. + + page_class -- Pages can be shown/hidden using three mechanisms: + + * PageLift - All pages will be rendered one on top of the other. When + a page is selected, it will be brought to the top, thus hiding all + other pages. Using this method, the TabbedPageSet will not be resized + when pages are switched. (It may still be resized when pages are + added/removed.) + + * PageRemove - When a page is selected, the currently showing page is + hidden, and the new page shown in its place. Using this method, the + TabbedPageSet may resize when pages are changed. + + * PagePackForget - This mechanism uses the pack placement manager. + When a page is shown it is packed, and when it is hidden it is + unpacked (i.e. pack_forget). This mechanism may also cause the + TabbedPageSet to resize when the page is changed. + + """ + Frame.__init__(self, parent, kw) + + self.page_class = page_class + self.pages = {} + self._pages_order = [] + self._current_page = None + self._default_page = None + + self.columnconfigure(0, weight=1) + self.rowconfigure(1, weight=1) + + self.pages_frame = Frame(self) + self.pages_frame.grid(row=1, column=0, sticky=NSEW) + if self.page_class.uses_grid: + self.pages_frame.columnconfigure(0, weight=1) + self.pages_frame.rowconfigure(0, weight=1) + + # the order of the following commands is important + self._tab_set = TabBarSet(self, self.change_page, n_rows=n_rows, + max_tabs_per_row=max_tabs_per_row, + expand_tabs=expand_tabs) + if page_names: + for name in page_names: + self.add_page(name) + self._tab_set.grid(row=0, column=0, sticky=NSEW) + + self.change_page(self._default_page) + + def add_page(self, page_name): + """Add a new page with the name given in page_name.""" + if not page_name: + raise InvalidNameError("Invalid TabPage name: '%s'" % page_name) + if page_name in self.pages: + raise AlreadyExistsError( + "TabPage named '%s' already exists" % page_name) + + self.pages[page_name] = self.page_class(self.pages_frame) + self._pages_order.append(page_name) + self._tab_set.add_tab(page_name) + + if len(self.pages) == 1: # adding first page + self._default_page = page_name + self.change_page(page_name) + + def remove_page(self, page_name): + """Destroy the page whose name is given in page_name.""" + if not page_name in self.pages: + raise KeyError("No such TabPage: '%s" % page_name) + + self._pages_order.remove(page_name) + + # handle removing last remaining, default, or currently shown page + if len(self._pages_order) > 0: + if page_name == self._default_page: + # set a new default page + self._default_page = self._pages_order[0] + else: + self._default_page = None + + if page_name == self._current_page: + self.change_page(self._default_page) + + self._tab_set.remove_tab(page_name) + page = self.pages.pop(page_name) + page.frame.destroy() + + def change_page(self, page_name): + """Show the page whose name is given in page_name.""" + if self._current_page == page_name: + return + if page_name is not None and page_name not in self.pages: + raise KeyError("No such TabPage: '%s'" % page_name) + + if self._current_page is not None: + self.pages[self._current_page]._hide() + self._current_page = None + + if page_name is not None: + self._current_page = page_name + self.pages[page_name]._show() + + self._tab_set.select_tab(page_name) + +if __name__ == '__main__': + # test dialog + root=Tk() + tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, + expand_tabs=False, + ) + tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) + Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() + Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() + Label(tabPage.pages['Baz'].frame, text='Baz').pack() + entryPgName=Entry(root) + buttonAdd=Button(root, text='Add Page', + command=lambda:tabPage.add_page(entryPgName.get())) + buttonRemove=Button(root, text='Remove Page', + command=lambda:tabPage.remove_page(entryPgName.get())) + labelPgName=Label(root, text='name of page to add/remove:') + buttonAdd.pack(padx=5, pady=5) + buttonRemove.pack(padx=5, pady=5) + labelPgName.pack(padx=5) + entryPgName.pack(padx=5) + root.mainloop() diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py index 917a6cc..0e7e663 100644 --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -6,13 +6,12 @@ from Tkinter import * import tkMessageBox class TextViewer(Toplevel): + """A simple text viewer dialog for IDLE + """ - simple text viewer dialog for idle - """ - def __init__(self, parent, title, fileName, data=None): - """If data exists, load it into viewer, otherwise try to load file. + def __init__(self, parent, title, text): + """Show the given text in a scrollable window with a 'close' button - fileName - string, should be an absoulute filename """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) @@ -33,23 +32,10 @@ class TextViewer(Toplevel): #key bindings for this dialog self.bind('<Return>',self.Ok) #dismiss dialog self.bind('<Escape>',self.Ok) #dismiss dialog - if data: - self.textView.insert(0.0, data) - else: - self.LoadTextFile(fileName) + self.textView.insert(0.0, text) self.textView.config(state=DISABLED) self.wait_window() - def LoadTextFile(self, fileName): - textFile = None - try: - textFile = open(fileName, 'r') - except IOError: - tkMessageBox.showerror(title='File Load Error', - message='Unable to load file %r .' % (fileName,)) - else: - self.textView.insert(0.0,textFile.read()) - def CreateWidgets(self): frameText = Frame(self, relief=SUNKEN, height=700) frameButtons = Frame(self) @@ -70,9 +56,38 @@ class TextViewer(Toplevel): def Ok(self, event=None): self.destroy() + +def view_text(parent, title, text): + TextViewer(parent, title, text) + +def view_file(parent, title, filename, encoding=None): + try: + if encoding: + import codecs + textFile = codecs.open(filename, 'r') + else: + textFile = open(filename, 'r') + except IOError: + import tkMessageBox + tkMessageBox.showerror(title='File Load Error', + message='Unable to load file %r .' % filename, + parent=parent) + else: + return view_text(parent, title, textFile.read()) + + if __name__ == '__main__': #test the dialog root=Tk() - Button(root,text='View', - command=lambda:TextViewer(root,'Text','./textView.py')).pack() + root.title('textView test') + filename = './textView.py' + text = file(filename, 'r').read() + btn1 = Button(root, text='view_text', + command=lambda:view_text(root, 'view_text', text)) + btn1.pack(side=LEFT) + btn2 = Button(root, text='view_file', + command=lambda:view_file(root, 'view_file', filename)) + btn2.pack(side=LEFT) + close = Button(root, text='Close', command=root.destroy) + close.pack(side=RIGHT) root.mainloop() diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 2125a5e..3b85123 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -41,8 +41,8 @@ except ImportError: __author__ = "Vinay Sajip <vinay_sajip@red-dove.com>" __status__ = "production" -__version__ = "0.5.0.2" -__date__ = "16 February 2007" +__version__ = "0.5.0.3" +__date__ = "26 September 2007" #--------------------------------------------------------------------------- # Miscellaneous module data @@ -236,7 +236,7 @@ class LogRecord: # 'Value is %d' instead of 'Value is 0'. # For the use case of passing a dictionary, this should not be a # problem. - if args and (len(args) == 1) and args[0] and isinstance(args[0], dict): + if args and len(args) == 1 and isinstance(args[0], dict) and args[0]: args = args[0] self.args = args self.levelname = getLevelName(level) @@ -730,7 +730,8 @@ class StreamHandler(Handler): """ Flushes the stream. """ - self.stream.flush() + if self.stream: + self.stream.flush() def emit(self, record): """ @@ -780,9 +781,11 @@ class FileHandler(StreamHandler): """ Closes the stream. """ - self.flush() - self.stream.close() - StreamHandler.close(self) + if self.stream: + self.flush() + self.stream.close() + StreamHandler.close(self) + self.stream = None def _open(self): """ @@ -1245,7 +1248,7 @@ def basicConfig(**kwargs): hdlr.setFormatter(fmt) root.addHandler(hdlr) level = kwargs.get("level") - if level: + if level is not None: root.setLevel(level) #--------------------------------------------------------------------------- diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index 893fbe6..2062809 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -231,11 +231,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler): # of days in the next week until the rollover day (3). if when.startswith('W'): day = t[6] # 0 is Monday - if day > self.dayOfWeek: - daysToWait = (day - self.dayOfWeek) - 1 - self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) - if day < self.dayOfWeek: - daysToWait = (6 - self.dayOfWeek) + day + if day != self.dayOfWeek: + if day < self.dayOfWeek: + daysToWait = self.dayOfWeek - day - 1 + else: + daysToWait = 6 - day + self.dayOfWeek self.rolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py index 1b73a65..6c36a9c 100644 --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -393,6 +393,7 @@ def _default_mime_types(): '.movie' : 'video/x-sgi-movie', '.mp2' : 'audio/mpeg', '.mp3' : 'audio/mpeg', + '.mp4' : 'video/mp4', '.mpa' : 'video/mpeg', '.mpe' : 'video/mpeg', '.mpeg' : 'video/mpeg', diff --git a/Lib/plat-freebsd6/IN.py b/Lib/plat-freebsd6/IN.py index 31e9e13..560bf84 100644 --- a/Lib/plat-freebsd6/IN.py +++ b/Lib/plat-freebsd6/IN.py @@ -1,6 +1,28 @@ # Generated by h2py from /usr/include/netinet/in.h # Included from sys/cdefs.h +__GNUCLIKE_ASM = 3 +__GNUCLIKE_ASM = 2 +__GNUCLIKE___TYPEOF = 1 +__GNUCLIKE___OFFSETOF = 1 +__GNUCLIKE___SECTION = 1 +__GNUCLIKE_ATTRIBUTE_MODE_DI = 1 +__GNUCLIKE_CTOR_SECTION_HANDLING = 1 +__GNUCLIKE_BUILTIN_CONSTANT_P = 1 +__GNUCLIKE_BUILTIN_VARARGS = 1 +__GNUCLIKE_BUILTIN_STDARG = 1 +__GNUCLIKE_BUILTIN_VAALIST = 1 +__GNUC_VA_LIST_COMPATIBILITY = 1 +__GNUCLIKE_BUILTIN_NEXT_ARG = 1 +__GNUCLIKE_BUILTIN_MEMCPY = 1 +__CC_SUPPORTS_INLINE = 1 +__CC_SUPPORTS___INLINE = 1 +__CC_SUPPORTS___INLINE__ = 1 +__CC_SUPPORTS___FUNC__ = 1 +__CC_SUPPORTS_WARNING = 1 +__CC_SUPPORTS_VARADIC_XXX = 1 +__CC_SUPPORTS_DYNAMIC_ARRAY_INIT = 1 +__CC_INT_IS_32BIT = 1 def __P(protos): return protos def __STRING(x): return #x @@ -29,6 +51,8 @@ def __predict_true(exp): return (exp) def __predict_false(exp): return (exp) +def __format_arg(fmtarg): return __attribute__((__format_arg__ (fmtarg))) + def __FBSDID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) def __RCSID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) @@ -86,8 +110,6 @@ LITTLE_ENDIAN = _LITTLE_ENDIAN BIG_ENDIAN = _BIG_ENDIAN PDP_ENDIAN = _PDP_ENDIAN BYTE_ORDER = _BYTE_ORDER -__INTEL_COMPILER_with_FreeBSD_endian = 1 -__INTEL_COMPILER_with_FreeBSD_endian = 1 def __word_swap_int_var(x): return \ def __word_swap_int_const(x): return \ @@ -96,12 +118,16 @@ def __word_swap_int(x): return __word_swap_int_var(x) def __byte_swap_int_var(x): return \ -def __byte_swap_int_var(x): return \ - def __byte_swap_int_const(x): return \ def __byte_swap_int(x): return __byte_swap_int_var(x) +def __byte_swap_long_var(x): return \ + +def __byte_swap_long_const(x): return \ + +def __byte_swap_long(x): return __byte_swap_long_var(x) + def __byte_swap_word_var(x): return \ def __byte_swap_word_const(x): return \ @@ -229,47 +255,50 @@ IPPROTO_ENCAP = 98 IPPROTO_APES = 99 IPPROTO_GMTP = 100 IPPROTO_IPCOMP = 108 +IPPROTO_SCTP = 132 IPPROTO_PIM = 103 +IPPROTO_CARP = 112 IPPROTO_PGM = 113 IPPROTO_PFSYNC = 240 IPPROTO_OLD_DIVERT = 254 IPPROTO_MAX = 256 IPPROTO_DONE = 257 IPPROTO_DIVERT = 258 +IPPROTO_SPACER = 32767 IPPORT_RESERVED = 1024 IPPORT_HIFIRSTAUTO = 49152 IPPORT_HILASTAUTO = 65535 IPPORT_RESERVEDSTART = 600 IPPORT_MAX = 65535 -def IN_CLASSA(i): return (((u_int32_t)(i) & (-2147483648)) == 0) +def IN_CLASSA(i): return (((u_int32_t)(i) & 0x80000000) == 0) -IN_CLASSA_NET = (-16777216) +IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 24 IN_CLASSA_HOST = 0x00ffffff IN_CLASSA_MAX = 128 -def IN_CLASSB(i): return (((u_int32_t)(i) & (-1073741824)) == (-2147483648)) +def IN_CLASSB(i): return (((u_int32_t)(i) & 0xc0000000) == 0x80000000) -IN_CLASSB_NET = (-65536) +IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 16 IN_CLASSB_HOST = 0x0000ffff IN_CLASSB_MAX = 65536 -def IN_CLASSC(i): return (((u_int32_t)(i) & (-536870912)) == (-1073741824)) +def IN_CLASSC(i): return (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) -IN_CLASSC_NET = (-256) +IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 8 IN_CLASSC_HOST = 0x000000ff -def IN_CLASSD(i): return (((u_int32_t)(i) & (-268435456)) == (-536870912)) +def IN_CLASSD(i): return (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) -IN_CLASSD_NET = (-268435456) +IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 28 IN_CLASSD_HOST = 0x0fffffff def IN_MULTICAST(i): return IN_CLASSD(i) -def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & (-268435456)) == (-268435456)) +def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) -def IN_BADCLASS(i): return (((u_int32_t)(i) & (-268435456)) == (-268435456)) +def IN_BADCLASS(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) -INADDR_NONE = (-1) +INADDR_NONE = 0xffffffff IN_LOOPBACKNET = 127 IP_OPTIONS = 1 IP_HDRINCL = 2 @@ -311,6 +340,8 @@ IP_DUMMYNET_DEL = 61 IP_DUMMYNET_FLUSH = 62 IP_DUMMYNET_GET = 64 IP_RECVTTL = 65 +IP_MINTTL = 66 +IP_DONTFRAG = 67 IP_DEFAULT_MULTICAST_TTL = 1 IP_DEFAULT_MULTICAST_LOOP = 1 IP_MAX_MEMBERSHIPS = 20 @@ -339,7 +370,7 @@ def in_nullhost(x): return ((x).s_addr == INADDR_ANY) # Included from netinet6/in6.h -__KAME_VERSION = "20010528/FreeBSD" +__KAME_VERSION = "FreeBSD" IPV6PORT_RESERVED = 1024 IPV6PORT_ANONMIN = 49152 IPV6PORT_ANONMAX = 65535 @@ -348,8 +379,8 @@ IPV6PORT_RESERVEDMAX = (IPV6PORT_RESERVED-1) INET6_ADDRSTRLEN = 46 IPV6_ADDR_INT32_ONE = 1 IPV6_ADDR_INT32_TWO = 2 -IPV6_ADDR_INT32_MNL = (-16711680) -IPV6_ADDR_INT32_MLL = (-16646144) +IPV6_ADDR_INT32_MNL = 0xff010000 +IPV6_ADDR_INT32_MLL = 0xff020000 IPV6_ADDR_INT32_SMP = 0x0000ffff IPV6_ADDR_INT16_ULL = 0xfe80 IPV6_ADDR_INT16_USL = 0xfec0 @@ -358,7 +389,7 @@ IPV6_ADDR_INT32_ONE = 0x01000000 IPV6_ADDR_INT32_TWO = 0x02000000 IPV6_ADDR_INT32_MNL = 0x000001ff IPV6_ADDR_INT32_MLL = 0x000002ff -IPV6_ADDR_INT32_SMP = (-65536) +IPV6_ADDR_INT32_SMP = 0xffff0000 IPV6_ADDR_INT16_ULL = 0x80fe IPV6_ADDR_INT16_USL = 0xc0fe IPV6_ADDR_INT16_MLL = 0x02ff @@ -511,5 +542,10 @@ IPV6CTL_AUTO_LINKLOCAL = 35 IPV6CTL_RIP6STATS = 36 IPV6CTL_PREFER_TEMPADDR = 37 IPV6CTL_ADDRCTLPOLICY = 38 +IPV6CTL_USE_DEFAULTZONE = 39 IPV6CTL_MAXFRAGS = 41 -IPV6CTL_MAXID = 42 +IPV6CTL_IFQ = 42 +IPV6CTL_ISATAPRTR = 43 +IPV6CTL_MCAST_PMTU = 44 +IPV6CTL_STEALTH = 45 +IPV6CTL_MAXID = 46 diff --git a/Lib/plat-freebsd7/IN.py b/Lib/plat-freebsd7/IN.py index 77314ac..4e3b3a2 100644 --- a/Lib/plat-freebsd7/IN.py +++ b/Lib/plat-freebsd7/IN.py @@ -10,9 +10,9 @@ __GNUCLIKE_ATTRIBUTE_MODE_DI = 1 __GNUCLIKE_CTOR_SECTION_HANDLING = 1 __GNUCLIKE_BUILTIN_CONSTANT_P = 1 __GNUCLIKE_BUILTIN_VARARGS = 1 +__GNUCLIKE_BUILTIN_STDARG = 1 __GNUCLIKE_BUILTIN_VAALIST = 1 __GNUC_VA_LIST_COMPATIBILITY = 1 -__GNUCLIKE_BUILTIN_STDARG = 1 __GNUCLIKE_BUILTIN_NEXT_ARG = 1 __GNUCLIKE_BUILTIN_MEMCPY = 1 __CC_SUPPORTS_INLINE = 1 @@ -51,6 +51,8 @@ def __predict_true(exp): return (exp) def __predict_false(exp): return (exp) +def __format_arg(fmtarg): return __attribute__((__format_arg__ (fmtarg))) + def __FBSDID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) def __RCSID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) @@ -247,6 +249,7 @@ IPPROTO_ENCAP = 98 IPPROTO_APES = 99 IPPROTO_GMTP = 100 IPPROTO_IPCOMP = 108 +IPPROTO_SCTP = 132 IPPROTO_PIM = 103 IPPROTO_CARP = 112 IPPROTO_PGM = 113 @@ -289,6 +292,10 @@ def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & (-268435456)) == (-268435456)) def IN_BADCLASS(i): return (((u_int32_t)(i) & (-268435456)) == (-268435456)) +def IN_LINKLOCAL(i): return (((u_int32_t)(i) & (-65536)) == (-1442971648)) + +def IN_LOCAL_GROUP(i): return (((u_int32_t)(i) & (-256)) == (-536870912)) + INADDR_NONE = (-1) IN_LOOPBACKNET = 127 IP_OPTIONS = 1 @@ -326,14 +333,35 @@ IP_FW_FLUSH = 52 IP_FW_ZERO = 53 IP_FW_GET = 54 IP_FW_RESETLOG = 55 +IP_FW_NAT_CFG = 56 +IP_FW_NAT_DEL = 57 +IP_FW_NAT_GET_CONFIG = 58 +IP_FW_NAT_GET_LOG = 59 IP_DUMMYNET_CONFIGURE = 60 IP_DUMMYNET_DEL = 61 IP_DUMMYNET_FLUSH = 62 IP_DUMMYNET_GET = 64 IP_RECVTTL = 65 +IP_MINTTL = 66 +IP_DONTFRAG = 67 +IP_ADD_SOURCE_MEMBERSHIP = 70 +IP_DROP_SOURCE_MEMBERSHIP = 71 +IP_BLOCK_SOURCE = 72 +IP_UNBLOCK_SOURCE = 73 +IP_MSFILTER = 74 +MCAST_JOIN_GROUP = 80 +MCAST_LEAVE_GROUP = 81 +MCAST_JOIN_SOURCE_GROUP = 82 +MCAST_LEAVE_SOURCE_GROUP = 83 +MCAST_BLOCK_SOURCE = 84 +MCAST_UNBLOCK_SOURCE = 85 IP_DEFAULT_MULTICAST_TTL = 1 IP_DEFAULT_MULTICAST_LOOP = 1 -IP_MAX_MEMBERSHIPS = 20 +IP_MIN_MEMBERSHIPS = 31 +IP_MAX_MEMBERSHIPS = 4095 +IP_MAX_SOURCE_FILTER = 1024 +MCAST_INCLUDE = 1 +MCAST_EXCLUDE = 2 IP_PORTRANGE_DEFAULT = 0 IP_PORTRANGE_HIGH = 1 IP_PORTRANGE_LOW = 2 @@ -359,7 +387,7 @@ def in_nullhost(x): return ((x).s_addr == INADDR_ANY) # Included from netinet6/in6.h -__KAME_VERSION = "20010528/FreeBSD" +__KAME_VERSION = "FreeBSD" IPV6PORT_RESERVED = 1024 IPV6PORT_ANONMIN = 49152 IPV6PORT_ANONMAX = 65535 @@ -430,6 +458,8 @@ def IN6_IS_ADDR_MC_GLOBAL(a): return \ def IN6_IS_SCOPE_LINKLOCAL(a): return \ +def IN6_IS_SCOPE_EMBED(a): return \ + def IFA6_IS_DEPRECATED(a): return \ def IFA6_IS_INVALID(a): return \ @@ -488,6 +518,7 @@ IPV6_AUTOFLOWLABEL = 59 IPV6_TCLASS = 61 IPV6_DONTFRAG = 62 IPV6_PREFER_TEMPADDR = 63 +IPV6_MSFILTER = 74 IPV6_RTHDR_LOOSE = 0 IPV6_RTHDR_STRICT = 1 IPV6_RTHDR_TYPE_0 = 0 @@ -531,5 +562,10 @@ IPV6CTL_AUTO_LINKLOCAL = 35 IPV6CTL_RIP6STATS = 36 IPV6CTL_PREFER_TEMPADDR = 37 IPV6CTL_ADDRCTLPOLICY = 38 +IPV6CTL_USE_DEFAULTZONE = 39 IPV6CTL_MAXFRAGS = 41 -IPV6CTL_MAXID = 42 +IPV6CTL_IFQ = 42 +IPV6CTL_ISATAPRTR = 43 +IPV6CTL_MCAST_PMTU = 44 +IPV6CTL_STEALTH = 45 +IPV6CTL_MAXID = 46 diff --git a/Lib/plat-freebsd8/IN.py b/Lib/plat-freebsd8/IN.py new file mode 100644 index 0000000..4e3b3a2 --- /dev/null +++ b/Lib/plat-freebsd8/IN.py @@ -0,0 +1,571 @@ +# Generated by h2py from /usr/include/netinet/in.h + +# Included from sys/cdefs.h +__GNUCLIKE_ASM = 3 +__GNUCLIKE_ASM = 2 +__GNUCLIKE___TYPEOF = 1 +__GNUCLIKE___OFFSETOF = 1 +__GNUCLIKE___SECTION = 1 +__GNUCLIKE_ATTRIBUTE_MODE_DI = 1 +__GNUCLIKE_CTOR_SECTION_HANDLING = 1 +__GNUCLIKE_BUILTIN_CONSTANT_P = 1 +__GNUCLIKE_BUILTIN_VARARGS = 1 +__GNUCLIKE_BUILTIN_STDARG = 1 +__GNUCLIKE_BUILTIN_VAALIST = 1 +__GNUC_VA_LIST_COMPATIBILITY = 1 +__GNUCLIKE_BUILTIN_NEXT_ARG = 1 +__GNUCLIKE_BUILTIN_MEMCPY = 1 +__CC_SUPPORTS_INLINE = 1 +__CC_SUPPORTS___INLINE = 1 +__CC_SUPPORTS___INLINE__ = 1 +__CC_SUPPORTS___FUNC__ = 1 +__CC_SUPPORTS_WARNING = 1 +__CC_SUPPORTS_VARADIC_XXX = 1 +__CC_SUPPORTS_DYNAMIC_ARRAY_INIT = 1 +__CC_INT_IS_32BIT = 1 +def __P(protos): return protos + +def __STRING(x): return #x + +def __XSTRING(x): return __STRING(x) + +def __P(protos): return () + +def __STRING(x): return "x" + +def __aligned(x): return __attribute__((__aligned__(x))) + +def __section(x): return __attribute__((__section__(x))) + +def __aligned(x): return __attribute__((__aligned__(x))) + +def __section(x): return __attribute__((__section__(x))) + +def __nonnull(x): return __attribute__((__nonnull__(x))) + +def __predict_true(exp): return __builtin_expect((exp), 1) + +def __predict_false(exp): return __builtin_expect((exp), 0) + +def __predict_true(exp): return (exp) + +def __predict_false(exp): return (exp) + +def __format_arg(fmtarg): return __attribute__((__format_arg__ (fmtarg))) + +def __FBSDID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) + +def __RCSID(s): return __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) + +def __RCSID_SOURCE(s): return __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) + +def __SCCSID(s): return __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) + +def __COPYRIGHT(s): return __IDSTRING(__CONCAT(__copyright_,__LINE__),s) + +_POSIX_C_SOURCE = 199009 +_POSIX_C_SOURCE = 199209 +__XSI_VISIBLE = 600 +_POSIX_C_SOURCE = 200112 +__XSI_VISIBLE = 500 +_POSIX_C_SOURCE = 199506 +_POSIX_C_SOURCE = 198808 +__POSIX_VISIBLE = 200112 +__ISO_C_VISIBLE = 1999 +__POSIX_VISIBLE = 199506 +__ISO_C_VISIBLE = 1990 +__POSIX_VISIBLE = 199309 +__ISO_C_VISIBLE = 1990 +__POSIX_VISIBLE = 199209 +__ISO_C_VISIBLE = 1990 +__POSIX_VISIBLE = 199009 +__ISO_C_VISIBLE = 1990 +__POSIX_VISIBLE = 198808 +__ISO_C_VISIBLE = 0 +__POSIX_VISIBLE = 0 +__XSI_VISIBLE = 0 +__BSD_VISIBLE = 0 +__ISO_C_VISIBLE = 1990 +__POSIX_VISIBLE = 0 +__XSI_VISIBLE = 0 +__BSD_VISIBLE = 0 +__ISO_C_VISIBLE = 1999 +__POSIX_VISIBLE = 200112 +__XSI_VISIBLE = 600 +__BSD_VISIBLE = 1 +__ISO_C_VISIBLE = 1999 + +# Included from sys/_types.h + +# Included from machine/_types.h + +# Included from machine/endian.h +_QUAD_HIGHWORD = 1 +_QUAD_LOWWORD = 0 +_LITTLE_ENDIAN = 1234 +_BIG_ENDIAN = 4321 +_PDP_ENDIAN = 3412 +_BYTE_ORDER = _LITTLE_ENDIAN +LITTLE_ENDIAN = _LITTLE_ENDIAN +BIG_ENDIAN = _BIG_ENDIAN +PDP_ENDIAN = _PDP_ENDIAN +BYTE_ORDER = _BYTE_ORDER +def __word_swap_int_var(x): return \ + +def __word_swap_int_const(x): return \ + +def __word_swap_int(x): return __word_swap_int_var(x) + +def __byte_swap_int_var(x): return \ + +def __byte_swap_int_const(x): return \ + +def __byte_swap_int(x): return __byte_swap_int_var(x) + +def __byte_swap_word_var(x): return \ + +def __byte_swap_word_const(x): return \ + +def __byte_swap_word(x): return __byte_swap_word_var(x) + +def __htonl(x): return __bswap32(x) + +def __htons(x): return __bswap16(x) + +def __ntohl(x): return __bswap32(x) + +def __ntohs(x): return __bswap16(x) + +IPPROTO_IP = 0 +IPPROTO_ICMP = 1 +IPPROTO_TCP = 6 +IPPROTO_UDP = 17 +def htonl(x): return __htonl(x) + +def htons(x): return __htons(x) + +def ntohl(x): return __ntohl(x) + +def ntohs(x): return __ntohs(x) + +IPPROTO_RAW = 255 +INET_ADDRSTRLEN = 16 +IPPROTO_HOPOPTS = 0 +IPPROTO_IGMP = 2 +IPPROTO_GGP = 3 +IPPROTO_IPV4 = 4 +IPPROTO_IPIP = IPPROTO_IPV4 +IPPROTO_ST = 7 +IPPROTO_EGP = 8 +IPPROTO_PIGP = 9 +IPPROTO_RCCMON = 10 +IPPROTO_NVPII = 11 +IPPROTO_PUP = 12 +IPPROTO_ARGUS = 13 +IPPROTO_EMCON = 14 +IPPROTO_XNET = 15 +IPPROTO_CHAOS = 16 +IPPROTO_MUX = 18 +IPPROTO_MEAS = 19 +IPPROTO_HMP = 20 +IPPROTO_PRM = 21 +IPPROTO_IDP = 22 +IPPROTO_TRUNK1 = 23 +IPPROTO_TRUNK2 = 24 +IPPROTO_LEAF1 = 25 +IPPROTO_LEAF2 = 26 +IPPROTO_RDP = 27 +IPPROTO_IRTP = 28 +IPPROTO_TP = 29 +IPPROTO_BLT = 30 +IPPROTO_NSP = 31 +IPPROTO_INP = 32 +IPPROTO_SEP = 33 +IPPROTO_3PC = 34 +IPPROTO_IDPR = 35 +IPPROTO_XTP = 36 +IPPROTO_DDP = 37 +IPPROTO_CMTP = 38 +IPPROTO_TPXX = 39 +IPPROTO_IL = 40 +IPPROTO_IPV6 = 41 +IPPROTO_SDRP = 42 +IPPROTO_ROUTING = 43 +IPPROTO_FRAGMENT = 44 +IPPROTO_IDRP = 45 +IPPROTO_RSVP = 46 +IPPROTO_GRE = 47 +IPPROTO_MHRP = 48 +IPPROTO_BHA = 49 +IPPROTO_ESP = 50 +IPPROTO_AH = 51 +IPPROTO_INLSP = 52 +IPPROTO_SWIPE = 53 +IPPROTO_NHRP = 54 +IPPROTO_MOBILE = 55 +IPPROTO_TLSP = 56 +IPPROTO_SKIP = 57 +IPPROTO_ICMPV6 = 58 +IPPROTO_NONE = 59 +IPPROTO_DSTOPTS = 60 +IPPROTO_AHIP = 61 +IPPROTO_CFTP = 62 +IPPROTO_HELLO = 63 +IPPROTO_SATEXPAK = 64 +IPPROTO_KRYPTOLAN = 65 +IPPROTO_RVD = 66 +IPPROTO_IPPC = 67 +IPPROTO_ADFS = 68 +IPPROTO_SATMON = 69 +IPPROTO_VISA = 70 +IPPROTO_IPCV = 71 +IPPROTO_CPNX = 72 +IPPROTO_CPHB = 73 +IPPROTO_WSN = 74 +IPPROTO_PVP = 75 +IPPROTO_BRSATMON = 76 +IPPROTO_ND = 77 +IPPROTO_WBMON = 78 +IPPROTO_WBEXPAK = 79 +IPPROTO_EON = 80 +IPPROTO_VMTP = 81 +IPPROTO_SVMTP = 82 +IPPROTO_VINES = 83 +IPPROTO_TTP = 84 +IPPROTO_IGP = 85 +IPPROTO_DGP = 86 +IPPROTO_TCF = 87 +IPPROTO_IGRP = 88 +IPPROTO_OSPFIGP = 89 +IPPROTO_SRPC = 90 +IPPROTO_LARP = 91 +IPPROTO_MTP = 92 +IPPROTO_AX25 = 93 +IPPROTO_IPEIP = 94 +IPPROTO_MICP = 95 +IPPROTO_SCCSP = 96 +IPPROTO_ETHERIP = 97 +IPPROTO_ENCAP = 98 +IPPROTO_APES = 99 +IPPROTO_GMTP = 100 +IPPROTO_IPCOMP = 108 +IPPROTO_SCTP = 132 +IPPROTO_PIM = 103 +IPPROTO_CARP = 112 +IPPROTO_PGM = 113 +IPPROTO_PFSYNC = 240 +IPPROTO_OLD_DIVERT = 254 +IPPROTO_MAX = 256 +IPPROTO_DONE = 257 +IPPROTO_DIVERT = 258 +IPPROTO_SPACER = 32767 +IPPORT_RESERVED = 1024 +IPPORT_HIFIRSTAUTO = 49152 +IPPORT_HILASTAUTO = 65535 +IPPORT_RESERVEDSTART = 600 +IPPORT_MAX = 65535 +def IN_CLASSA(i): return (((u_int32_t)(i) & (-2147483648)) == 0) + +IN_CLASSA_NET = (-16777216) +IN_CLASSA_NSHIFT = 24 +IN_CLASSA_HOST = 0x00ffffff +IN_CLASSA_MAX = 128 +def IN_CLASSB(i): return (((u_int32_t)(i) & (-1073741824)) == (-2147483648)) + +IN_CLASSB_NET = (-65536) +IN_CLASSB_NSHIFT = 16 +IN_CLASSB_HOST = 0x0000ffff +IN_CLASSB_MAX = 65536 +def IN_CLASSC(i): return (((u_int32_t)(i) & (-536870912)) == (-1073741824)) + +IN_CLASSC_NET = (-256) +IN_CLASSC_NSHIFT = 8 +IN_CLASSC_HOST = 0x000000ff +def IN_CLASSD(i): return (((u_int32_t)(i) & (-268435456)) == (-536870912)) + +IN_CLASSD_NET = (-268435456) +IN_CLASSD_NSHIFT = 28 +IN_CLASSD_HOST = 0x0fffffff +def IN_MULTICAST(i): return IN_CLASSD(i) + +def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & (-268435456)) == (-268435456)) + +def IN_BADCLASS(i): return (((u_int32_t)(i) & (-268435456)) == (-268435456)) + +def IN_LINKLOCAL(i): return (((u_int32_t)(i) & (-65536)) == (-1442971648)) + +def IN_LOCAL_GROUP(i): return (((u_int32_t)(i) & (-256)) == (-536870912)) + +INADDR_NONE = (-1) +IN_LOOPBACKNET = 127 +IP_OPTIONS = 1 +IP_HDRINCL = 2 +IP_TOS = 3 +IP_TTL = 4 +IP_RECVOPTS = 5 +IP_RECVRETOPTS = 6 +IP_RECVDSTADDR = 7 +IP_SENDSRCADDR = IP_RECVDSTADDR +IP_RETOPTS = 8 +IP_MULTICAST_IF = 9 +IP_MULTICAST_TTL = 10 +IP_MULTICAST_LOOP = 11 +IP_ADD_MEMBERSHIP = 12 +IP_DROP_MEMBERSHIP = 13 +IP_MULTICAST_VIF = 14 +IP_RSVP_ON = 15 +IP_RSVP_OFF = 16 +IP_RSVP_VIF_ON = 17 +IP_RSVP_VIF_OFF = 18 +IP_PORTRANGE = 19 +IP_RECVIF = 20 +IP_IPSEC_POLICY = 21 +IP_FAITH = 22 +IP_ONESBCAST = 23 +IP_FW_TABLE_ADD = 40 +IP_FW_TABLE_DEL = 41 +IP_FW_TABLE_FLUSH = 42 +IP_FW_TABLE_GETSIZE = 43 +IP_FW_TABLE_LIST = 44 +IP_FW_ADD = 50 +IP_FW_DEL = 51 +IP_FW_FLUSH = 52 +IP_FW_ZERO = 53 +IP_FW_GET = 54 +IP_FW_RESETLOG = 55 +IP_FW_NAT_CFG = 56 +IP_FW_NAT_DEL = 57 +IP_FW_NAT_GET_CONFIG = 58 +IP_FW_NAT_GET_LOG = 59 +IP_DUMMYNET_CONFIGURE = 60 +IP_DUMMYNET_DEL = 61 +IP_DUMMYNET_FLUSH = 62 +IP_DUMMYNET_GET = 64 +IP_RECVTTL = 65 +IP_MINTTL = 66 +IP_DONTFRAG = 67 +IP_ADD_SOURCE_MEMBERSHIP = 70 +IP_DROP_SOURCE_MEMBERSHIP = 71 +IP_BLOCK_SOURCE = 72 +IP_UNBLOCK_SOURCE = 73 +IP_MSFILTER = 74 +MCAST_JOIN_GROUP = 80 +MCAST_LEAVE_GROUP = 81 +MCAST_JOIN_SOURCE_GROUP = 82 +MCAST_LEAVE_SOURCE_GROUP = 83 +MCAST_BLOCK_SOURCE = 84 +MCAST_UNBLOCK_SOURCE = 85 +IP_DEFAULT_MULTICAST_TTL = 1 +IP_DEFAULT_MULTICAST_LOOP = 1 +IP_MIN_MEMBERSHIPS = 31 +IP_MAX_MEMBERSHIPS = 4095 +IP_MAX_SOURCE_FILTER = 1024 +MCAST_INCLUDE = 1 +MCAST_EXCLUDE = 2 +IP_PORTRANGE_DEFAULT = 0 +IP_PORTRANGE_HIGH = 1 +IP_PORTRANGE_LOW = 2 +IPPROTO_MAXID = (IPPROTO_AH + 1) +IPCTL_FORWARDING = 1 +IPCTL_SENDREDIRECTS = 2 +IPCTL_DEFTTL = 3 +IPCTL_DEFMTU = 4 +IPCTL_RTEXPIRE = 5 +IPCTL_RTMINEXPIRE = 6 +IPCTL_RTMAXCACHE = 7 +IPCTL_SOURCEROUTE = 8 +IPCTL_DIRECTEDBROADCAST = 9 +IPCTL_INTRQMAXLEN = 10 +IPCTL_INTRQDROPS = 11 +IPCTL_STATS = 12 +IPCTL_ACCEPTSOURCEROUTE = 13 +IPCTL_FASTFORWARDING = 14 +IPCTL_KEEPFAITH = 15 +IPCTL_GIF_TTL = 16 +IPCTL_MAXID = 17 +def in_nullhost(x): return ((x).s_addr == INADDR_ANY) + + +# Included from netinet6/in6.h +__KAME_VERSION = "FreeBSD" +IPV6PORT_RESERVED = 1024 +IPV6PORT_ANONMIN = 49152 +IPV6PORT_ANONMAX = 65535 +IPV6PORT_RESERVEDMIN = 600 +IPV6PORT_RESERVEDMAX = (IPV6PORT_RESERVED-1) +INET6_ADDRSTRLEN = 46 +IPV6_ADDR_INT32_ONE = 1 +IPV6_ADDR_INT32_TWO = 2 +IPV6_ADDR_INT32_MNL = (-16711680) +IPV6_ADDR_INT32_MLL = (-16646144) +IPV6_ADDR_INT32_SMP = 0x0000ffff +IPV6_ADDR_INT16_ULL = 0xfe80 +IPV6_ADDR_INT16_USL = 0xfec0 +IPV6_ADDR_INT16_MLL = 0xff02 +IPV6_ADDR_INT32_ONE = 0x01000000 +IPV6_ADDR_INT32_TWO = 0x02000000 +IPV6_ADDR_INT32_MNL = 0x000001ff +IPV6_ADDR_INT32_MLL = 0x000002ff +IPV6_ADDR_INT32_SMP = (-65536) +IPV6_ADDR_INT16_ULL = 0x80fe +IPV6_ADDR_INT16_USL = 0xc0fe +IPV6_ADDR_INT16_MLL = 0x02ff +def IN6_IS_ADDR_UNSPECIFIED(a): return \ + +def IN6_IS_ADDR_LOOPBACK(a): return \ + +def IN6_IS_ADDR_V4COMPAT(a): return \ + +def IN6_IS_ADDR_V4MAPPED(a): return \ + +IPV6_ADDR_SCOPE_NODELOCAL = 0x01 +IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01 +IPV6_ADDR_SCOPE_LINKLOCAL = 0x02 +IPV6_ADDR_SCOPE_SITELOCAL = 0x05 +IPV6_ADDR_SCOPE_ORGLOCAL = 0x08 +IPV6_ADDR_SCOPE_GLOBAL = 0x0e +__IPV6_ADDR_SCOPE_NODELOCAL = 0x01 +__IPV6_ADDR_SCOPE_INTFACELOCAL = 0x01 +__IPV6_ADDR_SCOPE_LINKLOCAL = 0x02 +__IPV6_ADDR_SCOPE_SITELOCAL = 0x05 +__IPV6_ADDR_SCOPE_ORGLOCAL = 0x08 +__IPV6_ADDR_SCOPE_GLOBAL = 0x0e +def IN6_IS_ADDR_LINKLOCAL(a): return \ + +def IN6_IS_ADDR_SITELOCAL(a): return \ + +def IN6_IS_ADDR_MC_NODELOCAL(a): return \ + +def IN6_IS_ADDR_MC_INTFACELOCAL(a): return \ + +def IN6_IS_ADDR_MC_LINKLOCAL(a): return \ + +def IN6_IS_ADDR_MC_SITELOCAL(a): return \ + +def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ + +def IN6_IS_ADDR_MC_GLOBAL(a): return \ + +def IN6_IS_ADDR_MC_NODELOCAL(a): return \ + +def IN6_IS_ADDR_MC_LINKLOCAL(a): return \ + +def IN6_IS_ADDR_MC_SITELOCAL(a): return \ + +def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ + +def IN6_IS_ADDR_MC_GLOBAL(a): return \ + +def IN6_IS_SCOPE_LINKLOCAL(a): return \ + +def IN6_IS_SCOPE_EMBED(a): return \ + +def IFA6_IS_DEPRECATED(a): return \ + +def IFA6_IS_INVALID(a): return \ + +IPV6_OPTIONS = 1 +IPV6_RECVOPTS = 5 +IPV6_RECVRETOPTS = 6 +IPV6_RECVDSTADDR = 7 +IPV6_RETOPTS = 8 +IPV6_SOCKOPT_RESERVED1 = 3 +IPV6_UNICAST_HOPS = 4 +IPV6_MULTICAST_IF = 9 +IPV6_MULTICAST_HOPS = 10 +IPV6_MULTICAST_LOOP = 11 +IPV6_JOIN_GROUP = 12 +IPV6_LEAVE_GROUP = 13 +IPV6_PORTRANGE = 14 +ICMP6_FILTER = 18 +IPV6_2292PKTINFO = 19 +IPV6_2292HOPLIMIT = 20 +IPV6_2292NEXTHOP = 21 +IPV6_2292HOPOPTS = 22 +IPV6_2292DSTOPTS = 23 +IPV6_2292RTHDR = 24 +IPV6_2292PKTOPTIONS = 25 +IPV6_CHECKSUM = 26 +IPV6_V6ONLY = 27 +IPV6_BINDV6ONLY = IPV6_V6ONLY +IPV6_IPSEC_POLICY = 28 +IPV6_FAITH = 29 +IPV6_FW_ADD = 30 +IPV6_FW_DEL = 31 +IPV6_FW_FLUSH = 32 +IPV6_FW_ZERO = 33 +IPV6_FW_GET = 34 +IPV6_RTHDRDSTOPTS = 35 +IPV6_RECVPKTINFO = 36 +IPV6_RECVHOPLIMIT = 37 +IPV6_RECVRTHDR = 38 +IPV6_RECVHOPOPTS = 39 +IPV6_RECVDSTOPTS = 40 +IPV6_RECVRTHDRDSTOPTS = 41 +IPV6_USE_MIN_MTU = 42 +IPV6_RECVPATHMTU = 43 +IPV6_PATHMTU = 44 +IPV6_REACHCONF = 45 +IPV6_PKTINFO = 46 +IPV6_HOPLIMIT = 47 +IPV6_NEXTHOP = 48 +IPV6_HOPOPTS = 49 +IPV6_DSTOPTS = 50 +IPV6_RTHDR = 51 +IPV6_PKTOPTIONS = 52 +IPV6_RECVTCLASS = 57 +IPV6_AUTOFLOWLABEL = 59 +IPV6_TCLASS = 61 +IPV6_DONTFRAG = 62 +IPV6_PREFER_TEMPADDR = 63 +IPV6_MSFILTER = 74 +IPV6_RTHDR_LOOSE = 0 +IPV6_RTHDR_STRICT = 1 +IPV6_RTHDR_TYPE_0 = 0 +IPV6_DEFAULT_MULTICAST_HOPS = 1 +IPV6_DEFAULT_MULTICAST_LOOP = 1 +IPV6_PORTRANGE_DEFAULT = 0 +IPV6_PORTRANGE_HIGH = 1 +IPV6_PORTRANGE_LOW = 2 +IPV6PROTO_MAXID = (IPPROTO_PIM + 1) +IPV6CTL_FORWARDING = 1 +IPV6CTL_SENDREDIRECTS = 2 +IPV6CTL_DEFHLIM = 3 +IPV6CTL_DEFMTU = 4 +IPV6CTL_FORWSRCRT = 5 +IPV6CTL_STATS = 6 +IPV6CTL_MRTSTATS = 7 +IPV6CTL_MRTPROTO = 8 +IPV6CTL_MAXFRAGPACKETS = 9 +IPV6CTL_SOURCECHECK = 10 +IPV6CTL_SOURCECHECK_LOGINT = 11 +IPV6CTL_ACCEPT_RTADV = 12 +IPV6CTL_KEEPFAITH = 13 +IPV6CTL_LOG_INTERVAL = 14 +IPV6CTL_HDRNESTLIMIT = 15 +IPV6CTL_DAD_COUNT = 16 +IPV6CTL_AUTO_FLOWLABEL = 17 +IPV6CTL_DEFMCASTHLIM = 18 +IPV6CTL_GIF_HLIM = 19 +IPV6CTL_KAME_VERSION = 20 +IPV6CTL_USE_DEPRECATED = 21 +IPV6CTL_RR_PRUNE = 22 +IPV6CTL_MAPPED_ADDR = 23 +IPV6CTL_V6ONLY = 24 +IPV6CTL_RTEXPIRE = 25 +IPV6CTL_RTMINEXPIRE = 26 +IPV6CTL_RTMAXCACHE = 27 +IPV6CTL_USETEMPADDR = 32 +IPV6CTL_TEMPPLTIME = 33 +IPV6CTL_TEMPVLTIME = 34 +IPV6CTL_AUTO_LINKLOCAL = 35 +IPV6CTL_RIP6STATS = 36 +IPV6CTL_PREFER_TEMPADDR = 37 +IPV6CTL_ADDRCTLPOLICY = 38 +IPV6CTL_USE_DEFAULTZONE = 39 +IPV6CTL_MAXFRAGS = 41 +IPV6CTL_IFQ = 42 +IPV6CTL_ISATAPRTR = 43 +IPV6CTL_MCAST_PMTU = 44 +IPV6CTL_STEALTH = 45 +IPV6CTL_MAXID = 46 diff --git a/Lib/plat-freebsd8/regen b/Lib/plat-freebsd8/regen new file mode 100644 index 0000000..8aa6898 --- /dev/null +++ b/Lib/plat-freebsd8/regen @@ -0,0 +1,3 @@ +#! /bin/sh +set -v +python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h diff --git a/Lib/sched.py b/Lib/sched.py index 7c3235e..51c4e74 100644 --- a/Lib/sched.py +++ b/Lib/sched.py @@ -16,11 +16,11 @@ integers or floating point numbers, as long as it is consistent. Events are specified by tuples (time, priority, action, argument). As in UNIX, lower priority numbers mean higher priority; in this way the queue can be maintained as a priority queue. Execution of the -event means calling the action function, passing it the argument. -Remember that in Python, multiple function arguments can be packed -in a tuple. The action function may be an instance method so it +event means calling the action function, passing it the argument +sequence in "argument" (remember that in Python, multiple function +arguments are be packed in a sequence). +The action function may be an instance method so it has another way to reference private data (besides global variables). -Parameterless functions or methods cannot be used, however. """ # XXX The timefunc and delayfunc should have been defined as methods @@ -89,7 +89,7 @@ class scheduler: exceptions are not caught but the scheduler's state remains well-defined so run() may be called again. - A questionably hack is added to allow other threads to run: + A questionable hack is added to allow other threads to run: just after an event is executed, a delay of 0 is executed, to avoid monopolizing the CPU when other threads are also runnable. @@ -111,7 +111,7 @@ class scheduler: # Verify that the event was not removed or altered # by another thread after we last looked at q[0]. if event is checked_event: - void = action(*argument) + action(*argument) delayfunc(0) # Let other threads run else: heapq.heappush(event) diff --git a/Lib/smtpd.py b/Lib/smtpd.py index 98ef436..3788f89 100755 --- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@ -221,7 +221,7 @@ class SMTPChannel(asynchat.async_chat): def smtp_MAIL(self, arg): print('===> MAIL', arg, file=DEBUGSTREAM) - address = self.__getaddr('FROM:', arg) + address = self.__getaddr('FROM:', arg) if arg else None if not address: self.push('501 Syntax: MAIL FROM:<address>') return @@ -237,7 +237,7 @@ class SMTPChannel(asynchat.async_chat): if not self.__mailfrom: self.push('503 Error: need MAIL command') return - address = self.__getaddr('TO:', arg) + address = self.__getaddr('TO:', arg) if arg else None if not address: self.push('501 Syntax: RCPT TO: <address>') return diff --git a/Lib/test/crashers/file_threads.py b/Lib/test/crashers/file_threads.py deleted file mode 100644 index d82ad3c..0000000 --- a/Lib/test/crashers/file_threads.py +++ /dev/null @@ -1,8 +0,0 @@ -# An example for http://bugs.python.org/issue815646 - -import thread - -while 1: - f = open("/tmp/dupa", "w") - thread.start_new_thread(f.close, ()) - f.close() diff --git a/Lib/test/crashers/multithreaded_close.py b/Lib/test/crashers/multithreaded_close.py new file mode 100644 index 0000000..5224341 --- /dev/null +++ b/Lib/test/crashers/multithreaded_close.py @@ -0,0 +1,14 @@ +# f.close() is not thread-safe: calling it at the same time as another +# operation (or another close) on the same file, but done from another +# thread, causes crashes. The issue is more complicated than it seems, +# witness the discussions in: +# +# http://bugs.python.org/issue595601 +# http://bugs.python.org/issue815646 + +import thread + +while 1: + f = open("multithreaded_close.tmp", "w") + thread.start_new_thread(f.close, ()) + f.close() diff --git a/Lib/test/decimaltestdata/extra.decTest b/Lib/test/decimaltestdata/extra.decTest index 36f2a97..0cc1bbb 100644 --- a/Lib/test/decimaltestdata/extra.decTest +++ b/Lib/test/decimaltestdata/extra.decTest @@ -154,6 +154,2112 @@ extr1301 fma Inf 0 sNaN456 -> NaN Invalid_operation extr1302 fma 0E123 -Inf sNaN789 -> NaN Invalid_operation extr1302 fma -Inf 0E-456 sNaN148 -> NaN Invalid_operation +-- Tests for the is_* boolean operations +precision: 9 +maxExponent: 999 +minExponent: -999 + +bool0000 iscanonical 0E-2000 -> 1 +bool0001 iscanonical -0E-2000 -> 1 +bool0002 iscanonical 0E-1008 -> 1 +bool0003 iscanonical -0E-1008 -> 1 +bool0004 iscanonical 0E-1007 -> 1 +bool0005 iscanonical -0E-1007 -> 1 +bool0006 iscanonical 0E-1006 -> 1 +bool0007 iscanonical -0E-1006 -> 1 +bool0008 iscanonical 0E-1000 -> 1 +bool0009 iscanonical -0E-1000 -> 1 +bool0010 iscanonical 0E-999 -> 1 +bool0011 iscanonical -0E-999 -> 1 +bool0012 iscanonical 0E-998 -> 1 +bool0013 iscanonical -0E-998 -> 1 +bool0014 iscanonical 0E-100 -> 1 +bool0015 iscanonical -0E-100 -> 1 +bool0016 iscanonical 0.000000 -> 1 +bool0017 iscanonical -0.000000 -> 1 +bool0018 iscanonical 0.000 -> 1 +bool0019 iscanonical -0.000 -> 1 +bool0020 iscanonical 0.00 -> 1 +bool0021 iscanonical -0.00 -> 1 +bool0022 iscanonical 0.0 -> 1 +bool0023 iscanonical -0.0 -> 1 +bool0024 iscanonical 0 -> 1 +bool0025 iscanonical -0 -> 1 +bool0026 iscanonical 0E+1 -> 1 +bool0027 iscanonical -0E+1 -> 1 +bool0028 iscanonical 0E+2 -> 1 +bool0029 iscanonical -0E+2 -> 1 +bool0030 iscanonical 0E+3 -> 1 +bool0031 iscanonical -0E+3 -> 1 +bool0032 iscanonical 0E+6 -> 1 +bool0033 iscanonical -0E+6 -> 1 +bool0034 iscanonical 0E+100 -> 1 +bool0035 iscanonical -0E+100 -> 1 +bool0036 iscanonical 0E+990 -> 1 +bool0037 iscanonical -0E+990 -> 1 +bool0038 iscanonical 0E+991 -> 1 +bool0039 iscanonical -0E+991 -> 1 +bool0040 iscanonical 0E+992 -> 1 +bool0041 iscanonical -0E+992 -> 1 +bool0042 iscanonical 0E+998 -> 1 +bool0043 iscanonical -0E+998 -> 1 +bool0044 iscanonical 0E+999 -> 1 +bool0045 iscanonical -0E+999 -> 1 +bool0046 iscanonical 0E+1000 -> 1 +bool0047 iscanonical -0E+1000 -> 1 +bool0048 iscanonical 0E+2000 -> 1 +bool0049 iscanonical -0E+2000 -> 1 +bool0050 iscanonical 1E-2000 -> 1 +bool0051 iscanonical -1E-2000 -> 1 +bool0052 iscanonical 1E-1008 -> 1 +bool0053 iscanonical -1E-1008 -> 1 +bool0054 iscanonical 1E-1007 -> 1 +bool0055 iscanonical -1E-1007 -> 1 +bool0056 iscanonical 1E-1006 -> 1 +bool0057 iscanonical -1E-1006 -> 1 +bool0058 iscanonical 1E-1000 -> 1 +bool0059 iscanonical -1E-1000 -> 1 +bool0060 iscanonical 1E-999 -> 1 +bool0061 iscanonical -1E-999 -> 1 +bool0062 iscanonical 1E-998 -> 1 +bool0063 iscanonical -1E-998 -> 1 +bool0064 iscanonical 1E-100 -> 1 +bool0065 iscanonical -1E-100 -> 1 +bool0066 iscanonical 0.000001 -> 1 +bool0067 iscanonical -0.000001 -> 1 +bool0068 iscanonical 0.001 -> 1 +bool0069 iscanonical -0.001 -> 1 +bool0070 iscanonical 0.01 -> 1 +bool0071 iscanonical -0.01 -> 1 +bool0072 iscanonical 0.1 -> 1 +bool0073 iscanonical -0.1 -> 1 +bool0074 iscanonical 1 -> 1 +bool0075 iscanonical -1 -> 1 +bool0076 iscanonical 1E+1 -> 1 +bool0077 iscanonical -1E+1 -> 1 +bool0078 iscanonical 1E+2 -> 1 +bool0079 iscanonical -1E+2 -> 1 +bool0080 iscanonical 1E+3 -> 1 +bool0081 iscanonical -1E+3 -> 1 +bool0082 iscanonical 1E+6 -> 1 +bool0083 iscanonical -1E+6 -> 1 +bool0084 iscanonical 1E+100 -> 1 +bool0085 iscanonical -1E+100 -> 1 +bool0086 iscanonical 1E+990 -> 1 +bool0087 iscanonical -1E+990 -> 1 +bool0088 iscanonical 1E+991 -> 1 +bool0089 iscanonical -1E+991 -> 1 +bool0090 iscanonical 1E+992 -> 1 +bool0091 iscanonical -1E+992 -> 1 +bool0092 iscanonical 1E+998 -> 1 +bool0093 iscanonical -1E+998 -> 1 +bool0094 iscanonical 1E+999 -> 1 +bool0095 iscanonical -1E+999 -> 1 +bool0096 iscanonical 1E+1000 -> 1 +bool0097 iscanonical -1E+1000 -> 1 +bool0098 iscanonical 1E+2000 -> 1 +bool0099 iscanonical -1E+2000 -> 1 +bool0100 iscanonical 9E-2000 -> 1 +bool0101 iscanonical -9E-2000 -> 1 +bool0102 iscanonical 9E-1008 -> 1 +bool0103 iscanonical -9E-1008 -> 1 +bool0104 iscanonical 9E-1007 -> 1 +bool0105 iscanonical -9E-1007 -> 1 +bool0106 iscanonical 9E-1006 -> 1 +bool0107 iscanonical -9E-1006 -> 1 +bool0108 iscanonical 9E-1000 -> 1 +bool0109 iscanonical -9E-1000 -> 1 +bool0110 iscanonical 9E-999 -> 1 +bool0111 iscanonical -9E-999 -> 1 +bool0112 iscanonical 9E-998 -> 1 +bool0113 iscanonical -9E-998 -> 1 +bool0114 iscanonical 9E-100 -> 1 +bool0115 iscanonical -9E-100 -> 1 +bool0116 iscanonical 0.000009 -> 1 +bool0117 iscanonical -0.000009 -> 1 +bool0118 iscanonical 0.009 -> 1 +bool0119 iscanonical -0.009 -> 1 +bool0120 iscanonical 0.09 -> 1 +bool0121 iscanonical -0.09 -> 1 +bool0122 iscanonical 0.9 -> 1 +bool0123 iscanonical -0.9 -> 1 +bool0124 iscanonical 9 -> 1 +bool0125 iscanonical -9 -> 1 +bool0126 iscanonical 9E+1 -> 1 +bool0127 iscanonical -9E+1 -> 1 +bool0128 iscanonical 9E+2 -> 1 +bool0129 iscanonical -9E+2 -> 1 +bool0130 iscanonical 9E+3 -> 1 +bool0131 iscanonical -9E+3 -> 1 +bool0132 iscanonical 9E+6 -> 1 +bool0133 iscanonical -9E+6 -> 1 +bool0134 iscanonical 9E+100 -> 1 +bool0135 iscanonical -9E+100 -> 1 +bool0136 iscanonical 9E+990 -> 1 +bool0137 iscanonical -9E+990 -> 1 +bool0138 iscanonical 9E+991 -> 1 +bool0139 iscanonical -9E+991 -> 1 +bool0140 iscanonical 9E+992 -> 1 +bool0141 iscanonical -9E+992 -> 1 +bool0142 iscanonical 9E+998 -> 1 +bool0143 iscanonical -9E+998 -> 1 +bool0144 iscanonical 9E+999 -> 1 +bool0145 iscanonical -9E+999 -> 1 +bool0146 iscanonical 9E+1000 -> 1 +bool0147 iscanonical -9E+1000 -> 1 +bool0148 iscanonical 9E+2000 -> 1 +bool0149 iscanonical -9E+2000 -> 1 +bool0150 iscanonical 9.99999999E-2000 -> 1 +bool0151 iscanonical -9.99999999E-2000 -> 1 +bool0152 iscanonical 9.99999999E-1008 -> 1 +bool0153 iscanonical -9.99999999E-1008 -> 1 +bool0154 iscanonical 9.99999999E-1007 -> 1 +bool0155 iscanonical -9.99999999E-1007 -> 1 +bool0156 iscanonical 9.99999999E-1006 -> 1 +bool0157 iscanonical -9.99999999E-1006 -> 1 +bool0158 iscanonical 9.99999999E-1000 -> 1 +bool0159 iscanonical -9.99999999E-1000 -> 1 +bool0160 iscanonical 9.99999999E-999 -> 1 +bool0161 iscanonical -9.99999999E-999 -> 1 +bool0162 iscanonical 9.99999999E-998 -> 1 +bool0163 iscanonical -9.99999999E-998 -> 1 +bool0164 iscanonical 9.99999999E-100 -> 1 +bool0165 iscanonical -9.99999999E-100 -> 1 +bool0166 iscanonical 0.00000999999999 -> 1 +bool0167 iscanonical -0.00000999999999 -> 1 +bool0168 iscanonical 0.00999999999 -> 1 +bool0169 iscanonical -0.00999999999 -> 1 +bool0170 iscanonical 0.0999999999 -> 1 +bool0171 iscanonical -0.0999999999 -> 1 +bool0172 iscanonical 0.999999999 -> 1 +bool0173 iscanonical -0.999999999 -> 1 +bool0174 iscanonical 9.99999999 -> 1 +bool0175 iscanonical -9.99999999 -> 1 +bool0176 iscanonical 99.9999999 -> 1 +bool0177 iscanonical -99.9999999 -> 1 +bool0178 iscanonical 999.999999 -> 1 +bool0179 iscanonical -999.999999 -> 1 +bool0180 iscanonical 9999.99999 -> 1 +bool0181 iscanonical -9999.99999 -> 1 +bool0182 iscanonical 9999999.99 -> 1 +bool0183 iscanonical -9999999.99 -> 1 +bool0184 iscanonical 9.99999999E+100 -> 1 +bool0185 iscanonical -9.99999999E+100 -> 1 +bool0186 iscanonical 9.99999999E+990 -> 1 +bool0187 iscanonical -9.99999999E+990 -> 1 +bool0188 iscanonical 9.99999999E+991 -> 1 +bool0189 iscanonical -9.99999999E+991 -> 1 +bool0190 iscanonical 9.99999999E+992 -> 1 +bool0191 iscanonical -9.99999999E+992 -> 1 +bool0192 iscanonical 9.99999999E+998 -> 1 +bool0193 iscanonical -9.99999999E+998 -> 1 +bool0194 iscanonical 9.99999999E+999 -> 1 +bool0195 iscanonical -9.99999999E+999 -> 1 +bool0196 iscanonical 9.99999999E+1000 -> 1 +bool0197 iscanonical -9.99999999E+1000 -> 1 +bool0198 iscanonical 9.99999999E+2000 -> 1 +bool0199 iscanonical -9.99999999E+2000 -> 1 +bool0200 iscanonical Infinity -> 1 +bool0201 iscanonical -Infinity -> 1 +bool0202 iscanonical NaN -> 1 +bool0203 iscanonical -NaN -> 1 +bool0204 iscanonical NaN123 -> 1 +bool0205 iscanonical -NaN123 -> 1 +bool0206 iscanonical sNaN -> 1 +bool0207 iscanonical -sNaN -> 1 +bool0208 iscanonical sNaN123 -> 1 +bool0209 iscanonical -sNaN123 -> 1 +bool0210 isfinite 0E-2000 -> 1 +bool0211 isfinite -0E-2000 -> 1 +bool0212 isfinite 0E-1008 -> 1 +bool0213 isfinite -0E-1008 -> 1 +bool0214 isfinite 0E-1007 -> 1 +bool0215 isfinite -0E-1007 -> 1 +bool0216 isfinite 0E-1006 -> 1 +bool0217 isfinite -0E-1006 -> 1 +bool0218 isfinite 0E-1000 -> 1 +bool0219 isfinite -0E-1000 -> 1 +bool0220 isfinite 0E-999 -> 1 +bool0221 isfinite -0E-999 -> 1 +bool0222 isfinite 0E-998 -> 1 +bool0223 isfinite -0E-998 -> 1 +bool0224 isfinite 0E-100 -> 1 +bool0225 isfinite -0E-100 -> 1 +bool0226 isfinite 0.000000 -> 1 +bool0227 isfinite -0.000000 -> 1 +bool0228 isfinite 0.000 -> 1 +bool0229 isfinite -0.000 -> 1 +bool0230 isfinite 0.00 -> 1 +bool0231 isfinite -0.00 -> 1 +bool0232 isfinite 0.0 -> 1 +bool0233 isfinite -0.0 -> 1 +bool0234 isfinite 0 -> 1 +bool0235 isfinite -0 -> 1 +bool0236 isfinite 0E+1 -> 1 +bool0237 isfinite -0E+1 -> 1 +bool0238 isfinite 0E+2 -> 1 +bool0239 isfinite -0E+2 -> 1 +bool0240 isfinite 0E+3 -> 1 +bool0241 isfinite -0E+3 -> 1 +bool0242 isfinite 0E+6 -> 1 +bool0243 isfinite -0E+6 -> 1 +bool0244 isfinite 0E+100 -> 1 +bool0245 isfinite -0E+100 -> 1 +bool0246 isfinite 0E+990 -> 1 +bool0247 isfinite -0E+990 -> 1 +bool0248 isfinite 0E+991 -> 1 +bool0249 isfinite -0E+991 -> 1 +bool0250 isfinite 0E+992 -> 1 +bool0251 isfinite -0E+992 -> 1 +bool0252 isfinite 0E+998 -> 1 +bool0253 isfinite -0E+998 -> 1 +bool0254 isfinite 0E+999 -> 1 +bool0255 isfinite -0E+999 -> 1 +bool0256 isfinite 0E+1000 -> 1 +bool0257 isfinite -0E+1000 -> 1 +bool0258 isfinite 0E+2000 -> 1 +bool0259 isfinite -0E+2000 -> 1 +bool0260 isfinite 1E-2000 -> 1 +bool0261 isfinite -1E-2000 -> 1 +bool0262 isfinite 1E-1008 -> 1 +bool0263 isfinite -1E-1008 -> 1 +bool0264 isfinite 1E-1007 -> 1 +bool0265 isfinite -1E-1007 -> 1 +bool0266 isfinite 1E-1006 -> 1 +bool0267 isfinite -1E-1006 -> 1 +bool0268 isfinite 1E-1000 -> 1 +bool0269 isfinite -1E-1000 -> 1 +bool0270 isfinite 1E-999 -> 1 +bool0271 isfinite -1E-999 -> 1 +bool0272 isfinite 1E-998 -> 1 +bool0273 isfinite -1E-998 -> 1 +bool0274 isfinite 1E-100 -> 1 +bool0275 isfinite -1E-100 -> 1 +bool0276 isfinite 0.000001 -> 1 +bool0277 isfinite -0.000001 -> 1 +bool0278 isfinite 0.001 -> 1 +bool0279 isfinite -0.001 -> 1 +bool0280 isfinite 0.01 -> 1 +bool0281 isfinite -0.01 -> 1 +bool0282 isfinite 0.1 -> 1 +bool0283 isfinite -0.1 -> 1 +bool0284 isfinite 1 -> 1 +bool0285 isfinite -1 -> 1 +bool0286 isfinite 1E+1 -> 1 +bool0287 isfinite -1E+1 -> 1 +bool0288 isfinite 1E+2 -> 1 +bool0289 isfinite -1E+2 -> 1 +bool0290 isfinite 1E+3 -> 1 +bool0291 isfinite -1E+3 -> 1 +bool0292 isfinite 1E+6 -> 1 +bool0293 isfinite -1E+6 -> 1 +bool0294 isfinite 1E+100 -> 1 +bool0295 isfinite -1E+100 -> 1 +bool0296 isfinite 1E+990 -> 1 +bool0297 isfinite -1E+990 -> 1 +bool0298 isfinite 1E+991 -> 1 +bool0299 isfinite -1E+991 -> 1 +bool0300 isfinite 1E+992 -> 1 +bool0301 isfinite -1E+992 -> 1 +bool0302 isfinite 1E+998 -> 1 +bool0303 isfinite -1E+998 -> 1 +bool0304 isfinite 1E+999 -> 1 +bool0305 isfinite -1E+999 -> 1 +bool0306 isfinite 1E+1000 -> 1 +bool0307 isfinite -1E+1000 -> 1 +bool0308 isfinite 1E+2000 -> 1 +bool0309 isfinite -1E+2000 -> 1 +bool0310 isfinite 9E-2000 -> 1 +bool0311 isfinite -9E-2000 -> 1 +bool0312 isfinite 9E-1008 -> 1 +bool0313 isfinite -9E-1008 -> 1 +bool0314 isfinite 9E-1007 -> 1 +bool0315 isfinite -9E-1007 -> 1 +bool0316 isfinite 9E-1006 -> 1 +bool0317 isfinite -9E-1006 -> 1 +bool0318 isfinite 9E-1000 -> 1 +bool0319 isfinite -9E-1000 -> 1 +bool0320 isfinite 9E-999 -> 1 +bool0321 isfinite -9E-999 -> 1 +bool0322 isfinite 9E-998 -> 1 +bool0323 isfinite -9E-998 -> 1 +bool0324 isfinite 9E-100 -> 1 +bool0325 isfinite -9E-100 -> 1 +bool0326 isfinite 0.000009 -> 1 +bool0327 isfinite -0.000009 -> 1 +bool0328 isfinite 0.009 -> 1 +bool0329 isfinite -0.009 -> 1 +bool0330 isfinite 0.09 -> 1 +bool0331 isfinite -0.09 -> 1 +bool0332 isfinite 0.9 -> 1 +bool0333 isfinite -0.9 -> 1 +bool0334 isfinite 9 -> 1 +bool0335 isfinite -9 -> 1 +bool0336 isfinite 9E+1 -> 1 +bool0337 isfinite -9E+1 -> 1 +bool0338 isfinite 9E+2 -> 1 +bool0339 isfinite -9E+2 -> 1 +bool0340 isfinite 9E+3 -> 1 +bool0341 isfinite -9E+3 -> 1 +bool0342 isfinite 9E+6 -> 1 +bool0343 isfinite -9E+6 -> 1 +bool0344 isfinite 9E+100 -> 1 +bool0345 isfinite -9E+100 -> 1 +bool0346 isfinite 9E+990 -> 1 +bool0347 isfinite -9E+990 -> 1 +bool0348 isfinite 9E+991 -> 1 +bool0349 isfinite -9E+991 -> 1 +bool0350 isfinite 9E+992 -> 1 +bool0351 isfinite -9E+992 -> 1 +bool0352 isfinite 9E+998 -> 1 +bool0353 isfinite -9E+998 -> 1 +bool0354 isfinite 9E+999 -> 1 +bool0355 isfinite -9E+999 -> 1 +bool0356 isfinite 9E+1000 -> 1 +bool0357 isfinite -9E+1000 -> 1 +bool0358 isfinite 9E+2000 -> 1 +bool0359 isfinite -9E+2000 -> 1 +bool0360 isfinite 9.99999999E-2000 -> 1 +bool0361 isfinite -9.99999999E-2000 -> 1 +bool0362 isfinite 9.99999999E-1008 -> 1 +bool0363 isfinite -9.99999999E-1008 -> 1 +bool0364 isfinite 9.99999999E-1007 -> 1 +bool0365 isfinite -9.99999999E-1007 -> 1 +bool0366 isfinite 9.99999999E-1006 -> 1 +bool0367 isfinite -9.99999999E-1006 -> 1 +bool0368 isfinite 9.99999999E-1000 -> 1 +bool0369 isfinite -9.99999999E-1000 -> 1 +bool0370 isfinite 9.99999999E-999 -> 1 +bool0371 isfinite -9.99999999E-999 -> 1 +bool0372 isfinite 9.99999999E-998 -> 1 +bool0373 isfinite -9.99999999E-998 -> 1 +bool0374 isfinite 9.99999999E-100 -> 1 +bool0375 isfinite -9.99999999E-100 -> 1 +bool0376 isfinite 0.00000999999999 -> 1 +bool0377 isfinite -0.00000999999999 -> 1 +bool0378 isfinite 0.00999999999 -> 1 +bool0379 isfinite -0.00999999999 -> 1 +bool0380 isfinite 0.0999999999 -> 1 +bool0381 isfinite -0.0999999999 -> 1 +bool0382 isfinite 0.999999999 -> 1 +bool0383 isfinite -0.999999999 -> 1 +bool0384 isfinite 9.99999999 -> 1 +bool0385 isfinite -9.99999999 -> 1 +bool0386 isfinite 99.9999999 -> 1 +bool0387 isfinite -99.9999999 -> 1 +bool0388 isfinite 999.999999 -> 1 +bool0389 isfinite -999.999999 -> 1 +bool0390 isfinite 9999.99999 -> 1 +bool0391 isfinite -9999.99999 -> 1 +bool0392 isfinite 9999999.99 -> 1 +bool0393 isfinite -9999999.99 -> 1 +bool0394 isfinite 9.99999999E+100 -> 1 +bool0395 isfinite -9.99999999E+100 -> 1 +bool0396 isfinite 9.99999999E+990 -> 1 +bool0397 isfinite -9.99999999E+990 -> 1 +bool0398 isfinite 9.99999999E+991 -> 1 +bool0399 isfinite -9.99999999E+991 -> 1 +bool0400 isfinite 9.99999999E+992 -> 1 +bool0401 isfinite -9.99999999E+992 -> 1 +bool0402 isfinite 9.99999999E+998 -> 1 +bool0403 isfinite -9.99999999E+998 -> 1 +bool0404 isfinite 9.99999999E+999 -> 1 +bool0405 isfinite -9.99999999E+999 -> 1 +bool0406 isfinite 9.99999999E+1000 -> 1 +bool0407 isfinite -9.99999999E+1000 -> 1 +bool0408 isfinite 9.99999999E+2000 -> 1 +bool0409 isfinite -9.99999999E+2000 -> 1 +bool0410 isfinite Infinity -> 0 +bool0411 isfinite -Infinity -> 0 +bool0412 isfinite NaN -> 0 +bool0413 isfinite -NaN -> 0 +bool0414 isfinite NaN123 -> 0 +bool0415 isfinite -NaN123 -> 0 +bool0416 isfinite sNaN -> 0 +bool0417 isfinite -sNaN -> 0 +bool0418 isfinite sNaN123 -> 0 +bool0419 isfinite -sNaN123 -> 0 +bool0420 isinfinite 0E-2000 -> 0 +bool0421 isinfinite -0E-2000 -> 0 +bool0422 isinfinite 0E-1008 -> 0 +bool0423 isinfinite -0E-1008 -> 0 +bool0424 isinfinite 0E-1007 -> 0 +bool0425 isinfinite -0E-1007 -> 0 +bool0426 isinfinite 0E-1006 -> 0 +bool0427 isinfinite -0E-1006 -> 0 +bool0428 isinfinite 0E-1000 -> 0 +bool0429 isinfinite -0E-1000 -> 0 +bool0430 isinfinite 0E-999 -> 0 +bool0431 isinfinite -0E-999 -> 0 +bool0432 isinfinite 0E-998 -> 0 +bool0433 isinfinite -0E-998 -> 0 +bool0434 isinfinite 0E-100 -> 0 +bool0435 isinfinite -0E-100 -> 0 +bool0436 isinfinite 0.000000 -> 0 +bool0437 isinfinite -0.000000 -> 0 +bool0438 isinfinite 0.000 -> 0 +bool0439 isinfinite -0.000 -> 0 +bool0440 isinfinite 0.00 -> 0 +bool0441 isinfinite -0.00 -> 0 +bool0442 isinfinite 0.0 -> 0 +bool0443 isinfinite -0.0 -> 0 +bool0444 isinfinite 0 -> 0 +bool0445 isinfinite -0 -> 0 +bool0446 isinfinite 0E+1 -> 0 +bool0447 isinfinite -0E+1 -> 0 +bool0448 isinfinite 0E+2 -> 0 +bool0449 isinfinite -0E+2 -> 0 +bool0450 isinfinite 0E+3 -> 0 +bool0451 isinfinite -0E+3 -> 0 +bool0452 isinfinite 0E+6 -> 0 +bool0453 isinfinite -0E+6 -> 0 +bool0454 isinfinite 0E+100 -> 0 +bool0455 isinfinite -0E+100 -> 0 +bool0456 isinfinite 0E+990 -> 0 +bool0457 isinfinite -0E+990 -> 0 +bool0458 isinfinite 0E+991 -> 0 +bool0459 isinfinite -0E+991 -> 0 +bool0460 isinfinite 0E+992 -> 0 +bool0461 isinfinite -0E+992 -> 0 +bool0462 isinfinite 0E+998 -> 0 +bool0463 isinfinite -0E+998 -> 0 +bool0464 isinfinite 0E+999 -> 0 +bool0465 isinfinite -0E+999 -> 0 +bool0466 isinfinite 0E+1000 -> 0 +bool0467 isinfinite -0E+1000 -> 0 +bool0468 isinfinite 0E+2000 -> 0 +bool0469 isinfinite -0E+2000 -> 0 +bool0470 isinfinite 1E-2000 -> 0 +bool0471 isinfinite -1E-2000 -> 0 +bool0472 isinfinite 1E-1008 -> 0 +bool0473 isinfinite -1E-1008 -> 0 +bool0474 isinfinite 1E-1007 -> 0 +bool0475 isinfinite -1E-1007 -> 0 +bool0476 isinfinite 1E-1006 -> 0 +bool0477 isinfinite -1E-1006 -> 0 +bool0478 isinfinite 1E-1000 -> 0 +bool0479 isinfinite -1E-1000 -> 0 +bool0480 isinfinite 1E-999 -> 0 +bool0481 isinfinite -1E-999 -> 0 +bool0482 isinfinite 1E-998 -> 0 +bool0483 isinfinite -1E-998 -> 0 +bool0484 isinfinite 1E-100 -> 0 +bool0485 isinfinite -1E-100 -> 0 +bool0486 isinfinite 0.000001 -> 0 +bool0487 isinfinite -0.000001 -> 0 +bool0488 isinfinite 0.001 -> 0 +bool0489 isinfinite -0.001 -> 0 +bool0490 isinfinite 0.01 -> 0 +bool0491 isinfinite -0.01 -> 0 +bool0492 isinfinite 0.1 -> 0 +bool0493 isinfinite -0.1 -> 0 +bool0494 isinfinite 1 -> 0 +bool0495 isinfinite -1 -> 0 +bool0496 isinfinite 1E+1 -> 0 +bool0497 isinfinite -1E+1 -> 0 +bool0498 isinfinite 1E+2 -> 0 +bool0499 isinfinite -1E+2 -> 0 +bool0500 isinfinite 1E+3 -> 0 +bool0501 isinfinite -1E+3 -> 0 +bool0502 isinfinite 1E+6 -> 0 +bool0503 isinfinite -1E+6 -> 0 +bool0504 isinfinite 1E+100 -> 0 +bool0505 isinfinite -1E+100 -> 0 +bool0506 isinfinite 1E+990 -> 0 +bool0507 isinfinite -1E+990 -> 0 +bool0508 isinfinite 1E+991 -> 0 +bool0509 isinfinite -1E+991 -> 0 +bool0510 isinfinite 1E+992 -> 0 +bool0511 isinfinite -1E+992 -> 0 +bool0512 isinfinite 1E+998 -> 0 +bool0513 isinfinite -1E+998 -> 0 +bool0514 isinfinite 1E+999 -> 0 +bool0515 isinfinite -1E+999 -> 0 +bool0516 isinfinite 1E+1000 -> 0 +bool0517 isinfinite -1E+1000 -> 0 +bool0518 isinfinite 1E+2000 -> 0 +bool0519 isinfinite -1E+2000 -> 0 +bool0520 isinfinite 9E-2000 -> 0 +bool0521 isinfinite -9E-2000 -> 0 +bool0522 isinfinite 9E-1008 -> 0 +bool0523 isinfinite -9E-1008 -> 0 +bool0524 isinfinite 9E-1007 -> 0 +bool0525 isinfinite -9E-1007 -> 0 +bool0526 isinfinite 9E-1006 -> 0 +bool0527 isinfinite -9E-1006 -> 0 +bool0528 isinfinite 9E-1000 -> 0 +bool0529 isinfinite -9E-1000 -> 0 +bool0530 isinfinite 9E-999 -> 0 +bool0531 isinfinite -9E-999 -> 0 +bool0532 isinfinite 9E-998 -> 0 +bool0533 isinfinite -9E-998 -> 0 +bool0534 isinfinite 9E-100 -> 0 +bool0535 isinfinite -9E-100 -> 0 +bool0536 isinfinite 0.000009 -> 0 +bool0537 isinfinite -0.000009 -> 0 +bool0538 isinfinite 0.009 -> 0 +bool0539 isinfinite -0.009 -> 0 +bool0540 isinfinite 0.09 -> 0 +bool0541 isinfinite -0.09 -> 0 +bool0542 isinfinite 0.9 -> 0 +bool0543 isinfinite -0.9 -> 0 +bool0544 isinfinite 9 -> 0 +bool0545 isinfinite -9 -> 0 +bool0546 isinfinite 9E+1 -> 0 +bool0547 isinfinite -9E+1 -> 0 +bool0548 isinfinite 9E+2 -> 0 +bool0549 isinfinite -9E+2 -> 0 +bool0550 isinfinite 9E+3 -> 0 +bool0551 isinfinite -9E+3 -> 0 +bool0552 isinfinite 9E+6 -> 0 +bool0553 isinfinite -9E+6 -> 0 +bool0554 isinfinite 9E+100 -> 0 +bool0555 isinfinite -9E+100 -> 0 +bool0556 isinfinite 9E+990 -> 0 +bool0557 isinfinite -9E+990 -> 0 +bool0558 isinfinite 9E+991 -> 0 +bool0559 isinfinite -9E+991 -> 0 +bool0560 isinfinite 9E+992 -> 0 +bool0561 isinfinite -9E+992 -> 0 +bool0562 isinfinite 9E+998 -> 0 +bool0563 isinfinite -9E+998 -> 0 +bool0564 isinfinite 9E+999 -> 0 +bool0565 isinfinite -9E+999 -> 0 +bool0566 isinfinite 9E+1000 -> 0 +bool0567 isinfinite -9E+1000 -> 0 +bool0568 isinfinite 9E+2000 -> 0 +bool0569 isinfinite -9E+2000 -> 0 +bool0570 isinfinite 9.99999999E-2000 -> 0 +bool0571 isinfinite -9.99999999E-2000 -> 0 +bool0572 isinfinite 9.99999999E-1008 -> 0 +bool0573 isinfinite -9.99999999E-1008 -> 0 +bool0574 isinfinite 9.99999999E-1007 -> 0 +bool0575 isinfinite -9.99999999E-1007 -> 0 +bool0576 isinfinite 9.99999999E-1006 -> 0 +bool0577 isinfinite -9.99999999E-1006 -> 0 +bool0578 isinfinite 9.99999999E-1000 -> 0 +bool0579 isinfinite -9.99999999E-1000 -> 0 +bool0580 isinfinite 9.99999999E-999 -> 0 +bool0581 isinfinite -9.99999999E-999 -> 0 +bool0582 isinfinite 9.99999999E-998 -> 0 +bool0583 isinfinite -9.99999999E-998 -> 0 +bool0584 isinfinite 9.99999999E-100 -> 0 +bool0585 isinfinite -9.99999999E-100 -> 0 +bool0586 isinfinite 0.00000999999999 -> 0 +bool0587 isinfinite -0.00000999999999 -> 0 +bool0588 isinfinite 0.00999999999 -> 0 +bool0589 isinfinite -0.00999999999 -> 0 +bool0590 isinfinite 0.0999999999 -> 0 +bool0591 isinfinite -0.0999999999 -> 0 +bool0592 isinfinite 0.999999999 -> 0 +bool0593 isinfinite -0.999999999 -> 0 +bool0594 isinfinite 9.99999999 -> 0 +bool0595 isinfinite -9.99999999 -> 0 +bool0596 isinfinite 99.9999999 -> 0 +bool0597 isinfinite -99.9999999 -> 0 +bool0598 isinfinite 999.999999 -> 0 +bool0599 isinfinite -999.999999 -> 0 +bool0600 isinfinite 9999.99999 -> 0 +bool0601 isinfinite -9999.99999 -> 0 +bool0602 isinfinite 9999999.99 -> 0 +bool0603 isinfinite -9999999.99 -> 0 +bool0604 isinfinite 9.99999999E+100 -> 0 +bool0605 isinfinite -9.99999999E+100 -> 0 +bool0606 isinfinite 9.99999999E+990 -> 0 +bool0607 isinfinite -9.99999999E+990 -> 0 +bool0608 isinfinite 9.99999999E+991 -> 0 +bool0609 isinfinite -9.99999999E+991 -> 0 +bool0610 isinfinite 9.99999999E+992 -> 0 +bool0611 isinfinite -9.99999999E+992 -> 0 +bool0612 isinfinite 9.99999999E+998 -> 0 +bool0613 isinfinite -9.99999999E+998 -> 0 +bool0614 isinfinite 9.99999999E+999 -> 0 +bool0615 isinfinite -9.99999999E+999 -> 0 +bool0616 isinfinite 9.99999999E+1000 -> 0 +bool0617 isinfinite -9.99999999E+1000 -> 0 +bool0618 isinfinite 9.99999999E+2000 -> 0 +bool0619 isinfinite -9.99999999E+2000 -> 0 +bool0620 isinfinite Infinity -> 1 +bool0621 isinfinite -Infinity -> 1 +bool0622 isinfinite NaN -> 0 +bool0623 isinfinite -NaN -> 0 +bool0624 isinfinite NaN123 -> 0 +bool0625 isinfinite -NaN123 -> 0 +bool0626 isinfinite sNaN -> 0 +bool0627 isinfinite -sNaN -> 0 +bool0628 isinfinite sNaN123 -> 0 +bool0629 isinfinite -sNaN123 -> 0 +bool0630 isnan 0E-2000 -> 0 +bool0631 isnan -0E-2000 -> 0 +bool0632 isnan 0E-1008 -> 0 +bool0633 isnan -0E-1008 -> 0 +bool0634 isnan 0E-1007 -> 0 +bool0635 isnan -0E-1007 -> 0 +bool0636 isnan 0E-1006 -> 0 +bool0637 isnan -0E-1006 -> 0 +bool0638 isnan 0E-1000 -> 0 +bool0639 isnan -0E-1000 -> 0 +bool0640 isnan 0E-999 -> 0 +bool0641 isnan -0E-999 -> 0 +bool0642 isnan 0E-998 -> 0 +bool0643 isnan -0E-998 -> 0 +bool0644 isnan 0E-100 -> 0 +bool0645 isnan -0E-100 -> 0 +bool0646 isnan 0.000000 -> 0 +bool0647 isnan -0.000000 -> 0 +bool0648 isnan 0.000 -> 0 +bool0649 isnan -0.000 -> 0 +bool0650 isnan 0.00 -> 0 +bool0651 isnan -0.00 -> 0 +bool0652 isnan 0.0 -> 0 +bool0653 isnan -0.0 -> 0 +bool0654 isnan 0 -> 0 +bool0655 isnan -0 -> 0 +bool0656 isnan 0E+1 -> 0 +bool0657 isnan -0E+1 -> 0 +bool0658 isnan 0E+2 -> 0 +bool0659 isnan -0E+2 -> 0 +bool0660 isnan 0E+3 -> 0 +bool0661 isnan -0E+3 -> 0 +bool0662 isnan 0E+6 -> 0 +bool0663 isnan -0E+6 -> 0 +bool0664 isnan 0E+100 -> 0 +bool0665 isnan -0E+100 -> 0 +bool0666 isnan 0E+990 -> 0 +bool0667 isnan -0E+990 -> 0 +bool0668 isnan 0E+991 -> 0 +bool0669 isnan -0E+991 -> 0 +bool0670 isnan 0E+992 -> 0 +bool0671 isnan -0E+992 -> 0 +bool0672 isnan 0E+998 -> 0 +bool0673 isnan -0E+998 -> 0 +bool0674 isnan 0E+999 -> 0 +bool0675 isnan -0E+999 -> 0 +bool0676 isnan 0E+1000 -> 0 +bool0677 isnan -0E+1000 -> 0 +bool0678 isnan 0E+2000 -> 0 +bool0679 isnan -0E+2000 -> 0 +bool0680 isnan 1E-2000 -> 0 +bool0681 isnan -1E-2000 -> 0 +bool0682 isnan 1E-1008 -> 0 +bool0683 isnan -1E-1008 -> 0 +bool0684 isnan 1E-1007 -> 0 +bool0685 isnan -1E-1007 -> 0 +bool0686 isnan 1E-1006 -> 0 +bool0687 isnan -1E-1006 -> 0 +bool0688 isnan 1E-1000 -> 0 +bool0689 isnan -1E-1000 -> 0 +bool0690 isnan 1E-999 -> 0 +bool0691 isnan -1E-999 -> 0 +bool0692 isnan 1E-998 -> 0 +bool0693 isnan -1E-998 -> 0 +bool0694 isnan 1E-100 -> 0 +bool0695 isnan -1E-100 -> 0 +bool0696 isnan 0.000001 -> 0 +bool0697 isnan -0.000001 -> 0 +bool0698 isnan 0.001 -> 0 +bool0699 isnan -0.001 -> 0 +bool0700 isnan 0.01 -> 0 +bool0701 isnan -0.01 -> 0 +bool0702 isnan 0.1 -> 0 +bool0703 isnan -0.1 -> 0 +bool0704 isnan 1 -> 0 +bool0705 isnan -1 -> 0 +bool0706 isnan 1E+1 -> 0 +bool0707 isnan -1E+1 -> 0 +bool0708 isnan 1E+2 -> 0 +bool0709 isnan -1E+2 -> 0 +bool0710 isnan 1E+3 -> 0 +bool0711 isnan -1E+3 -> 0 +bool0712 isnan 1E+6 -> 0 +bool0713 isnan -1E+6 -> 0 +bool0714 isnan 1E+100 -> 0 +bool0715 isnan -1E+100 -> 0 +bool0716 isnan 1E+990 -> 0 +bool0717 isnan -1E+990 -> 0 +bool0718 isnan 1E+991 -> 0 +bool0719 isnan -1E+991 -> 0 +bool0720 isnan 1E+992 -> 0 +bool0721 isnan -1E+992 -> 0 +bool0722 isnan 1E+998 -> 0 +bool0723 isnan -1E+998 -> 0 +bool0724 isnan 1E+999 -> 0 +bool0725 isnan -1E+999 -> 0 +bool0726 isnan 1E+1000 -> 0 +bool0727 isnan -1E+1000 -> 0 +bool0728 isnan 1E+2000 -> 0 +bool0729 isnan -1E+2000 -> 0 +bool0730 isnan 9E-2000 -> 0 +bool0731 isnan -9E-2000 -> 0 +bool0732 isnan 9E-1008 -> 0 +bool0733 isnan -9E-1008 -> 0 +bool0734 isnan 9E-1007 -> 0 +bool0735 isnan -9E-1007 -> 0 +bool0736 isnan 9E-1006 -> 0 +bool0737 isnan -9E-1006 -> 0 +bool0738 isnan 9E-1000 -> 0 +bool0739 isnan -9E-1000 -> 0 +bool0740 isnan 9E-999 -> 0 +bool0741 isnan -9E-999 -> 0 +bool0742 isnan 9E-998 -> 0 +bool0743 isnan -9E-998 -> 0 +bool0744 isnan 9E-100 -> 0 +bool0745 isnan -9E-100 -> 0 +bool0746 isnan 0.000009 -> 0 +bool0747 isnan -0.000009 -> 0 +bool0748 isnan 0.009 -> 0 +bool0749 isnan -0.009 -> 0 +bool0750 isnan 0.09 -> 0 +bool0751 isnan -0.09 -> 0 +bool0752 isnan 0.9 -> 0 +bool0753 isnan -0.9 -> 0 +bool0754 isnan 9 -> 0 +bool0755 isnan -9 -> 0 +bool0756 isnan 9E+1 -> 0 +bool0757 isnan -9E+1 -> 0 +bool0758 isnan 9E+2 -> 0 +bool0759 isnan -9E+2 -> 0 +bool0760 isnan 9E+3 -> 0 +bool0761 isnan -9E+3 -> 0 +bool0762 isnan 9E+6 -> 0 +bool0763 isnan -9E+6 -> 0 +bool0764 isnan 9E+100 -> 0 +bool0765 isnan -9E+100 -> 0 +bool0766 isnan 9E+990 -> 0 +bool0767 isnan -9E+990 -> 0 +bool0768 isnan 9E+991 -> 0 +bool0769 isnan -9E+991 -> 0 +bool0770 isnan 9E+992 -> 0 +bool0771 isnan -9E+992 -> 0 +bool0772 isnan 9E+998 -> 0 +bool0773 isnan -9E+998 -> 0 +bool0774 isnan 9E+999 -> 0 +bool0775 isnan -9E+999 -> 0 +bool0776 isnan 9E+1000 -> 0 +bool0777 isnan -9E+1000 -> 0 +bool0778 isnan 9E+2000 -> 0 +bool0779 isnan -9E+2000 -> 0 +bool0780 isnan 9.99999999E-2000 -> 0 +bool0781 isnan -9.99999999E-2000 -> 0 +bool0782 isnan 9.99999999E-1008 -> 0 +bool0783 isnan -9.99999999E-1008 -> 0 +bool0784 isnan 9.99999999E-1007 -> 0 +bool0785 isnan -9.99999999E-1007 -> 0 +bool0786 isnan 9.99999999E-1006 -> 0 +bool0787 isnan -9.99999999E-1006 -> 0 +bool0788 isnan 9.99999999E-1000 -> 0 +bool0789 isnan -9.99999999E-1000 -> 0 +bool0790 isnan 9.99999999E-999 -> 0 +bool0791 isnan -9.99999999E-999 -> 0 +bool0792 isnan 9.99999999E-998 -> 0 +bool0793 isnan -9.99999999E-998 -> 0 +bool0794 isnan 9.99999999E-100 -> 0 +bool0795 isnan -9.99999999E-100 -> 0 +bool0796 isnan 0.00000999999999 -> 0 +bool0797 isnan -0.00000999999999 -> 0 +bool0798 isnan 0.00999999999 -> 0 +bool0799 isnan -0.00999999999 -> 0 +bool0800 isnan 0.0999999999 -> 0 +bool0801 isnan -0.0999999999 -> 0 +bool0802 isnan 0.999999999 -> 0 +bool0803 isnan -0.999999999 -> 0 +bool0804 isnan 9.99999999 -> 0 +bool0805 isnan -9.99999999 -> 0 +bool0806 isnan 99.9999999 -> 0 +bool0807 isnan -99.9999999 -> 0 +bool0808 isnan 999.999999 -> 0 +bool0809 isnan -999.999999 -> 0 +bool0810 isnan 9999.99999 -> 0 +bool0811 isnan -9999.99999 -> 0 +bool0812 isnan 9999999.99 -> 0 +bool0813 isnan -9999999.99 -> 0 +bool0814 isnan 9.99999999E+100 -> 0 +bool0815 isnan -9.99999999E+100 -> 0 +bool0816 isnan 9.99999999E+990 -> 0 +bool0817 isnan -9.99999999E+990 -> 0 +bool0818 isnan 9.99999999E+991 -> 0 +bool0819 isnan -9.99999999E+991 -> 0 +bool0820 isnan 9.99999999E+992 -> 0 +bool0821 isnan -9.99999999E+992 -> 0 +bool0822 isnan 9.99999999E+998 -> 0 +bool0823 isnan -9.99999999E+998 -> 0 +bool0824 isnan 9.99999999E+999 -> 0 +bool0825 isnan -9.99999999E+999 -> 0 +bool0826 isnan 9.99999999E+1000 -> 0 +bool0827 isnan -9.99999999E+1000 -> 0 +bool0828 isnan 9.99999999E+2000 -> 0 +bool0829 isnan -9.99999999E+2000 -> 0 +bool0830 isnan Infinity -> 0 +bool0831 isnan -Infinity -> 0 +bool0832 isnan NaN -> 1 +bool0833 isnan -NaN -> 1 +bool0834 isnan NaN123 -> 1 +bool0835 isnan -NaN123 -> 1 +bool0836 isnan sNaN -> 1 +bool0837 isnan -sNaN -> 1 +bool0838 isnan sNaN123 -> 1 +bool0839 isnan -sNaN123 -> 1 +bool0840 isnormal 0E-2000 -> 0 +bool0841 isnormal -0E-2000 -> 0 +bool0842 isnormal 0E-1008 -> 0 +bool0843 isnormal -0E-1008 -> 0 +bool0844 isnormal 0E-1007 -> 0 +bool0845 isnormal -0E-1007 -> 0 +bool0846 isnormal 0E-1006 -> 0 +bool0847 isnormal -0E-1006 -> 0 +bool0848 isnormal 0E-1000 -> 0 +bool0849 isnormal -0E-1000 -> 0 +bool0850 isnormal 0E-999 -> 0 +bool0851 isnormal -0E-999 -> 0 +bool0852 isnormal 0E-998 -> 0 +bool0853 isnormal -0E-998 -> 0 +bool0854 isnormal 0E-100 -> 0 +bool0855 isnormal -0E-100 -> 0 +bool0856 isnormal 0.000000 -> 0 +bool0857 isnormal -0.000000 -> 0 +bool0858 isnormal 0.000 -> 0 +bool0859 isnormal -0.000 -> 0 +bool0860 isnormal 0.00 -> 0 +bool0861 isnormal -0.00 -> 0 +bool0862 isnormal 0.0 -> 0 +bool0863 isnormal -0.0 -> 0 +bool0864 isnormal 0 -> 0 +bool0865 isnormal -0 -> 0 +bool0866 isnormal 0E+1 -> 0 +bool0867 isnormal -0E+1 -> 0 +bool0868 isnormal 0E+2 -> 0 +bool0869 isnormal -0E+2 -> 0 +bool0870 isnormal 0E+3 -> 0 +bool0871 isnormal -0E+3 -> 0 +bool0872 isnormal 0E+6 -> 0 +bool0873 isnormal -0E+6 -> 0 +bool0874 isnormal 0E+100 -> 0 +bool0875 isnormal -0E+100 -> 0 +bool0876 isnormal 0E+990 -> 0 +bool0877 isnormal -0E+990 -> 0 +bool0878 isnormal 0E+991 -> 0 +bool0879 isnormal -0E+991 -> 0 +bool0880 isnormal 0E+992 -> 0 +bool0881 isnormal -0E+992 -> 0 +bool0882 isnormal 0E+998 -> 0 +bool0883 isnormal -0E+998 -> 0 +bool0884 isnormal 0E+999 -> 0 +bool0885 isnormal -0E+999 -> 0 +bool0886 isnormal 0E+1000 -> 0 +bool0887 isnormal -0E+1000 -> 0 +bool0888 isnormal 0E+2000 -> 0 +bool0889 isnormal -0E+2000 -> 0 +bool0890 isnormal 1E-2000 -> 0 +bool0891 isnormal -1E-2000 -> 0 +bool0892 isnormal 1E-1008 -> 0 +bool0893 isnormal -1E-1008 -> 0 +bool0894 isnormal 1E-1007 -> 0 +bool0895 isnormal -1E-1007 -> 0 +bool0896 isnormal 1E-1006 -> 0 +bool0897 isnormal -1E-1006 -> 0 +bool0898 isnormal 1E-1000 -> 0 +bool0899 isnormal -1E-1000 -> 0 +bool0900 isnormal 1E-999 -> 1 +bool0901 isnormal -1E-999 -> 1 +bool0902 isnormal 1E-998 -> 1 +bool0903 isnormal -1E-998 -> 1 +bool0904 isnormal 1E-100 -> 1 +bool0905 isnormal -1E-100 -> 1 +bool0906 isnormal 0.000001 -> 1 +bool0907 isnormal -0.000001 -> 1 +bool0908 isnormal 0.001 -> 1 +bool0909 isnormal -0.001 -> 1 +bool0910 isnormal 0.01 -> 1 +bool0911 isnormal -0.01 -> 1 +bool0912 isnormal 0.1 -> 1 +bool0913 isnormal -0.1 -> 1 +bool0914 isnormal 1 -> 1 +bool0915 isnormal -1 -> 1 +bool0916 isnormal 1E+1 -> 1 +bool0917 isnormal -1E+1 -> 1 +bool0918 isnormal 1E+2 -> 1 +bool0919 isnormal -1E+2 -> 1 +bool0920 isnormal 1E+3 -> 1 +bool0921 isnormal -1E+3 -> 1 +bool0922 isnormal 1E+6 -> 1 +bool0923 isnormal -1E+6 -> 1 +bool0924 isnormal 1E+100 -> 1 +bool0925 isnormal -1E+100 -> 1 +bool0926 isnormal 1E+990 -> 1 +bool0927 isnormal -1E+990 -> 1 +bool0928 isnormal 1E+991 -> 1 +bool0929 isnormal -1E+991 -> 1 +bool0930 isnormal 1E+992 -> 1 +bool0931 isnormal -1E+992 -> 1 +bool0932 isnormal 1E+998 -> 1 +bool0933 isnormal -1E+998 -> 1 +bool0934 isnormal 1E+999 -> 1 +bool0935 isnormal -1E+999 -> 1 +bool0936 isnormal 1E+1000 -> 0 +bool0937 isnormal -1E+1000 -> 0 +bool0938 isnormal 1E+2000 -> 0 +bool0939 isnormal -1E+2000 -> 0 +bool0940 isnormal 9E-2000 -> 0 +bool0941 isnormal -9E-2000 -> 0 +bool0942 isnormal 9E-1008 -> 0 +bool0943 isnormal -9E-1008 -> 0 +bool0944 isnormal 9E-1007 -> 0 +bool0945 isnormal -9E-1007 -> 0 +bool0946 isnormal 9E-1006 -> 0 +bool0947 isnormal -9E-1006 -> 0 +bool0948 isnormal 9E-1000 -> 0 +bool0949 isnormal -9E-1000 -> 0 +bool0950 isnormal 9E-999 -> 1 +bool0951 isnormal -9E-999 -> 1 +bool0952 isnormal 9E-998 -> 1 +bool0953 isnormal -9E-998 -> 1 +bool0954 isnormal 9E-100 -> 1 +bool0955 isnormal -9E-100 -> 1 +bool0956 isnormal 0.000009 -> 1 +bool0957 isnormal -0.000009 -> 1 +bool0958 isnormal 0.009 -> 1 +bool0959 isnormal -0.009 -> 1 +bool0960 isnormal 0.09 -> 1 +bool0961 isnormal -0.09 -> 1 +bool0962 isnormal 0.9 -> 1 +bool0963 isnormal -0.9 -> 1 +bool0964 isnormal 9 -> 1 +bool0965 isnormal -9 -> 1 +bool0966 isnormal 9E+1 -> 1 +bool0967 isnormal -9E+1 -> 1 +bool0968 isnormal 9E+2 -> 1 +bool0969 isnormal -9E+2 -> 1 +bool0970 isnormal 9E+3 -> 1 +bool0971 isnormal -9E+3 -> 1 +bool0972 isnormal 9E+6 -> 1 +bool0973 isnormal -9E+6 -> 1 +bool0974 isnormal 9E+100 -> 1 +bool0975 isnormal -9E+100 -> 1 +bool0976 isnormal 9E+990 -> 1 +bool0977 isnormal -9E+990 -> 1 +bool0978 isnormal 9E+991 -> 1 +bool0979 isnormal -9E+991 -> 1 +bool0980 isnormal 9E+992 -> 1 +bool0981 isnormal -9E+992 -> 1 +bool0982 isnormal 9E+998 -> 1 +bool0983 isnormal -9E+998 -> 1 +bool0984 isnormal 9E+999 -> 1 +bool0985 isnormal -9E+999 -> 1 +bool0986 isnormal 9E+1000 -> 0 +bool0987 isnormal -9E+1000 -> 0 +bool0988 isnormal 9E+2000 -> 0 +bool0989 isnormal -9E+2000 -> 0 +bool0990 isnormal 9.99999999E-2000 -> 0 +bool0991 isnormal -9.99999999E-2000 -> 0 +bool0992 isnormal 9.99999999E-1008 -> 0 +bool0993 isnormal -9.99999999E-1008 -> 0 +bool0994 isnormal 9.99999999E-1007 -> 0 +bool0995 isnormal -9.99999999E-1007 -> 0 +bool0996 isnormal 9.99999999E-1006 -> 0 +bool0997 isnormal -9.99999999E-1006 -> 0 +bool0998 isnormal 9.99999999E-1000 -> 0 +bool0999 isnormal -9.99999999E-1000 -> 0 +bool1000 isnormal 9.99999999E-999 -> 1 +bool1001 isnormal -9.99999999E-999 -> 1 +bool1002 isnormal 9.99999999E-998 -> 1 +bool1003 isnormal -9.99999999E-998 -> 1 +bool1004 isnormal 9.99999999E-100 -> 1 +bool1005 isnormal -9.99999999E-100 -> 1 +bool1006 isnormal 0.00000999999999 -> 1 +bool1007 isnormal -0.00000999999999 -> 1 +bool1008 isnormal 0.00999999999 -> 1 +bool1009 isnormal -0.00999999999 -> 1 +bool1010 isnormal 0.0999999999 -> 1 +bool1011 isnormal -0.0999999999 -> 1 +bool1012 isnormal 0.999999999 -> 1 +bool1013 isnormal -0.999999999 -> 1 +bool1014 isnormal 9.99999999 -> 1 +bool1015 isnormal -9.99999999 -> 1 +bool1016 isnormal 99.9999999 -> 1 +bool1017 isnormal -99.9999999 -> 1 +bool1018 isnormal 999.999999 -> 1 +bool1019 isnormal -999.999999 -> 1 +bool1020 isnormal 9999.99999 -> 1 +bool1021 isnormal -9999.99999 -> 1 +bool1022 isnormal 9999999.99 -> 1 +bool1023 isnormal -9999999.99 -> 1 +bool1024 isnormal 9.99999999E+100 -> 1 +bool1025 isnormal -9.99999999E+100 -> 1 +bool1026 isnormal 9.99999999E+990 -> 1 +bool1027 isnormal -9.99999999E+990 -> 1 +bool1028 isnormal 9.99999999E+991 -> 1 +bool1029 isnormal -9.99999999E+991 -> 1 +bool1030 isnormal 9.99999999E+992 -> 1 +bool1031 isnormal -9.99999999E+992 -> 1 +bool1032 isnormal 9.99999999E+998 -> 1 +bool1033 isnormal -9.99999999E+998 -> 1 +bool1034 isnormal 9.99999999E+999 -> 1 +bool1035 isnormal -9.99999999E+999 -> 1 +bool1036 isnormal 9.99999999E+1000 -> 0 +bool1037 isnormal -9.99999999E+1000 -> 0 +bool1038 isnormal 9.99999999E+2000 -> 0 +bool1039 isnormal -9.99999999E+2000 -> 0 +bool1040 isnormal Infinity -> 0 +bool1041 isnormal -Infinity -> 0 +bool1042 isnormal NaN -> 0 +bool1043 isnormal -NaN -> 0 +bool1044 isnormal NaN123 -> 0 +bool1045 isnormal -NaN123 -> 0 +bool1046 isnormal sNaN -> 0 +bool1047 isnormal -sNaN -> 0 +bool1048 isnormal sNaN123 -> 0 +bool1049 isnormal -sNaN123 -> 0 +bool1050 isqnan 0E-2000 -> 0 +bool1051 isqnan -0E-2000 -> 0 +bool1052 isqnan 0E-1008 -> 0 +bool1053 isqnan -0E-1008 -> 0 +bool1054 isqnan 0E-1007 -> 0 +bool1055 isqnan -0E-1007 -> 0 +bool1056 isqnan 0E-1006 -> 0 +bool1057 isqnan -0E-1006 -> 0 +bool1058 isqnan 0E-1000 -> 0 +bool1059 isqnan -0E-1000 -> 0 +bool1060 isqnan 0E-999 -> 0 +bool1061 isqnan -0E-999 -> 0 +bool1062 isqnan 0E-998 -> 0 +bool1063 isqnan -0E-998 -> 0 +bool1064 isqnan 0E-100 -> 0 +bool1065 isqnan -0E-100 -> 0 +bool1066 isqnan 0.000000 -> 0 +bool1067 isqnan -0.000000 -> 0 +bool1068 isqnan 0.000 -> 0 +bool1069 isqnan -0.000 -> 0 +bool1070 isqnan 0.00 -> 0 +bool1071 isqnan -0.00 -> 0 +bool1072 isqnan 0.0 -> 0 +bool1073 isqnan -0.0 -> 0 +bool1074 isqnan 0 -> 0 +bool1075 isqnan -0 -> 0 +bool1076 isqnan 0E+1 -> 0 +bool1077 isqnan -0E+1 -> 0 +bool1078 isqnan 0E+2 -> 0 +bool1079 isqnan -0E+2 -> 0 +bool1080 isqnan 0E+3 -> 0 +bool1081 isqnan -0E+3 -> 0 +bool1082 isqnan 0E+6 -> 0 +bool1083 isqnan -0E+6 -> 0 +bool1084 isqnan 0E+100 -> 0 +bool1085 isqnan -0E+100 -> 0 +bool1086 isqnan 0E+990 -> 0 +bool1087 isqnan -0E+990 -> 0 +bool1088 isqnan 0E+991 -> 0 +bool1089 isqnan -0E+991 -> 0 +bool1090 isqnan 0E+992 -> 0 +bool1091 isqnan -0E+992 -> 0 +bool1092 isqnan 0E+998 -> 0 +bool1093 isqnan -0E+998 -> 0 +bool1094 isqnan 0E+999 -> 0 +bool1095 isqnan -0E+999 -> 0 +bool1096 isqnan 0E+1000 -> 0 +bool1097 isqnan -0E+1000 -> 0 +bool1098 isqnan 0E+2000 -> 0 +bool1099 isqnan -0E+2000 -> 0 +bool1100 isqnan 1E-2000 -> 0 +bool1101 isqnan -1E-2000 -> 0 +bool1102 isqnan 1E-1008 -> 0 +bool1103 isqnan -1E-1008 -> 0 +bool1104 isqnan 1E-1007 -> 0 +bool1105 isqnan -1E-1007 -> 0 +bool1106 isqnan 1E-1006 -> 0 +bool1107 isqnan -1E-1006 -> 0 +bool1108 isqnan 1E-1000 -> 0 +bool1109 isqnan -1E-1000 -> 0 +bool1110 isqnan 1E-999 -> 0 +bool1111 isqnan -1E-999 -> 0 +bool1112 isqnan 1E-998 -> 0 +bool1113 isqnan -1E-998 -> 0 +bool1114 isqnan 1E-100 -> 0 +bool1115 isqnan -1E-100 -> 0 +bool1116 isqnan 0.000001 -> 0 +bool1117 isqnan -0.000001 -> 0 +bool1118 isqnan 0.001 -> 0 +bool1119 isqnan -0.001 -> 0 +bool1120 isqnan 0.01 -> 0 +bool1121 isqnan -0.01 -> 0 +bool1122 isqnan 0.1 -> 0 +bool1123 isqnan -0.1 -> 0 +bool1124 isqnan 1 -> 0 +bool1125 isqnan -1 -> 0 +bool1126 isqnan 1E+1 -> 0 +bool1127 isqnan -1E+1 -> 0 +bool1128 isqnan 1E+2 -> 0 +bool1129 isqnan -1E+2 -> 0 +bool1130 isqnan 1E+3 -> 0 +bool1131 isqnan -1E+3 -> 0 +bool1132 isqnan 1E+6 -> 0 +bool1133 isqnan -1E+6 -> 0 +bool1134 isqnan 1E+100 -> 0 +bool1135 isqnan -1E+100 -> 0 +bool1136 isqnan 1E+990 -> 0 +bool1137 isqnan -1E+990 -> 0 +bool1138 isqnan 1E+991 -> 0 +bool1139 isqnan -1E+991 -> 0 +bool1140 isqnan 1E+992 -> 0 +bool1141 isqnan -1E+992 -> 0 +bool1142 isqnan 1E+998 -> 0 +bool1143 isqnan -1E+998 -> 0 +bool1144 isqnan 1E+999 -> 0 +bool1145 isqnan -1E+999 -> 0 +bool1146 isqnan 1E+1000 -> 0 +bool1147 isqnan -1E+1000 -> 0 +bool1148 isqnan 1E+2000 -> 0 +bool1149 isqnan -1E+2000 -> 0 +bool1150 isqnan 9E-2000 -> 0 +bool1151 isqnan -9E-2000 -> 0 +bool1152 isqnan 9E-1008 -> 0 +bool1153 isqnan -9E-1008 -> 0 +bool1154 isqnan 9E-1007 -> 0 +bool1155 isqnan -9E-1007 -> 0 +bool1156 isqnan 9E-1006 -> 0 +bool1157 isqnan -9E-1006 -> 0 +bool1158 isqnan 9E-1000 -> 0 +bool1159 isqnan -9E-1000 -> 0 +bool1160 isqnan 9E-999 -> 0 +bool1161 isqnan -9E-999 -> 0 +bool1162 isqnan 9E-998 -> 0 +bool1163 isqnan -9E-998 -> 0 +bool1164 isqnan 9E-100 -> 0 +bool1165 isqnan -9E-100 -> 0 +bool1166 isqnan 0.000009 -> 0 +bool1167 isqnan -0.000009 -> 0 +bool1168 isqnan 0.009 -> 0 +bool1169 isqnan -0.009 -> 0 +bool1170 isqnan 0.09 -> 0 +bool1171 isqnan -0.09 -> 0 +bool1172 isqnan 0.9 -> 0 +bool1173 isqnan -0.9 -> 0 +bool1174 isqnan 9 -> 0 +bool1175 isqnan -9 -> 0 +bool1176 isqnan 9E+1 -> 0 +bool1177 isqnan -9E+1 -> 0 +bool1178 isqnan 9E+2 -> 0 +bool1179 isqnan -9E+2 -> 0 +bool1180 isqnan 9E+3 -> 0 +bool1181 isqnan -9E+3 -> 0 +bool1182 isqnan 9E+6 -> 0 +bool1183 isqnan -9E+6 -> 0 +bool1184 isqnan 9E+100 -> 0 +bool1185 isqnan -9E+100 -> 0 +bool1186 isqnan 9E+990 -> 0 +bool1187 isqnan -9E+990 -> 0 +bool1188 isqnan 9E+991 -> 0 +bool1189 isqnan -9E+991 -> 0 +bool1190 isqnan 9E+992 -> 0 +bool1191 isqnan -9E+992 -> 0 +bool1192 isqnan 9E+998 -> 0 +bool1193 isqnan -9E+998 -> 0 +bool1194 isqnan 9E+999 -> 0 +bool1195 isqnan -9E+999 -> 0 +bool1196 isqnan 9E+1000 -> 0 +bool1197 isqnan -9E+1000 -> 0 +bool1198 isqnan 9E+2000 -> 0 +bool1199 isqnan -9E+2000 -> 0 +bool1200 isqnan 9.99999999E-2000 -> 0 +bool1201 isqnan -9.99999999E-2000 -> 0 +bool1202 isqnan 9.99999999E-1008 -> 0 +bool1203 isqnan -9.99999999E-1008 -> 0 +bool1204 isqnan 9.99999999E-1007 -> 0 +bool1205 isqnan -9.99999999E-1007 -> 0 +bool1206 isqnan 9.99999999E-1006 -> 0 +bool1207 isqnan -9.99999999E-1006 -> 0 +bool1208 isqnan 9.99999999E-1000 -> 0 +bool1209 isqnan -9.99999999E-1000 -> 0 +bool1210 isqnan 9.99999999E-999 -> 0 +bool1211 isqnan -9.99999999E-999 -> 0 +bool1212 isqnan 9.99999999E-998 -> 0 +bool1213 isqnan -9.99999999E-998 -> 0 +bool1214 isqnan 9.99999999E-100 -> 0 +bool1215 isqnan -9.99999999E-100 -> 0 +bool1216 isqnan 0.00000999999999 -> 0 +bool1217 isqnan -0.00000999999999 -> 0 +bool1218 isqnan 0.00999999999 -> 0 +bool1219 isqnan -0.00999999999 -> 0 +bool1220 isqnan 0.0999999999 -> 0 +bool1221 isqnan -0.0999999999 -> 0 +bool1222 isqnan 0.999999999 -> 0 +bool1223 isqnan -0.999999999 -> 0 +bool1224 isqnan 9.99999999 -> 0 +bool1225 isqnan -9.99999999 -> 0 +bool1226 isqnan 99.9999999 -> 0 +bool1227 isqnan -99.9999999 -> 0 +bool1228 isqnan 999.999999 -> 0 +bool1229 isqnan -999.999999 -> 0 +bool1230 isqnan 9999.99999 -> 0 +bool1231 isqnan -9999.99999 -> 0 +bool1232 isqnan 9999999.99 -> 0 +bool1233 isqnan -9999999.99 -> 0 +bool1234 isqnan 9.99999999E+100 -> 0 +bool1235 isqnan -9.99999999E+100 -> 0 +bool1236 isqnan 9.99999999E+990 -> 0 +bool1237 isqnan -9.99999999E+990 -> 0 +bool1238 isqnan 9.99999999E+991 -> 0 +bool1239 isqnan -9.99999999E+991 -> 0 +bool1240 isqnan 9.99999999E+992 -> 0 +bool1241 isqnan -9.99999999E+992 -> 0 +bool1242 isqnan 9.99999999E+998 -> 0 +bool1243 isqnan -9.99999999E+998 -> 0 +bool1244 isqnan 9.99999999E+999 -> 0 +bool1245 isqnan -9.99999999E+999 -> 0 +bool1246 isqnan 9.99999999E+1000 -> 0 +bool1247 isqnan -9.99999999E+1000 -> 0 +bool1248 isqnan 9.99999999E+2000 -> 0 +bool1249 isqnan -9.99999999E+2000 -> 0 +bool1250 isqnan Infinity -> 0 +bool1251 isqnan -Infinity -> 0 +bool1252 isqnan NaN -> 1 +bool1253 isqnan -NaN -> 1 +bool1254 isqnan NaN123 -> 1 +bool1255 isqnan -NaN123 -> 1 +bool1256 isqnan sNaN -> 0 +bool1257 isqnan -sNaN -> 0 +bool1258 isqnan sNaN123 -> 0 +bool1259 isqnan -sNaN123 -> 0 +bool1260 issigned 0E-2000 -> 0 +bool1261 issigned -0E-2000 -> 1 +bool1262 issigned 0E-1008 -> 0 +bool1263 issigned -0E-1008 -> 1 +bool1264 issigned 0E-1007 -> 0 +bool1265 issigned -0E-1007 -> 1 +bool1266 issigned 0E-1006 -> 0 +bool1267 issigned -0E-1006 -> 1 +bool1268 issigned 0E-1000 -> 0 +bool1269 issigned -0E-1000 -> 1 +bool1270 issigned 0E-999 -> 0 +bool1271 issigned -0E-999 -> 1 +bool1272 issigned 0E-998 -> 0 +bool1273 issigned -0E-998 -> 1 +bool1274 issigned 0E-100 -> 0 +bool1275 issigned -0E-100 -> 1 +bool1276 issigned 0.000000 -> 0 +bool1277 issigned -0.000000 -> 1 +bool1278 issigned 0.000 -> 0 +bool1279 issigned -0.000 -> 1 +bool1280 issigned 0.00 -> 0 +bool1281 issigned -0.00 -> 1 +bool1282 issigned 0.0 -> 0 +bool1283 issigned -0.0 -> 1 +bool1284 issigned 0 -> 0 +bool1285 issigned -0 -> 1 +bool1286 issigned 0E+1 -> 0 +bool1287 issigned -0E+1 -> 1 +bool1288 issigned 0E+2 -> 0 +bool1289 issigned -0E+2 -> 1 +bool1290 issigned 0E+3 -> 0 +bool1291 issigned -0E+3 -> 1 +bool1292 issigned 0E+6 -> 0 +bool1293 issigned -0E+6 -> 1 +bool1294 issigned 0E+100 -> 0 +bool1295 issigned -0E+100 -> 1 +bool1296 issigned 0E+990 -> 0 +bool1297 issigned -0E+990 -> 1 +bool1298 issigned 0E+991 -> 0 +bool1299 issigned -0E+991 -> 1 +bool1300 issigned 0E+992 -> 0 +bool1301 issigned -0E+992 -> 1 +bool1302 issigned 0E+998 -> 0 +bool1303 issigned -0E+998 -> 1 +bool1304 issigned 0E+999 -> 0 +bool1305 issigned -0E+999 -> 1 +bool1306 issigned 0E+1000 -> 0 +bool1307 issigned -0E+1000 -> 1 +bool1308 issigned 0E+2000 -> 0 +bool1309 issigned -0E+2000 -> 1 +bool1310 issigned 1E-2000 -> 0 +bool1311 issigned -1E-2000 -> 1 +bool1312 issigned 1E-1008 -> 0 +bool1313 issigned -1E-1008 -> 1 +bool1314 issigned 1E-1007 -> 0 +bool1315 issigned -1E-1007 -> 1 +bool1316 issigned 1E-1006 -> 0 +bool1317 issigned -1E-1006 -> 1 +bool1318 issigned 1E-1000 -> 0 +bool1319 issigned -1E-1000 -> 1 +bool1320 issigned 1E-999 -> 0 +bool1321 issigned -1E-999 -> 1 +bool1322 issigned 1E-998 -> 0 +bool1323 issigned -1E-998 -> 1 +bool1324 issigned 1E-100 -> 0 +bool1325 issigned -1E-100 -> 1 +bool1326 issigned 0.000001 -> 0 +bool1327 issigned -0.000001 -> 1 +bool1328 issigned 0.001 -> 0 +bool1329 issigned -0.001 -> 1 +bool1330 issigned 0.01 -> 0 +bool1331 issigned -0.01 -> 1 +bool1332 issigned 0.1 -> 0 +bool1333 issigned -0.1 -> 1 +bool1334 issigned 1 -> 0 +bool1335 issigned -1 -> 1 +bool1336 issigned 1E+1 -> 0 +bool1337 issigned -1E+1 -> 1 +bool1338 issigned 1E+2 -> 0 +bool1339 issigned -1E+2 -> 1 +bool1340 issigned 1E+3 -> 0 +bool1341 issigned -1E+3 -> 1 +bool1342 issigned 1E+6 -> 0 +bool1343 issigned -1E+6 -> 1 +bool1344 issigned 1E+100 -> 0 +bool1345 issigned -1E+100 -> 1 +bool1346 issigned 1E+990 -> 0 +bool1347 issigned -1E+990 -> 1 +bool1348 issigned 1E+991 -> 0 +bool1349 issigned -1E+991 -> 1 +bool1350 issigned 1E+992 -> 0 +bool1351 issigned -1E+992 -> 1 +bool1352 issigned 1E+998 -> 0 +bool1353 issigned -1E+998 -> 1 +bool1354 issigned 1E+999 -> 0 +bool1355 issigned -1E+999 -> 1 +bool1356 issigned 1E+1000 -> 0 +bool1357 issigned -1E+1000 -> 1 +bool1358 issigned 1E+2000 -> 0 +bool1359 issigned -1E+2000 -> 1 +bool1360 issigned 9E-2000 -> 0 +bool1361 issigned -9E-2000 -> 1 +bool1362 issigned 9E-1008 -> 0 +bool1363 issigned -9E-1008 -> 1 +bool1364 issigned 9E-1007 -> 0 +bool1365 issigned -9E-1007 -> 1 +bool1366 issigned 9E-1006 -> 0 +bool1367 issigned -9E-1006 -> 1 +bool1368 issigned 9E-1000 -> 0 +bool1369 issigned -9E-1000 -> 1 +bool1370 issigned 9E-999 -> 0 +bool1371 issigned -9E-999 -> 1 +bool1372 issigned 9E-998 -> 0 +bool1373 issigned -9E-998 -> 1 +bool1374 issigned 9E-100 -> 0 +bool1375 issigned -9E-100 -> 1 +bool1376 issigned 0.000009 -> 0 +bool1377 issigned -0.000009 -> 1 +bool1378 issigned 0.009 -> 0 +bool1379 issigned -0.009 -> 1 +bool1380 issigned 0.09 -> 0 +bool1381 issigned -0.09 -> 1 +bool1382 issigned 0.9 -> 0 +bool1383 issigned -0.9 -> 1 +bool1384 issigned 9 -> 0 +bool1385 issigned -9 -> 1 +bool1386 issigned 9E+1 -> 0 +bool1387 issigned -9E+1 -> 1 +bool1388 issigned 9E+2 -> 0 +bool1389 issigned -9E+2 -> 1 +bool1390 issigned 9E+3 -> 0 +bool1391 issigned -9E+3 -> 1 +bool1392 issigned 9E+6 -> 0 +bool1393 issigned -9E+6 -> 1 +bool1394 issigned 9E+100 -> 0 +bool1395 issigned -9E+100 -> 1 +bool1396 issigned 9E+990 -> 0 +bool1397 issigned -9E+990 -> 1 +bool1398 issigned 9E+991 -> 0 +bool1399 issigned -9E+991 -> 1 +bool1400 issigned 9E+992 -> 0 +bool1401 issigned -9E+992 -> 1 +bool1402 issigned 9E+998 -> 0 +bool1403 issigned -9E+998 -> 1 +bool1404 issigned 9E+999 -> 0 +bool1405 issigned -9E+999 -> 1 +bool1406 issigned 9E+1000 -> 0 +bool1407 issigned -9E+1000 -> 1 +bool1408 issigned 9E+2000 -> 0 +bool1409 issigned -9E+2000 -> 1 +bool1410 issigned 9.99999999E-2000 -> 0 +bool1411 issigned -9.99999999E-2000 -> 1 +bool1412 issigned 9.99999999E-1008 -> 0 +bool1413 issigned -9.99999999E-1008 -> 1 +bool1414 issigned 9.99999999E-1007 -> 0 +bool1415 issigned -9.99999999E-1007 -> 1 +bool1416 issigned 9.99999999E-1006 -> 0 +bool1417 issigned -9.99999999E-1006 -> 1 +bool1418 issigned 9.99999999E-1000 -> 0 +bool1419 issigned -9.99999999E-1000 -> 1 +bool1420 issigned 9.99999999E-999 -> 0 +bool1421 issigned -9.99999999E-999 -> 1 +bool1422 issigned 9.99999999E-998 -> 0 +bool1423 issigned -9.99999999E-998 -> 1 +bool1424 issigned 9.99999999E-100 -> 0 +bool1425 issigned -9.99999999E-100 -> 1 +bool1426 issigned 0.00000999999999 -> 0 +bool1427 issigned -0.00000999999999 -> 1 +bool1428 issigned 0.00999999999 -> 0 +bool1429 issigned -0.00999999999 -> 1 +bool1430 issigned 0.0999999999 -> 0 +bool1431 issigned -0.0999999999 -> 1 +bool1432 issigned 0.999999999 -> 0 +bool1433 issigned -0.999999999 -> 1 +bool1434 issigned 9.99999999 -> 0 +bool1435 issigned -9.99999999 -> 1 +bool1436 issigned 99.9999999 -> 0 +bool1437 issigned -99.9999999 -> 1 +bool1438 issigned 999.999999 -> 0 +bool1439 issigned -999.999999 -> 1 +bool1440 issigned 9999.99999 -> 0 +bool1441 issigned -9999.99999 -> 1 +bool1442 issigned 9999999.99 -> 0 +bool1443 issigned -9999999.99 -> 1 +bool1444 issigned 9.99999999E+100 -> 0 +bool1445 issigned -9.99999999E+100 -> 1 +bool1446 issigned 9.99999999E+990 -> 0 +bool1447 issigned -9.99999999E+990 -> 1 +bool1448 issigned 9.99999999E+991 -> 0 +bool1449 issigned -9.99999999E+991 -> 1 +bool1450 issigned 9.99999999E+992 -> 0 +bool1451 issigned -9.99999999E+992 -> 1 +bool1452 issigned 9.99999999E+998 -> 0 +bool1453 issigned -9.99999999E+998 -> 1 +bool1454 issigned 9.99999999E+999 -> 0 +bool1455 issigned -9.99999999E+999 -> 1 +bool1456 issigned 9.99999999E+1000 -> 0 +bool1457 issigned -9.99999999E+1000 -> 1 +bool1458 issigned 9.99999999E+2000 -> 0 +bool1459 issigned -9.99999999E+2000 -> 1 +bool1460 issigned Infinity -> 0 +bool1461 issigned -Infinity -> 1 +bool1462 issigned NaN -> 0 +bool1463 issigned -NaN -> 1 +bool1464 issigned NaN123 -> 0 +bool1465 issigned -NaN123 -> 1 +bool1466 issigned sNaN -> 0 +bool1467 issigned -sNaN -> 1 +bool1468 issigned sNaN123 -> 0 +bool1469 issigned -sNaN123 -> 1 +bool1470 issnan 0E-2000 -> 0 +bool1471 issnan -0E-2000 -> 0 +bool1472 issnan 0E-1008 -> 0 +bool1473 issnan -0E-1008 -> 0 +bool1474 issnan 0E-1007 -> 0 +bool1475 issnan -0E-1007 -> 0 +bool1476 issnan 0E-1006 -> 0 +bool1477 issnan -0E-1006 -> 0 +bool1478 issnan 0E-1000 -> 0 +bool1479 issnan -0E-1000 -> 0 +bool1480 issnan 0E-999 -> 0 +bool1481 issnan -0E-999 -> 0 +bool1482 issnan 0E-998 -> 0 +bool1483 issnan -0E-998 -> 0 +bool1484 issnan 0E-100 -> 0 +bool1485 issnan -0E-100 -> 0 +bool1486 issnan 0.000000 -> 0 +bool1487 issnan -0.000000 -> 0 +bool1488 issnan 0.000 -> 0 +bool1489 issnan -0.000 -> 0 +bool1490 issnan 0.00 -> 0 +bool1491 issnan -0.00 -> 0 +bool1492 issnan 0.0 -> 0 +bool1493 issnan -0.0 -> 0 +bool1494 issnan 0 -> 0 +bool1495 issnan -0 -> 0 +bool1496 issnan 0E+1 -> 0 +bool1497 issnan -0E+1 -> 0 +bool1498 issnan 0E+2 -> 0 +bool1499 issnan -0E+2 -> 0 +bool1500 issnan 0E+3 -> 0 +bool1501 issnan -0E+3 -> 0 +bool1502 issnan 0E+6 -> 0 +bool1503 issnan -0E+6 -> 0 +bool1504 issnan 0E+100 -> 0 +bool1505 issnan -0E+100 -> 0 +bool1506 issnan 0E+990 -> 0 +bool1507 issnan -0E+990 -> 0 +bool1508 issnan 0E+991 -> 0 +bool1509 issnan -0E+991 -> 0 +bool1510 issnan 0E+992 -> 0 +bool1511 issnan -0E+992 -> 0 +bool1512 issnan 0E+998 -> 0 +bool1513 issnan -0E+998 -> 0 +bool1514 issnan 0E+999 -> 0 +bool1515 issnan -0E+999 -> 0 +bool1516 issnan 0E+1000 -> 0 +bool1517 issnan -0E+1000 -> 0 +bool1518 issnan 0E+2000 -> 0 +bool1519 issnan -0E+2000 -> 0 +bool1520 issnan 1E-2000 -> 0 +bool1521 issnan -1E-2000 -> 0 +bool1522 issnan 1E-1008 -> 0 +bool1523 issnan -1E-1008 -> 0 +bool1524 issnan 1E-1007 -> 0 +bool1525 issnan -1E-1007 -> 0 +bool1526 issnan 1E-1006 -> 0 +bool1527 issnan -1E-1006 -> 0 +bool1528 issnan 1E-1000 -> 0 +bool1529 issnan -1E-1000 -> 0 +bool1530 issnan 1E-999 -> 0 +bool1531 issnan -1E-999 -> 0 +bool1532 issnan 1E-998 -> 0 +bool1533 issnan -1E-998 -> 0 +bool1534 issnan 1E-100 -> 0 +bool1535 issnan -1E-100 -> 0 +bool1536 issnan 0.000001 -> 0 +bool1537 issnan -0.000001 -> 0 +bool1538 issnan 0.001 -> 0 +bool1539 issnan -0.001 -> 0 +bool1540 issnan 0.01 -> 0 +bool1541 issnan -0.01 -> 0 +bool1542 issnan 0.1 -> 0 +bool1543 issnan -0.1 -> 0 +bool1544 issnan 1 -> 0 +bool1545 issnan -1 -> 0 +bool1546 issnan 1E+1 -> 0 +bool1547 issnan -1E+1 -> 0 +bool1548 issnan 1E+2 -> 0 +bool1549 issnan -1E+2 -> 0 +bool1550 issnan 1E+3 -> 0 +bool1551 issnan -1E+3 -> 0 +bool1552 issnan 1E+6 -> 0 +bool1553 issnan -1E+6 -> 0 +bool1554 issnan 1E+100 -> 0 +bool1555 issnan -1E+100 -> 0 +bool1556 issnan 1E+990 -> 0 +bool1557 issnan -1E+990 -> 0 +bool1558 issnan 1E+991 -> 0 +bool1559 issnan -1E+991 -> 0 +bool1560 issnan 1E+992 -> 0 +bool1561 issnan -1E+992 -> 0 +bool1562 issnan 1E+998 -> 0 +bool1563 issnan -1E+998 -> 0 +bool1564 issnan 1E+999 -> 0 +bool1565 issnan -1E+999 -> 0 +bool1566 issnan 1E+1000 -> 0 +bool1567 issnan -1E+1000 -> 0 +bool1568 issnan 1E+2000 -> 0 +bool1569 issnan -1E+2000 -> 0 +bool1570 issnan 9E-2000 -> 0 +bool1571 issnan -9E-2000 -> 0 +bool1572 issnan 9E-1008 -> 0 +bool1573 issnan -9E-1008 -> 0 +bool1574 issnan 9E-1007 -> 0 +bool1575 issnan -9E-1007 -> 0 +bool1576 issnan 9E-1006 -> 0 +bool1577 issnan -9E-1006 -> 0 +bool1578 issnan 9E-1000 -> 0 +bool1579 issnan -9E-1000 -> 0 +bool1580 issnan 9E-999 -> 0 +bool1581 issnan -9E-999 -> 0 +bool1582 issnan 9E-998 -> 0 +bool1583 issnan -9E-998 -> 0 +bool1584 issnan 9E-100 -> 0 +bool1585 issnan -9E-100 -> 0 +bool1586 issnan 0.000009 -> 0 +bool1587 issnan -0.000009 -> 0 +bool1588 issnan 0.009 -> 0 +bool1589 issnan -0.009 -> 0 +bool1590 issnan 0.09 -> 0 +bool1591 issnan -0.09 -> 0 +bool1592 issnan 0.9 -> 0 +bool1593 issnan -0.9 -> 0 +bool1594 issnan 9 -> 0 +bool1595 issnan -9 -> 0 +bool1596 issnan 9E+1 -> 0 +bool1597 issnan -9E+1 -> 0 +bool1598 issnan 9E+2 -> 0 +bool1599 issnan -9E+2 -> 0 +bool1600 issnan 9E+3 -> 0 +bool1601 issnan -9E+3 -> 0 +bool1602 issnan 9E+6 -> 0 +bool1603 issnan -9E+6 -> 0 +bool1604 issnan 9E+100 -> 0 +bool1605 issnan -9E+100 -> 0 +bool1606 issnan 9E+990 -> 0 +bool1607 issnan -9E+990 -> 0 +bool1608 issnan 9E+991 -> 0 +bool1609 issnan -9E+991 -> 0 +bool1610 issnan 9E+992 -> 0 +bool1611 issnan -9E+992 -> 0 +bool1612 issnan 9E+998 -> 0 +bool1613 issnan -9E+998 -> 0 +bool1614 issnan 9E+999 -> 0 +bool1615 issnan -9E+999 -> 0 +bool1616 issnan 9E+1000 -> 0 +bool1617 issnan -9E+1000 -> 0 +bool1618 issnan 9E+2000 -> 0 +bool1619 issnan -9E+2000 -> 0 +bool1620 issnan 9.99999999E-2000 -> 0 +bool1621 issnan -9.99999999E-2000 -> 0 +bool1622 issnan 9.99999999E-1008 -> 0 +bool1623 issnan -9.99999999E-1008 -> 0 +bool1624 issnan 9.99999999E-1007 -> 0 +bool1625 issnan -9.99999999E-1007 -> 0 +bool1626 issnan 9.99999999E-1006 -> 0 +bool1627 issnan -9.99999999E-1006 -> 0 +bool1628 issnan 9.99999999E-1000 -> 0 +bool1629 issnan -9.99999999E-1000 -> 0 +bool1630 issnan 9.99999999E-999 -> 0 +bool1631 issnan -9.99999999E-999 -> 0 +bool1632 issnan 9.99999999E-998 -> 0 +bool1633 issnan -9.99999999E-998 -> 0 +bool1634 issnan 9.99999999E-100 -> 0 +bool1635 issnan -9.99999999E-100 -> 0 +bool1636 issnan 0.00000999999999 -> 0 +bool1637 issnan -0.00000999999999 -> 0 +bool1638 issnan 0.00999999999 -> 0 +bool1639 issnan -0.00999999999 -> 0 +bool1640 issnan 0.0999999999 -> 0 +bool1641 issnan -0.0999999999 -> 0 +bool1642 issnan 0.999999999 -> 0 +bool1643 issnan -0.999999999 -> 0 +bool1644 issnan 9.99999999 -> 0 +bool1645 issnan -9.99999999 -> 0 +bool1646 issnan 99.9999999 -> 0 +bool1647 issnan -99.9999999 -> 0 +bool1648 issnan 999.999999 -> 0 +bool1649 issnan -999.999999 -> 0 +bool1650 issnan 9999.99999 -> 0 +bool1651 issnan -9999.99999 -> 0 +bool1652 issnan 9999999.99 -> 0 +bool1653 issnan -9999999.99 -> 0 +bool1654 issnan 9.99999999E+100 -> 0 +bool1655 issnan -9.99999999E+100 -> 0 +bool1656 issnan 9.99999999E+990 -> 0 +bool1657 issnan -9.99999999E+990 -> 0 +bool1658 issnan 9.99999999E+991 -> 0 +bool1659 issnan -9.99999999E+991 -> 0 +bool1660 issnan 9.99999999E+992 -> 0 +bool1661 issnan -9.99999999E+992 -> 0 +bool1662 issnan 9.99999999E+998 -> 0 +bool1663 issnan -9.99999999E+998 -> 0 +bool1664 issnan 9.99999999E+999 -> 0 +bool1665 issnan -9.99999999E+999 -> 0 +bool1666 issnan 9.99999999E+1000 -> 0 +bool1667 issnan -9.99999999E+1000 -> 0 +bool1668 issnan 9.99999999E+2000 -> 0 +bool1669 issnan -9.99999999E+2000 -> 0 +bool1670 issnan Infinity -> 0 +bool1671 issnan -Infinity -> 0 +bool1672 issnan NaN -> 0 +bool1673 issnan -NaN -> 0 +bool1674 issnan NaN123 -> 0 +bool1675 issnan -NaN123 -> 0 +bool1676 issnan sNaN -> 1 +bool1677 issnan -sNaN -> 1 +bool1678 issnan sNaN123 -> 1 +bool1679 issnan -sNaN123 -> 1 +bool1680 issubnormal 0E-2000 -> 0 +bool1681 issubnormal -0E-2000 -> 0 +bool1682 issubnormal 0E-1008 -> 0 +bool1683 issubnormal -0E-1008 -> 0 +bool1684 issubnormal 0E-1007 -> 0 +bool1685 issubnormal -0E-1007 -> 0 +bool1686 issubnormal 0E-1006 -> 0 +bool1687 issubnormal -0E-1006 -> 0 +bool1688 issubnormal 0E-1000 -> 0 +bool1689 issubnormal -0E-1000 -> 0 +bool1690 issubnormal 0E-999 -> 0 +bool1691 issubnormal -0E-999 -> 0 +bool1692 issubnormal 0E-998 -> 0 +bool1693 issubnormal -0E-998 -> 0 +bool1694 issubnormal 0E-100 -> 0 +bool1695 issubnormal -0E-100 -> 0 +bool1696 issubnormal 0.000000 -> 0 +bool1697 issubnormal -0.000000 -> 0 +bool1698 issubnormal 0.000 -> 0 +bool1699 issubnormal -0.000 -> 0 +bool1700 issubnormal 0.00 -> 0 +bool1701 issubnormal -0.00 -> 0 +bool1702 issubnormal 0.0 -> 0 +bool1703 issubnormal -0.0 -> 0 +bool1704 issubnormal 0 -> 0 +bool1705 issubnormal -0 -> 0 +bool1706 issubnormal 0E+1 -> 0 +bool1707 issubnormal -0E+1 -> 0 +bool1708 issubnormal 0E+2 -> 0 +bool1709 issubnormal -0E+2 -> 0 +bool1710 issubnormal 0E+3 -> 0 +bool1711 issubnormal -0E+3 -> 0 +bool1712 issubnormal 0E+6 -> 0 +bool1713 issubnormal -0E+6 -> 0 +bool1714 issubnormal 0E+100 -> 0 +bool1715 issubnormal -0E+100 -> 0 +bool1716 issubnormal 0E+990 -> 0 +bool1717 issubnormal -0E+990 -> 0 +bool1718 issubnormal 0E+991 -> 0 +bool1719 issubnormal -0E+991 -> 0 +bool1720 issubnormal 0E+992 -> 0 +bool1721 issubnormal -0E+992 -> 0 +bool1722 issubnormal 0E+998 -> 0 +bool1723 issubnormal -0E+998 -> 0 +bool1724 issubnormal 0E+999 -> 0 +bool1725 issubnormal -0E+999 -> 0 +bool1726 issubnormal 0E+1000 -> 0 +bool1727 issubnormal -0E+1000 -> 0 +bool1728 issubnormal 0E+2000 -> 0 +bool1729 issubnormal -0E+2000 -> 0 +bool1730 issubnormal 1E-2000 -> 1 +bool1731 issubnormal -1E-2000 -> 1 +bool1732 issubnormal 1E-1008 -> 1 +bool1733 issubnormal -1E-1008 -> 1 +bool1734 issubnormal 1E-1007 -> 1 +bool1735 issubnormal -1E-1007 -> 1 +bool1736 issubnormal 1E-1006 -> 1 +bool1737 issubnormal -1E-1006 -> 1 +bool1738 issubnormal 1E-1000 -> 1 +bool1739 issubnormal -1E-1000 -> 1 +bool1740 issubnormal 1E-999 -> 0 +bool1741 issubnormal -1E-999 -> 0 +bool1742 issubnormal 1E-998 -> 0 +bool1743 issubnormal -1E-998 -> 0 +bool1744 issubnormal 1E-100 -> 0 +bool1745 issubnormal -1E-100 -> 0 +bool1746 issubnormal 0.000001 -> 0 +bool1747 issubnormal -0.000001 -> 0 +bool1748 issubnormal 0.001 -> 0 +bool1749 issubnormal -0.001 -> 0 +bool1750 issubnormal 0.01 -> 0 +bool1751 issubnormal -0.01 -> 0 +bool1752 issubnormal 0.1 -> 0 +bool1753 issubnormal -0.1 -> 0 +bool1754 issubnormal 1 -> 0 +bool1755 issubnormal -1 -> 0 +bool1756 issubnormal 1E+1 -> 0 +bool1757 issubnormal -1E+1 -> 0 +bool1758 issubnormal 1E+2 -> 0 +bool1759 issubnormal -1E+2 -> 0 +bool1760 issubnormal 1E+3 -> 0 +bool1761 issubnormal -1E+3 -> 0 +bool1762 issubnormal 1E+6 -> 0 +bool1763 issubnormal -1E+6 -> 0 +bool1764 issubnormal 1E+100 -> 0 +bool1765 issubnormal -1E+100 -> 0 +bool1766 issubnormal 1E+990 -> 0 +bool1767 issubnormal -1E+990 -> 0 +bool1768 issubnormal 1E+991 -> 0 +bool1769 issubnormal -1E+991 -> 0 +bool1770 issubnormal 1E+992 -> 0 +bool1771 issubnormal -1E+992 -> 0 +bool1772 issubnormal 1E+998 -> 0 +bool1773 issubnormal -1E+998 -> 0 +bool1774 issubnormal 1E+999 -> 0 +bool1775 issubnormal -1E+999 -> 0 +bool1776 issubnormal 1E+1000 -> 0 +bool1777 issubnormal -1E+1000 -> 0 +bool1778 issubnormal 1E+2000 -> 0 +bool1779 issubnormal -1E+2000 -> 0 +bool1780 issubnormal 9E-2000 -> 1 +bool1781 issubnormal -9E-2000 -> 1 +bool1782 issubnormal 9E-1008 -> 1 +bool1783 issubnormal -9E-1008 -> 1 +bool1784 issubnormal 9E-1007 -> 1 +bool1785 issubnormal -9E-1007 -> 1 +bool1786 issubnormal 9E-1006 -> 1 +bool1787 issubnormal -9E-1006 -> 1 +bool1788 issubnormal 9E-1000 -> 1 +bool1789 issubnormal -9E-1000 -> 1 +bool1790 issubnormal 9E-999 -> 0 +bool1791 issubnormal -9E-999 -> 0 +bool1792 issubnormal 9E-998 -> 0 +bool1793 issubnormal -9E-998 -> 0 +bool1794 issubnormal 9E-100 -> 0 +bool1795 issubnormal -9E-100 -> 0 +bool1796 issubnormal 0.000009 -> 0 +bool1797 issubnormal -0.000009 -> 0 +bool1798 issubnormal 0.009 -> 0 +bool1799 issubnormal -0.009 -> 0 +bool1800 issubnormal 0.09 -> 0 +bool1801 issubnormal -0.09 -> 0 +bool1802 issubnormal 0.9 -> 0 +bool1803 issubnormal -0.9 -> 0 +bool1804 issubnormal 9 -> 0 +bool1805 issubnormal -9 -> 0 +bool1806 issubnormal 9E+1 -> 0 +bool1807 issubnormal -9E+1 -> 0 +bool1808 issubnormal 9E+2 -> 0 +bool1809 issubnormal -9E+2 -> 0 +bool1810 issubnormal 9E+3 -> 0 +bool1811 issubnormal -9E+3 -> 0 +bool1812 issubnormal 9E+6 -> 0 +bool1813 issubnormal -9E+6 -> 0 +bool1814 issubnormal 9E+100 -> 0 +bool1815 issubnormal -9E+100 -> 0 +bool1816 issubnormal 9E+990 -> 0 +bool1817 issubnormal -9E+990 -> 0 +bool1818 issubnormal 9E+991 -> 0 +bool1819 issubnormal -9E+991 -> 0 +bool1820 issubnormal 9E+992 -> 0 +bool1821 issubnormal -9E+992 -> 0 +bool1822 issubnormal 9E+998 -> 0 +bool1823 issubnormal -9E+998 -> 0 +bool1824 issubnormal 9E+999 -> 0 +bool1825 issubnormal -9E+999 -> 0 +bool1826 issubnormal 9E+1000 -> 0 +bool1827 issubnormal -9E+1000 -> 0 +bool1828 issubnormal 9E+2000 -> 0 +bool1829 issubnormal -9E+2000 -> 0 +bool1830 issubnormal 9.99999999E-2000 -> 1 +bool1831 issubnormal -9.99999999E-2000 -> 1 +bool1832 issubnormal 9.99999999E-1008 -> 1 +bool1833 issubnormal -9.99999999E-1008 -> 1 +bool1834 issubnormal 9.99999999E-1007 -> 1 +bool1835 issubnormal -9.99999999E-1007 -> 1 +bool1836 issubnormal 9.99999999E-1006 -> 1 +bool1837 issubnormal -9.99999999E-1006 -> 1 +bool1838 issubnormal 9.99999999E-1000 -> 1 +bool1839 issubnormal -9.99999999E-1000 -> 1 +bool1840 issubnormal 9.99999999E-999 -> 0 +bool1841 issubnormal -9.99999999E-999 -> 0 +bool1842 issubnormal 9.99999999E-998 -> 0 +bool1843 issubnormal -9.99999999E-998 -> 0 +bool1844 issubnormal 9.99999999E-100 -> 0 +bool1845 issubnormal -9.99999999E-100 -> 0 +bool1846 issubnormal 0.00000999999999 -> 0 +bool1847 issubnormal -0.00000999999999 -> 0 +bool1848 issubnormal 0.00999999999 -> 0 +bool1849 issubnormal -0.00999999999 -> 0 +bool1850 issubnormal 0.0999999999 -> 0 +bool1851 issubnormal -0.0999999999 -> 0 +bool1852 issubnormal 0.999999999 -> 0 +bool1853 issubnormal -0.999999999 -> 0 +bool1854 issubnormal 9.99999999 -> 0 +bool1855 issubnormal -9.99999999 -> 0 +bool1856 issubnormal 99.9999999 -> 0 +bool1857 issubnormal -99.9999999 -> 0 +bool1858 issubnormal 999.999999 -> 0 +bool1859 issubnormal -999.999999 -> 0 +bool1860 issubnormal 9999.99999 -> 0 +bool1861 issubnormal -9999.99999 -> 0 +bool1862 issubnormal 9999999.99 -> 0 +bool1863 issubnormal -9999999.99 -> 0 +bool1864 issubnormal 9.99999999E+100 -> 0 +bool1865 issubnormal -9.99999999E+100 -> 0 +bool1866 issubnormal 9.99999999E+990 -> 0 +bool1867 issubnormal -9.99999999E+990 -> 0 +bool1868 issubnormal 9.99999999E+991 -> 0 +bool1869 issubnormal -9.99999999E+991 -> 0 +bool1870 issubnormal 9.99999999E+992 -> 0 +bool1871 issubnormal -9.99999999E+992 -> 0 +bool1872 issubnormal 9.99999999E+998 -> 0 +bool1873 issubnormal -9.99999999E+998 -> 0 +bool1874 issubnormal 9.99999999E+999 -> 0 +bool1875 issubnormal -9.99999999E+999 -> 0 +bool1876 issubnormal 9.99999999E+1000 -> 0 +bool1877 issubnormal -9.99999999E+1000 -> 0 +bool1878 issubnormal 9.99999999E+2000 -> 0 +bool1879 issubnormal -9.99999999E+2000 -> 0 +bool1880 issubnormal Infinity -> 0 +bool1881 issubnormal -Infinity -> 0 +bool1882 issubnormal NaN -> 0 +bool1883 issubnormal -NaN -> 0 +bool1884 issubnormal NaN123 -> 0 +bool1885 issubnormal -NaN123 -> 0 +bool1886 issubnormal sNaN -> 0 +bool1887 issubnormal -sNaN -> 0 +bool1888 issubnormal sNaN123 -> 0 +bool1889 issubnormal -sNaN123 -> 0 +bool1890 iszero 0E-2000 -> 1 +bool1891 iszero -0E-2000 -> 1 +bool1892 iszero 0E-1008 -> 1 +bool1893 iszero -0E-1008 -> 1 +bool1894 iszero 0E-1007 -> 1 +bool1895 iszero -0E-1007 -> 1 +bool1896 iszero 0E-1006 -> 1 +bool1897 iszero -0E-1006 -> 1 +bool1898 iszero 0E-1000 -> 1 +bool1899 iszero -0E-1000 -> 1 +bool1900 iszero 0E-999 -> 1 +bool1901 iszero -0E-999 -> 1 +bool1902 iszero 0E-998 -> 1 +bool1903 iszero -0E-998 -> 1 +bool1904 iszero 0E-100 -> 1 +bool1905 iszero -0E-100 -> 1 +bool1906 iszero 0.000000 -> 1 +bool1907 iszero -0.000000 -> 1 +bool1908 iszero 0.000 -> 1 +bool1909 iszero -0.000 -> 1 +bool1910 iszero 0.00 -> 1 +bool1911 iszero -0.00 -> 1 +bool1912 iszero 0.0 -> 1 +bool1913 iszero -0.0 -> 1 +bool1914 iszero 0 -> 1 +bool1915 iszero -0 -> 1 +bool1916 iszero 0E+1 -> 1 +bool1917 iszero -0E+1 -> 1 +bool1918 iszero 0E+2 -> 1 +bool1919 iszero -0E+2 -> 1 +bool1920 iszero 0E+3 -> 1 +bool1921 iszero -0E+3 -> 1 +bool1922 iszero 0E+6 -> 1 +bool1923 iszero -0E+6 -> 1 +bool1924 iszero 0E+100 -> 1 +bool1925 iszero -0E+100 -> 1 +bool1926 iszero 0E+990 -> 1 +bool1927 iszero -0E+990 -> 1 +bool1928 iszero 0E+991 -> 1 +bool1929 iszero -0E+991 -> 1 +bool1930 iszero 0E+992 -> 1 +bool1931 iszero -0E+992 -> 1 +bool1932 iszero 0E+998 -> 1 +bool1933 iszero -0E+998 -> 1 +bool1934 iszero 0E+999 -> 1 +bool1935 iszero -0E+999 -> 1 +bool1936 iszero 0E+1000 -> 1 +bool1937 iszero -0E+1000 -> 1 +bool1938 iszero 0E+2000 -> 1 +bool1939 iszero -0E+2000 -> 1 +bool1940 iszero 1E-2000 -> 0 +bool1941 iszero -1E-2000 -> 0 +bool1942 iszero 1E-1008 -> 0 +bool1943 iszero -1E-1008 -> 0 +bool1944 iszero 1E-1007 -> 0 +bool1945 iszero -1E-1007 -> 0 +bool1946 iszero 1E-1006 -> 0 +bool1947 iszero -1E-1006 -> 0 +bool1948 iszero 1E-1000 -> 0 +bool1949 iszero -1E-1000 -> 0 +bool1950 iszero 1E-999 -> 0 +bool1951 iszero -1E-999 -> 0 +bool1952 iszero 1E-998 -> 0 +bool1953 iszero -1E-998 -> 0 +bool1954 iszero 1E-100 -> 0 +bool1955 iszero -1E-100 -> 0 +bool1956 iszero 0.000001 -> 0 +bool1957 iszero -0.000001 -> 0 +bool1958 iszero 0.001 -> 0 +bool1959 iszero -0.001 -> 0 +bool1960 iszero 0.01 -> 0 +bool1961 iszero -0.01 -> 0 +bool1962 iszero 0.1 -> 0 +bool1963 iszero -0.1 -> 0 +bool1964 iszero 1 -> 0 +bool1965 iszero -1 -> 0 +bool1966 iszero 1E+1 -> 0 +bool1967 iszero -1E+1 -> 0 +bool1968 iszero 1E+2 -> 0 +bool1969 iszero -1E+2 -> 0 +bool1970 iszero 1E+3 -> 0 +bool1971 iszero -1E+3 -> 0 +bool1972 iszero 1E+6 -> 0 +bool1973 iszero -1E+6 -> 0 +bool1974 iszero 1E+100 -> 0 +bool1975 iszero -1E+100 -> 0 +bool1976 iszero 1E+990 -> 0 +bool1977 iszero -1E+990 -> 0 +bool1978 iszero 1E+991 -> 0 +bool1979 iszero -1E+991 -> 0 +bool1980 iszero 1E+992 -> 0 +bool1981 iszero -1E+992 -> 0 +bool1982 iszero 1E+998 -> 0 +bool1983 iszero -1E+998 -> 0 +bool1984 iszero 1E+999 -> 0 +bool1985 iszero -1E+999 -> 0 +bool1986 iszero 1E+1000 -> 0 +bool1987 iszero -1E+1000 -> 0 +bool1988 iszero 1E+2000 -> 0 +bool1989 iszero -1E+2000 -> 0 +bool1990 iszero 9E-2000 -> 0 +bool1991 iszero -9E-2000 -> 0 +bool1992 iszero 9E-1008 -> 0 +bool1993 iszero -9E-1008 -> 0 +bool1994 iszero 9E-1007 -> 0 +bool1995 iszero -9E-1007 -> 0 +bool1996 iszero 9E-1006 -> 0 +bool1997 iszero -9E-1006 -> 0 +bool1998 iszero 9E-1000 -> 0 +bool1999 iszero -9E-1000 -> 0 +bool2000 iszero 9E-999 -> 0 +bool2001 iszero -9E-999 -> 0 +bool2002 iszero 9E-998 -> 0 +bool2003 iszero -9E-998 -> 0 +bool2004 iszero 9E-100 -> 0 +bool2005 iszero -9E-100 -> 0 +bool2006 iszero 0.000009 -> 0 +bool2007 iszero -0.000009 -> 0 +bool2008 iszero 0.009 -> 0 +bool2009 iszero -0.009 -> 0 +bool2010 iszero 0.09 -> 0 +bool2011 iszero -0.09 -> 0 +bool2012 iszero 0.9 -> 0 +bool2013 iszero -0.9 -> 0 +bool2014 iszero 9 -> 0 +bool2015 iszero -9 -> 0 +bool2016 iszero 9E+1 -> 0 +bool2017 iszero -9E+1 -> 0 +bool2018 iszero 9E+2 -> 0 +bool2019 iszero -9E+2 -> 0 +bool2020 iszero 9E+3 -> 0 +bool2021 iszero -9E+3 -> 0 +bool2022 iszero 9E+6 -> 0 +bool2023 iszero -9E+6 -> 0 +bool2024 iszero 9E+100 -> 0 +bool2025 iszero -9E+100 -> 0 +bool2026 iszero 9E+990 -> 0 +bool2027 iszero -9E+990 -> 0 +bool2028 iszero 9E+991 -> 0 +bool2029 iszero -9E+991 -> 0 +bool2030 iszero 9E+992 -> 0 +bool2031 iszero -9E+992 -> 0 +bool2032 iszero 9E+998 -> 0 +bool2033 iszero -9E+998 -> 0 +bool2034 iszero 9E+999 -> 0 +bool2035 iszero -9E+999 -> 0 +bool2036 iszero 9E+1000 -> 0 +bool2037 iszero -9E+1000 -> 0 +bool2038 iszero 9E+2000 -> 0 +bool2039 iszero -9E+2000 -> 0 +bool2040 iszero 9.99999999E-2000 -> 0 +bool2041 iszero -9.99999999E-2000 -> 0 +bool2042 iszero 9.99999999E-1008 -> 0 +bool2043 iszero -9.99999999E-1008 -> 0 +bool2044 iszero 9.99999999E-1007 -> 0 +bool2045 iszero -9.99999999E-1007 -> 0 +bool2046 iszero 9.99999999E-1006 -> 0 +bool2047 iszero -9.99999999E-1006 -> 0 +bool2048 iszero 9.99999999E-1000 -> 0 +bool2049 iszero -9.99999999E-1000 -> 0 +bool2050 iszero 9.99999999E-999 -> 0 +bool2051 iszero -9.99999999E-999 -> 0 +bool2052 iszero 9.99999999E-998 -> 0 +bool2053 iszero -9.99999999E-998 -> 0 +bool2054 iszero 9.99999999E-100 -> 0 +bool2055 iszero -9.99999999E-100 -> 0 +bool2056 iszero 0.00000999999999 -> 0 +bool2057 iszero -0.00000999999999 -> 0 +bool2058 iszero 0.00999999999 -> 0 +bool2059 iszero -0.00999999999 -> 0 +bool2060 iszero 0.0999999999 -> 0 +bool2061 iszero -0.0999999999 -> 0 +bool2062 iszero 0.999999999 -> 0 +bool2063 iszero -0.999999999 -> 0 +bool2064 iszero 9.99999999 -> 0 +bool2065 iszero -9.99999999 -> 0 +bool2066 iszero 99.9999999 -> 0 +bool2067 iszero -99.9999999 -> 0 +bool2068 iszero 999.999999 -> 0 +bool2069 iszero -999.999999 -> 0 +bool2070 iszero 9999.99999 -> 0 +bool2071 iszero -9999.99999 -> 0 +bool2072 iszero 9999999.99 -> 0 +bool2073 iszero -9999999.99 -> 0 +bool2074 iszero 9.99999999E+100 -> 0 +bool2075 iszero -9.99999999E+100 -> 0 +bool2076 iszero 9.99999999E+990 -> 0 +bool2077 iszero -9.99999999E+990 -> 0 +bool2078 iszero 9.99999999E+991 -> 0 +bool2079 iszero -9.99999999E+991 -> 0 +bool2080 iszero 9.99999999E+992 -> 0 +bool2081 iszero -9.99999999E+992 -> 0 +bool2082 iszero 9.99999999E+998 -> 0 +bool2083 iszero -9.99999999E+998 -> 0 +bool2084 iszero 9.99999999E+999 -> 0 +bool2085 iszero -9.99999999E+999 -> 0 +bool2086 iszero 9.99999999E+1000 -> 0 +bool2087 iszero -9.99999999E+1000 -> 0 +bool2088 iszero 9.99999999E+2000 -> 0 +bool2089 iszero -9.99999999E+2000 -> 0 +bool2090 iszero Infinity -> 0 +bool2091 iszero -Infinity -> 0 +bool2092 iszero NaN -> 0 +bool2093 iszero -NaN -> 0 +bool2094 iszero NaN123 -> 0 +bool2095 iszero -NaN123 -> 0 +bool2096 iszero sNaN -> 0 +bool2097 iszero -sNaN -> 0 +bool2098 iszero sNaN123 -> 0 +bool2099 iszero -sNaN123 -> 0 + ------------------------------------------------------------------------ -- The following tests (pwmx0 through pwmx440) are for the -- -- three-argument version of power: -- diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index d126854..d612022 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -1105,6 +1105,7 @@ _expectations = { _expectations['freebsd5'] = _expectations['freebsd4'] _expectations['freebsd6'] = _expectations['freebsd4'] _expectations['freebsd7'] = _expectations['freebsd4'] +_expectations['freebsd8'] = _expectations['freebsd4'] class _ExpectedSkips: def __init__(self): diff --git a/Lib/test/test_bufio.py b/Lib/test/test_bufio.py index 84d772e..804a401 100644 --- a/Lib/test/test_bufio.py +++ b/Lib/test/test_bufio.py @@ -13,6 +13,9 @@ class BufferSizeTest(unittest.TestCase): # Write s + "\n" + s to file, then open it and ensure that successive # .readline()s deliver what we wrote. + # Ensure we can open TESTFN for writing. + test_support.unlink(test_support.TESTFN) + # Since C doesn't guarantee we can write/read arbitrary bytes in text # files, use binary mode. f = open(test_support.TESTFN, "wb") @@ -31,11 +34,7 @@ class BufferSizeTest(unittest.TestCase): self.assert_(not line) # Must be at EOF f.close() finally: - try: - import os - os.unlink(test_support.TESTFN) - except: - pass + test_support.unlink(test_support.TESTFN) def drive_one(self, pattern): for length in lengths: diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py index 568e682..f92eb6f 100644 --- a/Lib/test/test_collections.py +++ b/Lib/test/test_collections.py @@ -2,7 +2,7 @@ import unittest from test import test_support -from collections import NamedTuple +from collections import namedtuple from collections import Hashable, Iterable, Iterator from collections import Sized, Container, Callable from collections import Set, MutableSet @@ -13,18 +13,27 @@ from collections import Sequence, MutableSequence class TestNamedTuple(unittest.TestCase): def test_factory(self): - Point = NamedTuple('Point', 'x y') + Point = namedtuple('Point', 'x y') self.assertEqual(Point.__name__, 'Point') self.assertEqual(Point.__doc__, 'Point(x, y)') self.assertEqual(Point.__slots__, ()) self.assertEqual(Point.__module__, __name__) self.assertEqual(Point.__getitem__, tuple.__getitem__) - self.assertRaises(ValueError, NamedTuple, 'abc%', 'def ghi') - self.assertRaises(ValueError, NamedTuple, 'abc', 'def g%hi') - NamedTuple('Point0', 'x1 y2') # Verify that numbers are allowed in names + + self.assertRaises(ValueError, namedtuple, 'abc%', 'efg ghi') # type has non-alpha char + self.assertRaises(ValueError, namedtuple, 'class', 'efg ghi') # type has keyword + self.assertRaises(ValueError, namedtuple, '9abc', 'efg ghi') # type starts with digit + + self.assertRaises(ValueError, namedtuple, 'abc', 'efg g%hi') # field with non-alpha char + self.assertRaises(ValueError, namedtuple, 'abc', 'abc class') # field has keyword + self.assertRaises(ValueError, namedtuple, 'abc', '8efg 9ghi') # field starts with digit + self.assertRaises(ValueError, namedtuple, 'abc', '__efg__ ghi') # field with double underscores + self.assertRaises(ValueError, namedtuple, 'abc', 'efg efg ghi') # duplicate field + + namedtuple('Point0', 'x1 y2') # Verify that numbers are allowed in names def test_instance(self): - Point = NamedTuple('Point', 'x y') + Point = namedtuple('Point', 'x y') p = Point(11, 22) self.assertEqual(p, Point(x=11, y=22)) self.assertEqual(p, Point(11, y=22)) @@ -40,14 +49,20 @@ class TestNamedTuple(unittest.TestCase): self.assert_('__weakref__' not in dir(p)) self.assertEqual(p.__fields__, ('x', 'y')) # test __fields__ attribute self.assertEqual(p.__replace__('x', 1), (1, 22)) # test __replace__ method + self.assertEqual(p.__asdict__(), dict(x=11, y=22)) # test __dict__ method # verify that field string can have commas - Point = NamedTuple('Point', 'x, y') + Point = namedtuple('Point', 'x, y') + p = Point(x=11, y=22) + self.assertEqual(repr(p), 'Point(x=11, y=22)') + + # verify that fieldspec can be a non-string sequence + Point = namedtuple('Point', ('x', 'y')) p = Point(x=11, y=22) self.assertEqual(repr(p), 'Point(x=11, y=22)') def test_tupleness(self): - Point = NamedTuple('Point', 'x y') + Point = namedtuple('Point', 'x y') p = Point(11, 22) self.assert_(isinstance(p, tuple)) @@ -66,9 +81,9 @@ class TestNamedTuple(unittest.TestCase): self.assertRaises(AttributeError, eval, 'p.z', locals()) def test_odd_sizes(self): - Zero = NamedTuple('Zero', '') + Zero = namedtuple('Zero', '') self.assertEqual(Zero(), ()) - Dot = NamedTuple('Dot', 'd') + Dot = namedtuple('Dot', 'd') self.assertEqual(Dot(1), (1,)) diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 513ba16..98b9479 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -95,35 +95,61 @@ RoundingDict = {'ceiling' : ROUND_CEILING, #Maps test-case names to roundings. # Name adapter to be able to change the Decimal and Context # interface without changing the test files from Cowlishaw -nameAdapter = {'toeng':'to_eng_string', - 'tosci':'to_sci_string', - 'samequantum':'same_quantum', - 'tointegral':'to_integral_value', - 'tointegralx':'to_integral_exact', - 'remaindernear':'remainder_near', - 'divideint':'divide_int', - 'squareroot':'sqrt', +nameAdapter = {'and':'logical_and', 'apply':'_apply', 'class':'number_class', 'comparesig':'compare_signal', 'comparetotal':'compare_total', 'comparetotmag':'compare_total_mag', - 'copyabs':'copy_abs', 'copy':'copy_decimal', + 'copyabs':'copy_abs', 'copynegate':'copy_negate', 'copysign':'copy_sign', - 'and':'logical_and', - 'or':'logical_or', - 'xor':'logical_xor', + 'divideint':'divide_int', 'invert':'logical_invert', + 'iscanonical':'is_canonical', + 'isfinite':'is_finite', + 'isinfinite':'is_infinite', + 'isnan':'is_nan', + 'isnormal':'is_normal', + 'isqnan':'is_qnan', + 'issigned':'is_signed', + 'issnan':'is_snan', + 'issubnormal':'is_subnormal', + 'iszero':'is_zero', 'maxmag':'max_mag', 'minmag':'min_mag', 'nextminus':'next_minus', 'nextplus':'next_plus', 'nexttoward':'next_toward', + 'or':'logical_or', 'reduce':'normalize', + 'remaindernear':'remainder_near', + 'samequantum':'same_quantum', + 'squareroot':'sqrt', + 'toeng':'to_eng_string', + 'tointegral':'to_integral_value', + 'tointegralx':'to_integral_exact', + 'tosci':'to_sci_string', + 'xor':'logical_xor', } +# The following functions return True/False rather than a Decimal instance + +LOGICAL_FUNCTIONS = ( + 'is_canonical', + 'is_finite', + 'is_infinite', + 'is_nan', + 'is_normal', + 'is_qnan', + 'is_signed', + 'is_snan', + 'is_subnormal', + 'is_zero', + 'same_quantum', + ) + # For some operations (currently exp, ln, log10, power), the decNumber # reference implementation imposes additional restrictions on the # context and operands. These restrictions are not part of the @@ -321,7 +347,7 @@ class DecimalTest(unittest.TestCase): print("--", self.context) try: result = str(funct(*vals)) - if fname == 'same_quantum': + if fname in LOGICAL_FUNCTIONS: result = str(int(eval(result))) # 'True', 'False' -> '1', '0' except Signals as error: self.fail("Raised %s in %s" % (error, s)) @@ -426,13 +452,18 @@ class DecimalExplicitConstructionTest(unittest.TestCase): #bad sign self.assertRaises(ValueError, Decimal, (8, (4, 3, 4, 9, 1), 2) ) + self.assertRaises(ValueError, Decimal, (0., (4, 3, 4, 9, 1), 2) ) + self.assertRaises(ValueError, Decimal, (Decimal(1), (4, 3, 4, 9, 1), 2)) #bad exp self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 9, 1), 'wrong!') ) + self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 9, 1), 0.) ) + self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, 9, 1), '1') ) #bad coefficients self.assertRaises(ValueError, Decimal, (1, (4, 3, 4, None, 1), 2) ) self.assertRaises(ValueError, Decimal, (1, (4, -3, 4, 9, 1), 2) ) + self.assertRaises(ValueError, Decimal, (1, (4, 10, 4, 9, 1), 2) ) def test_explicit_from_Decimal(self): @@ -1025,6 +1056,28 @@ class DecimalUsabilityTest(unittest.TestCase): d = Decimal("Infinity") self.assertEqual(d.as_tuple(), (0, (0,), 'F') ) + #leading zeros in coefficient should be stripped + d = Decimal( (0, (0, 0, 4, 0, 5, 3, 4), -2) ) + self.assertEqual(d.as_tuple(), (0, (4, 0, 5, 3, 4), -2) ) + d = Decimal( (1, (0, 0, 0), 37) ) + self.assertEqual(d.as_tuple(), (1, (0,), 37)) + d = Decimal( (1, (), 37) ) + self.assertEqual(d.as_tuple(), (1, (0,), 37)) + + #leading zeros in NaN diagnostic info should be stripped + d = Decimal( (0, (0, 0, 4, 0, 5, 3, 4), 'n') ) + self.assertEqual(d.as_tuple(), (0, (4, 0, 5, 3, 4), 'n') ) + d = Decimal( (1, (0, 0, 0), 'N') ) + self.assertEqual(d.as_tuple(), (1, (), 'N') ) + d = Decimal( (1, (), 'n') ) + self.assertEqual(d.as_tuple(), (1, (), 'n') ) + + #coefficient in infinity should be ignored + d = Decimal( (0, (4, 5, 3, 4), 'F') ) + self.assertEqual(d.as_tuple(), (0, (0,), 'F')) + d = Decimal( (1, (0, 2, 7, 1), 'F') ) + self.assertEqual(d.as_tuple(), (1, (0,), 'F')) + def test_immutability_operations(self): # Do operations and check that it didn't change change internal objects. diff --git a/Lib/test/test_deque.py b/Lib/test/test_deque.py index d51a865..890378e 100644 --- a/Lib/test/test_deque.py +++ b/Lib/test/test_deque.py @@ -47,6 +47,26 @@ class TestBasic(unittest.TestCase): self.assertEqual(right, list(range(150, 400))) self.assertEqual(list(d), list(range(50, 150))) + def test_maxlen(self): + self.assertRaises(ValueError, deque, 'abc', -1) + self.assertRaises(ValueError, deque, 'abc', -2) + d = deque(range(10), maxlen=3) + self.assertEqual(repr(d), 'deque([7, 8, 9], maxlen=3)') + self.assertEqual(list(d), [7, 8, 9]) + self.assertEqual(d, deque(range(10), 3)) + d.append(10) + self.assertEqual(list(d), [8, 9, 10]) + d.appendleft(7) + self.assertEqual(list(d), [7, 8, 9]) + d.extend([10, 11]) + self.assertEqual(list(d), [9, 10, 11]) + d.extendleft([8, 7]) + self.assertEqual(list(d), [7, 8, 9]) + d = deque(range(200), maxlen=10) + d.append(d) + d = deque(range(10), maxlen=None) + self.assertEqual(repr(d), 'deque([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])') + def test_comparisons(self): d = deque('xabc'); d.popleft() for e in [d, deque('abc'), deque('ab'), deque(), list(d)]: @@ -254,7 +274,7 @@ class TestBasic(unittest.TestCase): os.remove(test_support.TESTFN) def test_init(self): - self.assertRaises(TypeError, deque, 'abc', 2); + self.assertRaises(TypeError, deque, 'abc', 2, 3); self.assertRaises(TypeError, deque, 1); def test_hash(self): @@ -340,13 +360,13 @@ class TestBasic(unittest.TestCase): self.assertNotEqual(id(d), id(e)) self.assertEqual(list(d), list(e)) - def test_pickle_recursive(self): - d = deque('abc') - d.append(d) - for i in (0, 1, 2): - e = pickle.loads(pickle.dumps(d, i)) - self.assertNotEqual(id(d), id(e)) - self.assertEqual(id(e), id(e[-1])) +## def test_pickle_recursive(self): +## d = deque('abc') +## d.append(d) +## for i in (0, 1, 2): +## e = pickle.loads(pickle.dumps(d, i)) +## self.assertNotEqual(id(d), id(e)) +## self.assertEqual(id(e), id(e[-1])) def test_deepcopy(self): mut = [10] @@ -452,24 +472,40 @@ class TestSubclass(unittest.TestCase): self.assertEqual(type(d), type(e)) self.assertEqual(list(d), list(e)) - def test_pickle(self): - d = Deque('abc') - d.append(d) + d = Deque('abcde', maxlen=4) - e = pickle.loads(pickle.dumps(d)) - self.assertNotEqual(id(d), id(e)) + e = d.__copy__() self.assertEqual(type(d), type(e)) - dd = d.pop() - ee = e.pop() - self.assertEqual(id(e), id(ee)) - self.assertEqual(d, e) + self.assertEqual(list(d), list(e)) + + e = Deque(d) + self.assertEqual(type(d), type(e)) + self.assertEqual(list(d), list(e)) - d.x = d - e = pickle.loads(pickle.dumps(d)) - self.assertEqual(id(e), id(e.x)) + s = pickle.dumps(d) + e = pickle.loads(s) + self.assertNotEqual(id(d), id(e)) + self.assertEqual(type(d), type(e)) + self.assertEqual(list(d), list(e)) - d = DequeWithBadIter('abc') - self.assertRaises(TypeError, pickle.dumps, d) +## def test_pickle(self): +## d = Deque('abc') +## d.append(d) +## +## e = pickle.loads(pickle.dumps(d)) +## self.assertNotEqual(id(d), id(e)) +## self.assertEqual(type(d), type(e)) +## dd = d.pop() +## ee = e.pop() +## self.assertEqual(id(e), id(ee)) +## self.assertEqual(d, e) +## +## d.x = d +## e = pickle.loads(pickle.dumps(d)) +## self.assertEqual(id(e), id(e.x)) +## +## d = DequeWithBadIter('abc') +## self.assertRaises(TypeError, pickle.dumps, d) def test_weakref(self): d = deque('gallahad') diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py index f544f1f..870876d 100755 --- a/Lib/test/test_fcntl.py +++ b/Lib/test/test_fcntl.py @@ -23,7 +23,7 @@ if sys.platform.startswith('atheos'): if sys.platform in ('netbsd1', 'netbsd2', 'netbsd3', 'Darwin1.2', 'darwin', 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', - 'freebsd6', 'freebsd7', + 'freebsd6', 'freebsd7', 'freebsd8', 'bsdos2', 'bsdos3', 'bsdos4', 'openbsd', 'openbsd2', 'openbsd3', 'openbsd4'): if struct.calcsize('l') == 8: diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index 9abeb61..2216a99 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -83,13 +83,25 @@ class BasicTest(TestCase): resp = httplib.HTTPResponse(sock) resp.begin() self.assertEqual(resp.read(), b"Text") - resp.close() + self.assertTrue(resp.isclosed()) body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock) self.assertRaises(httplib.BadStatusLine, resp.begin) + def test_partial_reads(self): + # if we have a lenght, the system knows when to close itself + # same behaviour than when we read the whole thing with read() + body = "HTTP/1.1 200 Ok\r\nContent-Length: 4\r\n\r\nText" + sock = FakeSocket(body) + resp = httplib.HTTPResponse(sock) + resp.begin() + self.assertEqual(resp.read(2), b'Te') + self.assertFalse(resp.isclosed()) + self.assertEqual(resp.read(2), b'xt') + self.assertTrue(resp.isclosed()) + def test_host_port(self): # Check invalid host_port @@ -135,7 +147,6 @@ class BasicTest(TestCase): resp.begin() if resp.read(): self.fail("Did not expect response from HEAD request") - resp.close() def test_send_file(self): expected = (b'GET /foo HTTP/1.1\r\nHost: example.com\r\n' diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index e3728d8..81e2e8e 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -55,9 +55,14 @@ class TestBasicOps(unittest.TestCase): self.assertEqual(lzip('abc',count()), [('a', 0), ('b', 1), ('c', 2)]) self.assertEqual(lzip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)]) self.assertEqual(take(2, lzip('abc',count(3))), [('a', 3), ('b', 4)]) + self.assertEqual(take(2, zip('abc',count(-1))), [('a', -1), ('b', 0)]) + self.assertEqual(take(2, zip('abc',count(-3))), [('a', -3), ('b', -2)]) self.assertRaises(TypeError, count, 2, 3) self.assertRaises(TypeError, count, 'a') - self.assertRaises(OverflowError, list, islice(count(maxsize-5), 10)) + self.assertEqual(list(islice(count(maxsize-5), 10)), + list(range(maxsize-5, maxsize+5))) + self.assertEqual(list(islice(count(-maxsize-5), 10)), + list(range(-maxsize-5, -maxsize+5))) c = count(3) self.assertEqual(repr(c), 'count(3)') next(c) @@ -66,6 +71,11 @@ class TestBasicOps(unittest.TestCase): self.assertEqual(repr(c), 'count(-9)') next(c) self.assertEqual(next(c), -8) + for i in (-sys.maxint-5, -sys.maxint+5 ,-10, -1, 0, 10, sys.maxint-5, sys.maxint+5): + # Test repr (ignoring the L in longs) + r1 = repr(count(i)).replace('L', '') + r2 = 'count(%r)'.__mod__(i).replace('L', '') + self.assertEqual(r1, r2) def test_cycle(self): self.assertEqual(take(10, cycle('abc')), list('abcabcabca')) diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py index f7f561a..2afb3e9 100644 --- a/Lib/test/test_list.py +++ b/Lib/test/test_list.py @@ -1,4 +1,5 @@ import unittest +import sys from test import test_support, list_tests class ListTest(list_tests.CommonTest): @@ -18,6 +19,14 @@ class ListTest(list_tests.CommonTest): self.assertEqual(len([0]), 1) self.assertEqual(len([0, 1, 2]), 3) + def test_overflow(self): + lst = [4, 5, 6, 7] + n = int((sys.maxint*2+2) // len(lst)) + def mul(a, b): return a * b + def imul(a, b): a *= b + self.assertRaises((MemoryError, OverflowError), mul, lst, n) + self.assertRaises((MemoryError, OverflowError), imul, lst, n) + def test_main(verbose=None): test_support.run_unittest(ListTest) diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index f2232e4..974fde2 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -339,6 +339,50 @@ class MmapTests(unittest.TestCase): m[start:stop:step] = data self.assertEquals(m[:], bytes(L)) + def make_mmap_file (self, f, halfsize): + # Write 2 pages worth of data to the file + f.write (b'\0' * halfsize) + f.write (b'foo') + f.write (b'\0' * (halfsize - 3)) + f.flush () + return mmap.mmap (f.fileno(), 0) + + def test_offset (self): + f = open (TESTFN, 'w+b') + + try: # unlink TESTFN no matter what + halfsize = mmap.ALLOCATIONGRANULARITY + m = self.make_mmap_file (f, halfsize) + m.close () + f.close () + + mapsize = halfsize * 2 + # Try invalid offset + f = open(TESTFN, "r+b") + for offset in [-2, -1, None]: + try: + m = mmap.mmap(f.fileno(), mapsize, offset=offset) + self.assertEqual(0, 1) + except (ValueError, TypeError, OverflowError): + pass + else: + self.assertEqual(0, 0) + f.close() + + # Try valid offset, hopefully 8192 works on all OSes + f = open(TESTFN, "r+b") + m = mmap.mmap(f.fileno(), mapsize - halfsize, offset=halfsize) + self.assertEqual(m[0:3], b'foo') + f.close() + m.close() + + finally: + f.close() + try: + os.unlink(TESTFN) + except OSError: + pass + def test_main(): run_unittest(MmapTests) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 36f148e..82eb6e7 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -338,7 +338,7 @@ class GeneralModuleTests(unittest.TestCase): # I've ordered this by protocols that have both a tcp and udp # protocol, at least for modern Linuxes. if sys.platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', - 'freebsd7', 'darwin'): + 'freebsd7', 'freebsd8', 'darwin'): # avoid the 'echo' service on this platform, as there is an # assumption breaking non-standard port/protocol entry services = ('daytime', 'qotd', 'domain') diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index fb634f6..84f6a51 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -100,10 +100,19 @@ def bind_port(sock, host='', preferred_port=54321): tests and we don't try multiple ports, the test can fails. This makes the test more robust.""" - # some random ports that hopefully no one is listening on. - for port in [preferred_port, 9907, 10243, 32999]: + # Find some random ports that hopefully no one is listening on. + # Ideally each test would clean up after itself and not continue listening + # on any ports. However, this isn't the case. The last port (0) is + # a stop-gap that asks the O/S to assign a port. Whenever the warning + # message below is printed, the test that is listening on the port should + # be fixed to close the socket at the end of the test. + # Another reason why we can't use a port is another process (possibly + # another instance of the test suite) is using the same port. + for port in [preferred_port, 9907, 10243, 32999, 0]: try: sock.bind((host, port)) + if port == 0: + port = sock.getsockname()[1] return port except socket.error as e: (err, msg) = e.args @@ -519,8 +528,7 @@ def _run_suite(suite): elif len(result.failures) == 1 and not result.errors: err = result.failures[0][1] else: - msg = "errors occurred; run in verbose mode for details" - raise TestFailed(msg) + err = "errors occurred; run in verbose mode for details" raise TestFailed(err) diff --git a/Lib/test/test_univnewlines.py b/Lib/test/test_univnewlines.py index 22fd266..c3b7bc4 100644 --- a/Lib/test/test_univnewlines.py +++ b/Lib/test/test_univnewlines.py @@ -93,6 +93,13 @@ class TestCRLFNewlines(TestGenericUnivNewlines): NEWLINE = '\r\n' DATA = DATA_CRLF + def test_tell(self): + fp = open(test_support.TESTFN, self.READMODE) + self.assertEqual(repr(fp.newlines), repr(None)) + data = fp.readline() + pos = fp.tell() + self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + class TestMixedNewlines(TestGenericUnivNewlines): NEWLINE = ('\r', '\n') DATA = DATA_MIXED diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py index a3310a5..13656d6 100644 --- a/Lib/test/test_zlib.py +++ b/Lib/test/test_zlib.py @@ -42,14 +42,18 @@ class ChecksumTestCase(unittest.TestCase): class ExceptionTestCase(unittest.TestCase): # make sure we generate some expected errors - def test_bigbits(self): - # specifying total bits too large causes an error - self.assertRaises(zlib.error, - zlib.compress, 'ERROR', zlib.MAX_WBITS + 1) + def test_badlevel(self): + # specifying compression level out of range causes an error + # (but -1 is Z_DEFAULT_COMPRESSION and apparently the zlib + # accepts 0 too) + self.assertRaises(zlib.error, zlib.compress, 'ERROR', 10) def test_badcompressobj(self): # verify failure on building compress object with bad params self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0) + # specifying total bits too large causes an error + self.assertRaises(ValueError, + zlib.compressobj, 1, zlib.DEFLATED, zlib.MAX_WBITS + 1) def test_baddecompressobj(self): # verify failure on building decompress object with bad params diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py index 0386288..1b857a2 100644 --- a/Lib/xml/dom/minidom.py +++ b/Lib/xml/dom/minidom.py @@ -960,7 +960,7 @@ class CharacterData(Childless, Node): dotdotdot = "..." else: dotdotdot = "" - return "<DOM %s node \"%s%s\">" % ( + return '<DOM %s node "%r%s">' % ( self.__class__.__name__, data[0:10], dotdotdot) def substringData(self, offset, count): |