mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Wrote down the invariants of some common objects whose structure is
exposed in header files. Fixed a few comments in these headers. As we might have expected, writing down invariants systematically exposed a (minor) bug. In this case, function objects have a writeable func_code attribute, which could be set to code objects with the wrong number of free variables. Calling the resulting function segfaulted the interpreter. Added a corresponding test.
This commit is contained in:
parent
063e1e846d
commit
89a39461bf
12 changed files with 98 additions and 25 deletions
|
@ -16,12 +16,12 @@ PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */
|
|||
|
||||
A slice object containing start, stop, and step data members (the
|
||||
names are from range). After much talk with Guido, it was decided to
|
||||
let these be any arbitrary python type.
|
||||
let these be any arbitrary python type. Py_None stands for omitted values.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
PyObject *start, *stop, *step;
|
||||
PyObject *start, *stop, *step; /* not NULL */
|
||||
} PySliceObject;
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PySlice_Type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue