]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Refactor Python Xmethods to use is_specialization_of
authorJonathan Wakely <jwakely@redhat.com>
Thu, 28 Sep 2023 19:52:01 +0000 (20:52 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 28 Sep 2023 20:20:27 +0000 (21:20 +0100)
commit17d3477fa89466604bee5af2a2caf8de5441aeb5
treea5ede789369827d9d67475cf150c74eb46e66a33
parent6b5c3f9b8139d9eee358b354b35da0b757a0270d
libstdc++: Refactor Python Xmethods to use is_specialization_of

This copies the is_specialization_of function from printers.py (with
slight modification for versioned namespace handling) and reuses it in
xmethods.py to replace repetitive re.match calls in every class.

This fixes the problem that the regular expressions used \d without
escaping the backslash properly.

libstdc++-v3/ChangeLog:

* python/libstdcxx/v6/xmethods.py (is_specialization_of): Define
new function.
(ArrayMethodsMatcher, DequeMethodsMatcher)
(ForwardListMethodsMatcher, ListMethodsMatcher)
(VectorMethodsMatcher, AssociativeContainerMethodsMatcher)
(UniquePtrGetWorker, UniquePtrMethodsMatcher)
(SharedPtrSubscriptWorker, SharedPtrMethodsMatcher): Use
is_specialization_of instead of re.match.
libstdc++-v3/python/libstdcxx/v6/xmethods.py