diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py
index 402f360..51e61ed 100644
--- a/IPython/core/interactiveshell.py
+++ b/IPython/core/interactiveshell.py
@@ -923,7 +923,7 @@ class InteractiveShell(SingletonConfigurable, Magic):
         # A table holding all the namespaces IPython deals with, so that
         # introspection facilities can search easily.
         self.ns_table = {'user_global':self.user_module.__dict__,
-                         'user_local':user_ns,
+                         'user_local':self.user_ns,
                          'builtin':builtin_mod.__dict__
                          }
     
diff --git a/IPython/core/magic.py b/IPython/core/magic.py
index 38f900f..4670881 100644
--- a/IPython/core/magic.py
+++ b/IPython/core/magic.py
@@ -693,7 +693,7 @@ Currently the magic system has the following functions:\n"""
             return
 
         # default namespaces to be searched
-        def_search = ['user','builtin']
+        def_search = ['user_local', 'user_global', 'builtin']
 
         # Process options/args
         opts,args = self.parse_options(parameter_s,'cias:e:',list_all=True)
diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py
index 472611d..6e5458c 100644
--- a/IPython/core/oinspect.py
+++ b/IPython/core/oinspect.py
@@ -762,13 +762,15 @@ class Inspector:
                                  (name,ns_table.keys()))
 
         #print 'type_pattern:',type_pattern # dbg
-        search_result = []
+        search_result, namespaces_seen = set(), set()
         for ns_name in ns_search:
             ns = ns_table[ns_name]
-            tmp_res = list(list_namespace(ns,type_pattern,filter,
-                                          ignore_case=ignore_case,
-                                          show_all=show_all))
-            search_result.extend(tmp_res)
-        search_result.sort()
-
-        page.page('\n'.join(search_result))
+            # Normally, locals and globals are the same, so we just check one.
+            if id(ns) in namespaces_seen:
+                continue
+            namespaces_seen.add(id(ns))
+            tmp_res = list_namespace(ns, type_pattern, filter,
+                                    ignore_case=ignore_case, show_all=show_all)
+            search_result.update(tmp_res)
+
+        page.page('\n'.join(sorted(search_result)))
diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py
index 6ce6e6a..5221499 100644
--- a/IPython/core/tests/test_magic.py
+++ b/IPython/core/tests/test_magic.py
@@ -340,3 +340,7 @@ def doctest_precision():
     Out[5]: {u}'3.141593e+00'
     """
 
+def test_psearch():
+    with tt.AssertPrints("dict.fromkeys"):
+        _ip.run_cell("dict.fr*?")
+