Closed pierre-chataigner closed 1 year ago
The walrus operator currently appears in the following places:
djhtml/__main__.py
88: if changed := _verify_changed(source, result):
djhtml/lines.py
51: if text := self.text.strip():
68: if value := getattr(self, attr):
djhtml/modes.py
217: if tag := re.match(self.OPENING_TAG, raw_token):
246: if regex := self.AMBIGUOUS_BLOCK_TAGS.get(name):
290: if match := re.match(r"([\w\-\.:]+)(\s*)", src):
317: if tagname := re.search(r"\w+", raw_token):
djhtml/tokens.py
34: if value := getattr(self, attr):
Are you saying that all of these usages are incorrect? Then why do the unittests pass with Python 3.8, 3.9, 3.10 and 3.11?
Problem came from my side, my bad.
Hi,
I've encountered this error. with python 3.9.5 I believe it might be solved by replacing
if changed := _verify_changed(source, result):
byif (changed := _verify_changed(source, result)):
(with parenthesis) in accordance with PEP 572 : Relative precedence of :=