# HG changeset patch
# User Jenny Cooley
# Date 1374662667 3600
# Node ID cc944241f5eb06d323f29eeb4c0643d9fadc5cff
# Parent 0f8fd922eaed351e39f913f1317d319dcceb4c01
Trac 12270 swaps the order of the two independent processes described on the trac.
diff git a/sage/rings/number_field/number_field.py b/sage/rings/number_field/number_field.py
 a/sage/rings/number_field/number_field.py
+++ b/sage/rings/number_field/number_field.py
@@ 5680,12 +5680,6 @@
# Convert from L to K
K = self
L = x.parent()
 # List of candidates for K(x)
 f = x.minpoly()
 ys = f.roots(ring=K, multiplicities=False)
 if not ys:
 raise ValueError, "Cannot convert %s to %s (regardless of embeddings)"%(x,K)

# Find embeddings for K and L. If no embedding is given, simply
# take the identity map as "embedding". This handles the case
# where one field is created as subfield of the other.
@@ 5720,6 +5714,12 @@
else:
raise TypeError, "No compatible natural embeddings found for %s and %s"%(KF,LF)
+ # List of candidates for K(x)
+ f = x.minpoly()
+ ys = f.roots(ring=K, multiplicities=False)
+ if not ys:
+ raise ValueError, "Cannot convert %s to %s (regardless of embeddings)"%(x,K)
+
# Define a function are_roots_equal to determine whether two
# roots of f are equal. A simple a == b does not suffice for
# inexact fields because of floatingpoint errors.