Skip to content

Fix/ Statement copying in functions and added loop limit in for loops #223

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

Merged
merged 5 commits into from
Jul 1, 2025

Conversation

vinayswamik
Copy link
Collaborator

Summary of changes

Optimize statement copying in _visit_function_call and added max_loop_iters in _visit_forin_loop

  • Optimized the handling of return statements and function operations by using shallow copies where appropriate, while maintaining fallback to deep copies in case of errors.

Closes #202

  • Added a check to ensure loop ranges do not exceed the maximum allowed iterations, raising a LoopLimitExceededError if exceeded.

Closes #208

replaced deepcopy with shallow copy for function statements
- Added max loop limit in for loop statements
- Added test cases
@vinayswamik vinayswamik changed the title Fix/ Statement copying in functions and added max loop in for loops Fix/ Statement copying in functions and added loop limit in for loops Jun 29, 2025
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pyqasm/visitor.py 85.71% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member

@TheGupta2012 TheGupta2012 left a comment

Choose a reason for hiding this comment

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

LGTM

@TheGupta2012 TheGupta2012 merged commit 73c2167 into qBraid:main Jul 1, 2025
21 checks passed
@vinayswamik vinayswamik deleted the fix/resolving_bugs branch July 1, 2025 06:31
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.

[FEATURE] Add max_loop iteration limit in _visit_forin_loop Evaluate and replace copy.deepcopy with copy.copy
3 participants