waylan/Python-Markdown — Issue #48: Freeze with table not preceded by an empty line
Author: jpfleury
Created: 2011-10-15 19:11:02+00:00
State: open

1. Create a file `n.py` with the following content:

import markdown

text = """
Lorem ipsum
Lorem ipsum dolor sit amet inceptos | Lorem ipsum | Lorem ipsum
----------------------------------- | :---------: | :---------:
Lorem ipsum | Lorem ipsum | Lorem ipsum
"""

print markdown.markdown(text, extensions=['extra'])

2. Run the file:

$ python n.py

**Actual result:** Python-Markdown freezes. If we interrupt the process, we have the following output:

$ python n.py
^CTraceback (most recent call last):
File "n.py", line 10, in
print markdown.markdown(text, extensions=['extra'])
File "/home/nom/.local/lib/python2.7/site-packages/markdown/__init__.py", line 386, in markdown
return md.convert(text)
File "/home/nom/.local/lib/python2.7/site-packages/markdown/__init__.py", line 283, in convert
root = self.parser.parseDocument(self.lines).getroot()
File "/home/nom/.local/lib/python2.7/site-packages/markdown/blockparser.py", line 62, in parseDocument
self.parseChunk(self.root, '\n'.join(lines))
File "/home/nom/.local/lib/python2.7/site-packages/markdown/blockparser.py", line 77, in parseChunk
self.parseBlocks(parent, text.split('\n\n'))
File "/home/nom/.local/lib/python2.7/site-packages/markdown/blockparser.py", line 93, in parseBlocks
if processor.test(parent, blocks[0]):
File "/home/nom/.local/lib/python2.7/site-packages/markdown/blockprocessors.py", line 470, in test
return bool(self.SEARCH_RE.search(block))
KeyboardInterrupt
$

**Expected result:** no freeze.

**More information:**

- The following code doesn't make Python-Markdown to freeze:

import markdown

text = """
Lorem ipsum

Lorem ipsum dolor sit amet inceptos | Lorem ipsum | Lorem ipsum
----------------------------------- | :---------: | :---------:
Lorem ipsum | Lorem ipsum | Lorem ipsum
"""

print markdown.markdown(text, extensions=['extra'])

- Tested with `waylan-Python-Markdown-2.1.0.beta-0-ge8cdb0b.zip`.