Skip to content

Commit 0d09637

Browse files
authored
Fix inaccuracies in "Assorted Topics" section of "Defining Extension Types" tutorial (#104969)
1 parent 1af8251 commit 0d09637

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Doc/extending/newtypes.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ representation of the instance for which it is called. Here is a simple
168168
example::
169169

170170
static PyObject *
171-
newdatatype_repr(newdatatypeobject * obj)
171+
newdatatype_repr(newdatatypeobject *obj)
172172
{
173173
return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:%d}}",
174174
obj->obj_UnderlyingDatatypePtr->size);
@@ -188,7 +188,7 @@ used instead.
188188
Here is a simple example::
189189

190190
static PyObject *
191-
newdatatype_str(newdatatypeobject * obj)
191+
newdatatype_str(newdatatypeobject *obj)
192192
{
193193
return PyUnicode_FromFormat("Stringified_newdatatype{{size:%d}}",
194194
obj->obj_UnderlyingDatatypePtr->size);
@@ -338,7 +338,7 @@ Here is an example::
338338

339339
PyErr_Format(PyExc_AttributeError,
340340
"'%.100s' object has no attribute '%.400s'",
341-
tp->tp_name, name);
341+
Py_TYPE(obj)->tp_name, name);
342342
return NULL;
343343
}
344344

@@ -379,7 +379,7 @@ Here is a sample implementation, for a datatype that is considered equal if the
379379
size of an internal pointer is equal::
380380

381381
static PyObject *
382-
newdatatype_richcmp(PyObject *obj1, PyObject *obj2, int op)
382+
newdatatype_richcmp(newdatatypeobject *obj1, newdatatypeobject *obj2, int op)
383383
{
384384
PyObject *result;
385385
int c, size1, size2;
@@ -478,7 +478,7 @@ This function takes three arguments:
478478
Here is a toy ``tp_call`` implementation::
479479

480480
static PyObject *
481-
newdatatype_call(newdatatypeobject *self, PyObject *args, PyObject *kwds)
481+
newdatatype_call(newdatatypeobject *obj, PyObject *args, PyObject *kwds)
482482
{
483483
PyObject *result;
484484
const char *arg1;

0 commit comments

Comments
 (0)