Commit Graph

70 Commits

Author SHA1 Message Date
Stefan Krah 3cedf46cdb bpo-31406: Fix crash due to lack of type checking in subclassing. (#3477) 2017-09-10 18:08:04 +02:00
Stefan Krah c0c29dff79 bpo-31403: Remove WITHOUT_THREADS from _decimal. (#3474) 2017-09-09 19:26:22 +02:00
Angus Hollands 8614b59910 Correct typo (#976) 2017-04-03 18:16:14 +02:00
Serhiy Storchaka 2a404b63d4 Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()
is now of type "const char *" rather of "char *".
2017-01-22 23:07:07 +02:00
Stefan Krah 3c29fd0074 While a speedup of 1% is measurable, contexts aren't created that often,
so let's defer this until 3.7, 3.8, ... all have this new function.
2017-01-09 13:53:32 +01:00
Stefan Krah a40a3f35eb Merge 3.6. 2017-01-09 13:12:09 +01:00
Stefan Krah e660335b7e Merge 3.5. 2017-01-09 13:11:51 +01:00
Stefan Krah 18e0a97a1a Issue #28701: Revert part of 5bdc8e1a50c8 for the following reasons:
- There was no real problem to begin with.

  - The hypothetical problem has been fixed by 5bdc8e1a50c8.
2017-01-09 13:11:27 +01:00
Stefan Krah 45ed522237 Revert part of dbf72357cb4a that is in a rarely used path and causes
maintenance issues (cost/benefit).
2017-01-08 00:08:53 +01:00
Stefan Krah 2b938f84f4 Revert (unauthorized) parts of 54a89144ee1d which are not in a speed-sensitive
path in order to avoid maintenance issues.
2017-01-08 00:02:15 +01:00
Stefan Krah 1b5fa6b7c9 Revert (unauthorized) parts of b9eb35435178 which are not in a speed-sensitive
path and cause maintenance issues (3.6 <-> 3.7, private test suite).
2017-01-07 23:20:27 +01:00
Serhiy Storchaka 5ab81d787f Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of dict. 2016-12-16 16:18:57 +02:00
Victor Stinner 4c38154a43 Don't parenthesis in _PyObject_CallMethodId() format
Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation
a temporary tuple, and so is more efficient.
2016-12-09 00:33:39 +01:00
Victor Stinner a5ed5f000a Use _PyObject_CallNoArg()
Replace:
    PyObject_CallObject(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:45:50 +01:00
Serhiy Storchaka 3b73ea1278 Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:19:20 +02:00
Serhiy Storchaka f4934ea77d Issue #28701: Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:17:58 +02:00
Brett Cannon a721abac29 Issue #26331: Implement the parsing part of PEP 515.
Thanks to Georg Brandl for the patch.
2016-09-09 14:57:09 -07:00
Stefan Krah 243d8a7866 Merge 3.5. 2016-07-17 14:12:59 +02:00
Stefan Krah 8c126f17f0 Issue #26974: Fix segfault in the presence of absurd subclassing. Proactively
eliminate all internal uses of overridden methods.
2016-07-17 14:01:42 +02:00
Stefan Krah 1d245fabaf Merge 3.5. 2016-06-20 14:13:12 +02:00
Stefan Krah 947f099d99 Issue #27006: Do not use PyDec_CheckExact() on a type. 2016-06-20 14:12:52 +02:00
Stefan Krah 8113f490c5 Merge 3.5. 2016-06-20 12:10:42 +02:00
Stefan Krah 6817c59cf0 Issue #27006: from_float(): call the subclass' __new__() and __init__(). 2016-06-20 12:10:13 +02:00
Stefan Krah 8d013a8d36 Issue #26846: Post commit cleanup. 2016-04-26 16:34:41 +02:00
Serhiy Storchaka 59865e7fe1 Issue #26200: Restored more safe usages of Py_SETREF. 2016-04-11 09:57:37 +03:00
Serhiy Storchaka ec39756960 Issue #22570: Renamed Py_SETREF to Py_XSETREF. 2016-04-06 09:50:03 +03:00
Stefan Krah 53f2e0ad45 Issue #25928: Add Decimal.as_integer_ratio(). Python parts and docs by
Mark Dickinson.
2015-12-28 23:02:02 +01:00
Serhiy Storchaka 5c4064e8bd Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Serhiy Storchaka 20b39b27d9 Removed redundant casts to `char *`.
Corresponding functions now accept `const char *` (issue #1772673).
2014-09-28 11:27:24 +03:00
Stefan Krah cf26115651 Introduce and check for MPD_VERSION_HEX for precise management of builds
with an external libmpdec.
2014-08-26 21:31:47 +02:00
Stefan Krah 8fb74a35da Issue #21374: Fix pickling of DecimalTuple. 2014-04-29 18:24:50 +02:00
Benjamin Peterson ce68c19ee7 remove unused zero constants 2014-03-15 11:49:49 -05:00
Stefan Krah 45059eb1d0 1) Prepare libmpdec for the 2.4.0 release. None of the following changes affects
_decimal:

      o Make all "mpd_t to C integer" conversion functions available in both the
        64-bit and the 32-bit versions.

      o Make all mixed mpd_t/C integer arithmetic functions available in the
        32-bit version.

      o Better handling of __STDC_LIMIT_MACROS for C++ users.

      o Add struct tags (at the request of C++ users).

2) Check for libmpdec.so.2 if --with-system-libmpdec is used.
2013-11-24 19:44:57 +01:00
Stefan Krah 2fdf4e7b9b Move PyErr_NoMemory() closer to the failure. 2013-11-08 18:05:02 +01:00
Stefan Krah a0fd1f5a18 Change style to match the surrounding code (no early returns). 2013-11-08 17:48:58 +01:00
Victor Stinner ac470854b8 Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup()
failure (memory allocation failure): raise a MemoryError exception
2013-10-29 20:33:14 +01:00
Victor Stinner a992e11fe3 Issue #19437: Fix convert_op_cmp() of decimal.Decimal rich comparator, handle
PyObject_IsInstance() failure
2013-10-29 19:26:11 +01:00
Stefan Krah 891ca9e06a Backport bff16086f03b and bcaaaa00425b. 2013-05-29 19:14:17 +02:00
Stefan Krah 6edda14b29 Issue #17768: Support newline fill character in decimal.py and NUL fill
character in _decimal.c.
2013-05-29 15:45:38 +02:00
Stefan Krah eb8c451bd2 Since the return type of format() is not a Decimal, raise ValueError instead of
InvalidOperation if the format specification (width, prec) exceeds the internal
limits of libmpdec.
2013-01-24 15:22:33 +01:00
Stefan Krah 59a4a93f43 Issue #16422: Use strings for rounding mode constants for better readability
and pickling compatibility.
2013-01-16 12:58:59 +01:00
Stefan Krah fb7f580e81 Issue #16745: Hide a couple of symbols by making them local. 2012-12-21 23:11:05 +01:00
Stefan Krah 9a4ff437d1 Issue #15783: Support None default values in the Context() constructor. 2012-12-16 21:10:35 +01:00
Stefan Krah 040e311826 Issue #15783: Except for the number methods, the C version of decimal now
supports all None default values present in decimal.py. These values were
largely undocumented.
2012-12-15 22:33:33 +01:00
Stefan Krah 6e467049c6 Accept Unicode legacy strings in the Decimal constructor. 2012-11-10 23:09:04 +01:00
Stefan Krah 0f82b76b57 Issue #16431: Finally, consider all permutations. 2012-11-08 11:17:29 +01:00
Stefan Krah ed16eff57e Issue #16431: Also fix the opposite direction. 2012-11-07 23:47:19 +01:00
Stefan Krah f4abc7b8a0 Issue #16431: Use the type information when constructing a Decimal subtype
from a Decimal argument.
2012-11-07 23:12:25 +01:00
Stefan Krah dbcf103be0 Issue #15882: Change _decimal to accept any coefficient tuple when
constructing infinities. This is done for backwards compatibility
with decimal.py: Infinity coefficients are undefined in _decimal
(in accordance with the specification).
2012-09-10 19:34:58 +02:00
Mark Dickinson fc33d4ce0a Issue #15544: Fix Decimal.__float__ to work with payload-carrying NaNs. 2012-08-24 18:53:10 +01:00