Commit 3602b4d7 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

Fix optimised_pow2_inplace() on Python 3.10 (GH-4103)

Fix optimised_pow2_inplace() doctest on Python 3.10 because the error message changed.

Python 3.9 error message:
    unsupported operand type(s) for ** or pow(): 'int' and 'str'

Python 3.10 error message:
    unsupported operand type(s) for **=: 'int' and 'str'
parent db8cf13c
...@@ -153,9 +153,9 @@ def optimised_pow2_inplace(n): ...@@ -153,9 +153,9 @@ def optimised_pow2_inplace(n):
0.5 0.5
>>> optimised_pow2_inplace(0.5) == 2 ** 0.5 >>> optimised_pow2_inplace(0.5) == 2 ** 0.5
True True
>>> optimised_pow2_inplace('test') >>> optimised_pow2_inplace('test') #doctest: +ELLIPSIS
Traceback (most recent call last): Traceback (most recent call last):
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'str' TypeError: unsupported operand type(s) for ...: 'int' and 'str'
""" """
x = 2 x = 2
x **= n x **= n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment