Commit Graph

29 Commits

Author SHA1 Message Date
Andy Lester e6be9b59a9
closes bpo-39605: Fix some casts to not cast away const. (GH-18453)
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
2020-02-11 18:28:35 -08:00
Hai Shi 24ddd9c2d6 bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603) 2019-10-06 15:17:18 +03:00
Sergey Fedoseev 593bb30e82 closes bpo-34599: Improve performance of _Py_bytes_capitalize(). (GH-9083) 2018-09-06 21:54:49 -07:00
Tal Einat c929df3b96
bpo-20180: complete AC conversion of Objects/stringlib/transmogrify.h (GH-8039)
* converted bytes methods: expandtabs, ljust, rjust, center, zfill
* updated char_convertor to properly set the C default value
2018-07-06 13:17:38 +03:00
INADA Naoki bea57060c8
bpo-32677: Optimize str.isascii() (GH-5356) 2018-01-28 09:59:12 +09:00
INADA Naoki a49ac99029
bpo-32677: Add .isascii() to str, bytes and bytearray (GH-5342) 2018-01-27 14:06:21 +09:00
Lisa Roach 43ba8861e0 bpo-29549: Fixes docstring for str.index (#256)
* 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.
2017-04-04 22:36:22 -07:00
Oren Milman 004251059b bpo-29730: replace some calls to PyNumber_Check and improve some error messages (#650) 2017-03-13 00:37:05 +02:00
Benjamin Peterson 621b430a14 remove all usage of Py_LOCAL 2016-09-09 13:54:34 -07:00
Serhiy Storchaka f9efb8b18b Issue #27474: Unified error messages in the __contains__ method of bytes and
bytearray for integers in and out of the Py_ssize_t range.
Patch by Xiang Zhang.
2016-07-10 12:37:30 +03:00
Serhiy Storchaka ab8bcb34dc Issue #26765: Fixed parsing Py_ssize_t arguments on 32-bit Windows. 2016-07-03 13:26:52 +03:00
Serhiy Storchaka dd40fc3e57 Issue #26765: Moved common code and docstrings for bytes and bytearray methods
to bytes_methods.c.
2016-05-04 22:23:26 +03:00
Serhiy Storchaka ef1585eb9a Issue #25923: Added more const qualifiers to signatures of static and private functions. 2015-12-25 20:01:53 +02:00
Serhiy Storchaka 3dd3e26680 Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:25:42 +02:00
Serhiy Storchaka 4fdb68491e Issue #22896: Avoid to use PyObject_AsCharBuffer(), PyObject_AsReadBuffer()
and PyObject_AsWriteBuffer().
2015-02-03 01:21:08 +02:00
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.)
2014-10-05 11:47:01 -04:00
Martin v. Löwis 7252a6e81e Issue #20179: Apply Argument Clinic to bytes and bytearray.
Patch by Tal Einat.
2014-07-27 16:25:09 +02:00
Antoine Pitrou 9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Antoine Pitrou 94f6fa62bf Issue #13738: Simplify implementation of bytes.lower() and bytes.upper(). 2012-01-08 16:22:46 +01:00
Senthil Kumaran 84e3ccc48d Fix closes Issue12385 - Clarify maketrans method docstring for bytes and bytearray object. 2011-06-27 09:06:45 -07:00
Antoine Pitrou 47019e500c Fix (harmless) warning with MSVC. 2010-08-15 17:41:31 +00:00
Antoine Pitrou 9b491923b8 Fix indentation and remove dead code. 2010-08-15 17:38:46 +00:00
Senthil Kumaran e51ee8a5bc Fix the docstrings of the capitalize method. 2010-07-05 12:00:56 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
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.
........
2010-05-09 15:52:27 +00:00
Antoine Pitrou 403ce78872 Issue #7065: Fix a crash in bytes.maketrans and bytearray.maketrans when
using byte values greater than 127.  Patch by egreen.
2009-10-14 17:14:16 +00:00
Eric Smith 6dc46f5eaa Merged revisions 72040 via svnmerge from
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.
........
2009-04-27 20:39:49 +00:00
Georg Brandl abc387747d Add bytes/bytearray.maketrans() to mirror str.maketrans(), and deprecate
string.maketrans() which actually works on bytes.  (Also closes #5675.)
2009-04-12 15:51:51 +00:00
Christian Heimes 72b710a596 Renamed PyString to PyBytes 2008-05-26 13:28:38 +00:00
Gregory P. Smith 60d241f135 For PEP3137: Adds missing methods to the mutable PyBytes object (soon
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
2007-10-16 06:31:30 +00:00