summaryrefslogtreecommitdiffstats
path: root/Objects/bytes_methods.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43179: Generalise alignment for optimised string routines (GH-24624)Jessica Clarke2021-03-311-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | * Remove m68k-specific hack from ascii_decode On m68k, alignments of primitives is more relaxed, with 4-byte and 8-byte types only requiring 2-byte alignment, thus using sizeof(size_t) does not work. Instead, use the portable alternative. Note that this is a minimal fix that only relaxes the assertion and the condition for when to use the optimised version remains overly strict. Such issues will be fixed tree-wide in the next commit. NB: In C11 we could use _Alignof(size_t) instead, but for compatibility we use autoconf. * Optimise string routines for architectures with non-natural alignment C only requires that sizeof(x) is a multiple of alignof(x), not that the two are equal. Thus anywhere where we optimise based on alignment we should be using alignof(x) not sizeof(x). This is more annoying than it would be in C11 where we could just use _Alignof(x) (and alignof(x) in C++11), but since we still require only C99 we must plumb the information all the way from autoconf through the various typedefs and defines.
* bpo-38252: Use 8-byte step to detect ASCII sequence in 64bit Windows build ↵Ma Lin2020-10-181-10/+10
| | | | (GH-16334)
* bpo-40170: Add _PyIndex_Check() internal function (GH-19426)Victor Stinner2020-04-081-1/+2
| | | | | | | | | Add _PyIndex_Check() function to the internal C API: fast inlined verson of PyIndex_Check(). Add Include/internal/pycore_abstract.h header file. Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects and Python subdirectories.
* bpo-35081: Move bytes_methods.h to the internal C API (GH-18492)Victor Stinner2020-02-121-1/+1
| | | | | Move the bytes_methods.h header file to the internal C API as pycore_bytes_methods.h: it only contains private symbols (prefixed by "_Py"), except of the PyDoc_STRVAR_shared() macro.
* closes bpo-39605: Fix some casts to not cast away const. (GH-18453)Andy Lester2020-02-121-8/+8
| | | | | | | | | | | | | | | gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts
* bpo-38383: Fix possible integer overflow in startswith() of bytes and ↵Hai Shi2019-10-061-1/+1
| | | | bytearray. (GH-16603)
* closes bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-9083)Sergey Fedoseev2018-09-071-17/+3
|
* bpo-20180: complete AC conversion of Objects/stringlib/transmogrify.h (GH-8039)Tal Einat2018-07-061-30/+0
| | | | * converted bytes methods: expandtabs, ljust, rjust, center, zfill * updated char_convertor to properly set the C default value
* bpo-32677: Optimize str.isascii() (GH-5356)INADA Naoki2018-01-281-4/+36
|
* bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342)INADA Naoki2018-01-271-0/+20
|
* bpo-29549: Fixes docstring for str.index (#256)Lisa Roach2017-04-051-3/+10
| | | | | | | | | | | | | | * Updates B.index documentation. * Updates str.index documentation, makes it Argument Clinic compatible. * Removes ArgumentClinic code. * Finishes string.index documentation. * Updates string.rindex documentation. * Documents B.rindex.
* bpo-29730: replace some calls to PyNumber_Check and improve some error ↵Oren Milman2017-03-121-15/+19
| | | | messages (#650)
* remove all usage of Py_LOCALBenjamin Peterson2016-09-091-2/+2
|
* Issue #27474: Unified error messages in the __contains__ method of bytes andSerhiy Storchaka2016-07-101-1/+1
| | | | | bytearray for integers in and out of the Py_ssize_t range. Patch by Xiang Zhang.
* Issue #26765: Fixed parsing Py_ssize_t arguments on 32-bit Windows.Serhiy Storchaka2016-07-031-0/+1
|
* Issue #26765: Moved common code and docstrings for bytes and bytearray methodsSerhiy Storchaka2016-05-041-0/+424
| | | | to bytes_methods.c.
* Issue #25923: Added more const qualifiers to signatures of static and ↵Serhiy Storchaka2015-12-251-3/+3
| | | | private functions.
* Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-39/+7
|\ | | | | | | and PyObject_AsWriteBuffer().
| * Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()Serhiy Storchaka2015-02-021-27/+6
| | | | | | | | and PyObject_AsWriteBuffer().
* | #16518: Bring error messages in harmony with docs ("bytes-like object")R David Murray2014-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | 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.)
* | Issue #20179: Apply Argument Clinic to bytes and bytearray.Martin v. Löwis2014-07-271-4/+2
|/ | | | Patch by Tal Einat.
* Issue #18722: Remove uses of the "register" keyword in C code.Antoine Pitrou2013-08-131-15/+15
|
* Issue #13738: Simplify implementation of bytes.lower() and bytes.upper().Antoine Pitrou2012-01-081-10/+2
|
* Fix closes Issue12385 - Clarify maketrans method docstring for bytes and ↵Senthil Kumaran2011-06-271-4/+4
| | | | bytearray object.
* Fix (harmless) warning with MSVC.Antoine Pitrou2010-08-151-1/+1
|
* Fix indentation and remove dead code.Antoine Pitrou2010-08-151-132/+98
|
* Fix the docstrings of the capitalize method.Senthil Kumaran2010-07-051-1/+2
|
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-157/+157
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* Issue #7065: Fix a crash in bytes.maketrans and bytearray.maketrans whenAntoine Pitrou2009-10-141-2/+2
| | | | using byte values greater than 127. Patch by egreen.
* Merged revisions 72040 via svnmerge fromEric Smith2009-04-271-246/+33
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r72040 | eric.smith | 2009-04-27 15:04:37 -0400 (Mon, 27 Apr 2009) | 1 line Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors. ........
* Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecateGeorg Brandl2009-04-121-0/+67
| | | | string.maketrans() which actually works on bytes. (Also closes #5675.)
* Renamed PyString to PyBytesChristian Heimes2008-05-261-10/+10
|
* For PEP3137: Adds missing methods to the mutable PyBytes object (soonGregory P. Smith2007-10-161-0/+610
to be called a buffer). Shares code with stringobject when possible. Adds unit tests with common code that should be usable to test the PEPs mutable buffer() and immutable bytes() types. http://bugs.python.org/issue1261