Skip to content

Commit 6baf552

Browse files
authored
GH-137623: Begin enforcing docstring length in Argument Clinic (#137624)
1 parent 003bd8c commit 6baf552

File tree

6 files changed

+355
-12
lines changed

6 files changed

+355
-12
lines changed

Lib/test/clinic.test.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5084,14 +5084,18 @@ Test_an_metho_arg_named_arg_impl(TestObj *self, int arg)
50845084
Test.__init__
50855085
*args: tuple
50865086
5087-
Varargs init method. For example, nargs is translated to PyTuple_GET_SIZE.
5087+
Varargs init method.
5088+
5089+
For example, nargs is translated to PyTuple_GET_SIZE.
50885090
[clinic start generated code]*/
50895091

50905092
PyDoc_STRVAR(Test___init____doc__,
50915093
"Test(*args)\n"
50925094
"--\n"
50935095
"\n"
5094-
"Varargs init method. For example, nargs is translated to PyTuple_GET_SIZE.");
5096+
"Varargs init method.\n"
5097+
"\n"
5098+
"For example, nargs is translated to PyTuple_GET_SIZE.");
50955099

50965100
static int
50975101
Test___init___impl(TestObj *self, PyObject *args);
@@ -5120,21 +5124,25 @@ Test___init__(PyObject *self, PyObject *args, PyObject *kwargs)
51205124

51215125
static int
51225126
Test___init___impl(TestObj *self, PyObject *args)
5123-
/*[clinic end generated code: output=f172425cec373cd6 input=4b8388c4e6baab6f]*/
5127+
/*[clinic end generated code: output=0e5836c40dbc2397 input=a615a4485c0fc3e2]*/
51245128

51255129
/*[clinic input]
51265130
@classmethod
51275131
Test.__new__
51285132
*args: tuple
51295133
5130-
Varargs new method. For example, nargs is translated to PyTuple_GET_SIZE.
5134+
Varargs new method.
5135+
5136+
For example, nargs is translated to PyTuple_GET_SIZE.
51315137
[clinic start generated code]*/
51325138

51335139
PyDoc_STRVAR(Test__doc__,
51345140
"Test(*args)\n"
51355141
"--\n"
51365142
"\n"
5137-
"Varargs new method. For example, nargs is translated to PyTuple_GET_SIZE.");
5143+
"Varargs new method.\n"
5144+
"\n"
5145+
"For example, nargs is translated to PyTuple_GET_SIZE.");
51385146

51395147
static PyObject *
51405148
Test_impl(PyTypeObject *type, PyObject *args);
@@ -5162,7 +5170,7 @@ Test(PyTypeObject *type, PyObject *args, PyObject *kwargs)
51625170

51635171
static PyObject *
51645172
Test_impl(PyTypeObject *type, PyObject *args)
5165-
/*[clinic end generated code: output=ee1e8892a67abd4a input=a8259521129cad20]*/
5173+
/*[clinic end generated code: output=e6fba0c8951882fd input=8ce30adb836aeacb]*/
51665174

51675175

51685176
/*[clinic input]

Modules/clinic/posixmodule.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3295,15 +3295,15 @@ dir_fd, effective_ids, and follow_symlinks may not be implemented
32953295
NotImplementedError.
32963296
32973297
Note that most operations will use the effective uid/gid, therefore this
3298-
routine can be used in a suid/sgid environment to test if the invoking user
3299-
has the specified access to the path.
3298+
routine can be used in a suid/sgid environment to test if the invoking
3299+
user has the specified access to the path.
33003300
33013301
[clinic start generated code]*/
33023302

33033303
static int
33043304
os_access_impl(PyObject *module, path_t *path, int mode, int dir_fd,
33053305
int effective_ids, int follow_symlinks)
3306-
/*[clinic end generated code: output=cf84158bc90b1a77 input=3ffe4e650ee3bf20]*/
3306+
/*[clinic end generated code: output=cf84158bc90b1a77 input=c33565f7584b99e4]*/
33073307
{
33083308
int return_value;
33093309

Lines changed: 299 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
OVERLONG_SUMMARY = frozenset((
2+
# Lib/test/
3+
'test_preprocessor_guarded_if_e_or_f',
4+
5+
# Modules/
6+
'_abc._abc_init',
7+
'_abc._abc_instancecheck',
8+
'_abc._abc_register',
9+
'_abc._abc_subclasscheck',
10+
'_codecs.lookup',
11+
'_ctypes.byref',
12+
'_curses.can_change_color',
13+
'_curses.is_term_resized',
14+
'_curses.mousemask',
15+
'_curses.reset_prog_mode',
16+
'_curses.reset_shell_mode',
17+
'_curses.termname',
18+
'_curses.window.enclose',
19+
'_functools.reduce',
20+
'_gdbm.gdbm.setdefault',
21+
'_hashlib.HMAC.hexdigest',
22+
'_hashlib.openssl_shake_128',
23+
'_hashlib.openssl_shake_256',
24+
'_hashlib.pbkdf2_hmac',
25+
'_hmac.HMAC.hexdigest',
26+
'_interpreters.is_shareable',
27+
'_io._BufferedIOBase.read1',
28+
'_lzma._decode_filter_properties',
29+
'_remote_debugging.RemoteUnwinder.__init__',
30+
'_remote_debugging.RemoteUnwinder.get_all_awaited_by',
31+
'_remote_debugging.RemoteUnwinder.get_async_stack_trace',
32+
'_socket.inet_aton',
33+
'_sre.SRE_Match.expand',
34+
'_sre.SRE_Match.groupdict',
35+
'_sre.SRE_Pattern.finditer',
36+
'_sre.SRE_Pattern.search',
37+
'_sre.SRE_Pattern.sub',
38+
'_sre.SRE_Pattern.subn',
39+
'_ssl._SSLContext.sni_callback',
40+
'_ssl._SSLSocket.pending',
41+
'_ssl._SSLSocket.sendfile',
42+
'_ssl.get_default_verify_paths',
43+
'_ssl.RAND_status',
44+
'_sysconfig.config_vars',
45+
'_testcapi.make_exception_with_doc',
46+
'_testcapi.VectorCallClass.set_vectorcall',
47+
'_tkinter.getbusywaitinterval',
48+
'_tkinter.setbusywaitinterval',
49+
'_tracemalloc.reset_peak',
50+
'_zstd.get_frame_size',
51+
'_zstd.set_parameter_types',
52+
'_zstd.ZstdDecompressor.decompress',
53+
'array.array.buffer_info',
54+
'array.array.frombytes',
55+
'array.array.fromfile',
56+
'array.array.tobytes',
57+
'cmath.isfinite',
58+
'datetime.datetime.strptime',
59+
'gc.get_objects',
60+
'itertools.chain.from_iterable',
61+
'itertools.combinations_with_replacement.__new__',
62+
'itertools.cycle.__new__',
63+
'itertools.starmap.__new__',
64+
'itertools.takewhile.__new__',
65+
'math.comb',
66+
'math.perm',
67+
'os.getresgid',
68+
'os.lstat',
69+
'os.pread',
70+
'os.pwritev',
71+
'os.sched_getaffinity',
72+
'os.sched_rr_get_interval',
73+
'os.timerfd_gettime',
74+
'os.timerfd_gettime_ns',
75+
'os.urandom',
76+
'os.WIFEXITED',
77+
'os.WTERMSIG',
78+
'pwd.getpwall',
79+
'pyexpat.xmlparser.ExternalEntityParserCreate',
80+
'pyexpat.xmlparser.GetReparseDeferralEnabled',
81+
'pyexpat.xmlparser.SetParamEntityParsing',
82+
'pyexpat.xmlparser.UseForeignDTD',
83+
'readline.redisplay',
84+
'signal.set_wakeup_fd',
85+
'unicodedata.UCD.combining',
86+
'unicodedata.UCD.decomposition',
87+
'zoneinfo.ZoneInfo.dst',
88+
'zoneinfo.ZoneInfo.tzname',
89+
'zoneinfo.ZoneInfo.utcoffset',
90+
91+
# Objects/
92+
'B.zfill',
93+
'bytearray.count',
94+
'bytearray.endswith',
95+
'bytearray.extend',
96+
'bytearray.find',
97+
'bytearray.index',
98+
'bytearray.maketrans',
99+
'bytearray.rfind',
100+
'bytearray.rindex',
101+
'bytearray.rsplit',
102+
'bytearray.split',
103+
'bytearray.splitlines',
104+
'bytearray.startswith',
105+
'bytes.count',
106+
'bytes.endswith',
107+
'bytes.find',
108+
'bytes.index',
109+
'bytes.maketrans',
110+
'bytes.rfind',
111+
'bytes.rindex',
112+
'bytes.startswith',
113+
'code.replace',
114+
'complex.conjugate',
115+
'dict.pop',
116+
'float.as_integer_ratio',
117+
'frame.f_trace',
118+
'int.bit_count',
119+
'OrderedDict.fromkeys',
120+
'OrderedDict.pop',
121+
'set.symmetric_difference_update',
122+
'str.count',
123+
'str.endswith',
124+
'str.find',
125+
'str.index',
126+
'str.isprintable',
127+
'str.rfind',
128+
'str.rindex',
129+
'str.rsplit',
130+
'str.split',
131+
'str.startswith',
132+
'str.strip',
133+
'str.swapcase',
134+
'str.zfill',
135+
136+
# PC/
137+
'msvcrt.kbhit',
138+
139+
# Python/
140+
'_jit.is_active',
141+
'_jit.is_available',
142+
'_jit.is_enabled',
143+
'marshal.dumps',
144+
'sys._current_exceptions',
145+
'sys._setprofileallthreads',
146+
'sys._settraceallthreads',
147+
))
148+
149+
OVERLONG_BODY = frozenset((
150+
# Modules/
151+
'_bz2.BZ2Decompressor.decompress',
152+
'_curses.color_content',
153+
'_curses.flash',
154+
'_curses.longname',
155+
'_curses.resize_term',
156+
'_curses.use_env',
157+
'_curses.window.border',
158+
'_curses.window.derwin',
159+
'_curses.window.getch',
160+
'_curses.window.getkey',
161+
'_curses.window.inch',
162+
'_curses.window.insch',
163+
'_curses.window.insnstr',
164+
'_curses.window.is_linetouched',
165+
'_curses.window.noutrefresh',
166+
'_curses.window.overlay',
167+
'_curses.window.overwrite',
168+
'_curses.window.refresh',
169+
'_curses.window.scroll',
170+
'_curses.window.subwin',
171+
'_curses.window.touchline',
172+
'_curses_panel.panel.hide',
173+
'_functools.reduce',
174+
'_hashlib.HMAC.hexdigest',
175+
'_hmac.HMAC.hexdigest',
176+
'_interpreters.capture_exception',
177+
'_io._IOBase.seek',
178+
'_io._TextIOBase.detach',
179+
'_io.FileIO.read',
180+
'_io.FileIO.readall',
181+
'_io.FileIO.seek',
182+
'_io.open',
183+
'_io.open_code',
184+
'_lzma.LZMADecompressor.decompress',
185+
'_multibytecodec.MultibyteCodec.decode',
186+
'_multibytecodec.MultibyteCodec.encode',
187+
'_posixsubprocess.fork_exec',
188+
'_remote_debugging.RemoteUnwinder.__init__',
189+
'_remote_debugging.RemoteUnwinder.get_all_awaited_by',
190+
'_remote_debugging.RemoteUnwinder.get_async_stack_trace',
191+
'_remote_debugging.RemoteUnwinder.get_stack_trace',
192+
'_socket.socket.send',
193+
'_sqlite3.Blob.read',
194+
'_sqlite3.Blob.seek',
195+
'_sqlite3.Blob.write',
196+
'_sqlite3.Connection.deserialize',
197+
'_sqlite3.Connection.serialize',
198+
'_sqlite3.Connection.set_progress_handler',
199+
'_sqlite3.Connection.setlimit',
200+
'_ssl._SSLContext.sni_callback',
201+
'_ssl._SSLSocket.context',
202+
'_ssl._SSLSocket.get_channel_binding',
203+
'_ssl._SSLSocket.sendfile',
204+
'_tkinter.setbusywaitinterval',
205+
'_zstd.ZstdCompressor.compress',
206+
'_zstd.ZstdCompressor.flush',
207+
'_zstd.ZstdCompressor.set_pledged_input_size',
208+
'_zstd.ZstdDecompressor.__new__',
209+
'_zstd.ZstdDecompressor.decompress',
210+
'_zstd.ZstdDecompressor.unused_data',
211+
'_zstd.ZstdDict.__new__',
212+
'_zstd.ZstdDict.as_digested_dict',
213+
'_zstd.ZstdDict.as_prefix',
214+
'_zstd.ZstdDict.as_undigested_dict',
215+
'array.array.byteswap',
216+
'array.array.fromunicode',
217+
'array.array.tounicode',
218+
'binascii.a2b_base64',
219+
'cmath.isclose',
220+
'datetime.date.fromtimestamp',
221+
'datetime.datetime.fromtimestamp',
222+
'datetime.time.strftime',
223+
'fcntl.ioctl',
224+
'fcntl.lockf',
225+
'gc.freeze',
226+
'itertools.combinations_with_replacement.__new__',
227+
'math.nextafter',
228+
'os.fspath',
229+
'os.link',
230+
'os.listdir',
231+
'os.listxattr',
232+
'os.lseek',
233+
'os.mknod',
234+
'os.preadv',
235+
'os.pwritev',
236+
'os.readinto',
237+
'os.rename',
238+
'os.replace',
239+
'os.setxattr',
240+
'pyexpat.xmlparser.GetInputContext',
241+
'pyexpat.xmlparser.UseForeignDTD',
242+
'select.devpoll',
243+
'select.poll',
244+
'select.select',
245+
'signal.setitimer',
246+
'signal.signal',
247+
'termios.tcsetwinsize',
248+
'zlib.Decompress.decompress',
249+
'zlib.ZlibDecompressor.decompress',
250+
251+
# Objects/
252+
'bytearray.maketrans',
253+
'bytearray.partition',
254+
'bytearray.replace',
255+
'bytearray.rpartition',
256+
'bytearray.rsplit',
257+
'bytearray.splitlines',
258+
'bytearray.strip',
259+
'bytes.maketrans',
260+
'bytes.partition',
261+
'bytes.replace',
262+
'bytes.rpartition',
263+
'bytes.rsplit',
264+
'bytes.splitlines',
265+
'bytes.strip',
266+
'float.__getformat__',
267+
'list.sort',
268+
'memoryview.tobytes',
269+
'str.capitalize',
270+
'str.isalnum',
271+
'str.isalpha',
272+
'str.isdecimal',
273+
'str.isdigit',
274+
'str.isidentifier',
275+
'str.islower',
276+
'str.isnumeric',
277+
'str.isspace',
278+
'str.isupper',
279+
'str.join',
280+
'str.partition',
281+
'str.removeprefix',
282+
'str.replace',
283+
'str.rpartition',
284+
'str.splitlines',
285+
'str.title',
286+
'str.translate',
287+
288+
# PC/
289+
'_wmi.exec_query',
290+
291+
# Python/
292+
'__import__',
293+
'_contextvars.ContextVar.get',
294+
'_contextvars.ContextVar.reset',
295+
'_contextvars.ContextVar.set',
296+
'_imp.acquire_lock',
297+
'marshal.dumps',
298+
'sys._stats_dump',
299+
))

0 commit comments

Comments
 (0)