summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlend E. Aasland <erlend@python.org>2023-12-27 23:20:57 (GMT)
committerGitHub <noreply@github.com>2023-12-27 23:20:57 (GMT)
commit7ab9efdd6a2fb21cddca1ccd70175f1ac6bd9168 (patch)
treea7e125a89887d2780615430fcd50733bfdd70722
parent87295b4068762f9cbdfcae5fed5ff54aadd3cb62 (diff)
downloadcpython-7ab9efdd6a2fb21cddca1ccd70175f1ac6bd9168.zip
cpython-7ab9efdd6a2fb21cddca1ccd70175f1ac6bd9168.tar.gz
cpython-7ab9efdd6a2fb21cddca1ccd70175f1ac6bd9168.tar.bz2
gh-113299: Move cpp.py into libclinic (#113526)
-rw-r--r--Lib/test/test_clinic.py2
-rwxr-xr-xTools/clinic/clinic.py4
-rw-r--r--Tools/clinic/libclinic/cpp.py (renamed from Tools/clinic/cpp.py)5
3 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 3d6816d..7323bdd 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -3920,7 +3920,7 @@ class ClinicReprTests(unittest.TestCase):
self.assertEqual(repr(parameter), "<clinic.Parameter 'bar'>")
def test_Monitor_repr(self):
- monitor = clinic.cpp.Monitor("test.c")
+ monitor = libclinic.cpp.Monitor("test.c")
self.assertRegex(repr(monitor), r"<clinic.Monitor \d+ line=0 condition=''>")
monitor.line_number = 42
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 82efff5..f6f9558 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -13,7 +13,6 @@ import builtins as bltns
import collections
import contextlib
import copy
-import cpp
import dataclasses as dc
import enum
import functools
@@ -53,6 +52,7 @@ from typing import (
# Local imports.
import libclinic
+import libclinic.cpp
from libclinic import ClinicError
@@ -648,7 +648,7 @@ class CLanguage(Language):
def __init__(self, filename: str) -> None:
super().__init__(filename)
- self.cpp = cpp.Monitor(filename)
+ self.cpp = libclinic.cpp.Monitor(filename)
def parse_line(self, line: str) -> None:
self.cpp.writeline(line)
diff --git a/Tools/clinic/cpp.py b/Tools/clinic/libclinic/cpp.py
index 6590990..e115d65 100644
--- a/Tools/clinic/cpp.py
+++ b/Tools/clinic/libclinic/cpp.py
@@ -3,7 +3,10 @@ import re
import sys
from typing import NoReturn
-from libclinic.errors import ParseError
+from .errors import ParseError
+
+
+__all__ = ["Monitor"]
TokenAndCondition = tuple[str, str]