Index: /pyyaml/trunk/ext/_yaml.pyx
===================================================================
--- /pyyaml/trunk/ext/_yaml.pyx	(revision 223)
+++ /pyyaml/trunk/ext/_yaml.pyx	(revision 233)
@@ -652,4 +652,7 @@
     def check_node(self):
         self._parse_next_event()
+        if self.parsed_event.type == YAML_STREAM_START_EVENT:
+            yaml_event_delete(&self.parsed_event)
+            self._parse_next_event()
         if self.parsed_event.type != YAML_STREAM_END_EVENT:
             return True
@@ -662,7 +665,4 @@
 
     cdef object _compose_document(self):
-        if self.parsed_event.type == YAML_STREAM_START_EVENT:
-            yaml_event_delete(&self.parsed_event)
-            self._parse_next_event()
         yaml_event_delete(&self.parsed_event)
         node = self._compose_node(None, None)
Index: /pyyaml/trunk/tests/data/empty-document-bug.canonical
===================================================================
--- /pyyaml/trunk/tests/data/empty-document-bug.canonical	(revision 233)
+++ /pyyaml/trunk/tests/data/empty-document-bug.canonical	(revision 233)
@@ -0,0 +1,1 @@
+# This YAML stream contains no YAML documents.
Index: /pyyaml/trunk/lib/yaml/composer.py
===================================================================
--- /pyyaml/trunk/lib/yaml/composer.py	(revision 223)
+++ /pyyaml/trunk/lib/yaml/composer.py	(revision 233)
@@ -15,4 +15,8 @@
 
     def check_node(self):
+        # Drop the STREAM-START event.
+        if self.check_event(StreamStartEvent):
+            self.get_event()
+
         # If there are more documents available?
         return not self.check_event(StreamEndEvent)
@@ -24,9 +28,4 @@
 
     def compose_document(self):
-
-        # Drop the STREAM-START event.
-        if self.check_event(StreamStartEvent):
-            self.get_event()
-
         # Drop the DOCUMENT-START event.
         self.get_event()
