[Python-checkins] AC: Update unsupported_special_methods (GH-24956)

corona10 webhook-mailer at python.org
Wed Mar 24 20:19:46 EDT 2021


https://github.com/python/cpython/commit/df9ade9beb86935963f8ae47d9377578399ab6d2
commit: df9ade9beb86935963f8ae47d9377578399ab6d2
branch: master
author: Dong-hee Na <donghee.na at python.org>
committer: corona10 <donghee.na92 at gmail.com>
date: 2021-03-25T09:19:23+09:00
summary:

AC: Update unsupported_special_methods (GH-24956)

files:
M Tools/clinic/clinic.py

diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index d4d7795246854..959742677d2f6 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -2159,7 +2159,6 @@ def __repr__(self):
 __mod__
 __mul__
 __neg__
-__new__
 __next__
 __or__
 __pos__
@@ -4227,6 +4226,9 @@ def state_modulename_name(self, line):
         module, cls = self.clinic._module_and_class(fields)
 
         fields = full_name.split('.')
+        if fields[-1] in unsupported_special_methods:
+            fail(f"{fields[-1]} is a special method and cannot be converted to Argument Clinic!  (Yet.)")
+
         if fields[-1] == '__new__':
             if (self.kind != CLASS_METHOD) or (not cls):
                 fail("__new__ must be a class method!")
@@ -4237,8 +4239,6 @@ def state_modulename_name(self, line):
             self.kind = METHOD_INIT
             if not return_converter:
                 return_converter = init_return_converter()
-        elif fields[-1] in unsupported_special_methods:
-            fail(fields[-1] + " is a special method and cannot be converted to Argument Clinic!  (Yet.)")
 
         if not return_converter:
             return_converter = CReturnConverter()



More information about the Python-checkins mailing list