GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — gh-105927: Add PyWeakref_GetRef() function by vstinner · Pull Request #105932 · python/cpython Conversation
|
|
Once this PR will be merged, I will create a follow PR to replace PyWeakref_GET_OBJECT() with PyWeakref_GetRef(). I have it locally, but GitHub doesn't let me create a "patch serie". |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
b7997c9 to
5841078
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
In new API, please don't return NULL without an exception set. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It doesn't return NULL with an exception set. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Add tests on PyWeakref_NewRef(), PyWeakref_GetObject(), PyWeakref_GET_OBJECT() and PyWeakref_GetRef(). * PyWeakref_GetObject() now raises a TypeError if the argument is not a weak reference, instead of SystemError.
5841078 to
8de770d
Compare
|
I changed the API to: I also added tests. @erlend-aasland @encukou: Please review the updated PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Using an |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Change Sphinx formatting * Don't change PyWeakref_GetObject() exception
|
@erlend-aasland: I addressed your review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Thanks! Looks good. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM; I'm interested in Petr's review, though :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Enhance also the doc: specific strong/borrowed reference
|
2de3897 is in itself a nice docs update that could be backported through 3.11! :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks good.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I dislike "3 states" return value: error, case 1 or case 2. It forces to store the return value in a variable and uses 2 if to cover the 3 code paths. Also, IMO the API is more error prone since someone may write the wrong test for the error case. Well, I don't know how much is just m personal taste and what is objective here 😁 I prefer to only return -1 on error, and 0 for the other cases. So I don't need an extra variable. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.