104 lines
4.3 KiB
Diff
104 lines
4.3 KiB
Diff
From d6f8634004aa679d2d71037bd63af82052f08fee Mon Sep 17 00:00:00 2001
|
||
From: Stephen Finucane <stephen@that.guru>
|
||
Date: Tue, 19 Nov 2019 23:53:54 +0700
|
||
Subject: [PATCH 07/26] py3: Replace 'sys.maxint' with 'sys.maxsize'
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
From the Python 3 release docs [1]:
|
||
|
||
The sys.maxint constant was removed, since there is no longer a limit
|
||
to the value of integers. However, sys.maxsize can be used as an
|
||
integer larger than any practical list or string index. It conforms to
|
||
the implementation’s “natural” integer size and is typically the
|
||
same as sys.maxint in previous releases on the same platform (assuming
|
||
the same build options).
|
||
|
||
[1] https://docs.python.org/3.1/whatsnew/3.0.html#integers
|
||
|
||
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
||
|
||
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8354 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
|
||
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
|
||
---
|
||
docutils/nodes.py | 4 ++--
|
||
docutils/parsers/rst/tableparser.py | 2 +-
|
||
docutils/statemachine.py | 2 +-
|
||
docutils/transforms/parts.py | 4 ++--
|
||
4 files changed, 6 insertions(+), 6 deletions(-)
|
||
|
||
diff --git a/docutils/nodes.py b/docutils/nodes.py
|
||
index 71189ab..c524373 100644
|
||
--- a/docutils/nodes.py
|
||
+++ b/docutils/nodes.py
|
||
@@ -977,7 +977,7 @@ class Element(Node):
|
||
'Losing "%s" attribute: %s' % (att, self[att])
|
||
self.parent.replace(self, new)
|
||
|
||
- def first_child_matching_class(self, childclass, start=0, end=sys.maxint):
|
||
+ def first_child_matching_class(self, childclass, start=0, end=sys.maxsize):
|
||
"""
|
||
Return the index of the first child whose class exactly matches.
|
||
|
||
@@ -997,7 +997,7 @@ class Element(Node):
|
||
return None
|
||
|
||
def first_child_not_matching_class(self, childclass, start=0,
|
||
- end=sys.maxint):
|
||
+ end=sys.maxsize):
|
||
"""
|
||
Return the index of the first child whose class does *not* match.
|
||
|
||
diff --git a/docutils/parsers/rst/tableparser.py b/docutils/parsers/rst/tableparser.py
|
||
index 45af72f..2760ea0 100644
|
||
--- a/docutils/parsers/rst/tableparser.py
|
||
+++ b/docutils/parsers/rst/tableparser.py
|
||
@@ -498,7 +498,7 @@ class SimpleTableParser(TableParser):
|
||
"""
|
||
# "Infinite" value for a dummy last column's beginning, used to
|
||
# check for text overflow:
|
||
- columns.append((sys.maxint, None))
|
||
+ columns.append((sys.maxsize, None))
|
||
lastcol = len(columns) - 2
|
||
# combining characters do not contribute to the column width
|
||
lines = [strip_combining_chars(line) for line in lines]
|
||
diff --git a/docutils/statemachine.py b/docutils/statemachine.py
|
||
index b56f3c5..5d7fe77 100644
|
||
--- a/docutils/statemachine.py
|
||
+++ b/docutils/statemachine.py
|
||
@@ -1341,7 +1341,7 @@ class StringList(ViewList):
|
||
|
||
"""A `ViewList` with string-specific methods."""
|
||
|
||
- def trim_left(self, length, start=0, end=sys.maxint):
|
||
+ def trim_left(self, length, start=0, end=sys.maxsize):
|
||
"""
|
||
Trim `length` characters off the beginning of each item, in-place,
|
||
from index `start` to `end`. No whitespace-checking is done on the
|
||
diff --git a/docutils/transforms/parts.py b/docutils/transforms/parts.py
|
||
index 11b1b23..7a2fa0f 100644
|
||
--- a/docutils/transforms/parts.py
|
||
+++ b/docutils/transforms/parts.py
|
||
@@ -37,7 +37,7 @@ class SectNum(Transform):
|
||
self.startnode.parent.remove(self.startnode)
|
||
if self.document.settings.sectnum_xform:
|
||
if self.maxdepth is None:
|
||
- self.maxdepth = sys.maxint
|
||
+ self.maxdepth = sys.maxsize
|
||
self.update_section_numbers(self.document)
|
||
else: # store details for eventual section numbering by the writer
|
||
self.document.settings.sectnum_depth = self.maxdepth
|
||
@@ -120,7 +120,7 @@ class Contents(Transform):
|
||
sections = [sect for sect in node if isinstance(sect, nodes.section)]
|
||
entries = []
|
||
autonum = 0
|
||
- depth = self.startnode.details.get('depth', sys.maxint)
|
||
+ depth = self.startnode.details.get('depth', sys.maxsize)
|
||
for section in sections:
|
||
title = section[0]
|
||
auto = title.get('auto') # May be set by SectNum.
|
||
--
|
||
2.24.0.375.geb5ae68d41
|
||
|