Index: modules/block/block.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.module,v
retrieving revision 1.421
diff -u -p -r1.421 block.module
--- modules/block/block.module	13 May 2010 07:53:02 -0000	1.421
+++ modules/block/block.module	9 Jun 2010 19:33:11 -0000
@@ -242,6 +242,15 @@ function block_page_build(&$page) {
         $page[$region] = $blocks;
       }
     }
+    // Once we've finished attaching all blocks to the page, clear the static
+    // cache to allow modules to alter the block list differently in different
+    // contexts. For example, any code that triggers hook_page_build() more
+    // than once in the same page request may need to alter the block list
+    // differently each time, so that only certain parts of the page are
+    // actually built. We do not clear the cache any earlier than this, though,
+    // because it is used each time block_get_blocks_by_region() gets called
+    // above.
+    drupal_static_reset('block_list');
   }
   else {
     // Append region description if we are rendering the regions demo page.
