diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 63d93d8c5c..9f468b2dbf 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -410,7 +410,9 @@ dictionary syntax::
     'bar'
     >>> del c['foo']
     >>> c['foo']
-    ''
+    Traceback (most recent call last):
+    ...
+    KeyError: 'foo'
     >>> c['newvariable'] = 'hello'
     >>> c['newvariable']
     'hello'