id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc
173	Python regular expression named groups breaks (?) pyyaml	anonymous	xi	"I'm using pyyaml 3.09 in Python 2.6.5 on Ubuntu 10.04 LTS. 

I have a yaml file I used for configuration of a web server (tornado), and the section of my file causing issues looks like this: 

{{{
RequestHandlers:
  # [ path, handler class, [whitelist] ]
   - [/stats, myapp.core.Stats, [127.0.0.1, 10.0.0.0/8]]
   - [r'/(?P<id>.*)', myapp.core.Foo, [127.0.0.1, 192.168.0.0/16]]
   - [/.*, myapp.core.MainHandler, []]
}}}


When this gets loaded, pyyaml yells at me. Here's a python interpreter session: 

============================================
{{{
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type ""help"", ""copyright"", ""credits"" or ""license"" for more information.
>>> import yaml
>>> stream = open('etc/subzero.yaml')
>>> config = yaml.load(stream)
Traceback (most recent call last):
  File ""<stdin>"", line 1, in <module>
  File ""build/bdist.linux-i686/egg/yaml/__init__.py"", line 58, in load
    
  File ""build/bdist.linux-i686/egg/yaml/constructor.py"", line 42, in get_single_data
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 36, in get_single_node
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 55, in compose_document
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 84, in compose_node
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 133, in compose_mapping_node
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 82, in compose_node
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 111, in compose_sequence_node
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 82, in compose_node
  File ""build/bdist.linux-i686/egg/yaml/composer.py"", line 110, in compose_sequence_node
  File ""build/bdist.linux-i686/egg/yaml/parser.py"", line 93, in check_event
  File ""build/bdist.linux-i686/egg/yaml/parser.py"", line 479, in parse_flow_sequence_entry
yaml.parser.ParserError: while parsing a flow sequence
  in ""etc/myapp.yaml"", line 35, column 5
expected ',' or ']', but got '?'
  in ""etc/myapp.yaml"", line 35, column 10
}}}
============================================

Line 35 is:
{{{
   - [r'/(?P<id>.*)', myapp.core.Foo, [127.0.0.1, 192.168.0.0/16]]
}}}
I'm wondering why it's choking here. Disabling this line causes everything to work perfectly well. The question mark is a special case in YAML, but (I thought) only when it's accompanied by a space. I don't recall ever needing to escape anything inside of a yaml file, but I tried escaping the '?'. Not sure what to try next. If I double-quote like ""r'/(?P<id>.*)'"" then it'll be a double-quoted string on the other end of the load as well, which doesn't help me. 

Clue hereby solicited. "	defect	closed	normal	pyyaml	normal	invalid		
