Skip to content

Commit 85470bb

Browse files
committed
Don’t crash when braces are not at the beginning of the tag
Fix #34.
1 parent ed50a67 commit 85470bb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cssselect2/tree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,9 @@ def in_disabled_fieldset(self):
371371

372372
def _split_etree_tag(tag):
373373
position = tag.rfind('}')
374-
if position == -1:
374+
if position == -1 or tag[0] != '{':
375375
return '', tag
376376
else:
377-
assert tag[0] == '{'
378377
return tag[1:position], tag[position+1:]
379378

380379

0 commit comments

Comments
 (0)