Skip to content

Commit 6799dd8

Browse files
committed
Add xxlimited import and skip test if unavailable for method_get METH_METHOD
1 parent 030e077 commit 6799dd8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Lib/test/test_descr.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
except ImportError:
2929
xxsubtype = None
3030

31+
try:
32+
import xxlimited
33+
except ImportError:
34+
xxlimited = None
35+
3136

3237
class OperatorsTest(unittest.TestCase):
3338

@@ -1803,6 +1808,8 @@ class SubSpam(spam.spamlist): pass
18031808
spam_cm.__get__(None, list)
18041809
self.assertEqual(str(cm.exception), expected_errmsg)
18051810

1811+
@support.impl_detail("the module 'xxlimited' is internal")
1812+
@unittest.skipIf(xxlimited is None, "requires xxlimited module")
18061813
def test_method_get_meth_method_invalid_type(self):
18071814
# gh-146615: method_get() for METH_METHOD descriptors used to pass
18081815
# Py_TYPE(type)->tp_name as the %V fallback instead of the separate
@@ -1812,9 +1819,6 @@ def test_method_get_meth_method_invalid_type(self):
18121819
#
18131820
# METH_METHOD|METH_FASTCALL|METH_KEYWORDS is the only flag combination
18141821
# that enters the affected branch in method_get().
1815-
1816-
import xxlimited
1817-
18181822
xxo = xxlimited.Xxo()
18191823
descr = xxlimited.Xxo.demo
18201824

0 commit comments

Comments
 (0)