vectorgraphics / asymptote

2D & 3D TeX-Aware Vector Graphics Language
https://asymptote.sourceforge.io/
GNU General Public License v3.0
533 stars 89 forks source link

[xasy2asy] fix "SyntaxWarning" with python3.12+ #464

Closed vp1981 closed 1 week ago

vp1981 commented 1 week ago

Hello.

Below is trivial patch to fix "SyntaxWarning"

From 48ceffa0033e43b3d0f7d50ea3311e111172f77d Mon Sep 17 00:00:00 2001
From: Vladimir Lomov <vladimir@bnode.bkoty.ru>
Date: Mon, 24 Jun 2024 13:28:15 +0800
Subject: [PATCH 1/2] Fix "SyntaxWarning" for python3.12+

Signed-off-by: Vladimir Lomov <vladimir@bnode.bkoty.ru>
---
 GUI/xasy2asy.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/GUI/xasy2asy.py b/GUI/xasy2asy.py
index 25c75b2e..cf1edb8a 100644
--- a/GUI/xasy2asy.py
+++ b/GUI/xasy2asy.py
@@ -1536,8 +1536,8 @@ class xasyScript(xasyItem):

     def getObjectCode(self, asy2psmap=identity()):
         numeric=r'([-+]?(?:(?:\d*\.\d+)|(?:\d+\.?)))'
-        rSize=re.compile("size\(\("+numeric+","+numeric+","+numeric+","
-                         +numeric+","+numeric+","+numeric+"\)\); "+
+        rSize=re.compile(r"size\(\("+numeric+","+numeric+","+numeric+","
+                         +numeric+","+numeric+","+numeric+r"\)\); "+
                          self.resizeComment)

         newScript = self.getReplacedKeysCode(self.findNonIdKeys())
-- 
2.45.2
johncbowman commented 1 week ago

Thank you; next time a pull request would be more convenient...