Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-39573: Convert Py_TYPE() to a static inline function#20290
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
6 commits Select commit Hold shift + click to select a range
21dd58e bpo-39573: Convert Py_TYPE() to a static inline function
corona10 8e9637a bpo-39573: Update docs
corona10 a8b98db bpo-39573: Apply code review
corona10 4306ac8 Update Doc/whatsnew/3.10.rst
corona10 cd3c677 Update Doc/c-api/structures.rst
corona10 7757af5 bpo-39573: Apply code review
corona10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -91,25 +91,41 @@ Optimizations | ||
| ============= | ||
| Build and C API Changes | ||
| ======================= | ||
| Deprecated | ||
| ========== | ||
| Removed | ||
| ======= | ||
corona10 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| Porting to Python 3.10 | ||
| ====================== | ||
| This section lists previously described changes and other bugfixes | ||
| that may require changes to your code. | ||
| Build Changes | ||
| ============= | ||
| C API Changes | ||
| ============= | ||
| New Features | ||
| ------------ | ||
| Porting to Python 3.10 | ||
| ---------------------- | ||
| * Since :c:func:`Py_TYPE()` is changed to the inline static function, | ||
| ``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, new_type)``: | ||
| see :c:func:`Py_SET_TYPE()` (available since Python 3.9). | ||
| (Contributed by Dong-hee Na in :issue:`39573`.) | ||
| Removed | ||
| ------- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -121,9 +121,13 @@ typedef struct{ | ||
| #define _PyVarObject_CAST(op) ((PyVarObject*)(op)) | ||
| #define Py_REFCNT(ob) (_PyObject_CAST(ob)->ob_refcnt) | ||
| #define Py_TYPE(ob) (_PyObject_CAST(ob)->ob_type) | ||
| #define Py_SIZE(ob) (_PyVarObject_CAST(ob)->ob_size) | ||
| static inline PyTypeObject* _Py_TYPE(const PyObject *ob){ | ||
| return ob->ob_type; | ||
| } | ||
| #define Py_TYPE(ob) _Py_TYPE(_PyObject_CAST_CONST(ob)) | ||
corona10 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| static inline int _Py_IS_TYPE(const PyObject *ob, const PyTypeObject *type){ | ||
| return ob->ob_type == type; | ||
| } | ||
2 changes: 2 additions & 0 deletions 2 Misc/NEWS.d/next/Core and Builtins/2020-05-22-00-34-34.bpo-39573.QO2QHj.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| :c:func:`Py_TYPE()` is changed to the inline static function. Patch by | ||
| Dong-hee Na. |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.