Skip to content

gh-112069: Do not require lock if the set has never been exposed. - #118069

Merged
corona10 merged 3 commits into
python:mainfrom
corona10:gh-112069-init
Apr 25, 2024
Merged

gh-112069: Do not require lock if the set has never been exposed.#118069
corona10 merged 3 commits into
python:mainfrom
corona10:gh-112069-init

Conversation

@corona10

@corona10corona10 commented Apr 18, 2024

Copy link
Copy Markdown
Member

@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @corona10 for commit 50d62bd 🤖

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 18, 2024
Comment threadObjects/setobject.c Outdated
if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable))
return -1;

if (self->fill == 0 && Py_REFCNT(self) == 1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should do the Py_REFCNT() check first so that we don't access self->fill without a lock in case there are other threads with references modifying self.

Also, do we need to set self->hash = -1 as we do below?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Also, do we need to set self->hash = -1 as we do below?

Well it will be more safe.

@corona10
corona10 requested a review from colesburyApril 20, 2024 00:55
@rhettinger
rhettinger removed their request for review April 21, 2024 19:11
@corona10

Copy link
Copy Markdown
MemberAuthor

@colesbury gentle ping :)

@colesburycolesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@corona10
corona10 merged commit eb20a7d into python:mainApr 25, 2024
@corona10
corona10 deleted the gh-112069-init branch April 25, 2024 15:14
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.

3 participants

@corona10@bedevere-bot@colesbury