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

Update RustPython to fix Dict.keys type #2086

Merged
merged 2 commits into from
Jan 22, 2023

Conversation

harupy
Copy link
Contributor

@harupy harupy commented Jan 22, 2023

This PR upgrades RustPython to fix the type of Dict.keys to Vec<Option<Expr>> (see RustPython/RustPython#4449 for why this change was needed) and unblock #1884.

@harupy
Copy link
Contributor Author

harupy commented Jan 22, 2023

Prior to RustPython/RustPython#4449,

{"a": 0, **b, "c": 1}

is parsed as:

[
    Located {
        location: Location {
            row: 1,
            column: 0,
        },
        end_location: Some(
            Location {
                row: 1,
                column: 21,
            },
        ),
        custom: (),
        node: Expr {
            value: Located {
                location: Location {
                    row: 1,
                    column: 0,
                },
                end_location: Some(
                    Location {
                        row: 1,
                        column: 21,
                    },
                ),
                custom: (),
                node: Dict {
                    👇 contains a single key
                    keys: [
                        Located {
                            location: Location {
                                row: 1,
                                column: 1,
                            },
                            end_location: Some(
                                Location {
                                    row: 1,
                                    column: 4,
                                },
                            ),
                            custom: (),
                            node: Constant {
                                value: Str(
                                    "a",
                                ),
                                kind: None,
                            },
                        },
                    ],
                    values: [
                        Located {
                            location: Location {
                                row: 1,
                                column: 6,
                            },
                            end_location: Some(
                                Location {
                                    row: 1,
                                    column: 7,
                                },
                            ),
                            custom: (),
                            node: Constant {
                                value: Int(
                                    0,
                                ),
                                kind: None,
                            },
                        },
                        Located {
                            location: Location {
                                row: 1,
                                column: 11,
                            },
                            end_location: Some(
                                Location {
                                    row: 1,
                                    column: 12,
                                },
                            ),
                            custom: (),
                            node: Name {
                                id: "b",
                                ctx: Load,
                            },
                        },
                        Located {
                            location: Location {
                                row: 1,
                                column: 14,
                            },
                            end_location: Some(
                                Location {
                                    row: 1,
                                    column: 17,
                                },
                            ),
                            custom: (),
                            👇 `"c": 1` is parsed as dict!
                            node: Dict {
                                keys: [
                                    Located {
                                        location: Location {
                                            row: 1,
                                            column: 14,
                                        },
                                        end_location: Some(
                                            Location {
                                                row: 1,
                                                column: 17,
                                            },
                                        ),
                                        custom: (),
                                        node: Constant {
                                            value: Str(
                                                "c",
                                            ),
                                            kind: None,
                                        },
                                    },
                                ],
                                values: [
                                    Located {
                                        location: Location {
                                            row: 1,
                                            column: 19,
                                        },
                                        end_location: Some(
                                            Location {
                                                row: 1,
                                                column: 20,
                                            },
                                        ),
                                        custom: (),
                                        node: Constant {
                                            value: Int(
                                                1,
                                            ),
                                            kind: None,
                                        },
                                    },
                                ],
                            },
                        },
                    ],
                },
            },
        },
    },
]

.iter()
.flatten()
.map(std::convert::Into::into)
.collect(),
Copy link
Member

Choose a reason for hiding this comment

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

I think this may need to preserve the None, to be truly comparable, right?

Copy link
Member

Choose a reason for hiding this comment

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

(So we'd need to update the definition of ComparableExpr.)

Copy link
Member

Choose a reason for hiding this comment

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

(I'll go ahead and do this, then merge.)

Copy link
Contributor Author

@harupy harupy Jan 22, 2023

Choose a reason for hiding this comment

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

@charliermarsh Thanks for the update!

.iter()
.flatten()
.chain(values.iter())
.any(contains_await),
Copy link
Member

Choose a reason for hiding this comment

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

Oh, we should rewrite this to use any_over_expr. Can be a separate PR, or included here...

@charliermarsh charliermarsh merged commit a7ce862 into astral-sh:main Jan 22, 2023
renovate bot referenced this pull request in ixm-one/pytest-cmake-presets Jan 22, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://github.com/charliermarsh/ruff) | `^0.0.229` ->
`^0.0.230` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.230/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.230/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.230/compatibility-slim/0.0.229)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.230/confidence-slim/0.0.229)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.230`](https://github.com/charliermarsh/ruff/releases/tag/v0.0.230)

[Compare
Source](https://github.com/charliermarsh/ruff/compare/v0.0.229...v0.0.230)

#### What's Changed

- fix: pin rustpython to the same revision to fix cargo vendor by
[@&#8203;figsoda](https://github.com/figsoda) in
[https://github.com/charliermarsh/ruff/pull/2069](https://github.com/charliermarsh/ruff/pull/2069)
- feat: implementation for TRY004 by
[@&#8203;sbrugman](https://github.com/sbrugman) in
[https://github.com/charliermarsh/ruff/pull/2066](https://github.com/charliermarsh/ruff/pull/2066)
- ICN001 import-alias-is-not-conventional should check "from" imports by
[@&#8203;Zeddicus414](https://github.com/Zeddicus414) in
[https://github.com/charliermarsh/ruff/pull/2070](https://github.com/charliermarsh/ruff/pull/2070)
- Update link to Pylint parity tracking issue by
[@&#8203;cosmojg](https://github.com/cosmojg) in
[https://github.com/charliermarsh/ruff/pull/2074](https://github.com/charliermarsh/ruff/pull/2074)
- ICN001 check from imports that have no alias by
[@&#8203;Zeddicus414](https://github.com/Zeddicus414) in
[https://github.com/charliermarsh/ruff/pull/2072](https://github.com/charliermarsh/ruff/pull/2072)
- Index source code upfront to power (row, column) lookups by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/1990](https://github.com/charliermarsh/ruff/pull/1990)
- Remove remaining `ropey` usages by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2076](https://github.com/charliermarsh/ruff/pull/2076)
- Include package path in cache key by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2077](https://github.com/charliermarsh/ruff/pull/2077)
- feat: update scripts to new rules structure by
[@&#8203;sbrugman](https://github.com/sbrugman) in
[https://github.com/charliermarsh/ruff/pull/2078](https://github.com/charliermarsh/ruff/pull/2078)
- Base `INP` check on package inference by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2079](https://github.com/charliermarsh/ruff/pull/2079)
- Improve generator precedence operations by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2080](https://github.com/charliermarsh/ruff/pull/2080)
- Support decorators in source code generator by
[@&#8203;charliermarsh](https://github.com/charliermarsh) in
[https://github.com/charliermarsh/ruff/pull/2081](https://github.com/charliermarsh/ruff/pull/2081)
- feat: enable autofix for TRY004 by
[@&#8203;sbrugman](https://github.com/sbrugman) in
[https://github.com/charliermarsh/ruff/pull/2084](https://github.com/charliermarsh/ruff/pull/2084)
- Refactor, decouple and support "PL" by
[@&#8203;not-my-profile](https://github.com/not-my-profile) in
[https://github.com/charliermarsh/ruff/pull/2051](https://github.com/charliermarsh/ruff/pull/2051)
- \[`pep8-naming`]\[`N806`] Don't mark `TypeVar` & `NewType` Assignment
as Errors by [@&#8203;saadmk11](https://github.com/saadmk11) in
[https://github.com/charliermarsh/ruff/pull/2085](https://github.com/charliermarsh/ruff/pull/2085)
- Update linters pypi links to latest version by
[@&#8203;alonme](https://github.com/alonme) in
[https://github.com/charliermarsh/ruff/pull/2062](https://github.com/charliermarsh/ruff/pull/2062)
- flake8\_to_ruff: support `isort` options by
[@&#8203;shannonrothe](https://github.com/shannonrothe) in
[https://github.com/charliermarsh/ruff/pull/2082](https://github.com/charliermarsh/ruff/pull/2082)
- Update RustPython to fix `Dict.keys` type by
[@&#8203;harupy](https://github.com/harupy) in
[https://github.com/charliermarsh/ruff/pull/2086](https://github.com/charliermarsh/ruff/pull/2086)

#### New Contributors

- [@&#8203;figsoda](https://github.com/figsoda) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/2069](https://github.com/charliermarsh/ruff/pull/2069)
- [@&#8203;cosmojg](https://github.com/cosmojg) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/2074](https://github.com/charliermarsh/ruff/pull/2074)
- [@&#8203;alonme](https://github.com/alonme) made their first
contribution in
[https://github.com/charliermarsh/ruff/pull/2062](https://github.com/charliermarsh/ruff/pull/2062)
- [@&#8203;shannonrothe](https://github.com/shannonrothe) made their
first contribution in
[https://github.com/charliermarsh/ruff/pull/2082](https://github.com/charliermarsh/ruff/pull/2082)

**Full Changelog**:
astral-sh/ruff@v0.0.229...v0.0.230

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDguNCIsInVwZGF0ZWRJblZlciI6IjM0LjEwOC40In0=-->

Signed-off-by: Renovate Bot <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants