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.
9 years ago
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.
9 years ago
Serhiy Storchaka
ba85d69a3e
bpo-29878: Add global instances of int for 0 and 1. ( #852 )
9 years ago
Serhiy Storchaka
18b250f844
bpo-29793: Convert some builtin types constructors to Argument Clinic. ( #615 )
9 years ago
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.
9 years ago
Serhiy Storchaka
2e5642422f
bpo-29695: Remove bad keyword parameters in int(), bool(), float(), list() and tuple(). ( #518 )
9 years ago
orenmn
86aa269646
remove 3 redundant casts in Objects/longobject.c ( #445 )
9 years ago
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.
9 years ago
Serhiy Storchaka
196a7bc1ea
Issue #29421 : Make int.to_bytes() and int.from_bytes() slightly faster
(10-20% for small integers).
9 years ago
Serhiy Storchaka
495e8808d7
Issue #20185 : Converted the int class to Argument Clinic.
Based on patch by Vajrasky Kok.
9 years ago
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().
10 years ago
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 .
10 years ago
Serhiy Storchaka
460bd0d284
Issue #19569 : Compiler warnings are now emitted if use most of deprecated
functions.
10 years ago
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
10 years ago
Serhiy Storchaka
f4934ea77d
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
10 years ago
Serhiy Storchaka
b2e64f903d
Issue #28621 : Sped up converting int to float by reusing faster bits counting
implementation. Patch by Adrian Wielgosik.
10 years ago
Mark Dickinson
c1c4a64edb
Issue #27111 : Minor simplication to long_add and long_sub fast path code. Thanks Oren Milman.
10 years ago
Mark Dickinson
fba121fe9d
Issue #27441 : Remove some redundant assignments to ob_size in longobject.c. Thanks Oren Milman.
10 years ago
Mark Dickinson
92ca535626
Issue #27222 : various cleanups in long_rshift. Thanks Oren Milman.
10 years ago
Mark Dickinson
36820dd5a9
Issue #25221 : Fix corrupted result from PyLong_FromLong(0) when Python is compiled with NSMALLPOSINTS = 0.
10 years ago
Brett Cannon
a721abac29
Issue #26331 : Implement the parsing part of PEP 515.
Thanks to Georg Brandl for the patch.
10 years ago
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
10 years ago
Benjamin Peterson
2f8bfef158
replace PY_SIZE_MAX with SIZE_MAX
10 years ago
Benjamin Peterson
ca47063998
replace Py_(u)intptr_t with the c99 standard types
10 years ago
Benjamin Peterson
d953f8e10b
remove some silly defined() tests
10 years ago
Benjamin Peterson
af580dff4a
replace PY_LONG_LONG with long long
10 years ago
Benjamin Peterson
ed4aa83ff7
require a long long data type ( closes #27961 )
10 years ago
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
10 years ago
Mark Dickinson
82a95277b8
Issue #27870 : A left shift of zero by a large integer no longer attempts to allocate large amounts of memory.
10 years ago
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.
10 years ago
Mark Dickinson
583c6e860c
Issue #27214 : Fix potential bug and remove useless optimization in long_invert. Thanks Oren Milman.
10 years ago
Mark Dickinson
b820d7f631
Issue #27792 : force int return type for modulo operations involving bools.
10 years ago
Mark Dickinson
1dc3c898a8
Untabify Objects/longobject.c.
10 years ago
Mark Dickinson
dc590a4cc3
Issue #25604 : Fix minor bug in integer true division, which could
have caused off-by-one-ulp results on certain platforms.
10 years ago
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.
10 years ago
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
Based on patch by Ville Skyttä.
10 years ago
Serhiy Storchaka
e63e5d60ee
Issue #27073 : Removed redundant checks in long_add and long_sub.
Patch by Oren Milman.
10 years ago
Serhiy Storchaka
ea36c941a1
Issue #23640 : int.from_bytes() no longer bypasses constructors for subclasses.
10 years ago
Victor Stinner
f963c13597
longobject.c: fix compilation warning on Windows 64-bit
We know that Py_SIZE(b) is -1 or 1 an so fits into the sdigit type.
10 years ago
Yury Selivanov
e0b23095ee
Issues #26289 and #26315 : Optimize floor/modulo div for single-digit longs
Microbenchmarks show 2-2.5x improvement. Built-in 'divmod' function
is now also ~10% faster.
-m timeit -s "x=22331" "x//2;x//-3;x//4;x//5;x//-6;x//7;x//8;x//-99;x//100;"
with patch: 0.321 without patch: 0.633
-m timeit -s "x=22331" "x%2;x%3;x%-4;x%5;x%6;x%-7;x%8;x%99;x%-100;"
with patch: 0.224 without patch: 0.66
Big thanks to Serhiy Storchaka, Mark Dickinson and Victor Stinner for
thorow code reviews and algorithms improvements.
10 years ago
Yury Selivanov
a0fcaca4e1
Issue #26288 : Fix comment
10 years ago
Yury Selivanov
186c30b7ae
Issue #26288 : Optimize PyLong_AsDouble.
10 years ago
Serhiy Storchaka
15095800a3
Issue #24731 : Fixed crash on converting objects with special methods
__bytes__, __trunc__, and __float__ returning instances of subclasses of
bytes, int, and float to subclasses of bytes, int, and float correspondingly.
11 years ago
Victor Stinner
1285e5c805
Fix compiler warnings (uninitialized variables), false alarms in fact
11 years ago
Victor Stinner
199c9a6f4b
Fix long_format_binary()
Issue #25399 : Fix long_format_binary(), allocate bytes for the bytes writer.
11 years ago
Victor Stinner
be75b8cf23
Issue #25349 : Optimize bytes % int
Optimize bytes.__mod__(args) for integere formats: %d (%i, %u), %o, %x and %X.
_PyBytesWriter is now used to format directly the integer into the writer
buffer, instead of using a temporary bytes object.
Formatting is between 30% and 50% faster on a microbenchmark.
11 years ago
Victor Stinner
5783fd2c58
Issue #24999 : In longobject.c, use two shifts instead of ">> 2*PyLong_SHIFT" to
avoid undefined behaviour when LONG_MAX type is smaller than 60 bits.
This change should fix a warning with the ICC compiler.
11 years ago
Serhiy Storchaka
48e47aaa28
Issue #22486 : Added the math.gcd() function. The fractions.gcd() function now is
deprecated. Based on patch by Mark Dickinson.
11 years ago
R David Murray
861470c836
#16518 : Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required. (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
12 years ago
Serhiy Storchaka
20b39b27d9
Removed redundant casts to `char *`.
Corresponding functions now accept `const char *` (issue #1772673 ).
12 years ago