◐ Shell
reader mode source ↗
Skip to content

gh-87390: Fix starred tuple equality and pickling#92249

Closed
mrahtz wants to merge 5 commits into
python:mainfrom
mrahtz:unpacked-tuple-equality
Closed

gh-87390: Fix starred tuple equality and pickling#92249
mrahtz wants to merge 5 commits into
python:mainfrom
mrahtz:unpacked-tuple-equality

Conversation

@mrahtz

@mrahtz mrahtz commented May 3, 2022

Copy link
Copy Markdown
Contributor

Hilariously, before this PR, it turned out that *tuple[int] was equal to tuple[int]. Fixing it, I realised that pickling was also broken: it didn't preserve gaobject.starred. This PR fixes both.

I've tested for refleaks with python3 -m test -v test_genericalias -R 3:3, and it came back clean, so I think we're good.

@Fidget-Spinner I guess you're the one most familiar with this code? :)

@JelleZijlstra

Copy link
Copy Markdown
Member

I think this is worth a NEWS entry; it's been a while since we put the rest of this code into main. I'll review the PR now.

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

Thanks! I'm a little unhappy about making unpacked a public argument to the constructor, but I'm not sure how else we'd get pickling to work.

@mrahtz

mrahtz commented May 3, 2022

Copy link
Copy Markdown
Contributor Author

I think this is worth a NEWS entry; it's been a while since we put the rest of this code into main.

I've added a NEWS entry for this specific change, but just to double check - were you thinking of this specific change, or the rest of the PEP 646-related changes we made to genericaliasobject.c recently? (I had to check, but we did have something in the NEWS for 3.11.0a7 saying that we "Allow unpacking types.GenericAlias objects".)

@JelleZijlstra

Copy link
Copy Markdown
Member

I think this is worth a NEWS entry; it's been a while since we put the rest of this code into main.

I've added a NEWS entry for this specific change, but just to double check - were you thinking of this specific change, or the rest of the PEP 646-related changes we made to genericaliasobject.c recently? (I had to check, but we did have something in the NEWS for 3.11.0a7 saying that we "Allow unpacking types.GenericAlias objects".)

Just for this change (the PR title would be good as a NEWS entry too).

@JelleZijlstra JelleZijlstra self-assigned this May 3, 2022

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

Great work! We're pretty close.

@Fidget-Spinner

Copy link
Copy Markdown
Member

Azure pipelines patcheck fail is unrelated, I will fix it on main.

@Fidget-Spinner

Copy link
Copy Markdown
Member

Azure pipelines patcheck fail is unrelated, I will fix it on main.

Nevermind, it seems that 65f88a6 fixed the whitespace issues, so this just needs updating from main.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hide comment

I do not like an idea about extending GenericAlias() with the third parameter. It is a public API.

I'll provide an alternate PR.

@serhiy-storchaka

Copy link
Copy Markdown
Member

See #92337.

@carljm

carljm commented May 7, 2022

Copy link
Copy Markdown
Member

Looks like this can be closed since the alternative was already merged.

@carljm carljm closed this May 7, 2022
@mrahtz mrahtz deleted the unpacked-tuple-equality branch May 7, 2022 11:22
Sign up for free to 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.

8 participants