Skip to content

Fix inaccuracies in "Assorted Topics" section of "Defining Extension Types" tutorial #104969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Doc/extending/newtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ representation of the instance for which it is called. Here is a simple
example::

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

static PyObject *
newdatatype_str(newdatatypeobject * obj)
newdatatype_str(newdatatypeobject *obj)
{
return PyUnicode_FromFormat("Stringified_newdatatype{{size:%d}}",
obj->obj_UnderlyingDatatypePtr->size);
Expand Down Expand Up @@ -338,7 +338,7 @@ Here is an example::

PyErr_Format(PyExc_AttributeError,
"'%.100s' object has no attribute '%.400s'",
tp->tp_name, name);
Py_TYPE(obj)->tp_name, name);
return NULL;
}

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

static PyObject *
newdatatype_richcmp(PyObject *obj1, PyObject *obj2, int op)
newdatatype_richcmp(newdatatypeobject *obj1, newdatatypeobject *obj2, int op)
{
PyObject *result;
int c, size1, size2;
Expand Down Expand Up @@ -478,7 +478,7 @@ This function takes three arguments:
Here is a toy ``tp_call`` implementation::

static PyObject *
newdatatype_call(newdatatypeobject *self, PyObject *args, PyObject *kwds)
newdatatype_call(newdatatypeobject *obj, PyObject *args, PyObject *kwds)
{
PyObject *result;
const char *arg1;
Expand Down