-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
[2.7] bpo-29165: doc: make extending/newtypes more Python 3 friendly #211
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
Conversation
PyObject_HEAD_INIT(NULL) can't be used here on Python 3. PyVarObject_HEAD_INIT(NULL, 0) can be used on both of Python 2 and 3.
|
||
This line is a bit of a wart; what we'd like to write is:: | ||
|
||
PyObject_HEAD_INIT(&PyType_Type) | ||
PyVarObject_HEAD_INIT(&PyType_Type, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is worth to explain what 0
means here (it is a historical artifact).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want this pull request only copies from Python 3's doc.
@@ -244,7 +236,7 @@ doesn't do anything. It can't even be subclassed. | |||
Adding data and methods to the Basic example | |||
-------------------------------------------- | |||
|
|||
Let's expend the basic example to add some data and methods. Let's also make | |||
Let's extend the basic example to add some data and methods. Let's also make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"extend" or "expand"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -965,14 +957,15 @@ Finalization and De-allocation | |||
|
|||
This function is called when the reference count of the instance of your type is | |||
reduced to zero and the Python interpreter wants to reclaim it. If your type | |||
has memory to free or other clean-up to perform, put it here. The object itself | |||
needs to be freed here as well. Here is an example of this function:: | |||
has memory to free or other clean-up to perform, you can put it here. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is changed in these lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked diff of Doc/include/*.c between 2.7 and master, and backported many style fixes. I checked |
thanks |
Fixes python#211 Signed-off-by: Filipe Laíns <[email protected]>
No description provided.