mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
partial Merge bitcoin/bitcoin#27483: Bump python minimum version to 3.8
fac395e5eb2cd3210ba6345f777a586a9bec84e3 ci: Bump ci/lint/Dockerfile (MarcoFalke) fa6eb6516727a8675dc6e46634d8343e282528ab test: Use python3.8 pow() (MarcoFalke) 88881cf7ac029aea660c2413ca8e2a5136fcd41b Bump python minimum version to 3.8 (MarcoFalke) Pull request description: There is no pressing reason to drop support for 3.7, however there are several maintenance issues: * There is no supported operating system that ships 3.7 by default. (debian:buster is EOL and unmaintained to the extent that it doesn't run in the CI environment. See https://github.com/bitcoin/bitcoin/pull/27340#issuecomment-1484988445) * Compiling python 3.7 from source is also unsupported on at least macos, according to https://github.com/bitcoin/bitcoin/pull/24017#issuecomment-1107820790 * Recent versions of lief require 3.8, see https://github.com/bitcoin/bitcoin/pull/27507#issuecomment-1517561645 Fix all maintenance issues by bumping the minimum. ACKs for top commit: RandyMcMillan: ACK fac395e fjahr: ACK fac395e5eb2cd3210ba6345f777a586a9bec84e3 fanquake: ACK fac395e5eb2cd3210ba6345f777a586a9bec84e3 Tree-SHA512: c198decdbbe29d186d73ea3f6549d8a38479383495d14a965a2f9211ce39637b43f13a4c2a5d3bf56e2d468be4bbe49b4ee8e8e19ec69936ff43ddf2b714c712
This commit is contained in:
parent
d5041b6f6e
commit
6e7b402fe9
@ -613,18 +613,7 @@ def modinv(a, n):
|
|||||||
"""Compute the modular inverse of a modulo n using the extended Euclidean
|
"""Compute the modular inverse of a modulo n using the extended Euclidean
|
||||||
Algorithm. See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers.
|
Algorithm. See https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers.
|
||||||
"""
|
"""
|
||||||
# TODO: Change to pow(a, -1, n) available in Python 3.8
|
return pow(a, -1, n)
|
||||||
t1, t2 = 0, 1
|
|
||||||
r1, r2 = n, a
|
|
||||||
while r2 != 0:
|
|
||||||
q = r1 // r2
|
|
||||||
t1, t2 = t2, t1 - q * t2
|
|
||||||
r1, r2 = r2, r1 - q * r2
|
|
||||||
if r1 > 1:
|
|
||||||
return None
|
|
||||||
if t1 < 0:
|
|
||||||
t1 += n
|
|
||||||
return t1
|
|
||||||
|
|
||||||
class TestFrameworkUtil(unittest.TestCase):
|
class TestFrameworkUtil(unittest.TestCase):
|
||||||
def test_modinv(self):
|
def test_modinv(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user