Victor Stinner
5dcc06f6e0
bpo-38858: Allocate small integers on the heap (GH-17301)
Allocate small Python integers (small_ints of longobject.c) on the
heap, rather than using static objects.
6 years ago
Victor Stinner
6314abcc08
bpo-37802: Fix a compiler warning in longobject.c (GH-16517)
bpo-37802, bpo-38321: Fix the following warnings:
longobject.c(420): warning C4244: 'function': conversion from
'unsigned __int64' to 'sdigit', possible loss of data
longobject.c(428): warning C4267: 'function': conversion from
'size_t' to 'sdigit', possible loss of data
6 years ago
HongWeipeng
42acb7b8d2
bpo-35696: Simplify long_compare() (GH-16146)
6 years ago
Sergey Fedoseev
c6734ee7c5
bpo-37802: Slightly improve perfomance of PyLong_FromUnsigned*() (GH-15192)
6 years ago
Raymond Hettinger
7117074410
bpo-38096: Clean up the "struct sequence" / "named tuple" docs (GH-15895)
* bpo-38096: Clean up the "struct sequence" / "named tuple" docs
* Fix remaining occurrences of "struct sequence"
* Repair a user visible docstring
6 years ago
Jordon Xu
2ec7010206
bpo-37752: Delete redundant Py_CHARMASK in normalizestring() (GH-15095)
6 years ago
animalize
6b519985d2
replace inline function `is_small_int` with a macro version (GH-15710)
6 years ago
Victor Stinner
bed4817d52
Make PyXXX_Fini() functions private (GH-15531)
For example, rename PyTuple_Fini() to _PyTuple_Fini().
These functions are only declared in the internal C API.
6 years ago
Greg Price
5e63ab05f1
bpo-37812: Convert CHECK_SMALL_INT macro to a function so the return is explicit. (GH-15216)
6 years ago
Jeroen Demeyer
196a530e00
bpo-37483: add _PyObject_CallOneArg() function ( #14558 )
7 years ago
Zackery Spytz
dc2476500d
bpo-37170: Fix the cast on error in PyLong_AsUnsignedLongLongMask() (GH-13860)
7 years ago
Petr Viktorin
1e375c6269
bpo-36027: Really fix "incompatible pointer type" compiler warning (GH-13761)
Apologies for the earlier hasty attempt.
7 years ago
Petr Viktorin
e584cbff1e
bpo-36027 bpo-36974: Fix "incompatible pointer type" compiler warnings (GH-13758)
7 years ago
Mark Dickinson
c52996785a
bpo-36027: Extend three-argument pow to negative second argument (GH-13266)
7 years ago
Jeroen Demeyer
530f506ac9
bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async (GH-13464)
Automatically replace
tp_print -> tp_vectorcall_offset
tp_compare -> tp_as_async
tp_reserved -> tp_as_async
7 years ago
Inada Naoki
7d408697a9
remove unnecessary tp_dealloc (GH-13647)
7 years ago
Serhiy Storchaka
a5119e7d75
bpo-36957: Add _PyLong_Rshift() and _PyLong_Lshift(). (GH-13416)
7 years ago
Serhiy Storchaka
96aeaec647
bpo-36793: Remove unneeded __str__ definitions. (GH-13081)
Classes that define __str__ the same as __repr__ can
just inherit it from object.
7 years ago
stratakis
a10d426bab
bpo-36292: Mark unreachable code as such in long bitwise ops (GH-12333)
7 years ago
Serhiy Storchaka
6a44f6eef3
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)
Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
7 years ago
Sergey Fedoseev
ea6207d593
bpo-36063: Minor performance tweak in long_divmod(). (GH-11915)
7 years ago
Victor Stinner
6d43f6f081
bpo-35713: Split _Py_InitializeCore into subfunctions (GH-11650)
* Split _Py_InitializeCore_impl() into subfunctions: add multiple pycore_init_xxx() functions
* Preliminary sys.stderr is now set earlier to get an usable
sys.stderr ealier.
* Move code into _Py_Initialize_ReconfigureCore() to be able to call
it from _Py_InitializeCore().
* Split _PyExc_Init(): create a new _PyBuiltins_AddExceptions()
function.
* Call _PyExc_Init() earlier in _Py_InitializeCore_impl()
and new_interpreter() to get working exceptions earlier.
* _Py_ReadyTypes() now returns _PyInitError rather than calling
Py_FatalError().
* Misc code cleanup
7 years ago
Victor Stinner
b509d52083
bpo-35059: PyObject_INIT() casts to PyObject* (GH-10674)
PyObject_INIT() and PyObject_INIT_VAR() now cast their first argument
to PyObject*, as done in Python 3.7.
Revert partially commit b4435e20a9 .
7 years ago
Pablo Galindo
49c75a8086
bpo-35064 prefix smelly symbols that appear with COUNT_ALLOCS with _Py_ (GH-10152)
Configuring python with ./configure --with-pydebug CFLAGS="-D COUNT_ALLOCS -O0"
makes "make smelly" fail as some symbols were being exported without the "Py_" or
"_Py" prefixes.
7 years ago
Victor Stinner
b4435e20a9
bpo-35059: Convert PyObject_INIT() to function (GH-10077)
* Convert PyObject_INIT() and PyObject_INIT_VAR() macros to static
inline functions.
* Fix usage of these functions: cast to PyObject* or PyVarObject*.
7 years ago
Serhiy Storchaka
b2e2025941
bpo-33073: Rework int.as_integer_ratio() implementation (GH-9303)
* Simplify the C code.
* Simplify tests and make them more strict and robust.
* Add references in the documentation.
7 years ago
Zackery Spytz
7bb9cd0a67
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.
7 years ago
Raymond Hettinger
73820a60cc
Fix compiler warning with a type cast (GH-9300)
7 years ago
Raymond Hettinger
00bc08ec11
Fix-up parenthesis, organization, and NULL check (GH-9297)
7 years ago
Lisa Roach
5ac704306f
bpo-33073: Adding as_integer_ratio to ints. (GH-8750)
7 years ago
Serhiy Storchaka
7cb7bcff20
bpo-20260: Implement non-bitwise unsigned int converters for Argument Clinic. (GH-8434)
8 years ago
Serhiy Storchaka
6405feecda
bpo-33012: Fix invalid function casts for long_long. (GH-6652)
long_long() was used with three function types:
PyCFunction, getter and unaryfunction.
8 years ago
Siddhesh Poyarekar
55edd0c185
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast
into a PyCFunction, which takes two arguments. This triggers an
invalid function cast warning in gcc8 due to the argument mismatch.
Fix this by adding a dummy unused argument.
8 years ago
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.
8 years ago
Serhiy Storchaka
29ba688034
bpo-31619: Fixed integer overflow in converting huge strings to int. ( #3884 )
8 years ago
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
8 years ago
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%.
8 years ago
stratakis
e8b1965639
bpo-23699: Use a macro to reduce boilerplate code in rich comparison functions (GH-793)
8 years ago
Serhiy Storchaka
85c0b8941f
bpo-31619: Fixed a ValueError when convert a string with large number of underscores ( #3827 )
to integer with binary base.
8 years ago
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.
8 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().
9 years ago