Zackery Spytz
e36ed475ea
[3.7] bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() (GH-13860) (GH-13896)
...
(cherry picked from commit dc2476500d
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-06-07 17:41:10 +02:00
Miss Islington (bot)
1596fea0a3
bpo-34899: Fix a possible assertion failure due to int_from_bytes_impl() (GH-9705)
...
The _PyLong_FromByteArray() call in int_from_bytes_impl() was
unchecked.
(cherry picked from commit 7bb9cd0a67
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-10-05 14:28:56 -07:00
Victor Stinner
dd431b32f4
PyLong_FromString(): fix Coverity CID 1424951 ( #4738 )
...
Explicitly cast digits (Py_ssize_t) to double to fix the following
false-alarm warning from Coverity:
"fsize_z = digits * log_base_BASE[base] + 1;"
CID 1424951: Incorrect expression (UNINTENDED_INTEGER_DIVISION)
Dividing integer expressions "9223372036854775783UL" and "4UL", and
then converting the integer quotient to type "double". Any remainder,
or fractional part of the quotient, is ignored.
2017-12-08 00:06:55 +01:00
Serhiy Storchaka
29ba688034
bpo-31619: Fixed integer overflow in converting huge strings to int. ( #3884 )
2017-12-03 22:16:21 +02:00
Sanyam Khurana
28b624825e
bpo-16055: Fixes incorrect error text for int('1', base=1000) ( #4376 )
...
* bpo-16055: Fixes incorrect error text for int('1', base=1000)
* bpo-16055: Address review comments
2017-11-13 13:49:26 -08:00
Serhiy Storchaka
9b6c60cbce
bpo-31979: Simplify transforming decimals to ASCII ( #4336 )
...
in int(), float() and complex() parsers.
This also speeds up parsing non-ASCII numbers by around 20%.
2017-11-13 21:23:48 +02:00
stratakis
e8b1965639
bpo-23699: Use a macro to reduce boilerplate code in rich comparison functions (GH-793)
2017-11-02 20:32:54 +10:00
Serhiy Storchaka
85c0b8941f
bpo-31619: Fixed a ValueError when convert a string with large number of underscores ( #3827 )
...
to integer with binary base.
2017-10-03 14:13:44 +03:00
Barry Warsaw
b2e5794870
bpo-31338 ( #3374 )
...
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
2017-09-14 18:13:16 -07:00
Serhiy Storchaka
918403cfc3
bpo-29816: Shift operation now has less opportunity to raise OverflowError. ( #680 )
...
ValueError always is raised rather than OverflowError for negative counts.
Shifting zero with non-negative count always returns zero.
2017-03-30 09:47:07 +03:00
Serhiy Storchaka
ba85d69a3e
bpo-29878: Add global instances of int for 0 and 1. ( #852 )
2017-03-30 09:09:41 +03:00
Serhiy Storchaka
18b250f844
bpo-29793: Convert some builtin types constructors to Argument Clinic. ( #615 )
2017-03-19 08:51:07 +02:00
svelankar
390a0969c1
bpo-29749: Update int() docstring (GH-565)
...
The docstring did not properly represent the fact that the argument to int() was positional-only.
2017-03-08 16:29:01 -08:00
Serhiy Storchaka
2e5642422f
bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). ( #518 )
2017-03-06 17:01:06 +02:00
orenmn
86aa269646
remove 3 redundant casts in Objects/longobject.c ( #445 )
2017-03-06 08:42:47 +00:00
Serhiy Storchaka
58d23e6806
bpo-29695: Deprecated using bad named keyword arguments in builtings: ( #486 )
...
int(), bool(), float(), list() and tuple(). Specify the value as a
positional argument instead.
2017-03-06 00:53:39 +02:00
Serhiy Storchaka
196a7bc1ea
Issue #29421 : Make int.to_bytes() and int.from_bytes() slightly faster
...
(10-20% for small integers).
2017-02-02 16:54:45 +02:00
Serhiy Storchaka
495e8808d7
Issue #20185 : Converted the int class to Argument Clinic.
...
Based on patch by Vajrasky Kok.
2017-02-01 23:12:20 +02:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)
PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This change is part of the fastcall project. The change on listsort() is
related to the issue #23507 .
2016-12-01 14:43:22 +01:00
Serhiy Storchaka
460bd0d284
Issue #19569 : Compiler warnings are now emitted if use most of deprecated
...
functions.
2016-11-20 12:16:46 +02:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
1a73bf365e
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:57 +02: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
Serhiy Storchaka
b2e64f903d
Issue #28621 : Sped up converting int to float by reusing faster bits counting
...
implementation. Patch by Adrian Wielgosik.
2016-11-08 20:34:22 +02:00
Mark Dickinson
c1c4a64edb
Issue #27111 : Minor simplication to long_add and long_sub fast path code. Thanks Oren Milman.
2016-09-17 20:01:56 +01:00
Mark Dickinson
fba121fe9d
Issue #27441 : Remove some redundant assignments to ob_size in longobject.c. Thanks Oren Milman.
2016-09-17 19:44:13 +01:00
Mark Dickinson
92ca535626
Issue #27222 : various cleanups in long_rshift. Thanks Oren Milman.
2016-09-17 17:50:50 +01:00
Mark Dickinson
82cb124300
Issue #25221 : merge from 3.5.
2016-09-10 20:20:08 +01:00
Mark Dickinson
36820dd5a9
Issue #25221 : Fix corrupted result from PyLong_FromLong(0) when Python is compiled with NSMALLPOSINTS = 0.
2016-09-10 20:17:36 +01: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
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
Benjamin Peterson
2f8bfef158
replace PY_SIZE_MAX with SIZE_MAX
2016-09-07 09:26:18 -07:00
Benjamin Peterson
ca47063998
replace Py_(u)intptr_t with the c99 standard types
2016-09-06 13:47:26 -07:00
Benjamin Peterson
d953f8e10b
remove some silly defined() tests
2016-09-06 10:51:19 -07:00
Benjamin Peterson
af580dff4a
replace PY_LONG_LONG with long long
2016-09-06 10:46:49 -07:00
Benjamin Peterson
ed4aa83ff7
require a long long data type ( closes #27961 )
2016-09-05 17:44:18 -07:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Mark Dickinson
82a95277b8
Issue #27870 : A left shift of zero by a large integer no longer attempts to allocate large amounts of memory.
2016-08-29 19:27:06 +01:00
Mark Dickinson
4e1de16f88
Issue #25402 : in int-to-decimal-string conversion, reduce intermediate storage requirements and relax restriction on converting large integers. Patch by Serhiy Storchaka.
2016-08-29 17:26:43 +01:00
Mark Dickinson
583c6e860c
Issue #27214 : Fix potential bug and remove useless optimization in long_invert. Thanks Oren Milman.
2016-08-29 16:40:29 +01:00
Mark Dickinson
b820d7f631
Issue #27792 : force int return type for modulo operations involving bools.
2016-08-22 12:24:46 +01:00
Mark Dickinson
1dc3c898a8
Untabify Objects/longobject.c.
2016-08-21 10:33:36 +01:00
Mark Dickinson
dc590a4cc3
Issue #25604 : Fix minor bug in integer true division, which could
...
have caused off-by-one-ulp results on certain platforms.
2016-08-21 10:23:23 +01:00
Victor Stinner
8bcf312d09
Issue #27786 : Simplify x_sub()
...
The z variable is known to be a fresh number which cannot be shared, Py_SIZE()
can be used directly to negate the number.
2016-08-17 19:48:33 +02:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Serhiy Storchaka
e63e5d60ee
Issue #27073 : Removed redundant checks in long_add and long_sub.
...
Patch by Oren Milman.
2016-06-04 00:06:45 +03:00
Serhiy Storchaka
ea36c941a1
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
2016-05-12 10:37:58 +03:00