mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
gh-100239: specialize long tail of binary operations (#128722)
This commit is contained in:
parent
e81fe940c9
commit
3893a92d95
21 changed files with 796 additions and 492 deletions
|
@ -357,9 +357,12 @@ class Parser(PLexer):
|
|||
def uop(self) -> UOp | None:
|
||||
if tkn := self.expect(lx.IDENTIFIER):
|
||||
if self.expect(lx.DIVIDE):
|
||||
sign = 1
|
||||
if negate := self.expect(lx.MINUS):
|
||||
sign = -1
|
||||
if num := self.expect(lx.NUMBER):
|
||||
try:
|
||||
size = int(num.text)
|
||||
size = sign * int(num.text)
|
||||
except ValueError:
|
||||
raise self.make_syntax_error(
|
||||
f"Expected integer, got {num.text!r}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue