Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1330
diff -u -p -r1.1330 node.module
--- modules/node/node.module	2 Dec 2010 23:58:21 -0000	1.1330
+++ modules/node/node.module	9 Dec 2010 21:13:02 -0000
@@ -672,10 +672,10 @@ function node_type_update_nodes($old_typ
  */
 function _node_types_build($rebuild = FALSE) {
   $cid = 'node_types:' . $GLOBALS['language']->language;
+  $_node_types = &drupal_static(__FUNCTION__, (object) array('init' => TRUE, 'types' => array(), 'names' => array()));
 
   if (!$rebuild) {
-    $_node_types = &drupal_static(__FUNCTION__);
-    if (isset($_node_types)) {
+    if (!isset($_node_types->init)) {
       return $_node_types;
     }
     if ($cache = cache_get($cid)) {
@@ -683,8 +683,8 @@ function _node_types_build($rebuild = FA
       return $_node_types;
     }
   }
-
-  $_node_types = (object) array('types' => array(), 'names' => array());
+  // Unset internal initialization flag.
+  unset($_node_types->init);
 
   foreach (module_implements('node_info') as $module) {
     $info_array = module_invoke($module, 'node_info');
@@ -734,6 +734,8 @@ function _node_types_build($rebuild = FA
     foreach ($_node_types->types as $type => $type_object) {
       if (!empty($type_object->is_new) || !empty($type_object->disabled_changed)) {
         node_type_save($type_object);
+        // Since the type has been saved, the is_new flag is no longer needed.
+        unset($_node_types->types[$type]->is_new);
       }
     }
   }
Index: modules/node/node.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.test,v
retrieving revision 1.104
diff -u -p -r1.104 node.test
--- modules/node/node.test	9 Dec 2010 08:01:56 -0000	1.104
+++ modules/node/node.test	9 Dec 2010 21:13:02 -0000
@@ -1169,9 +1169,24 @@ class NodeTypeTestCase extends DrupalWeb
   }
 
   /**
+   * Test that fresh node types are returned by node_type_get_types().
+   */
+  function testNodeTypeCaching() {
+    // Prime the node type cache.
+    node_types_rebuild();
+    // Enable the blog module, which provides a content type.
+    module_enable(array('blog'), FALSE);
+    $this->resetAll();
+    // node_type_get_types() should include the new type.
+    $new_types = node_type_get_types();
+    $this->assertTrue(isset($new_types['blog']), t('Retrieved node types include new type.'));
+    $this->assertTrue(empty($new_types['blog']->is_new), t('The is_new flag was unset after the type was saved.'));
+  }
+
+  /**
    * Test editing a node type using the UI.
    */
