Blob Blame History Raw
From 644fb2f9115bdbed77b4c9aa577b5bf0c1fbb39c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
Date: Sun, 16 Feb 2020 22:56:58 +0100
Subject: [PATCH] ast.Str and other constants are deprecated since 3.8.

Fixes #279.
---
 rope/base/pyobjects.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rope/base/pyobjects.py b/rope/base/pyobjects.py
index fd4d1c822..97860c8eb 100644
--- a/rope/base/pyobjects.py
+++ b/rope/base/pyobjects.py
@@ -220,7 +220,8 @@ def get_module(self):
     def get_doc(self):
         if len(self.get_ast().body) > 0:
             expr = self.get_ast().body[0]
-            if isinstance(expr, ast.Expr) and isinstance(expr.value, ast.Str):
+            ast_Str = ast.Constant if hasattr(ast, "Constant") else ast.Str
+            if isinstance(expr, ast.Expr) and isinstance(expr.value, ast_Str):
                 docstring = expr.value.s
                 coding = self.get_module().coding
                 return _decode_data(docstring, coding)