Skip to content

GH-137623: Use an AC decorator for docstring line length enforcement #137690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/test/clinic.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -4080,13 +4080,14 @@ test_preprocessor_guarded_if_with_continuation_impl(PyObject *module)
#if CONDITION_E || CONDITION_F
#warning "different type of CPP directive"
/*[clinic input]
@permit_long_summary
test_preprocessor_guarded_if_e_or_f
Makes sure cpp.Monitor handles other directives than preprocessor conditionals.
[clinic start generated code]*/

static PyObject *
test_preprocessor_guarded_if_e_or_f_impl(PyObject *module)
/*[clinic end generated code: output=e49d24ff64ad88bc input=57b9c37f938bc4f1]*/
/*[clinic end generated code: output=e49d24ff64ad88bc input=3ca9ab4e883300ed]*/
#endif

/*[clinic input]
Expand Down
12 changes: 8 additions & 4 deletions Modules/_abc.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ compute_abstract_methods(PyObject *self)
#define COLLECTION_FLAGS (Py_TPFLAGS_SEQUENCE | Py_TPFLAGS_MAPPING)

/*[clinic input]
@permit_long_summary
_abc._abc_init

self: object
Expand All @@ -494,7 +495,7 @@ Internal ABC helper for class set-up. Should be never used outside abc module.

static PyObject *
_abc__abc_init(PyObject *module, PyObject *self)
/*[clinic end generated code: output=594757375714cda1 input=8d7fe470ff77f029]*/
/*[clinic end generated code: output=594757375714cda1 input=0b3513f947736d39]*/
{
_abcmodule_state *state = get_abc_state(module);
PyObject *data;
Expand Down Expand Up @@ -543,6 +544,7 @@ _abc__abc_init(PyObject *module, PyObject *self)
}

/*[clinic input]
@permit_long_summary
_abc._abc_register

self: object
Expand All @@ -554,7 +556,7 @@ Internal ABC helper for subclasss registration. Should be never used outside abc

static PyObject *
_abc__abc_register_impl(PyObject *module, PyObject *self, PyObject *subclass)
/*[clinic end generated code: output=7851e7668c963524 input=ca589f8c3080e67f]*/
/*[clinic end generated code: output=7851e7668c963524 input=135ab13a581b4414]*/
{
if (!PyType_Check(subclass)) {
PyErr_SetString(PyExc_TypeError, "Can only register classes");
Expand Down Expand Up @@ -606,6 +608,7 @@ _abc__abc_register_impl(PyObject *module, PyObject *self, PyObject *subclass)


/*[clinic input]
@permit_long_summary
_abc._abc_instancecheck

self: object
Expand All @@ -618,7 +621,7 @@ Internal ABC helper for instance checks. Should be never used outside abc module
static PyObject *
_abc__abc_instancecheck_impl(PyObject *module, PyObject *self,
PyObject *instance)
/*[clinic end generated code: output=b8b5148f63b6b56f input=a4f4525679261084]*/
/*[clinic end generated code: output=b8b5148f63b6b56f input=0bbc8da0ea346719]*/
{
PyObject *subtype, *result = NULL, *subclass = NULL;
_abc_data *impl = _get_impl(module, self);
Expand Down Expand Up @@ -692,6 +695,7 @@ static int subclasscheck_check_registry(_abc_data *impl, PyObject *subclass,
PyObject **result);

/*[clinic input]
@permit_long_summary
_abc._abc_subclasscheck

self: object
Expand All @@ -704,7 +708,7 @@ Internal ABC helper for subclasss checks. Should be never used outside abc modul
static PyObject *
_abc__abc_subclasscheck_impl(PyObject *module, PyObject *self,
PyObject *subclass)
/*[clinic end generated code: output=b56c9e4a530e3894 input=1d947243409d10b8]*/
/*[clinic end generated code: output=b56c9e4a530e3894 input=5bf1ef712f5d3610]*/
{
if (!PyType_Check(subclass)) {
PyErr_SetString(PyExc_TypeError, "issubclass() arg 1 must be a class");
Expand Down
3 changes: 2 additions & 1 deletion Modules/_bz2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len, Py_ssize_t max_length)
}

/*[clinic input]
@permit_long_docstring_body
_bz2.BZ2Decompressor.decompress

data: Py_buffer
Expand All @@ -622,7 +623,7 @@ the unused_data attribute.
static PyObject *
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
Py_ssize_t max_length)
/*[clinic end generated code: output=23e41045deb240a3 input=52e1ffc66a8ea624]*/
/*[clinic end generated code: output=23e41045deb240a3 input=3703e78f91757655]*/
{
PyObject *result = NULL;

Expand Down
3 changes: 2 additions & 1 deletion Modules/_codecsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ _codecs_unregister(PyObject *module, PyObject *search_function)
}

/*[clinic input]
@permit_long_summary
_codecs.lookup
encoding: str
/
Expand All @@ -101,7 +102,7 @@ Looks up a codec tuple in the Python codec registry and returns a CodecInfo obje

static PyObject *
_codecs_lookup_impl(PyObject *module, const char *encoding)
/*[clinic end generated code: output=9f0afa572080c36d input=3c572c0db3febe9c]*/
/*[clinic end generated code: output=9f0afa572080c36d input=02227d5429491ab3]*/
{
return _PyCodec_Lookup(encoding);
}
Expand Down
3 changes: 2 additions & 1 deletion Modules/_ctypes/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,7 @@ align_func(PyObject *self, PyObject *obj)


/*[clinic input]
@permit_long_summary
@critical_section obj
_ctypes.byref
obj: object(subclass_of="clinic_state()->PyCData_Type")
Expand All @@ -1798,7 +1799,7 @@ Return a pointer lookalike to a C instance, only usable as function argument.

static PyObject *
_ctypes_byref_impl(PyObject *module, PyObject *obj, Py_ssize_t offset)
/*[clinic end generated code: output=60dec5ed520c71de input=6ec02d95d15fbd56]*/
/*[clinic end generated code: output=60dec5ed520c71de input=870076149a2de427]*/
{
ctypes_state *st = get_module_state(module);

Expand Down
3 changes: 2 additions & 1 deletion Modules/_curses_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ _curses_panel_panel_bottom_impl(PyCursesPanelObject *self)
}

/*[clinic input]
@permit_long_docstring_body
_curses_panel.panel.hide

Hide the panel.
Expand All @@ -369,7 +370,7 @@ This does not delete the object, it just makes the window on screen invisible.

static PyObject *
_curses_panel_panel_hide_impl(PyCursesPanelObject *self)
/*[clinic end generated code: output=a7bbbd523e1eab49 input=f6ab884e99386118]*/
/*[clinic end generated code: output=a7bbbd523e1eab49 input=9071b463a39a1a6a]*/
{
int rtn = hide_panel(self->pan);
return curses_panel_panel_check_err(self, rtn, "hide_panel", "hide");
Expand Down
Loading
Loading