Merge ssize_t branch. · alloyapple/python@6fc3b2f · GitHub
Skip to content

Commit 6fc3b2f

Browse files
author
martin.v.loewis
committed
Merge ssize_t branch.
git-svn-id: http://svn.python.org/projects/python/trunk@42382 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 558c40c commit 6fc3b2f

102 files changed

Lines changed: 2659 additions & 1677 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Include/abstract.h

Lines changed: 18 additions & 18 deletions

Include/bufferobject.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ PyAPI_DATA(PyTypeObject) PyBuffer_Type;
1717
#define Py_END_OF_BUFFER (-1)
1818

1919
PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base,
20-
int offset, int size);
20+
Py_ssize_t offset, Py_ssize_t size);
2121
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base,
22-
int offset,
23-
int size);
22+
Py_ssize_t offset,
23+
Py_ssize_t size);
2424

25-
PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, int size);
26-
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, int size);
25+
PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size);
26+
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size);
2727

28-
PyAPI_FUNC(PyObject *) PyBuffer_New(int size);
28+
PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size);
2929

3030
#ifdef __cplusplus
3131
}

Include/cStringIO.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static struct PycStringIO_CAPI {
2929
/* Read a string from an input object. If the last argument
3030
is -1, the remainder will be read.
3131
*/
32-
int(*cread)(PyObject *, char **, int);
32+
int(*cread)(PyObject *, char **, Py_ssize_t);
3333

3434
/* Read a line from an input object. Returns the length of the read
3535
line as an int and a pointer inside the object buffer as char** (so
@@ -38,7 +38,7 @@ static struct PycStringIO_CAPI {
3838
int(*creadline)(PyObject *, char **);
3939

4040
/* Write a string to an output object*/
41-
int(*cwrite)(PyObject *, const char *, int);
41+
int(*cwrite)(PyObject *, const char *, Py_ssize_t);
4242

4343
/* Get the output object as a Python string (returns new reference). */
4444
PyObject *(*cgetvalue)(PyObject *);

Include/ceval.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ PyAPI_FUNC(void) PyEval_ReInitThreads(void);
148148

149149
#endif /* !WITH_THREAD */
150150

151-
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, int *);
151+
PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *);
152152

153153

154154
#ifdef __cplusplus

Include/dictobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item);
9595
PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key);
9696
PyAPI_FUNC(void) PyDict_Clear(PyObject *mp);
9797
PyAPI_FUNC(int) PyDict_Next(
98-
PyObject *mp, int *pos, PyObject **key, PyObject **value);
98+
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value);
9999
PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp);
100100
PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp);
101101
PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp);
102-
PyAPI_FUNC(int) PyDict_Size(PyObject *mp);
102+
PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp);
103103
PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp);
104104
PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key);
105105

Include/intobject.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ PyAPI_DATA(PyTypeObject) PyInt_Type;
3232

3333
PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int);
3434
#ifdef Py_USING_UNICODE
35-
PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, int, int);
35+
PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
3636
#endif
3737
PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
38+
PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t);
39+
PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t);
3840
PyAPI_FUNC(long) PyInt_AsLong(PyObject *);
41+
PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *);
3942
PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *);
4043
#ifdef HAVE_LONG_LONG
4144
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *);

Include/listobject.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,22 @@ typedef struct {
3535
* Items must normally not be NULL, except during construction when
3636
* the list is not yet visible outside the function that builds it.
3737
*/
38-
int allocated;
38+
Py_ssize_t allocated;
3939
} PyListObject;
4040

4141
PyAPI_DATA(PyTypeObject) PyList_Type;
4242

4343
#define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type)
4444
#define PyList_CheckExact(op) ((op)->ob_type == &PyList_Type)
4545

46-
PyAPI_FUNC(PyObject *) PyList_New(int size);
47-
PyAPI_FUNC(int) PyList_Size(PyObject *);
48-
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, int);
49-
PyAPI_FUNC(int) PyList_SetItem(PyObject *, int, PyObject *);
50-
PyAPI_FUNC(int) PyList_Insert(PyObject *, int, PyObject *);
46+
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
47+
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);
48+
PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t);
49+
PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *);
50+
PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *);
5151
PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
52-
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, int, int);
53-
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, int, int, PyObject *);
52+
PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t);
53+
PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
5454
PyAPI_FUNC(int) PyList_Sort(PyObject *);
5555
PyAPI_FUNC(int) PyList_Reverse(PyObject *);
5656
PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);

Include/longintrepr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct _longobject {
5252
digit ob_digit[1];
5353
};
5454

55-
PyAPI_FUNC(PyLongObject *) _PyLong_New(int);
55+
PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
5656

5757
/* Return a copy of src. */
5858
PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);

Include/longobject.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ PyAPI_FUNC(long) PyLong_AsLong(PyObject *);
2121
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
2222
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
2323

24+
/* For use by intobject.c only */
25+
PyAPI_FUNC(Py_ssize_t) _PyLong_AsSsize_t(PyObject *);
26+
PyAPI_FUNC(PyObject *) _PyLong_FromSize_t(size_t);
27+
PyAPI_FUNC(PyObject *) _PyLong_FromSsize_t(Py_ssize_t);
28+
2429
/* _PyLong_AsScaledDouble returns a double x and an exponent e such that
2530
the true value is approximately equal to x * 2**(SHIFT*e). e is >= 0.
2631
x is 0.0 if and only if the input is 0 (in which case, e and x are both
@@ -43,7 +48,7 @@ PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *);
4348

4449
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
4550
#ifdef Py_USING_UNICODE
46-
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, int, int);
51+
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
4752
#endif
4853

4954
/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.

Include/marshal.h

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)