summaryrefslogtreecommitdiffstats
path: root/Objects/bytearrayobject.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35713: Rework Python initialization (GH-11647)Victor Stinner2019-01-221-11/+0
| | | | | | | | | | | | | | | | | | | * The PyByteArray_Init() and PyByteArray_Fini() functions have been removed. They did nothing since Python 2.7.4 and Python 3.2.0, were excluded from the limited API (stable ABI), and were not documented. * Move "_PyXXX_Init()" and "_PyXXX_Fini()" declarations from Include/cpython/pylifecycle.h to Include/internal/pycore_pylifecycle.h. Replace "PyAPI_FUNC(TYPE)" with "extern TYPE". * _PyExc_Init() now returns an error on failure rather than calling Py_FatalError(). Move macros inside _PyExc_Init() and undefine them when done. Rewrite macros to make them look more like statement: add ";" when using them, add "do { ... } while (0)". * _PyUnicode_Init() now returns a _PyInitError error rather than call Py_FatalError(). * Move stdin check from _PySys_BeginInit() to init_sys_streams(). * _Py_ReadyTypes() now returns a _PyInitError error rather than calling Py_FatalError().
* bpo-35444: Unify and optimize the helper for getting a builtin object. ↵Serhiy Storchaka2018-12-111-2/+3
| | | | | | | | (GH-11047) This speeds up pickling of some iterators. This fixes also error handling in pickling methods when fail to look up builtin "getattr".
* bpo-35081: Add Include/internal/pycore_object.h (GH-10640)Victor Stinner2018-11-211-0/+1
| | | | Move _PyObject_GC_TRACK() and _PyObject_GC_UNTRACK() from Include/objimpl.h to Include/internal/pycore_object.h.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-2/+2
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-2/+2
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-34984: Improve error messages for bytes and bytearray constructors. ↵Serhiy Storchaka2018-10-211-4/+20
| | | | (GH-9874)
* bpo-34974: Do not replace unexpected errors in bytes() and bytearray(). ↵Serhiy Storchaka2018-10-141-2/+1
| | | | | | | (GH-9852) bytes and bytearray constructors converted unexpected exceptions (e.g. MemoryError and KeyboardInterrupt) to TypeError.
* bpo-34170: Add _PyCoreConfig.bytes_warning (GH-8447)Victor Stinner2018-07-241-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add more fields to _PyCoreConfig: * _check_hash_pycs_mode * bytes_warning * debug * inspect * interactive * legacy_windows_fs_encoding * legacy_windows_stdio * optimization_level * quiet * unbuffered_stdio * user_site_directory * verbose * write_bytecode Changes: * Remove pymain_get_global_config() and pymain_set_global_config() which became useless. These functions have been replaced by _PyCoreConfig_GetGlobalConfig() and _PyCoreConfig_SetGlobalConfig(). * sys.flags.dont_write_bytecode value is now restricted to 1 even if -B option is specified multiple times on the command line. * PyThreadState_Clear() now uses the config from the current interpreter rather than using global Py_VerboseFlag
* bpo-20180: complete AC conversion of Objects/stringlib/transmogrify.h (GH-8039)Tal Einat2018-07-061-6/+5
| | | | * converted bytes methods: expandtabs, ljust, rjust, center, zfill * updated char_convertor to properly set the C default value
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-17/+17
| | | | | | | | | (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.
* bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)INADA Naoki2018-01-271-0/+2
|
* Add the const qualifier to "char *" variables that refer to literal strings. ↵Serhiy Storchaka2017-11-111-6/+9
| | | | (#4370)
* bpo-23699: Use a macro to reduce boilerplate code in rich comparison ↵stratakis2017-11-021-26/+11
| | | | functions (GH-793)
* bpo-20047: Make bytearray methods partition() and rpartition() rejecting (#4158)Serhiy Storchaka2017-10-281-12/+34
| | | separators that are not bytes-like objects.
* bpo-27541: Reprs of subclasses of some classes now contain actual type name. ↵Serhiy Storchaka2017-09-211-6/+10
| | | | | (#3631) Affected classes are bytearray, array, deque, defaultdict, count and repeat.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+2
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31279: Silence -Wstringop-overflow warning. (#3207)Stefan Krah2017-08-251-1/+1
|
* Expand the PySlice_GetIndicesEx macro. (#1023)Serhiy Storchaka2017-04-081-6/+6
|
* bpo-29116: Fix error messages for concatenating bytes and bytearray with ↵Serhiy Storchaka2017-03-191-1/+1
| | | | unsupported type. (#709)
* bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485)Serhiy Storchaka2017-03-121-2/+2
|
* Merge 3.6INADA Naoki2017-01-061-9/+13
|\
| * Issue #29159: Fix regression in bytes(x) when x.__index__() raises Exception.INADA Naoki2017-01-061-9/+13
| |
* | Backed out changeset b9c9691c72c5Victor Stinner2016-12-041-2/+4
| | | | | | | | | | | | Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like _PyObject_CallArg1() uses more stack memory than PyObject_CallFunctionObjArgs().
* | Replace PyObject_CallFunctionObjArgs() with fastcallVictor Stinner2016-12-011-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-201-4/+1
|/ | | | functions.
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|
* Issue #27506: Support bytes/bytearray.translate() delete as keyword argumentMartin Panter2016-08-271-8/+5
| | | | Patch by Xiang Zhang.
* Issue #27704: Optimized creating bytes and bytearray from byte-like objectsSerhiy Storchaka2016-08-151-10/+8
| | | | | and iterables. Speed up to 3 times for short objects. Original patch by Naoki Inada.
* Issue #27507: Merge overflow check from 3.5Martin Panter2016-07-181-1/+11
|\
| * Issue #27507: Check for integer overflow in bytearray.extend()Martin Panter2016-07-181-1/+11
| | | | | | | | Patch by Xiang Zhang.
* | Issue #27473: Fixed possible integer overflow in bytes and bytearraySerhiy Storchaka2016-07-101-12/+9
|\ \ | |/ | | | | concatenations. Patch by Xiang Zhang.
| * Issue #27473: Fixed possible integer overflow in bytes and bytearraySerhiy Storchaka2016-07-101-12/+9
| | | | | | | | concatenations. Patch by Xiang Zhang.
* | Issue #27443: __length_hint__() of bytearray itearator no longer returnSerhiy Storchaka2016-07-031-1/+5
|\ \ | |/ | | | | negative integer for resized bytearray.
| * Issue #27443: __length_hint__() of bytearray itearator no longer returnSerhiy Storchaka2016-07-031-1/+5
| | | | | | | | negative integer for resized bytearray.
* | Backed out changeset b0087e17cd5e (issue #26765)Serhiy Storchaka2016-07-031-12/+67
| | | | | | | | For unknown reasons it perhaps caused a crash on 32-bit Windows (issue #).
* | Issue #26765: Moved wrappers for bytes and bytearray methods to common headerSerhiy Storchaka2016-07-011-67/+12
| | | | | | | | file.
* | Issue #27007: The fromhex() class methods of bytes and bytearray subclassesSerhiy Storchaka2016-07-011-4/+8
| | | | | | | | now return an instance of corresponding subclass.
* | Issue #27039: Fixed bytearray.remove() for values greater than 127.Serhiy Storchaka2016-05-161-5/+2
|\ \ | |/ | | | | Based on patch by Joe Jevnik.
| * Issue #27039: Fixed bytearray.remove() for values greater than 127.Serhiy Storchaka2016-05-161-7/+4
| | | | | | | | Patch by Joe Jevnik.
* | Issue #26765: Moved common code for the replace() method of bytes and bytearraySerhiy Storchaka2016-05-051-500/+3
| | | | | | | | to a template file.
* | Issue #26765: Moved common code and docstrings for bytes and bytearray methodsSerhiy Storchaka2016-05-041-328/+24
| | | | | | | | to bytes_methods.c.
* | Got rid of redundand "self" parameter declarations.Serhiy Storchaka2016-05-021-33/+14
| | | | | | | | Argument Clinic is now able to infer all needed information.
* | Issue #26778: Fixed "a/an/and" typos in code comment, documentation and errorSerhiy Storchaka2016-04-171-1/+1
|\ \ | |/ | | | | messages.
| * Issue #26778: Fixed "a/an/and" typos in code comment and documentation.Serhiy Storchaka2016-04-171-1/+1
| |
* | Issue #26766: Remove redundant bytearray_format() from bytearrayobject.cBerker Peksag2016-04-151-14/+1
| |
* | Issue #26494: Fixed crash on iterating exhausting iterators.Serhiy Storchaka2016-03-301-1/+1
|\ \ | |/ | | | | | | | | Affected classes are generic sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator.
| * Issue #26494: Fixed crash on iterating exhausting iterators.Serhiy Storchaka2016-03-301-1/+1
| | | | | | | | | | | | Affected classes are generic sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator.
* | Optimize bytes.replace(b'', b'.')Victor Stinner2016-03-211-9/+19
| | | | | | | | | | Issue #26574: Optimize bytes.replace(b'', b'.') and bytearray.replace(b'', b'.'): up to 80% faster. Patch written by Josh Snider.
* | Oops, revert unwanted change used to create an exampleVictor Stinner2016-03-151-1/+0
| | | | | | | | Issue #26564.
* | On memory error, dump the memory block tracebackVictor Stinner2016-03-151-0/+1
| | | | | | | | | | | | Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a memory block was allocated on memory block. Use the tracemalloc module to get the traceback.