Skip to content

Commit eb43976

Browse files
authored
Merge commit from fork
* Fix inefficient attribute pattern Found by @mauriceng98 * Fix lint
1 parent 3a661b2 commit eb43976

5 files changed

Lines changed: 30 additions & 4 deletions

File tree

docs/src/markdown/about/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ icon: lucide/scroll-text
33
---
44
# Changelog
55

6+
## 2.8.4
7+
8+
- **FIX**: Fix another inefficient attribute pattern (@mauriceng98).
9+
610
## 2.8.3
711

812
- **FIX**: Fix inefficient attribute pattern.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ include = [
5454
"/tests/**/*.py",
5555
"/.pyspelling.yml",
5656
"/.coveragerc",
57-
"/mkdocs.yml"
57+
"/zensical.yml"
5858
]
5959

6060
[tool.mypy]
@@ -128,7 +128,7 @@ passenv = *
128128
deps =
129129
-rrequirements/docs.txt
130130
commands =
131-
{envbindir}/zensical build -f zensical.yml --clean --strict
131+
{envbindir}/zensical build -f zensical.yml --clean
132132
pyspelling -j 8
133133
134134
[testenv:lint]

soupsieve/__meta__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,5 @@ def parse_version(ver: str) -> Version:
193193
return Version(major, minor, micro, release, pre, post, dev)
194194

195195

196-
__version_info__ = Version(2, 8, 3, "final")
196+
__version_info__ = Version(2, 8, 4, "final")
197197
__version__ = __version_info__._get_canonical()

soupsieve/css_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
# `nth` content
119119
NTH = fr'(?:[-+])?(?:[0-9]+n?|n)(?:(?<=n){WSC}*(?:[-+]){WSC}*(?:[0-9]+))?'
120120
# Value: quoted string or identifier
121-
VALUE = fr'''(?:"(?:\\(?:.|{NEWLINE})|[^\\"\r\n\f]+)*?"|'(?:\\(?:.|{NEWLINE})|[^\\'\r\n\f]+)*?'|{IDENTIFIER})'''
121+
VALUE = fr'''(?:"(?:\\(?:.|{NEWLINE})|[^\\"\r\n\f])*?"|'(?:\\(?:.|{NEWLINE})|[^\\'\r\n\f])*?'|{IDENTIFIER})'''
122122
# Attribute value comparison. `!=` is handled special as it is non-standard.
123123
ATTR = fr'(?:{WSC}*(?P<cmp>[!~^|*$]?=){WSC}*(?P<value>{VALUE})(?:{WSC}*(?P<case>[is]))?)?{WSC}*'
124124

tests/test_extra/test_attribute.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,25 @@ def test_bad_attribute(self):
6262
self.assertEqual(e.context, '[\\]!=D4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n^')
6363
self.assertEqual(e.line, 1)
6464
self.assertEqual(e.col, 1)
65+
66+
def test_bad_attribute_unclused(self):
67+
"""Test bad attribute fails for syntax error, not timeout error."""
68+
69+
import signal
70+
71+
def timeout_handler(signum, frame):
72+
raise TimeoutError
73+
74+
signal.signal(signal.SIGALRM, timeout_handler)
75+
signal.alarm(3)
76+
77+
passed = False
78+
try:
79+
with self.assertRaises(sv.SelectorSyntaxError):
80+
sv.compile('[a="' + ('x' * 300))
81+
passed = True
82+
except TimeoutError:
83+
pass
84+
finally:
85+
signal.alarm(0)
86+
self.assertTrue(passed)

0 commit comments

Comments
 (0)