Skip to content

Commit e07a9fe

Browse files
author
walter.doerwald
committed
Add T_PYSSIZET in structmember.h: This can be used for
Py_ssize_t members. Simplify the implementation of UnicodeError objects: start and end attributes are now stored directly as Py_ssize_t members, which simplifies various get and set functions. git-svn-id: http://svn.python.org/projects/python/trunk@55962 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 8c63212 commit e07a9fe

File tree

5 files changed

+120
-168
lines changed

5 files changed

+120
-168
lines changed

Include/pyerrors.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ typedef struct {
3434
PyObject *message;
3535
PyObject *encoding;
3636
PyObject *object;
37-
PyObject *start;
38-
PyObject *end;
37+
Py_ssize_t start;
38+
Py_ssize_t end;
3939
PyObject *reason;
4040
} PyUnicodeErrorObject;
4141
#endif

Include/structmember.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ typedef struct PyMemberDef {
6868
#ifdef HAVE_LONG_LONG
6969
#define T_LONGLONG 17
7070
#define T_ULONGLONG 18
71+
#define T_PYSSIZET 19 /* Py_ssize_t */
7172
#endif /* HAVE_LONG_LONG */
7273

7374
/* Flags */

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Core and builtins
1414

1515
- Patch #1733960: Allow T_LONGLONG to accept ints.
1616

17+
- T_PYSSIZET can now be used in PyMemberDef lists for Py_ssize_t members.
18+
1719
- Prevent expandtabs() on string and unicode objects from causing a segfault
1820
when a large width is passed on 32-bit platforms.
1921

@@ -687,6 +689,9 @@ Library
687689
- Fix utf-8-sig incremental decoder, which didn't recognise a BOM when the
688690
first chunk fed to the decoder started with a BOM, but was longer than 3 bytes.
689691

692+
- The implementation of UnicodeError objects has been simplified (start and end
693+
attributes are now stored directly as Py_ssize_t members).
694+
690695
Extension Modules
691696
-----------------
692697

0 commit comments

Comments
 (0)