| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,7 +94,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 94 | 94 | This field is not inherited by subtypes. | |
| 95 | 95 | ||
| 96 | 96 | ||
| 97 | - .. c:member:: char* PyTypeObject.tp_name | ||
| 97 | + .. c:member:: const char* PyTypeObject.tp_name | ||
| 98 | 98 | ||
| 99 | 99 | Pointer to a NUL-terminated string containing the name of the type. For types | |
| 100 | 100 | that are accessible as module globals, the string should be the full module | |
@@ -367,7 +367,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 367 | 367 | inherited individually. | |
| 368 | 368 | ||
| 369 | 369 | ||
| 370 | - .. c:member:: long PyTypeObject.tp_flags | ||
| 370 | + .. c:member:: unsigned long PyTypeObject.tp_flags | ||
| 371 | 371 | ||
| 372 | 372 | This field is a bit mask of various flags. Some flags indicate variant | |
| 373 | 373 | semantics for certain situations; others are used to indicate that certain | |
@@ -467,7 +467,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 467 | 467 | .. versionadded:: 3.4 | |
| 468 | 468 | ||
| 469 | 469 | ||
| 470 | - .. c:member:: char* PyTypeObject.tp_doc | ||
| 470 | + .. c:member:: const char* PyTypeObject.tp_doc | ||
| 471 | 471 | ||
| 472 | 472 | An optional pointer to a NUL-terminated C string giving the docstring for this | |
| 473 | 473 | type object. This is exposed as the :attr:`__doc__` attribute on the type and | |
@@ -614,7 +614,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 614 | 614 | +----------------+------------+ | |
| 615 | 615 | ||
| 616 | 616 | ||
| 617 | - .. c:member:: long PyTypeObject.tp_weaklistoffset | ||
| 617 | + .. c:member:: Py_ssize_t PyTypeObject.tp_weaklistoffset | ||
| 618 | 618 | ||
| 619 | 619 | If the instances of this type are weakly referenceable, this field is greater | |
| 620 | 620 | than zero and contains the offset in the instance structure of the weak | |
@@ -781,7 +781,7 @@ type objects) *must* have the :attr:`ob_size` field. | |||
| 781 | 781 | .. XXX explain. | |
| 782 | 782 | ||
| 783 | 783 | ||
| 784 | - .. c:member:: long PyTypeObject.tp_dictoffset | ||
| 784 | + .. c:member:: Py_ssize_t PyTypeObject.tp_dictoffset | ||
| 785 | 785 | ||
| 786 | 786 | If the instances of this type have a dictionary containing instance variables, | |
| 787 | 787 | this field is non-zero and contains the offset in the instances of the type of | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -893,20 +893,20 @@ fields in the right order! It's often easiest to find an example that includes | |||
| 893 | 893 | all the fields you need (even if they're initialized to ``0``) and then change | |
| 894 | 894 | the values to suit your new type. :: | |
| 895 | 895 | ||
| 896 | - char *tp_name; /* For printing */ | ||
| 896 | + const char *tp_name; /* For printing */ | ||
| 897 | 897 | ||
| 898 | 898 | The name of the type - as mentioned in the last section, this will appear in | |
| 899 | 899 | various places, almost entirely for diagnostic purposes. Try to choose something | |
| 900 | 900 | that will be helpful in such a situation! :: | |
| 901 | 901 | ||
| 902 | - int tp_basicsize, tp_itemsize; /* For allocation */ | ||
| 902 | + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ | ||
| 903 | 903 | ||
| 904 | 904 | These fields tell the runtime how much memory to allocate when new objects of | |
| 905 | 905 | this type are created. Python has some built-in support for variable length | |
| 906 | 906 | structures (think: strings, lists) which is where the :c:member:`~PyTypeObject.tp_itemsize` field | |
| 907 | 907 | comes in. This will be dealt with later. :: | |
| 908 | 908 | ||
| 909 | - char *tp_doc; | ||
| 909 | + const char *tp_doc; | ||
| 910 | 910 | ||
| 911 | 911 | Here you can put a string (or its address) that you want returned when the | |
| 912 | 912 | Python script references ``obj.__doc__`` to retrieve the doc string. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,15 +1,15 @@ | |||
| 1 | 1 | typedef struct _typeobject { | |
| 2 | 2 | PyObject_VAR_HEAD | |
| 3 | - char *tp_name; /* For printing, in format "<module>.<name>" */ | ||
| 4 | - int tp_basicsize, tp_itemsize; /* For allocation */ | ||
| 3 | + const char *tp_name; /* For printing, in format "<module>.<name>" */ | ||
| 4 | + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ | ||
| 5 | 5 | ||
| 6 | 6 | /* Methods to implement standard operations */ | |
| 7 | 7 | ||
| 8 | 8 | destructor tp_dealloc; | |
| 9 | 9 | printfunc tp_print; | |
| 10 | 10 | getattrfunc tp_getattr; | |
| 11 | 11 | setattrfunc tp_setattr; | |
| 12 | - void *tp_reserved; | ||
| 12 | + void *tp_reserved; /* formerly known as tp_compare */ | ||
| 13 | 13 | reprfunc tp_repr; | |
| 14 | 14 | ||
| 15 | 15 | /* Method suites for standard classes */ | |
@@ -30,9 +30,9 @@ typedef struct _typeobject { | |||
| 30 | 30 | PyBufferProcs *tp_as_buffer; | |
| 31 | 31 | ||
| 32 | 32 | /* Flags to define presence of optional/expanded features */ | |
| 33 | - long tp_flags; | ||
| 33 | + unsigned long tp_flags; | ||
| 34 | 34 | ||
| 35 | - char *tp_doc; /* Documentation string */ | ||
| 35 | + const char *tp_doc; /* Documentation string */ | ||
| 36 | 36 | ||
| 37 | 37 | /* call function for all accessible objects */ | |
| 38 | 38 | traverseproc tp_traverse; | |
@@ -44,7 +44,7 @@ typedef struct _typeobject { | |||
| 44 | 44 | richcmpfunc tp_richcompare; | |
| 45 | 45 | ||
| 46 | 46 | /* weak reference enabler */ | |
| 47 | - long tp_weaklistoffset; | ||
| 47 | + Py_ssize_t tp_weaklistoffset; | ||
| 48 | 48 | ||
| 49 | 49 | /* Iterators */ | |
| 50 | 50 | getiterfunc tp_iter; | |
@@ -58,7 +58,7 @@ typedef struct _typeobject { | |||
| 58 | 58 | PyObject *tp_dict; | |
| 59 | 59 | descrgetfunc tp_descr_get; | |
| 60 | 60 | descrsetfunc tp_descr_set; | |
| 61 | - long tp_dictoffset; | ||
| 61 | + Py_ssize_t tp_dictoffset; | ||
| 62 | 62 | initproc tp_init; | |
| 63 | 63 | allocfunc tp_alloc; | |
| 64 | 64 | newfunc tp_new; | |
@@ -69,7 +69,6 @@ typedef struct _typeobject { | |||
| 69 | 69 | PyObject *tp_cache; | |
| 70 | 70 | PyObject *tp_subclasses; | |
| 71 | 71 | PyObject *tp_weaklist; | |
| 72 | - | ||
| 73 | 72 | destructor tp_del; | |
| 74 | 73 | ||
| 75 | 74 | /* Type attribute cache version tag. Added in version 2.6 */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1473,6 +1473,7 @@ Bob Weiner | |||
| 1473 | 1473 | Edward Welbourne | |
| 1474 | 1474 | Cliff Wells | |
| 1475 | 1475 | Rickard Westman | |
| 1476 | + Joseph Weston | ||
| 1476 | 1477 | Jeff Wheeler | |
| 1477 | 1478 | Christopher White | |
| 1478 | 1479 | David White | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -449,6 +449,9 @@ C API | |||
| 449 | 449 | Documentation | |
| 450 | 450 | ------------- | |
| 451 | 451 | ||
| 452 | + - Issue #24808: Update the types of some PyTypeObject fields. Patch by | ||
| 453 | + Joseph Weston. | ||
| 454 | + | ||
| 452 | 455 | - Issue #22812: Fix unittest discovery examples. | |
| 453 | 456 | Patch from Pam McA'Nulty. | |
| 454 | 457 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments