Repository: sympy/sympy

Issue:
Symbol subs Vector exception
```
A = ReferenceFrame('A')
v = A.x
s, t = symbols('s t')
```

```(s / t)```
output: s / t

```(v / t)```
output: 1/t n̂x 

```(s / t).subs(s, v)```
output:
```
anaconda3/lib/python3.4/site-packages/sympy/parsing/sympy_parser.py in eval_expr(code, local_dict, global_dict)
    689     """
    690     expr = eval(
--> 691         code, global_dict, local_dict)  # take local objects in preference
    692 
    693     return expr

<string> in <module>()

AttributeError: 'function' object has no attribute 'x'
```

Discussion:

Patch:
diff --git a/sympy/core/basic.py b/sympy/core/basic.py
index 9699c354db..3a4a6af4f7 100644
--- a/sympy/core/basic.py
+++ b/sympy/core/basic.py
@@ -849,15 +849,20 @@ def subs(self, *args, **kwargs):
 
         sequence = list(sequence)
         for i in range(len(sequence)):
-            o, n = sequence[i]
-            so, sn = sympify(o), sympify(n)
-            if not isinstance(so, Basic):
-                if type(o) is str:
-                    so = Symbol(o)
-            sequence[i] = (so, sn)
-            if _aresame(so, sn):
-                sequence[i] = None
-                continue
+            s = list(sequence[i])
+            for j, si in enumerate(s):
+                try:
+                    si = sympify(si, strict=True)
+                except SympifyError:
+                    if type(si) is str:
+                        si = Symbol(si)
+                    else:
+                        # if it can't be sympified, skip it
+                        sequence[i] = None
+                        break
+                s[j] = si
+            else:
+                sequence[i] = None if _aresame(*s) else tuple(s)
         sequence = list(filter(None, sequence))
 
         if unordered:
diff --git a/sympy/physics/vector/vector.py b/sympy/physics/vector/vector.py
index e835c3999f..93dc3d24c3 100644
--- a/sympy/physics/vector/vector.py
+++ b/sympy/physics/vector/vector.py
@@ -128,7 +128,10 @@ def __eq__(self, other):
 
         if other == 0:
             other = Vector(0)
-        other = _check_vector(other)
+        try:
+            other = _check_vector(other)
+        except TypeError:
+            return False
         if (self.args == []) and (other.args == []):
             return True
         elif (self.args == []) or (other.args == []):


Test patch:
diff --git a/sympy/core/tests/test_subs.py b/sympy/core/tests/test_subs.py
index 73238f0289..d25846d850 100644
--- a/sympy/core/tests/test_subs.py
+++ b/sympy/core/tests/test_subs.py
@@ -678,3 +678,15 @@ def test_RootOf_issue_10092():
     eq = x**3 - 17*x**2 + 81*x - 118
     r = RootOf(eq, 0)
     assert (x < r).subs(x, r) is S.false
+
+
+def test_issue_8886():
+    from sympy.physics.mechanics import ReferenceFrame as R
+    from sympy.abc import x
+    # if something can't be sympified we assume that it
+    # doesn't play well with SymPy and disallow the
+    # substitution
+    v = R('A').x
+    assert x.subs(x, v) == x
+    assert v.subs(v, x) == v
+    assert v.__eq__(x) is False