# Finite Field Extension

I am using SageMath version 9.2. I was trying the example in the documentation:

`sage: k = GF(2)`

`sage: k.extension(x^1000 + x^5 + x^4 + x^3 + 1, 'a')`

However, this gives the error: `UnboundLocalError: local variable 'E' referenced before assignment`

How do I fix this?

Same behaviour with SageMath 9.3.beta9. This is a bug.

Is there any other way I can specify a finite field modulo a particular irreducible polynomial?

The code for the

`extension`

method of finite fields is atThere are a bunch of if/elif/else branches to decide how to define

`E`

.In this case we are in the first branch of the main "if",

which has a nested if/elif/elif with no final "else", so that

`E`

never gets defined.