Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchakaserhiy-storchaka commented Nov 6, 2023

It is a sample. We perhaps will only merge a part of these changes.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing code with 3 cases (error, not found, found) is really hard to me, especially since you also change ownership and reference counting in the same PR. I cannot review such giant single PR. If you want me to review it, please create smaller PRs. For example, only change around 10 PyDict_Get call per PR. Just Modules/_ctypes/_ctypes.c alone is already a big piece.

}
int rc = PyDict_GetItemRef(dict, key, presult);
if (rc <= 0){// error or not found
*presult = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it now redundant?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, redundant. And the code here can be simplified even more.

// error or found
Py_DECREF(key);
return result;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add // not found after to be extra explicit, since this code pattern is not common.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added here and in other places.

@vstinner
Copy link
Member

What's the status of that PR? Was it rebased on the main branch to retrieve other already merged changes? It's marked as a draft. I prefer to wait until it's not a draft to review it.

@serhiy-storchaka
Copy link
MemberAuthor

It was merged with main to include already merged changes. I extracted also Python/bytecodes.c in a separate PR #111978.

The remaining is relatively small and simple.

@serhiy-storchaka
Copy link
MemberAuthor

Split on more PRs.

@serhiy-storchakaserhiy-storchaka marked this pull request as draft November 14, 2023 19:22
@vstinner
Copy link
Member

Split on more PRs.

Is this PR ready for a review? It's marked as a draft and now has a conflict.

@serhiy-storchaka
Copy link
MemberAuthor

I left the combined PR to see the general image, but most of changes were already merged in other PRs.

@serhiy-storchakaserhiy-storchaka deleted the use-dict_getitemref branch January 11, 2024 09:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@serhiy-storchaka@vstinner