Skip to content

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

Merged
TheGupta2012 merged 5 commits intoqBraid:mainfrom
vinayswamik:fix/resolving_bugs
Jul 1, 2025
Merged

Fix/ Statement copying in functions and added loop limit in for loops#223
TheGupta2012 merged 5 commits intoqBraid:mainfrom
vinayswamik:fix/resolving_bugs

Conversation

@vinayswamik
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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