python-rope/rope

Extract of incomplete block is allowed to half-execute

raymyers opened this issue · 0 comments

Describe the bug
Currently Rope will allow an extract to partially execute that includes the statement that begins an indented block but not the last statement in the block.

To Reproduce
Steps to reproduce the behavior:

  1. Code before refactoring:
if True:
   a = 1
   b = 2
  1. Describe the refactoring you want to do

Extract function of the region marked in comments

# start {{
if True:
   a = 1 # }} end
   b = 2
  1. Expected code after refactoring:

No change, exception raised

  1. Describe the error or unexpected result that you are getting

No exception raised, creates a new function but does not replace the target region with a call to it.

Editor information (please complete the following information):

  • Rope Python version: 3.10
  • Rope version: Rope 1.10