Skip to content
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

IdDict: support deletion, and support nothing used as a key #26839

Merged
merged 2 commits into from Apr 23, 2018

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Apr 17, 2018

No description provided.

@vtjnash vtjnash added status:priority This should be addressed urgently backport pending 0.5 kind:bugfix This change fixes an existing bug labels Apr 17, 2018
@martinholters
Copy link
Member

Tests?

@vchuravy vchuravy added the status:needs tests Unit tests are required for this change label Apr 17, 2018
@JeffBezanson
Copy link
Sponsor Member

6b94780

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 17, 2018

No, that shouldn't have an affect on this

@JeffBezanson
Copy link
Sponsor Member

I believe that's the change that caused this.

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 17, 2018

No, the bug is with the subsequent line (*bp = NULL;), which was pre-existing. The 6b94780 change did allow some significant performance optimization for this patch however.

@JeffBezanson
Copy link
Sponsor Member

You're right; it was a more general problem with deletion.

src/table.c Outdated
return &tab[index + 1];
if (key != jl_nothing)
// `nothing` is our sentinel value for deletion, so need to keep searching if it's also our search key
return NULL;
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This looks like dead code --- if tab[index + 1] == NULL then key must be nothing.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Good point (For comparison, I put an assert here in the other function. Just didn’t realize I had converged them after exploring some alternative ways of expressing this.)

previously, if we deleted one key or added `nothing` as a key,
we might lose some of the other entries too (until rehash)

fix #26833
@vtjnash vtjnash merged commit c0a278c into master Apr 23, 2018
@vtjnash vtjnash deleted the jn/iddict-delete branch April 23, 2018 20:33
@ararslan ararslan mentioned this pull request Apr 26, 2018
7 tasks
vtjnash added a commit that referenced this pull request Apr 27, 2018
previously, if we deleted one key or added `nothing` as a key,
we might lose some of the other entries too (until rehash)

fix #26833

(cherry-pick PR #26839, 5e57c21)
ararslan pushed a commit that referenced this pull request Apr 27, 2018
previously, if we deleted one key or added `nothing` as a key,
we might lose some of the other entries too (until rehash)

fix #26833

(cherry-pick PR #26839, 5e57c21)

(cherry picked from commit 6d60f78)
ararslan pushed a commit that referenced this pull request May 8, 2018
previously, if we deleted one key or added `nothing` as a key,
we might lose some of the other entries too (until rehash)

fix #26833

(cherry-pick PR #26839, 5e57c21)

(cherry picked from commit 6d60f78)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bugfix This change fixes an existing bug status:priority This should be addressed urgently
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants