summaryrefslogtreecommitdiffstats
path: root/Include/longobject.h
Commit message (Collapse)AuthorAgeFilesLines
* gh-108444: Add PyLong_AsInt() public function (#108445)Victor Stinner2023-08-241-0/+6
| | | | | | * Rename _PyLong_AsInt() to PyLong_AsInt(). * Add documentation. * Add test. * For now, keep _PyLong_AsInt() as an alias to PyLong_AsInt().
* gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815)Victor Stinner2022-06-161-1/+1
|
* bpo-45459: Add pytypedefs.h header file (GH-31527)Victor Stinner2022-02-241-2/+0
| | | | | | | | | | | | | | | | | | Move forward declarations of Python C API types to a new pytypedefs.h header file to solve interdependency issues between header files. pytypedefs.h contains forward declarations of the following types: * PyCodeObject * PyFrameObject * PyGetSetDef * PyInterpreterState * PyLongObject * PyMemberDef * PyMethodDef * PyModuleDef * PyObject * PyThreadState * PyTypeObject
* bpo-35134: Add Include/cpython/longobject.h (GH-29044)Victor Stinner2021-10-191-130/+3
| | | | | | | | | | Move Include/longobject.h non-limited API to a new Include/cpython/longobject.h header file. Move the following definitions to the internal C API: * _PyLong_DigitValue * _PyLong_FormatAdvancedWriter() * _PyLong_FormatWriter()
* bpo-42161: Remove private _PyLong_Zero and _PyLong_One (GH-23003)Victor Stinner2020-10-271-3/+0
| | | | | Use PyLong_FromLong(0) and PyLong_FromLong(1) of the public C API instead. For Python internals, _PyLong_GetZero() and _PyLong_GetOne() of pycore_long.h can be used.
* bpo-41123: Remove PyLong_FromUnicode() (GH-21204)Inada Naoki2020-06-291-2/+0
|
* bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)Serhiy Storchaka2020-05-261-17/+0
| | | | Only __index__ should be used to make integer conversions lossless.
* bpo-39573: Clean up modules and headers to use Py_IS_TYPE() function (GH-18521)Dong-hee Na2020-02-171-1/+1
|
* Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)Greg Price2019-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | All call sites pass NULL for `recode_encoding`, so this path is completely untested. That's been true since before Python 3.0. It adds significant complexity to this logic, so it's best to take it out. All call sites now have a literal NULL, and that's been true since commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at the call site in Python/ast.c where we're parsing a bytes literal. But even before then, that condition `foo` had been a constant since unadorned string literals started meaning Unicode, in commit 572dbf8f1 aka v3.0a1~1035 . The `unicode` parameter is already unused, so mark it as unused too. The code that acted on it was also taken out before Python 3.0, in commit 8d30cc014 aka v3.0a1~1031 . The function (PyBytes_DecodeEscape) is exposed in the API, but it's never been documented.
* bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)Zackery Spytz2019-05-281-1/+2
|
* bpo-36957: Add _PyLong_Rshift() and _PyLong_Lshift(). (GH-13416)Serhiy Storchaka2019-05-191-0/+3
|
* bpo-36048: Use __index__() instead of __int__() for implicit conversion if ↵Serhiy Storchaka2019-02-251-1/+11
| | | | | | available. (GH-11952) Deprecate using the __int__() method in implicit conversions of Python numbers to C integers.
* bpo-20260: Implement non-bitwise unsigned int converters for Argument ↵Serhiy Storchaka2018-07-261-0/+8
| | | | Clinic. (GH-8434)
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-301-0/+5
|
* Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-201-1/+1
| | | | functions.
* Issue #26900: Excluded underscored names and other private API from limited API.Serhiy Storchaka2016-09-111-0/+2
|
* replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-6/+6
|
* require a long long data type (closes #27961)Benjamin Peterson2016-09-061-2/+0
|
* Issue #27626: Merge spelling fixes from 3.5Martin Panter2016-07-281-1/+1
|\
| * Issue #27626: Spelling fixes in docs, comments and internal namesMartin Panter2016-07-281-1/+1
| | | | | | | | Based on patch by Ville Skyttä.
* | Modify _PyBytes_DecodeEscapeRecode() to use _PyBytesAPIVictor Stinner2015-10-141-1/+2
| | | | | | | | | | | | | | * Don't overallocate by 400% when recode is needed: only overallocate on demand using _PyBytesWriter. * Use _PyLong_DigitValue to convert hexadecimal digit to int * Create _PyBytes_DecodeEscapeRecode() subfunction
* | Optimize bytes.fromhex() and bytearray.fromhex()Victor Stinner2015-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Issue #25401: Optimize bytes.fromhex() and bytearray.fromhex(): they are now between 2x and 3.5x faster. Changes: * Use a fast-path working on a char* string for ASCII string * Use a slow-path for non-ASCII string * Replace slow hex_digit_to_int() function with a O(1) lookup in _PyLong_DigitValue precomputed table * Use _PyBytesWriter API to handle the buffer * Add unit tests to check the error position in error messages
* | Issue #25349: Optimize bytes % intVictor Stinner2015-10-091-0/+7
|/ | | | | | | | 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.
* Issue #22486: Added the math.gcd() function. The fractions.gcd() function ↵Serhiy Storchaka2015-05-121-0/+3
| | | | | | now is deprecated. Based on patch by Mark Dickinson.
* Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-0/+6
|\ | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
| * Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-0/+6
| | | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
* | Issue #1772673: The type of `char*` arguments now changed to `const char*`.Serhiy Storchaka2013-10-191-3/+3
| |
* | Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-3/+3
|\ \ | |/ | | | | error messages and comments.
| * Issue #18783: Removed existing mentions of Python long type in docstrings,Serhiy Storchaka2013-08-271-3/+3
| | | | | | | | error messages and comments.
* | Issue #16741: Fix an error reporting in int().Serhiy Storchaka2013-08-031-0/+1
|\ \ | |/
| * Issue #16741: Fix an error reporting in int().Serhiy Storchaka2013-08-031-0/+1
| |
| * Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-191-0/+3
| |\ | | | | | | | | | | | | | | | when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
| | * Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-191-0/+3
| | | | | | | | | | | | | | | | | | when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
* | | Issue #17931: Resolve confusion on Windows between pids and process handles.Richard Oudkerk2013-06-051-0/+13
| | |
* | | Issue #15989: Fix several occurrences of integer overflowSerhiy Storchaka2013-01-141-0/+3
|/ / | | | | | | when result of PyLong_AsLong() narrowed to int without checks.
* | Issue #14744: Use the new _PyUnicodeWriter internal API to speed up str%args ↵Victor Stinner2012-05-291-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and str.format(args) * Formatting string, int, float and complex use the _PyUnicodeWriter API. It avoids a temporary buffer in most cases. * Add _PyUnicodeWriter_WriteStr() to restore the PyAccu optimization: just keep a reference to the string if the output is only composed of one string * Disable overallocation when formatting the last argument of str%args and str.format(args) * Overallocation allocates at least 100 characters: add min_length attribute to the _PyUnicodeWriter structure * Add new private functions: _PyUnicode_FastCopyCharacters(), _PyUnicode_FastFill() and _PyUnicode_FromASCII() The speed up is around 20% in average.
* | Clean up a few tabs that went in with PEP393.Ezio Melotti2011-09-281-8/+8
| |
* | Implement PEP 393.Martin v. Löwis2011-09-281-2/+4
|/
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-0/+8
|
* Issue #4835: make PyLong_FromSocket_t() and PyLong_AsSocket_t() privateAntoine Pitrou2010-08-281-9/+0
| | | | | to the socket module, and fix the width of socket descriptors to be correctly detected under 64-bit Windows.
* Issue #9089: Remove references to intobject.c and intobject.h from comments.Mark Dickinson2010-06-271-1/+1
|
* Fix naming inconsistency.Mark Dickinson2010-06-071-2/+2
|
* Issue #8817: Expose round-to-nearest variant of divmod in _PyLong_Divmod_NearMark Dickinson2010-05-261-0/+8
| | | | for use by the datetime module; also refactor long_round to use this function.
* Change PARSE_PID to _Py_PARSE_PID (cleanup for r78946).Gregory P. Smith2010-03-141-3/+3
|
* * Replaces the internals of the subprocess module from fork through exec onGregory P. Smith2010-03-141-0/+17
| | | | | | | | | | | | | | | POSIX systems with a C extension module. This is required in order for the subprocess module to be made thread safe. The pure python implementation is retained so that it can continue to be used if for some reason the _posixsubprocess extension module is not available. The unittest executes tests on both code paths to guarantee compatibility. * Moves PyLong_FromPid and PyLong_AsPid from posixmodule.c into longobject.h. Code reviewed by jeffrey.yasskin at http://codereview.appspot.com/223077/show
* Merged revisions 77842 via svnmerge fromMark Dickinson2010-01-301-0/+1
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77842 | mark.dickinson | 2010-01-30 10:08:33 +0000 (Sat, 30 Jan 2010) | 4 lines Issue #7767: Add new C-API function PyLong_AsLongLongAndOverflow, a long long variant of PyLong_AsLongAndOverflow. Patch by Case Van Horsen. ........
* Merged revisions 77234 via svnmerge fromMark Dickinson2010-01-021-7/+7
| | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77234 | mark.dickinson | 2010-01-02 14:45:40 +0000 (Sat, 02 Jan 2010) | 7 lines Refactor some longobject internals: PyLong_AsDouble and _PyLong_AsScaledDouble (the latter renamed to _PyLong_Frexp) now use the same core code. The exponent produced by _PyLong_Frexp now has type Py_ssize_t instead of the previously used int, and no longer needs scaling by PyLong_SHIFT. This frees the math module from having to know anything about the PyLong implementation. This closes issue #5576. ........
* Issue #4258: Make it possible to use 30-bit digits for PyLongs:Mark Dickinson2009-03-181-0/+1
| | | | | | | - new configure option --enable-big-digits - new structseq sys.int_info giving information about the internal format By default, 30-bit digits are enabled on 64-bit machines but disabled on 32-bit machines.
* Reduce the size of the _PyLong_DigitValue table.Raymond Hettinger2009-01-091-1/+1
|
* Refactor and clean up str.format() code (and helpers) in advance of ↵Eric Smith2008-05-301-0/+6
| | | | optimizations.