Skip to content

Commit ef3de3f

Browse files
committed
revert <> error message, update tests
1 parent 7a5f540 commit ef3de3f

3 files changed

Lines changed: 9 additions & 535 deletions

File tree

Lib/test/test_syntax.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,27 +3533,27 @@ def test_double_ampersand(self):
35333533
def test_diamond_operator(self):
35343534
self._check_error(
35353535
"1<>2",
3536-
r'Are you trying to overthrow the SC\? Use operator "!="!',
3536+
"invalid syntax",
35373537
lineno=1,
35383538
end_lineno=1,
35393539
offset=2,
35403540
end_offset=4,
35413541
)
3542-
self._check_error(
3543-
"1 < > 2",
3544-
"invalid syntax",
3545-
lineno=1,
3546-
end_lineno=1,
3547-
offset=5,
3548-
end_offset=6,
3549-
)
35503542

35513543
def test_diamond_operator_barry_as_flufl(self):
35523544
# Under barry_as_FLUFL, '<>' is the valid "not equal" operator
35533545
compile(
35543546
"from __future__ import barry_as_FLUFL\n1<>2",
35553547
"<test>", "exec",
35563548
)
3549+
self._check_error(
3550+
"from __future__ import barry_as_FLUFL\na < > b",
3551+
"invalid syntax",
3552+
lineno=2,
3553+
end_lineno=2,
3554+
offset=5,
3555+
end_offset=6,
3556+
)
35573557

35583558
def test_triple_equal(self):
35593559
self._check_error(

Parser/action_helpers.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -931,10 +931,6 @@ _PyPegen_check_barry_as_flufl(Parser *p, Token* t) {
931931
return -1;
932932
}
933933
if (!(p->flags & PyPARSE_BARRY_AS_BDFL)) {
934-
if (strcmp(tok_str, "<>") == 0) {
935-
RAISE_SYNTAX_ERROR("invalid syntax. Are you trying to overthrow the SC? Use operator \"!=\"!");
936-
return -1;
937-
}
938934
return strcmp(tok_str, "!=");
939935
}
940936
return 0;

0 commit comments

Comments
 (0)