-
Notifications
You must be signed in to change notification settings - Fork 2
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
Pyrona: Create RegionObject
and RegionMetadata
objects
#9
Conversation
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.
LGTM
I addressed Matt's comments now! Also tests added. |
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.
LGTM. Couple more minor conventions.
4d3d0db
to
b95cb10
Compare
Since the cpython style seems to be inconsistent, I searched for it and found Pep7. Most likely not perfect, but a good reference. |
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.
Looks good a few minor things, a couple of possible issues.
Objects/regions.c
Outdated
@@ -237,8 +314,9 @@ int _Py_CheckRegionInvariant(PyThreadState *tstate) | |||
|
|||
// Also need to visit the type of the object | |||
// As this isn't covered by the traverse. | |||
// TODO: this might be covered by tp_traverse? |
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.
Doesn't seem to be. I don't understand why though.
6842db5
to
4551ac8
Compare
Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
Co-authored-by: Tobias Wrigstad <tobias.wrigstad@it.uu.se>
4551ac8
to
4324ae4
Compare
4324ae4
to
edebab3
Compare
I believe this should be everything. The last three commits address the review comments. (Thank you for the detailed review <3) The segmentation fault fixes have become part of e808d1f (My rebase was a bit too aggressive sorry)
#9 (comment) should be the last pending comment. |
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.
Couple of minor bits
Objects/regions.c
Outdated
@@ -809,15 +815,15 @@ static int Region_init(PyRegionObject *self, PyObject *args, PyObject *kwds) { | |||
|
|||
// Make the region an owner of the bridge object | |||
self->ob_base.ob_region = (Py_uintptr_t) self->metadata; | |||
_Py_MakeImmutable(Py_TYPE(self)); | |||
_Py_MakeImmutable((PyObject*)Py_TYPE(self)); |
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 think there is something that gives the Type directly at the correct type. PyObject_Type(self)
But I think it might gives you a reference count, but the current code doesn't.
I am not sure if _Py_MakeImmutable
should receive a borrow or an actual rc. We should discuss in the stand up tomorrow.
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.
Built-in functions in cpython only borrow arguments, meaning they don't modify the ref count, unless they return an object. The actual decref of the arguments is done by the runtime here:
Lines 2773 to 2775 in ee37c2b
for (int i = 0; i < total_args; i++) { | |
Py_DECREF(args[i]); | |
} |
I've added a doc comment to _Py_MakeImmutable
and changed the default return type to None
RegionObject
and RegionMetadata
objects
@matajoh Since we have |
I've now added a |
bf291ee
to
8924b0b
Compare
Thank you for the detail review. A lot of good comments. The last commit should have addressed everything that has been resolved. I tried to explain our decisions on the others and often added comments in the code to document it better. |
91c5468
to
b322148
Compare
TODO list:
cc: @TobiasWrigstad