summaryrefslogtreecommitdiff
path: root/sphinx/pycode/ast.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-17 04:01:17 +0100
committerAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-09-27 18:31:47 +0100
commit7649eb1505dada483af9897459f699a2a106bed4 (patch)
tree7123bc37b60a0b55e34caa1314dcfc1283465f4c /sphinx/pycode/ast.py
parent51927bb6e416aea4f30b39de28e40b53168b7fed (diff)
downloadsphinx-git-7649eb1505dada483af9897459f699a2a106bed4.tar.gz
Clean up after dropping Python 3.6
Diffstat (limited to 'sphinx/pycode/ast.py')
-rw-r--r--sphinx/pycode/ast.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/pycode/ast.py b/sphinx/pycode/ast.py
index d4646f0b7..c0d6fc463 100644
--- a/sphinx/pycode/ast.py
+++ b/sphinx/pycode/ast.py
@@ -3,7 +3,7 @@
import sys
from typing import Dict, List, Optional, Type, overload
-if sys.version_info > (3, 8):
+if sys.version_info[:2] >= (3, 8):
import ast
else:
try:
@@ -159,7 +159,7 @@ class _UnparseVisitor(ast.NodeVisitor):
if node.value is Ellipsis:
return "..."
elif isinstance(node.value, (int, float, complex)):
- if self.code and sys.version_info > (3, 8):
+ if self.code and sys.version_info[:2] >= (3, 8):
return ast.get_source_segment(self.code, node) # type: ignore
else:
return repr(node.value)
@@ -219,7 +219,7 @@ class _UnparseVisitor(ast.NodeVisitor):
else:
return "(" + ", ".join(self.visit(e) for e in node.elts) + ")"
- if sys.version_info < (3, 8):
+ if sys.version_info[:2] <= (3, 7):
# these ast nodes were deprecated in python 3.8
def visit_Bytes(self, node: ast.Bytes) -> str:
return repr(node.s)