summaryrefslogtreecommitdiff
path: root/Include/bytesobject.h
AgeCommit message (Collapse)AuthorLines
2017-11-28bpo-32150: Expand tabs to spaces in C files. (#4583)Serhiy Storchaka-7/+7
2016-12-27Issue #29058: All stable API extensions added after Python 3.2 are nowSerhiy Storchaka-0/+2
available only when Py_LIMITED_API is set to the PY_VERSION_HEX value of the minimum Python version supporting this API.
2016-10-31Issue 28128: Print out better error/warning messages for invalid string ↵Eric V. Smith-0/+5
escapes. Backport to 3.6.
2016-08-30Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger-1/+1
2016-04-15Issue #15984: Merge PyUnicode doc from 3.5Martin Panter-1/+1
2016-04-15Correct “an” → “a” with “Unicode”, “user”, “UTF”, etcMartin Panter-1/+1
This affects documentation, code comments, and a debugging messages.
2015-10-14Add _PyBytesWriter_Resize() functionVictor Stinner-1/+18
This function gives a control to the buffer size without using min_size.
2015-10-14Optimize bytes.fromhex() and bytearray.fromhex()Victor Stinner-0/+3
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
2015-10-14Optimize bytearray % argsVictor Stinner-1/+5
Issue #25399: Don't create temporary bytes objects: modify _PyBytes_Format() to create work directly on bytearray objects. * Rename _PyBytes_Format() to _PyBytes_FormatEx() just in case if something outside CPython uses it * _PyBytes_FormatEx() now uses (char*, Py_ssize_t) for the input string, so bytearray_format() doesn't need tot create a temporary input bytes object * Add use_bytearray parameter to _PyBytes_FormatEx() which is passed to _PyBytesWriter, to create a bytearray buffer instead of a bytes buffer Most formatting operations are now between 2.5 and 5 times faster.
2015-10-14Add use_bytearray attribute to _PyBytesWriterVictor Stinner-4/+8
Issue #25399: Add a new use_bytearray attribute to _PyBytesWriter to use a bytearray buffer, instead of using a bytes object.
2015-10-12Relax _PyBytesWriter APIVictor Stinner-7/+7
Don't require _PyBytesWriter pointer to be a "char *". Same change for _PyBytesWriter_WriteBytes() parameter. For example, binascii uses "unsigned char*".
2015-10-09Add _PyBytesWriter_WriteBytes() to factorize the codeVictor Stinner-0/+7
2015-10-09_PyBytesWriter: rename size attribute to min_sizeVictor Stinner-2/+3
2015-10-09Issue #25318: cleanup code _PyBytesWriterVictor Stinner-2/+2
Rename "stack buffer" to "small buffer". Add also an assertion in _PyBytesWriter_GetPos().
2015-10-09Issue #25318: Move _PyBytesWriter to bytesobject.cVictor Stinner-0/+52
Declare also the private API in bytesobject.h.
2015-01-23Issue20284: Implement PEP461Ethan Furman-0/+1
2013-08-13Issue #18722: Remove uses of the "register" keyword in C code.Antoine Pitrou-5/+5
2012-04-27Simplify and optimize formatlong()Victor Stinner-2/+0
* Remove _PyBytes_FormatLong(): inline it into formatlong() * the input type is always a long, so remove the code for bool * don't duplicate the string if the length does not change * Use PyUnicode_DATA() instead of _PyUnicode_AsString()
2010-12-03Merge branches/pep-0384.Martin v. Löwis-1/+10
2010-10-17make hashes always the size of pointers; introduce Py_hash_t #9778Benjamin Peterson-1/+1
2009-04-16The other half of Issue #1580: use short float repr where possible.Eric Smith-14/+12
Addresses the float -> string conversion, using David Gay's code which was added in Mark Dickinson's checkin r71663. Also addresses these, which are intertwined with the short repr changes: - Issue #5772: format(1e100, '<') produces '1e+100', not '1.0e+100' - Issue #5515: 'n' formatting with commas no longer works poorly with leading zeros. - PEP 378 Format Specifier for Thousands Separator: implemented for floats.
2009-04-03Added ',' thousands grouping to int.__format__. See PEP 378.Eric Smith-1/+13
This is incomplete, but I want to get some version into the next alpha. I am still working on: Documentation. More tests. Implement for floats. In addition, there's an existing bug with 'n' formatting that carries forward to thousands grouping (issue 5515).
2008-08-26make bytes(o) respect __bytes__ #2415Benjamin Peterson-0/+1
This adds two new C-API functions: PyObject_Bytes and PyBytes_FromObject. Reviewer: Barry
2008-06-24Merged revisions 64491 via svnmerge fromEric Smith-2/+2
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64491 | eric.smith | 2008-06-23 20:42:10 -0400 (Mon, 23 Jun 2008) | 1 line Modified interface to _Py_[String|Unicode]InsertThousandsGrouping, in anticipation of fixing issue 3140. ........
2008-06-10Merged revisions ↵Georg Brandl-4/+4
63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines Added a note to [] that special forms & special chars lose their meaning and backrefs can't be used inside [] ........ r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines #3010: clarification about stdin/use_rawinput. ........ r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines #3005: add explaining sentence to easydialogs docs. ........ r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines Add plain text make target. ........ r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines Spaces vs. tabs. ........ r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines Make the _H #define's match the header file names. Fix comments to mention the correct type names. ........ r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines Adds a Thread.getIdent() method to provide the _get_ident() value for any given threading.Thread object. feature request issue 2871. ........ r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines Fixed complex.__getnewargs__() to not emit another complex object. ........ r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line Document 'utc' parameter ........ r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line Add various items ........ r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line Grammar fix ........ r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines Markup fix. ........ r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines Add a reminder for the maintainer of whatsnew. ........ r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc() to ease standalone use of the algorithm. ........ r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines Revert unwanted changes. ........ r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines X-ref to numbers module. ........ r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines Document the "st" API, to avoid confusion with the "new" AST. Add a note about using the new AST module. ........ r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines Add Gregor Lingl. ........ r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines Add the "ast" module, containing helpers to ease use of the "_ast" classes. ........ r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line Add Arnaud for his efforts on multi-arg set operations. ........ r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines #2536: fix itertools.permutations and itertools.combinations docstrings. ........
2008-05-26remove PyBytes_Format from headerBenjamin Peterson-1/+0
2008-05-26Renamed files bytesobject.[ch] and stringobject.[ch]Christian Heimes-35/+93
Fixed Windows build
2008-05-26Renamed PyBytes to PyByteArrayChristian Heimes-14/+14
2007-12-19#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.Christian Heimes-2/+2
2007-11-29Added all PyTypeObjects to the appropriate header files.Christian Heimes-0/+1
Before the patch a lot of internal types weren't available in the header files. The patch exposes the new iterators, views and some other types to all C modules. I've also renamed some of the types and tp_names.
2007-08-25Fix typo in commentNeal Norwitz-1/+1
2007-08-19Code review of the new buffer protocol. Mostly add questions that shouldNeal Norwitz-0/+1
be answered with the comments removed. There are many places that require checks when doing arithmetic for memory sizes when allocating memory. Otherwise, overflow is possible with a subsequent crash. Fix SF #1777057 which was a result of not initializing the new BufferError properly. Had to update the test for exceptions for BufferError too.
2007-08-18Merged in py3k-buffer branch to main line. All objects now use the buffer ↵Travis E. Oliphant-0/+1
protocol in PEP 3118.
2007-07-21Fix merge breakage.Martin v. Löwis-1/+1
2007-07-21Merged revisions 56467-56482 via svnmerge fromMartin v. Löwis-1/+1
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ................ r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines Merged revisions 56466-56476 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines PEP 3123: Provide forward compatibility with Python 3.0, while keeping backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT. ........ ................ r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines PEP 3123: Use proper C inheritance for PyObject. ................ r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines Add longintrepr.h to Python.h, so that the compiler can see that PyFalse is really some kind of PyObject*. ................ r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines Qualify SHIFT, MASK, BASE. ................ r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines Correctly refer to _ob_next. ................
2007-06-14Add asserts to PyBytes_AS_STRING and PyBytes_GET_SIZE.Guido van Rossum-2/+2
2007-04-13Rough and dirty job -- allow concatenation of bytes and arbitraryGuido van Rossum-0/+1
buffer-supporting objects (Unicode always excluded), and also of str and bytes. (For some reason u"" + b"" doesn't fail, I'll investigate later.)
2006-05-05Optimizations for bytes reallocation.Guido van Rossum-0/+1
This uses up to 12.5% overallocation, not entirely unlike list_resize(). Could probably use more tweaks for odd allocation patterns, TBD. Also add __alloc__() method which returns the actually allocated size. PS. I'm now convinced that we need something like "".join(); later.
2006-04-24Added much functionality to the bytes type.Guido van Rossum-2/+3
Change file.readinto() to require binary mode.
2006-04-22Here is a bytes type. It's very minimal but it's a start.Guido van Rossum-0/+47