Repository: sympy/sympy

Issue:
[LGTM]: loop variable not used in diophantine
Instances of `for v1 in` should be changed to `for var in` (2 of them) in diophantine.py.

Here is a test case:

```
eq=(x**2 + y**2 +3*x- 5)
diophantine(eq,permute=True)
master:
{(1, -1), (1, 1), (-4, 1), (-4, -1)}
corrrected:
{(1, -1), (4, -1), (-1, 1), (-4, -1), (-4, 1), (-1, -1), (4, 1), (1, 1)}
```

Discussion:

Patch:
diff --git a/sympy/solvers/diophantine.py b/sympy/solvers/diophantine.py
index 838d93b799..e7f73bcece 100644
--- a/sympy/solvers/diophantine.py
+++ b/sympy/solvers/diophantine.py
@@ -240,7 +240,7 @@ def diophantine(eq, param=symbols("t", integer=True), syms=None,
                     # here var_mul is like [(x,), (y, )]
                     for v1 in var_mul:
                         try:
-                            coeff = c[var[0]]
+                            coeff = c[v1[0]]
                         except KeyError:
                             coeff = 0
                         x_coeff = bool(x_coeff) and bool(coeff)
@@ -265,7 +265,7 @@ def diophantine(eq, param=symbols("t", integer=True), syms=None,
                     # here var_mul is like [(x,), (y, )]
                     for v1 in var_mul:
                         try:
-                            coeff = c[var[0]]
+                            coeff = c[v1[0]]
                         except KeyError:
                             coeff = 0
                         x_coeff = bool(x_coeff) and bool(coeff)


Test patch:
diff --git a/sympy/solvers/tests/test_diophantine.py b/sympy/solvers/tests/test_diophantine.py
index d8374b8849..f4bc011b4a 100644
--- a/sympy/solvers/tests/test_diophantine.py
+++ b/sympy/solvers/tests/test_diophantine.py
@@ -540,6 +540,8 @@ def test_diophantine():
     assert diophantine(1/x) == set()
     assert diophantine(1/x + 1/y - S.Half)
     set([(6, 3), (-2, 1), (4, 4), (1, -2), (3, 6)])
+    assert diophantine(x**2 + y**2 +3*x- 5, permute=True) == \
+        set([(-1, 1), (-4, -1), (1, -1), (1, 1), (-4, 1), (-1, -1), (4, 1), (4, -1)])
 
 
 def test_general_pythagorean():