# Sum(1/(n**3 - 1), (n, -oo, -2)).doit() raise UnboundLocalVariable #9908

Closed
opened this Issue Sep 11, 2015 · 4 comments

Projects
None yet
3 participants
Member

### gxyd commented Sep 11, 2015

 ``````>>> n = Symbol('n', integer=True) >>> Sum(1/(n**3 - 1), (n, -oo, -2)).doit() --------------------------------------------------------------------------- UnboundLocalError Traceback (most recent call last) in () ----> 1 Sum(1/(n**3 - 1), (n, -oo, -2)).doit() /home/gxyd/Public/sympy/sympy/concrete/summations.py in doit(self, **hints) 182 i = i.label 183 --> 184 newf = eval_sum(f, (i, a, b)) 185 if newf is None: 186 if f == self.function: /home/gxyd/Public/sympy/sympy/concrete/summations.py in eval_sum(f, limits) 587 # this can save time when b-a is big. 588 # We should try to transform to partial fractions --> 589 value = eval_sum_symbolic(f.expand(), (i, a, b)) 590 if value is not None: 591 return value /home/gxyd/Public/sympy/sympy/concrete/summations.py in eval_sum_symbolic(f, limits) 687 return r 688 --> 689 return eval_sum_hyper(f_orig, (i, a, b)) 690 691 /home/gxyd/Public/sympy/sympy/concrete/summations.py in eval_sum_hyper(f, i_a_b) 764 if cond == False: 765 return None --> 766 return Piecewise((res1 - res2, cond), (old_sum, True)) 767 768 if a == S.NegativeInfinity: UnboundLocalError: local variable 'res1' referenced before assignment ``````
Member

### leosartaj commented Sep 11, 2015

 This looks like an indentation issue to me. L-766 should be indented one more block.
Member

### leosartaj commented Sep 11, 2015

 @irresolute Maybe you can pick this up.

Contributor

### rresol commented Sep 12, 2015

 @leosartaj sure!

### rresol added a commit to rresol/sympy that referenced this issue Sep 15, 2015

``` Fixed issue sympy#9908 ```
`Added test for issue sympy#9908`
``` ae92e2a ```

Merged

### rresol added a commit to rresol/sympy that referenced this issue Sep 15, 2015

``` Fixed Indentation Error in summations.py and added test for Issue sym… ```
`…py#9908`
``` 36c37b9 ```

### rresol added a commit to rresol/sympy that referenced this issue Sep 16, 2015

``` Fixed Indentation Error in summations.py and added test fo issue symp… ```
`…y#9908`
``` c97b5ee ```

### rresol added a commit to rresol/sympy that referenced this issue Sep 17, 2015

``` Fixed Indentation Error in summations.py and added test for the issue s… ```
`…ympy#9908`
``` 3d7148c ```

### rresol added a commit to rresol/sympy that referenced this issue Sep 17, 2015

``` Fixed Indentation Error in summations.py and added test for issue sym… ```
`…py#9908`
``` 182ab29 ```

### rresol added a commit to rresol/sympy that referenced this issue Sep 25, 2015

``` Fixed indenation error in summations.py and added test for issue symp… ```
`…y#9908`
``` c83ecd4 ```

### leosartaj added a commit that referenced this issue Sep 26, 2015

``` Merge pull request #9919 from rresol/9908 ```
`Fixed issue #9908`
``` ffbec6f ```
Member

### gxyd commented Sep 26, 2015

 closing fixed by #9919

### kshitij10496 added a commit to kshitij10496/sympy that referenced this issue Sep 29, 2015

``` Fixed indenation error in summations.py and added test for issue symp… ```
`…y#9908`
``` 2a74a6f ```

### kevalds51 added a commit to kevalds51/sympy that referenced this issue Oct 7, 2015

``` Fixed indenation error in summations.py and added test for issue symp… ```
`…y#9908`
``` 43b3ed0 ```

### skirpichev added a commit to diofant/diofant that referenced this issue Feb 12, 2016

``` Fixed indenation error in summations.py ```
```Also added test for issue sympy/sympy#9908

Conflicts:
sympy/concrete/summations.py

// minor edits by skirpichev```
``` 1cf7769 ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue May 13, 2016

``` Fixed indenation error in summations.py ```
```Also added test for issue sympy/sympy#9908

Conflicts:
sympy/concrete/summations.py

// minor edits by skirpichev```
``` 138143b ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue May 21, 2016

``` Fixed indenation error in summations.py ```
```Also added test for issue sympy/sympy#9908

Conflicts:
sympy/concrete/summations.py

// minor edits by skirpichev```
``` 2512efa ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue May 22, 2016

``` Fixed indenation error in summations.py ```
```Also added test for issue sympy/sympy#9908

Conflicts:
sympy/concrete/summations.py

// minor edits by skirpichev```
``` ed3039f ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jun 26, 2016

``` Fixed indenation error in summations.py ```
```Also added test for issue sympy/sympy#9908

Conflicts:
sympy/concrete/summations.py

// minor edits by skirpichev```
``` d1b92a2 ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 16, 2016

``` Fixed indenation error in summations.py ```
```Also added test for issue sympy/sympy#9908

// minor edits by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>```
``` cc3fa8d ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016

``` Add regression tests & mention closed issues ```
```    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
close sympy/sympy#9173 (test was added in 5a510ac)
close sympy/sympy#9808 (fixed in 09e539b)
close sympy/sympy#9341 (fixed in af98a00)
close sympy/sympy#9908 (fixed in cc3fa8d)
close sympy/sympy#6171 (test added in d278031)
close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
close sympy/sympy#10201 (fixed in 0d0fc5f)
close sympy/sympy#9057 (test was added in 8290a0c)
close sympy/sympy#11159 (test was added in ffb76cb)
close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
close sympy/sympy#11081 (see ed01e16 and bb92329)
close sympy/sympy#10974 (see 73fc425)
close sympy/sympy#10806 (test in 539929a)
close sympy/sympy#10801 (test in 2fe3da5)
close sympy/sympy#9549 (test in 88bdefa)
close sympy/sympy#4231 (test was added in fb411d5)
close sympy/sympy#8634 (see 2fcbb58)
close sympy/sympy#8481 (see 1ef20d3)
close sympy/sympy#9956 (fixed in a34735f)
close sympy/sympy#9747 (see e117c60)
close sympy/sympy#7853 (see 3e4fbed)
close sympy/sympy#9634 (see 2be03f5)
close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
close sympy/sympy#9192 (see 9bf622f)
close sympy/sympy#7130 (see e068fa3)
close sympy/sympy#8514 (see b2d543b)
close sympy/sympy#9334 (see 90de625)
close sympy/sympy#8229 (see 9755b89)
close sympy/sympy#8061 (see 7054f06)
close sympy/sympy#7872 (tested in diofant#6)
close sympy/sympy#3496 (tested in test_log_symbolic)
close sympy/sympy#2929 (see da7db7a)
close sympy/sympy#8203 (oo is not a real, see diofant#36)
close sympy/sympy#7649 (0 is imaginary since diofant#8)
close sympy/sympy#7256 (fixed in c0a4549)
close sympy/sympy#6783 (see cb28d63)
close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
close sympy/sympy#5295 (fixed with diofant#354)
close sympy/sympy#4856 (we now have flake/pep tests)
close sympy/sympy#4555 (flake8 enabled after diofant#214)
close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
close sympy/sympy#5484 (see above)

fixes sympy/sympy#8825 (probably via diofant#209)
fixes sympy/sympy#8635
fixes sympy/sympy#8157
fixes sympy/sympy#7872
fixes sympy/sympy#7599
fixes sympy/sympy#6179
fixes sympy/sympy#5415
fixes sympy/sympy#2865
fixes sympy/sympy#5907
fixes sympy/sympy#11722

Closes diofant#347```
``` 74ade76 ```

### skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016

``` Add regression tests & mention closed issues ```
```    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
close sympy/sympy#9173 (test was added in 5a510ac)
close sympy/sympy#9808 (fixed in 09e539b)
close sympy/sympy#9341 (fixed in af98a00)
close sympy/sympy#9908 (fixed in cc3fa8d)
close sympy/sympy#6171 (test added in d278031)
close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
close sympy/sympy#10201 (fixed in 0d0fc5f)
close sympy/sympy#9057 (test was added in 8290a0c)
close sympy/sympy#11159 (test was added in ffb76cb)
close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
close sympy/sympy#11081 (see ed01e16 and bb92329)
close sympy/sympy#10974 (see 73fc425)
close sympy/sympy#10806 (test in 539929a)
close sympy/sympy#10801 (test in 2fe3da5)
close sympy/sympy#9549 (test in 88bdefa)
close sympy/sympy#4231 (test was added in fb411d5)
close sympy/sympy#8634 (see 2fcbb58)
close sympy/sympy#8481 (see 1ef20d3)
close sympy/sympy#9956 (fixed in a34735f)
close sympy/sympy#9747 (see e117c60)
close sympy/sympy#7853 (see 3e4fbed)
close sympy/sympy#9634 (see 2be03f5)
close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
close sympy/sympy#9192 (see 9bf622f)
close sympy/sympy#7130 (see e068fa3)
close sympy/sympy#8514 (see b2d543b)
close sympy/sympy#9334 (see 90de625)
close sympy/sympy#8229 (see 9755b89)
close sympy/sympy#8061 (see 7054f06)
close sympy/sympy#7872 (tested in diofant#6)
close sympy/sympy#3496 (tested in test_log_symbolic)
close sympy/sympy#2929 (see da7db7a)
close sympy/sympy#8203 (oo is not a real, see diofant#36)
close sympy/sympy#7649 (0 is imaginary since diofant#8)
close sympy/sympy#7256 (fixed in c0a4549)
close sympy/sympy#6783 (see cb28d63)
close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
close sympy/sympy#5295 (fixed with diofant#354)
close sympy/sympy#4856 (we now have flake/pep tests)
close sympy/sympy#4555 (flake8 enabled after diofant#214)
close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
close sympy/sympy#5484 (see above)

fixes sympy/sympy#8825 (probably via diofant#209)
fixes sympy/sympy#8635
fixes sympy/sympy#8157
fixes sympy/sympy#7872
fixes sympy/sympy#7599
fixes sympy/sympy#6179
fixes sympy/sympy#5415
fixes sympy/sympy#2865
fixes sympy/sympy#5907
fixes sympy/sympy#11722

Closes diofant#347```
``` 48c035e ```