Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray
........
r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line
Copied files from py3k w/o modifications
........
r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines
Take One
* Added initialization code, warnings, flags etc. to the appropriate places
* Added new buffer interface to string type
* Modified tests
* Modified Makefile.pre.in to compile the new files
* Added bytesobject.c to Python.h
........
r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines
Disabled bytearray.extend for now since it causes an infinite recursion
Fixed serveral unit tests
........
r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines
Added PyBytes support to several places:
str + bytearray
ord(bytearray)
bytearray(str, encoding)
........
r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line
Fixed more unit tests related to type('') is not unicode
........
r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines
Fixed more unit tests
Fixed bytearray.extend
........
r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line
Implemented old buffer interface for bytearray
........
r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line
Added backport of the io module
........
r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line
Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines
Fixed more tests
Fixed bytearray() comparsion with unicode()
Fixed iterator assignment of bytearray
........
r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines
str(bytesarray()) now returns the bytes and not the representation of the bytearray object
Enabled and fixed more unit tests
........
r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines
Clear error PyNumber_AsSsize_t() fails
Use CHARMASK for ob_svall access
disabled a test with memoryview again
........
r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line
Untested updates to the PCBuild directory
........
r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line
The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines
Disabled last failing test
I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytes warning code
........
r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line
Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 09:49:49 -03:00
|
|
|
|
2008-06-01 19:57:47 -03:00
|
|
|
/* Bytes (String) object interface */
|
2008-05-26 09:29:14 -03:00
|
|
|
|
2008-06-01 19:57:47 -03:00
|
|
|
#ifndef Py_BYTESOBJECT_H
|
|
|
|
#define Py_BYTESOBJECT_H
|
Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray
........
r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line
Copied files from py3k w/o modifications
........
r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines
Take One
* Added initialization code, warnings, flags etc. to the appropriate places
* Added new buffer interface to string type
* Modified tests
* Modified Makefile.pre.in to compile the new files
* Added bytesobject.c to Python.h
........
r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines
Disabled bytearray.extend for now since it causes an infinite recursion
Fixed serveral unit tests
........
r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines
Added PyBytes support to several places:
str + bytearray
ord(bytearray)
bytearray(str, encoding)
........
r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line
Fixed more unit tests related to type('') is not unicode
........
r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines
Fixed more unit tests
Fixed bytearray.extend
........
r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line
Implemented old buffer interface for bytearray
........
r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line
Added backport of the io module
........
r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line
Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines
Fixed more tests
Fixed bytearray() comparsion with unicode()
Fixed iterator assignment of bytearray
........
r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines
str(bytesarray()) now returns the bytes and not the representation of the bytearray object
Enabled and fixed more unit tests
........
r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines
Clear error PyNumber_AsSsize_t() fails
Use CHARMASK for ob_svall access
disabled a test with memoryview again
........
r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line
Untested updates to the PCBuild directory
........
r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line
The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines
Disabled last failing test
I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytes warning code
........
r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line
Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 09:49:49 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2008-05-26 09:29:14 -03:00
|
|
|
/*
|
2008-05-26 09:51:38 -03:00
|
|
|
Type PyBytesObject represents a character string. An extra zero byte is
|
2008-05-26 09:29:14 -03:00
|
|
|
reserved at the end to ensure it is zero-terminated, but a size is
|
|
|
|
present so strings with null bytes in them can be represented. This
|
|
|
|
is an immutable object type.
|
|
|
|
|
|
|
|
There are functions to create new string objects, to test
|
|
|
|
an object for string-ness, and to get the
|
|
|
|
string value. The latter function returns a null pointer
|
|
|
|
if the object is not of the proper type.
|
|
|
|
There is a variant that takes an explicit size as well as a
|
|
|
|
variant that assumes a zero-terminated string. Note that none of the
|
|
|
|
functions should be applied to nil objects.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Caching the hash (ob_shash) saves recalculation of a string's hash value.
|
|
|
|
Interning strings (ob_sstate) tries to ensure that only one string
|
|
|
|
object with a given value exists, so equality tests can be one pointer
|
|
|
|
comparison. This is generally restricted to strings that "look like"
|
|
|
|
Python identifiers, although the intern() builtin can be used to force
|
|
|
|
interning of any string.
|
|
|
|
Together, these sped the interpreter by up to 20%. */
|
|
|
|
|
Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray
........
r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line
Copied files from py3k w/o modifications
........
r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines
Take One
* Added initialization code, warnings, flags etc. to the appropriate places
* Added new buffer interface to string type
* Modified tests
* Modified Makefile.pre.in to compile the new files
* Added bytesobject.c to Python.h
........
r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines
Disabled bytearray.extend for now since it causes an infinite recursion
Fixed serveral unit tests
........
r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines
Added PyBytes support to several places:
str + bytearray
ord(bytearray)
bytearray(str, encoding)
........
r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line
Fixed more unit tests related to type('') is not unicode
........
r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines
Fixed more unit tests
Fixed bytearray.extend
........
r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line
Implemented old buffer interface for bytearray
........
r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line
Added backport of the io module
........
r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line
Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines
Fixed more tests
Fixed bytearray() comparsion with unicode()
Fixed iterator assignment of bytearray
........
r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines
str(bytesarray()) now returns the bytes and not the representation of the bytearray object
Enabled and fixed more unit tests
........
r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines
Clear error PyNumber_AsSsize_t() fails
Use CHARMASK for ob_svall access
disabled a test with memoryview again
........
r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line
Untested updates to the PCBuild directory
........
r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line
The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines
Disabled last failing test
I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytes warning code
........
r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line
Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 09:49:49 -03:00
|
|
|
typedef struct {
|
|
|
|
PyObject_VAR_HEAD
|
2008-05-26 09:29:14 -03:00
|
|
|
long ob_shash;
|
|
|
|
int ob_sstate;
|
|
|
|
char ob_sval[1];
|
|
|
|
|
|
|
|
/* Invariants:
|
|
|
|
* ob_sval contains space for 'ob_size+1' elements.
|
|
|
|
* ob_sval[ob_size] == 0.
|
|
|
|
* ob_shash is the hash of the string or -1 if not computed yet.
|
|
|
|
* ob_sstate != 0 iff the string object is in stringobject.c's
|
|
|
|
* 'interned' dictionary; in this case the two references
|
|
|
|
* from 'interned' to this object are *not counted* in ob_refcnt.
|
|
|
|
*/
|
2008-05-26 09:51:38 -03:00
|
|
|
} PyBytesObject;
|
2008-05-26 09:29:14 -03:00
|
|
|
|
|
|
|
#define SSTATE_NOT_INTERNED 0
|
|
|
|
#define SSTATE_INTERNED_MORTAL 1
|
|
|
|
#define SSTATE_INTERNED_IMMORTAL 2
|
|
|
|
|
|
|
|
PyAPI_DATA(PyTypeObject) PyBaseString_Type;
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_DATA(PyTypeObject) PyBytes_Type;
|
2008-05-26 09:29:14 -03:00
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
#define PyBytes_Check(op) \
|
2008-05-26 09:29:14 -03:00
|
|
|
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS)
|
2008-05-26 09:51:38 -03:00
|
|
|
#define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
|
2008-05-26 09:29:14 -03:00
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
|
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
|
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
|
2008-05-26 09:29:14 -03:00
|
|
|
Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
|
2008-05-26 09:29:14 -03:00
|
|
|
Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
|
|
|
|
PyAPI_FUNC(char *) PyBytes_AsString(PyObject *);
|
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int);
|
|
|
|
PyAPI_FUNC(void) PyBytes_Concat(PyObject **, PyObject *);
|
|
|
|
PyAPI_FUNC(void) PyBytes_ConcatAndDel(PyObject **, PyObject *);
|
|
|
|
PyAPI_FUNC(int) _PyBytes_Resize(PyObject **, Py_ssize_t);
|
|
|
|
PyAPI_FUNC(int) _PyBytes_Eq(PyObject *, PyObject*);
|
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_Format(PyObject *, PyObject *);
|
|
|
|
PyAPI_FUNC(PyObject *) _PyBytes_FormatLong(PyObject*, int, int,
|
2008-05-26 09:29:14 -03:00
|
|
|
int, char**, int*);
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
|
2008-05-26 09:29:14 -03:00
|
|
|
const char *, Py_ssize_t,
|
|
|
|
const char *);
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(void) PyBytes_InternInPlace(PyObject **);
|
|
|
|
PyAPI_FUNC(void) PyBytes_InternImmortal(PyObject **);
|
|
|
|
PyAPI_FUNC(PyObject *) PyBytes_InternFromString(const char *);
|
2008-05-26 09:29:14 -03:00
|
|
|
PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void);
|
|
|
|
|
|
|
|
/* Use only if you know it's a string */
|
2008-05-26 09:51:38 -03:00
|
|
|
#define PyBytes_CHECK_INTERNED(op) (((PyBytesObject *)(op))->ob_sstate)
|
2008-05-26 09:29:14 -03:00
|
|
|
|
|
|
|
/* Macro, trading safety for speed */
|
2008-05-26 09:51:38 -03:00
|
|
|
#define PyBytes_AS_STRING(op) (((PyBytesObject *)(op))->ob_sval)
|
|
|
|
#define PyBytes_GET_SIZE(op) Py_SIZE(op)
|
2008-05-26 09:29:14 -03:00
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
|
2008-05-26 09:29:14 -03:00
|
|
|
x must be an iterable object. */
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
|
2008-05-26 09:29:14 -03:00
|
|
|
|
|
|
|
/* --- Generic Codecs ----------------------------------------------------- */
|
|
|
|
|
|
|
|
/* Create an object by decoding the encoded string s of the
|
|
|
|
given size. */
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject*) PyBytes_Decode(
|
2008-05-26 09:29:14 -03:00
|
|
|
const char *s, /* encoded string */
|
|
|
|
Py_ssize_t size, /* size of buffer */
|
|
|
|
const char *encoding, /* encoding */
|
|
|
|
const char *errors /* error handling */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Encodes a char buffer of the given size and returns a
|
|
|
|
Python object. */
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject*) PyBytes_Encode(
|
2008-05-26 09:29:14 -03:00
|
|
|
const char *s, /* string char buffer */
|
|
|
|
Py_ssize_t size, /* number of chars to encode */
|
|
|
|
const char *encoding, /* encoding */
|
|
|
|
const char *errors /* error handling */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Encodes a string object and returns the result as Python
|
|
|
|
object. */
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject*) PyBytes_AsEncodedObject(
|
2008-05-26 09:29:14 -03:00
|
|
|
PyObject *str, /* string object */
|
|
|
|
const char *encoding, /* encoding */
|
|
|
|
const char *errors /* error handling */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Encodes a string object and returns the result as Python string
|
|
|
|
object.
|
|
|
|
|
|
|
|
If the codec returns an Unicode object, the object is converted
|
|
|
|
back to a string using the default encoding.
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
DEPRECATED - use PyBytes_AsEncodedObject() instead. */
|
2008-05-26 09:29:14 -03:00
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject*) PyBytes_AsEncodedString(
|
2008-05-26 09:29:14 -03:00
|
|
|
PyObject *str, /* string object */
|
|
|
|
const char *encoding, /* encoding */
|
|
|
|
const char *errors /* error handling */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Decodes a string object and returns the result as Python
|
|
|
|
object. */
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject*) PyBytes_AsDecodedObject(
|
2008-05-26 09:29:14 -03:00
|
|
|
PyObject *str, /* string object */
|
|
|
|
const char *encoding, /* encoding */
|
|
|
|
const char *errors /* error handling */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Decodes a string object and returns the result as Python string
|
|
|
|
object.
|
|
|
|
|
|
|
|
If the codec returns an Unicode object, the object is converted
|
|
|
|
back to a string using the default encoding.
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
DEPRECATED - use PyBytes_AsDecodedObject() instead. */
|
2008-05-26 09:29:14 -03:00
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(PyObject*) PyBytes_AsDecodedString(
|
2008-05-26 09:29:14 -03:00
|
|
|
PyObject *str, /* string object */
|
|
|
|
const char *encoding, /* encoding */
|
|
|
|
const char *errors /* error handling */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Provides access to the internal data buffer and size of a string
|
|
|
|
object or the default encoded version of an Unicode object. Passing
|
|
|
|
NULL as *len parameter will force the string buffer to be
|
|
|
|
0-terminated (passing a string with embedded NULL characters will
|
|
|
|
cause an exception). */
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(int) PyBytes_AsStringAndSize(
|
2008-05-26 09:29:14 -03:00
|
|
|
register PyObject *obj, /* string or Unicode object */
|
|
|
|
register char **s, /* pointer to buffer variable */
|
|
|
|
register Py_ssize_t *len /* pointer to length variable or NULL
|
|
|
|
(only possible for 0-terminated
|
|
|
|
strings) */
|
|
|
|
);
|
|
|
|
|
|
|
|
/* Using the current locale, insert the thousands grouping
|
|
|
|
into the string pointed to by buffer. For the argument descriptions,
|
|
|
|
see Objects/stringlib/localeutil.h */
|
|
|
|
|
2008-05-26 09:51:38 -03:00
|
|
|
PyAPI_FUNC(int) _PyBytes_InsertThousandsGrouping(char *buffer,
|
2008-05-26 09:29:14 -03:00
|
|
|
Py_ssize_t len,
|
|
|
|
char *plast,
|
|
|
|
Py_ssize_t buf_size,
|
|
|
|
Py_ssize_t *count,
|
|
|
|
int append_zero_char);
|
Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray
........
r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line
Copied files from py3k w/o modifications
........
r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines
Take One
* Added initialization code, warnings, flags etc. to the appropriate places
* Added new buffer interface to string type
* Modified tests
* Modified Makefile.pre.in to compile the new files
* Added bytesobject.c to Python.h
........
r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines
Disabled bytearray.extend for now since it causes an infinite recursion
Fixed serveral unit tests
........
r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines
Added PyBytes support to several places:
str + bytearray
ord(bytearray)
bytearray(str, encoding)
........
r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line
Fixed more unit tests related to type('') is not unicode
........
r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines
Fixed more unit tests
Fixed bytearray.extend
........
r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line
Implemented old buffer interface for bytearray
........
r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line
Added backport of the io module
........
r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line
Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines
Fixed more tests
Fixed bytearray() comparsion with unicode()
Fixed iterator assignment of bytearray
........
r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines
str(bytesarray()) now returns the bytes and not the representation of the bytearray object
Enabled and fixed more unit tests
........
r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines
Clear error PyNumber_AsSsize_t() fails
Use CHARMASK for ob_svall access
disabled a test with memoryview again
........
r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line
Untested updates to the PCBuild directory
........
r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line
The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines
Disabled last failing test
I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytes warning code
........
r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line
Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 09:49:49 -03:00
|
|
|
|
2008-05-30 15:10:04 -03:00
|
|
|
/* Format the object based on the format_spec, as defined in PEP 3101
|
|
|
|
(Advanced String Formatting). */
|
|
|
|
PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj,
|
|
|
|
char *format_spec,
|
|
|
|
Py_ssize_t format_spec_len);
|
|
|
|
|
Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray
........
r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line
Copied files from py3k w/o modifications
........
r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines
Take One
* Added initialization code, warnings, flags etc. to the appropriate places
* Added new buffer interface to string type
* Modified tests
* Modified Makefile.pre.in to compile the new files
* Added bytesobject.c to Python.h
........
r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines
Disabled bytearray.extend for now since it causes an infinite recursion
Fixed serveral unit tests
........
r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines
Added PyBytes support to several places:
str + bytearray
ord(bytearray)
bytearray(str, encoding)
........
r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line
Fixed more unit tests related to type('') is not unicode
........
r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines
Fixed more unit tests
Fixed bytearray.extend
........
r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line
Implemented old buffer interface for bytearray
........
r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line
Added backport of the io module
........
r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line
Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines
Fixed more tests
Fixed bytearray() comparsion with unicode()
Fixed iterator assignment of bytearray
........
r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines
str(bytesarray()) now returns the bytes and not the representation of the bytearray object
Enabled and fixed more unit tests
........
r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines
Clear error PyNumber_AsSsize_t() fails
Use CHARMASK for ob_svall access
disabled a test with memoryview again
........
r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line
Untested updates to the PCBuild directory
........
r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line
The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines
Disabled last failing test
I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytes warning code
........
r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line
Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line
Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 09:49:49 -03:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2008-06-01 19:57:47 -03:00
|
|
|
#endif /* !Py_BYTESOBJECT_H */
|