Skip to content

Conversation

@erlend-aasland
Copy link
Contributor

@erlend-aaslanderlend-aasland commented Jan 5, 2021

@erlend-aasland
Copy link
ContributorAuthor

cc @shihai1991

PyMem_Free(capi);
return-1;
}
if (PyModule_AddObject(module, "_ucnhash_CAPI", capsule) <0){
Copy link
Member

Choose a reason for hiding this comment

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

How about using PyModule_AddObjectRef in here too?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We could do that, but I'm not sure it would improve this code. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

PyModule_AddObjectRef() is more easy to understand than PyModule_AddObject(), because PyModule_AddObject() will steal the refs sometimes.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

After thinking about it, I do agree. It's easier to follow the ref count when reading the code. I'll change it. Thanks!

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Should I change the other PyModule_AddObject in unicodedata_exec() while we're there?

@erlend-aasland
Copy link
ContributorAuthor

@vstinner, would you mind reviewing this?

@vstinner
Copy link
Member

@vstinner, would you mind reviewing this?

Not yet. I'm fixing the second regression caused by your latest change :-D https://bugs.python.org/issue42866 I'm not blaming you, regressions are common, and I'm fine with dealing with them. It's just that I prefer to fix all known regressions before taking the risk of adding new ones ;-)

@erlend-aasland
Copy link
ContributorAuthor

Not yet. I'm fixing the second regression caused by your latest change :-D https://bugs.python.org/issue42866 I'm not blaming you, regressions are common, and I'm fine with dealing with them. It's just that I prefer to fix all known regressions before taking the risk of adding new ones ;-)

I totally understand that, and I appreciate you helping out fixing the regressions :)

@erlend-aasland
Copy link
ContributorAuthor

PTAL, @vstinner

@vstinnervstinner merged commit 61d2639 into python:masterJan 20, 2021
@vstinner
Copy link
Member

Merged, thanks.

@erlend-aaslanderlend-aasland deleted the bpo-41798/unicodedata branch January 20, 2021 11:04
@erlend-aasland
Copy link
ContributorAuthor

Merged, thanks.

Thanks for reviewing!

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@erlend-aasland@vstinner@shihai1991@the-knights-who-say-ni@bedevere-bot