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

Add tests for ast optimizations #122666

Closed
Eclips4 opened this issue Aug 4, 2024 · 2 comments
Closed

Add tests for ast optimizations #122666

Eclips4 opened this issue Aug 4, 2024 · 2 comments
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@Eclips4
Copy link
Member

Eclips4 commented Aug 4, 2024

Feature or enhancement

Proposal:

Currently we have a one test case which testing that optimize parameter for ast.parse is working as expected.

I propose to add tests for these ast optimizations:

  • Optimization for binary operations if left and right operands are constants
  • Optimization for unary operations if operand is constant
  • Optimization for in operator if right operand is constant list or set
  • Folding of tuples
  • Subscription for constant sequences (tuple, string)

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

@Eclips4 Eclips4 added type-feature A feature request or enhancement tests Tests in the Lib/test dir labels Aug 4, 2024
JelleZijlstra added a commit that referenced this issue Aug 26, 2024
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Aug 26, 2024
(cherry picked from commit 9f9b00d)

Co-authored-by: Kirill Podoprigora <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@serhiy-storchaka
Copy link
Member

Tests for optimization are included in test_peepholer.

@Eclips4
Copy link
Member Author

Eclips4 commented Aug 26, 2024

Tests for optimization are included in test_peepholer.

test_peepholer tests that something is present in the bytecode, but it doesn't tell which part of interpreter are responsible for that.

JelleZijlstra added a commit that referenced this issue Aug 27, 2024
(cherry picked from commit 9f9b00d)

Co-authored-by: Kirill Podoprigora <[email protected]>
Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>
@Eclips4 Eclips4 closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants