[Python-checkins] gh-90716: Remove _pylong._DEBUG flag (#99063)
vstinner
webhook-mailer at python.org
Thu Nov 3 13:16:33 EDT 2022
https://github.com/python/cpython/commit/9c4ae037b9c39312b792964497c090ce01570208
commit: 9c4ae037b9c39312b792964497c090ce01570208
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-11-03T18:16:28+01:00
summary:
gh-90716: Remove _pylong._DEBUG flag (#99063)
To debug the _pylong module, it's trivial to add this code again
locally. There is not need to keep it in Python releases.
files:
M Lib/_pylong.py
diff --git a/Lib/_pylong.py b/Lib/_pylong.py
index e0d4e9042193..d14c1d938363 100644
--- a/Lib/_pylong.py
+++ b/Lib/_pylong.py
@@ -16,8 +16,6 @@
import re
import decimal
-_DEBUG = False
-
def int_to_decimal(n):
"""Asymptotically fast conversion of an 'int' to Decimal."""
@@ -32,9 +30,6 @@ def int_to_decimal(n):
# "clever" recursive way. If we want a string representation, we
# apply str to _that_.
- if _DEBUG:
- print('int_to_decimal', n.bit_length(), file=sys.stderr)
-
D = decimal.Decimal
D2 = D(2)
@@ -141,8 +136,6 @@ def inner(a, b):
def int_from_string(s):
"""Asymptotically fast version of PyLong_FromString(), conversion
of a string of decimal digits into an 'int'."""
- if _DEBUG:
- print('int_from_string', len(s), file=sys.stderr)
# PyLong_FromString() has already removed leading +/-, checked for invalid
# use of underscore characters, checked that string consists of only digits
# and underscores, and stripped leading whitespace. The input can still
@@ -281,8 +274,6 @@ def int_divmod(a, b):
"""Asymptotically fast replacement for divmod, for 'int'.
Its time complexity is O(n**1.58), where n = #bits(a) + #bits(b).
"""
- if _DEBUG:
- print('int_divmod', a.bit_length(), b.bit_length(), file=sys.stderr)
if b == 0:
raise ZeroDivisionError
elif b < 0:
More information about the Python-checkins
mailing list