| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
numbers.
|
|
|
|
| |
divideint and divmod). Thanks Mark Dickinson.
|
|
|
|
|
| |
executed through a subclass (thanks Mark Dickinson).
Added a bit of testing for this.
|
|
|
|
|
|
|
| |
to a bool). Also second argument to watchexp is now converted
to Decimal, just as with all the other two-argument operations.
Thanks Mark Dickinson.
|
|
|
|
|
|
|
| |
fully updated to the latests Decimal Specification (v1.66) and the
latests test cases (v2.56).
Thanks to Mark Dickinson for all his help during this process.
|
|
|
|
| |
better error message, more descriptive. (bug #1770009)
|
|
|
|
| |
You might want to review this change as it's my first time. Be gentle. :-)
|
|
|
|
|
| |
Exceptions now are raised in the new style. And a mockup class is
now also new style. Thanks Santiago Pereson.
|
| |
|
| |
|
|
|
|
| |
decimal.localcontext()
|
|
|
|
| |
module and add unit tests. (python-dev discussion is ongoing regarding what we do about Python 2.5)
|
|
|
|
|
| |
r50697: Comments and docs cleanups, and some little fixes
per recommendation from Raymond Hettinger.
|
| |
|
|
|
|
| |
Peresón
|
| |
|
|
|
|
| |
of all remaining references to context objects that I could find. Without a __context__() method context objects no longer exist. Also get test_with working again, and adopt a suggestion from Neal for decimal.Context.get_manager()
|
|
|
|
|
|
|
|
| |
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
terminology in the alpha 1 documentation.
- "context manager" reverts to its alpha 1 definition
- the term "context specifier" goes away entirely
- contextlib.GeneratorContextManager is renamed GeneratorContext
There are still a number of changes relative to alpha 1:
- the expression in the with statement is explicitly called the
"context expression" in the language reference
- the terms 'with statement context', 'context object' or 'with
statement context' are used in several places instead of a bare
'context'. The aim of this is to avoid ambiguity in relation to the
runtime context set up when the block is executed, and the context
objects that already exist in various application domains (such as
decimal.Context)
- contextlib.contextmanager is renamed to contextfactory
This best reflects the nature of the function resulting from the
use of that decorator
- decimal.ContextManager is renamed to WithStatementContext
Simple dropping the 'Manager' part wasn't possible due to the
fact that decimal.Context already exists and means something
different. WithStatementContext is ugly but workable.
A technically unrelated change snuck into this commit:
contextlib.closing now avoids the overhead of creating a
generator, since it's trivial to implement that particular
context manager directly.
|
|
|
|
|
|
|
| |
Anyway, this is the changes to the with-statement
so that __exit__ must return a true value in order
for a pending exception to be ignored.
The PEP (343) is already updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- New semantics for __exit__() -- it must re-raise the exception
if type is not None; the with-statement itself doesn't do this.
(See the updated PEP for motivation.)
- Added context managers to:
- file
- thread.LockType
- threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
- decimal.Context
- Added contextlib.py, which defines @contextmanager, nested(), closing().
- Unit tests all around; bot no docs yet.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
instead of raising a TypeError. Allows other types to successfully
implement __radd__() style methods.
* Remove future division import from test suite.
* Remove test suite's shadowing of __builtin__.dir().
|
| |
|
| |
|
| |
|
|
|
|
| |
* The decimal module wouldn't load on builds without threads.
|
| |
|
|
|
|
|
|
|
|
| |
(Contributed by Facundo Batista.)
Code simplification by eliminating the unnecessary and error-prone
convolutions for the previously weird sign convention in _WorkRep().
Makes the code more understandable, more reliable, and a bit faster.
|
| |
|
|
|
|
| |
(Contributed by Neal Norwitz. Reviewed by Facundo Bastista.)
|
| |
|
|
|
|
|
| |
Simplify internal calls and logic for _fix() and _fixexponents().
(Contributed by Facundo Batista.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(Contributed by Nick Coghlan.)
Various code cleanups and optimizations (saves about 40% on testsuite
execution time and on the telco benchmark).
* caches results of various operations on self (esp. checks for being
a special value).
* _WorkRep now uses ints and longs for intermediate computations.
|
|
|
|
| |
updates as bugfixes.
|
|
|
|
|
|
|
|
|
|
|
| |
(version 1.45):
The max and min operations follow the rules in the current IEEE 754 revision draft:
if one operand is a quiet NaN and the other is number, then the number is always returned
if both operands are finite and equal in numerical value then an ordering is applied:
if the signs differ then max returns the operand with the positive sign and
min returns the operand with the negative sign; if the signs are the same then
the exponent is used to select the result.
|
|
|
|
| |
* Facilitate reloads of local thread.
|
|
|
|
|
| |
* Protect the pre-defined contexts by using a deepcopy() instead of copy().
* Micro-optimization: prefer x&1 over x%2
|
| |
|
| |
|
|
|
|
|
|
|
| |
by the locals() call in the context constructor.
* Remove unnecessary properties for int, exp, and sign which duplicated
information returned by as_tuple().
|
|
|
|
|
| |
* Context.create_decimal can take a zero default just like Decimal().
* Fix typo in comment.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Rename "trap_enablers" to just "traps".
* Simplify names of "settraps" and "setflags" to just "traps" and "flags".
* Show "capitals" in the context representation
* Simplify the Context constructor to match its repr form so that only
the set flags and traps need to be listed.
* Representation can now be run through eval().
Improve the error message when the Decimal constructor is given a float.
The test suite no longer needs a duplicate reset_flags method.
|
|
|
|
|
|
|
|
| |
public.
* Removed the non-signal conditions from __all__.
* Removed the XXX comment which was resolved.
* Use ^ instead of operator.xor
* Remove the threading lock which is no longer necessary.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Map conditions to related signals.
* Make contexts unhashable.
* Eliminate used "default" attribute in exception definitions.
* Eliminate the _filterfunc in favor of a straight list.
Docs:
* Eliminate documented references to conditions that are not signals.
* Eliminate parenthetical notes such as "1/0 --> Inf" which are no
longer true with the new defaults.
|
| |
|
| |
|