Commit 7aa445d2 authored by Larry Hastings's avatar Larry Hastings

Issue #19273: The marker comments Argument Clinic uses have been changed

to improve readability.
parent d26276a2
This diff is collapsed.
......@@ -21,6 +21,9 @@ Library
Tools/Demos
-----------
- Issue #19273: The marker comments Argument Clinic uses have been changed
to improve readability.
- Issue #20157: When Argument Clinic renames a parameter because its name
collides with a C keyword, it no longer exposes that rename to PyArg_Parse.
......
......@@ -134,11 +134,11 @@ typedef chtype attr_t; /* No attr_t type is available */
#define STRICT_SYSV_CURSES
#endif
/*[clinic]
/*[clinic input]
module curses
class curses.window
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/* Definition of exception curses.error */
......@@ -555,7 +555,7 @@ PyCursesWindow_Dealloc(PyCursesWindowObject *wo)
/* Addch, Addstr, Addnstr */
/*[clinic]
/*[clinic input]
curses.window.addch
......@@ -581,7 +581,7 @@ Paint character ch at (y, x) with attributes attr,
overwriting any character previously painted at that location.
By default, the character position and attributes are the
current settings for the window object.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(curses_window_addch__doc__,
"addch([x, y,] ch, [attr])\n"
......@@ -650,7 +650,7 @@ curses_window_addch(PyObject *self, PyObject *args)
static PyObject *
curses_window_addch_impl(PyObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr)
/*[clinic checksum: 44ed958b891cde91205e584c766e048f3999714f]*/
/*[clinic end generated code: checksum=44ed958b891cde91205e584c766e048f3999714f]*/
{
PyCursesWindowObject *cwself = (PyCursesWindowObject *)self;
int coordinates_group = group_left_1;
......
......@@ -16,11 +16,11 @@
#include "datetime.h"
#undef Py_BUILD_CORE
/*[clinic]
/*[clinic input]
module datetime
class datetime.datetime
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/* We require that C int be at least 32 bits, and use int virtually
* everywhere. In just a few cases we use a temp long, where a Python
......@@ -4145,7 +4145,7 @@ datetime_best_possible(PyObject *cls, TM_FUNC f, PyObject *tzinfo)
tzinfo);
}
/*[clinic]
/*[clinic input]
@classmethod
datetime.datetime.now
......@@ -4156,7 +4156,7 @@ datetime.datetime.now
Returns new datetime object representing current time local to tz.
If no tz is specified, uses local timezone.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(datetime_datetime_now__doc__,
"now(tz=None)\n"
......@@ -4192,7 +4192,7 @@ exit:
static PyObject *
datetime_datetime_now_impl(PyTypeObject *cls, PyObject *tz)
/*[clinic checksum: ca3d26a423b3f633b260c7622e303f0915a96f7c]*/
/*[clinic end generated code: checksum=ca3d26a423b3f633b260c7622e303f0915a96f7c]*/
{
PyObject *self;
......
......@@ -28,11 +28,11 @@ static char *which_dbm = "Berkeley DB";
#error "No ndbm.h available!"
#endif
/*[clinic]
/*[clinic input]
module dbm
class dbm.dbm
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
typedef struct {
PyObject_HEAD
......@@ -49,13 +49,13 @@ static PyTypeObject Dbmtype;
static PyObject *DbmError;
/*[python]
/*[python input]
class dbmobject_converter(self_converter):
type = "dbmobject *"
def converter_init(self):
self.name = 'dp'
[python]*/
/*[python checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
static PyObject *
newdbmobject(const char *file, int flags, int mode)
......@@ -263,7 +263,7 @@ static PySequenceMethods dbm_as_sequence = {
0, /* sq_inplace_repeat */
};
/*[clinic]
/*[clinic input]
dbm.dbm.get
......@@ -276,7 +276,7 @@ dbm.dbm.get
/
Return the value for key if present, otherwise default.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(dbm_dbm_get__doc__,
"get(key, [default])\n"
......@@ -318,7 +318,7 @@ dbm_dbm_get(PyObject *self, PyObject *args)
static PyObject *
dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, int group_right_1, PyObject *default_value)
/*[clinic checksum: 28cf8928811bde51e535d67ae98ea039d79df717]*/
/*[clinic end generated code: checksum=28cf8928811bde51e535d67ae98ea039d79df717]*/
{
datum dbm_key, val;
......@@ -440,7 +440,7 @@ static PyTypeObject Dbmtype = {
/* ----------------------------------------------------------------- */
/*[clinic]
/*[clinic input]
dbm.open as dbmopen
......@@ -458,7 +458,7 @@ dbm.open as dbmopen
Return a database object.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(dbmopen__doc__,
"open(filename, flags=\'r\', mode=0o666)\n"
......@@ -498,7 +498,7 @@ exit:
static PyObject *
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode)
/*[clinic checksum: fb265f75641553ccd963f84c143b35c11f9121fc]*/
/*[clinic end generated code: checksum=fb265f75641553ccd963f84c143b35c11f9121fc]*/
{
int iflags;
......
#include "Python.h"
#include "opcode.h"
/*[clinic]
/*[clinic input]
module _opcode
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/*[clinic]
/*[clinic input]
_opcode.stack_effect -> int
......@@ -18,7 +18,7 @@ _opcode.stack_effect -> int
/
Compute the stack effect of the opcode.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(_opcode_stack_effect__doc__,
"stack_effect(opcode, [oparg])\n"
......@@ -64,10 +64,10 @@ exit:
static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, int group_right_1, int oparg)
/*[clinic checksum: e880e62dc7b0de73403026eaf4f8074aa106358b]*/
/*[clinic end generated code: checksum=e880e62dc7b0de73403026eaf4f8074aa106358b]*/
{
int effect;
if (HAS_ARG(opcode)) {
if (HAS_ARG(opcode)) {
if (!group_right_1) {
PyErr_SetString(PyExc_ValueError,
"stack_effect: opcode requires oparg but oparg was not specified");
......
This diff is collapsed.
......@@ -4,12 +4,12 @@
#define GET_WEAKREFS_LISTPTR(o) \
((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o))
/*[clinic]
/*[clinic input]
module _weakref
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/*[clinic]
/*[clinic input]
_weakref.getweakrefcount -> Py_ssize_t
......@@ -17,7 +17,7 @@ _weakref.getweakrefcount -> Py_ssize_t
/
Return the number of weak references to 'object'.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
"getweakrefcount(object)\n"
......@@ -45,13 +45,13 @@ exit:
static Py_ssize_t
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object)
/*[clinic checksum: 436e8fbe0297434375f039d8c2d9fc3a9bbe773c]*/
/*[clinic end generated code: checksum=436e8fbe0297434375f039d8c2d9fc3a9bbe773c]*/
{
PyWeakReference **list;
if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)))
return 0;
list = GET_WEAKREFS_LISTPTR(object);
return _PyWeakref_GetWeakrefCount(*list);
}
......
......@@ -181,10 +181,10 @@ corresponding Unix manual entries for more information on calls.");
#endif /* ! __WATCOMC__ || __QNX__ */
/*[clinic]
/*[clinic input]
module os
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
#ifndef _MSC_VER
......@@ -2355,7 +2355,7 @@ posix_do_stat(char *function_name, path_t *path,
#endif
/*[python]
/*[python input]
class path_t_converter(CConverter):
......@@ -2396,10 +2396,10 @@ class dir_fd_converter(CConverter):
self.c_default = 'DEFAULT_DIR_FD'
[python]*/
/*[python checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/*[clinic]
/*[clinic input]
os.stat -> object(doc_default='stat_result')
......@@ -2427,7 +2427,7 @@ dir_fd and follow_symlinks may not be implemented
It's an error to use dir_fd or follow_symlinks when specifying path as
an open file descriptor.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(os_stat__doc__,
"stat(path, *, dir_fd=None, follow_symlinks=True)\n"
......@@ -2481,7 +2481,7 @@ exit:
static PyObject *
os_stat_impl(PyModuleDef *module, path_t *path, int dir_fd, int follow_symlinks)
/*[clinic checksum: 85a71ad602e89f8e280118da976f70cd2f9abdf1]*/
/*[clinic end generated code: checksum=85a71ad602e89f8e280118da976f70cd2f9abdf1]*/
{
return posix_do_stat("stat", path, dir_fd, follow_symlinks);
}
......@@ -2522,7 +2522,7 @@ posix_lstat(PyObject *self, PyObject *args, PyObject *kwargs)
#else
#define OS_ACCESS_DIR_FD_CONVERTER dir_fd_unavailable
#endif
/*[clinic]
/*[clinic input]
os.access -> object(doc_default='True if granted, False otherwise')
path: path_t(allow_fd=True)
......@@ -2559,7 +2559,7 @@ Note that most operations will use the effective uid/gid, therefore this
routine can be used in a suid/sgid environment to test if the invoking user
has the specified access to the path.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(os_access__doc__,
"access(path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)\n"
......@@ -2622,7 +2622,7 @@ exit:
static PyObject *
os_access_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks)
/*[clinic checksum: 636e835c36562a2fc11acab75314634127fdf769]*/
/*[clinic end generated code: checksum=636e835c36562a2fc11acab75314634127fdf769]*/
{
PyObject *return_value = NULL;
......@@ -2706,7 +2706,7 @@ exit:
#ifdef HAVE_TTYNAME
/*[clinic]
/*[clinic input]
os.ttyname -> DecodeFSDefault
fd: int
......@@ -2715,7 +2715,7 @@ os.ttyname -> DecodeFSDefault
/
Return the name of the terminal device connected to 'fd'.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(os_ttyname__doc__,
"ttyname(fd)\n"
......@@ -2752,7 +2752,7 @@ exit:
static char *
os_ttyname_impl(PyModuleDef *module, int fd)
/*[clinic checksum: 0f368134dc0a7f21f25185e2e6bacf7675fb473a]*/
/*[clinic end generated code: checksum=0f368134dc0a7f21f25185e2e6bacf7675fb473a]*/
{
char *ret;
......
......@@ -17,11 +17,11 @@
#include "ucnhash.h"
#include "structmember.h"
/*[clinic]
/*[clinic input]
module unicodedata
class unicodedata.UCD
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/* character properties */
......@@ -113,7 +113,7 @@ static Py_UCS4 getuchar(PyUnicodeObject *obj)
/* --- Module API --------------------------------------------------------- */
/*[clinic]
/*[clinic input]
unicodedata.UCD.decimal
......@@ -126,7 +126,7 @@ Converts a Unicode character into its equivalent decimal value.
Returns the decimal value assigned to the Unicode character unichr
as integer. If no such value is defined, default is returned, or, if
not given, ValueError is raised.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
"decimal(unichr, default=None)\n"
......@@ -161,7 +161,7 @@ exit:
static PyObject *
unicodedata_UCD_decimal_impl(PyObject *self, PyUnicodeObject *unichr, PyObject *default_value)
/*[clinic checksum: 73edde0e9cd5913ea174c4fa81504369761b7426]*/
/*[clinic end generated code: checksum=73edde0e9cd5913ea174c4fa81504369761b7426]*/
{
PyUnicodeObject *v = (PyUnicodeObject *)unichr;
int have_old = 0;
......
......@@ -81,12 +81,12 @@ zlib_error(z_stream zst, int err, char *msg)
PyErr_Format(ZlibError, "Error %d %s: %.200s", err, msg, zmsg);
}
/*[clinic]
/*[clinic input]
module zlib
class zlib.Compress
class zlib.Decompress
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
PyDoc_STRVAR(compressobj__doc__,
"compressobj(level=-1, method=DEFLATED, wbits=15, memlevel=8,\n"
......@@ -164,7 +164,7 @@ PyZlib_Free(voidpf ctx, void *ptr)
PyMem_RawFree(ptr);
}
/*[clinic]
/*[clinic input]
zlib.compress
bytes: Py_buffer
......@@ -177,7 +177,7 @@ zlib.compress
Returns compressed string.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(zlib_compress__doc__,
"compress(bytes, [level])\n"
......@@ -227,7 +227,7 @@ zlib_compress(PyModuleDef *module, PyObject *args)
static PyObject *
zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int group_right_1, int level)
/*[clinic checksum: 9f055a396620bc1a8a13d74c3496249528b32b0d]*/
/*[clinic end generated code: checksum=9f055a396620bc1a8a13d74c3496249528b32b0d]*/
{
PyObject *ReturnVal = NULL;
Byte *input, *output = NULL;
......@@ -306,14 +306,14 @@ zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int group_right_1, int
return ReturnVal;
}
/*[python]
/*[python input]
class uint_converter(CConverter):
type = 'unsigned int'
converter = 'uint_converter'
[python]*/
/*[python checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
static int
uint_converter(PyObject *obj, void *ptr)
......@@ -743,7 +743,7 @@ save_unconsumed_input(compobject *self, int err)
return 0;
}
/*[clinic]
/*[clinic input]
zlib.Decompress.decompress
......@@ -762,7 +762,7 @@ Return a string containing the decompressed version of the data.
After calling this function, some of the input data may still be stored in
internal buffers for later processing.
Call the flush() method to clear these buffers.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
"decompress(data, max_length=0)\n"
......@@ -808,7 +808,7 @@ exit:
static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data, unsigned int max_length)
/*[clinic checksum: 5b1e4f9f1ef8eca55fff78356f9df0c81232ed3b]*/
/*[clinic end generated code: checksum=5b1e4f9f1ef8eca55fff78356f9df0c81232ed3b]*/
{
int err;
unsigned int old_length, length = DEFAULTALLOC;
......@@ -1026,13 +1026,13 @@ PyZlib_flush(compobject *self, PyObject *args)
#ifdef HAVE_ZLIB_COPY
/*[clinic]
/*[clinic input]
zlib.Compress.copy
self: self(type="compobject *")
Return a copy of the compression object.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(zlib_Compress_copy__doc__,
"copy()\n"
......@@ -1056,7 +1056,7 @@ zlib_Compress_copy(PyObject *self, PyObject *Py_UNUSED(ignored))
static PyObject *
zlib_Compress_copy_impl(compobject *self)
/*[clinic checksum: 2f454ee15be3bc53cfb4e845c3f891f68be4c8e4]*/
/*[clinic end generated code: checksum=2f454ee15be3bc53cfb4e845c3f891f68be4c8e4]*/
{
compobject *retval = NULL;
int err;
......
......@@ -69,10 +69,10 @@ to the combined-table form.
#include "Python.h"
#include "stringlib/eq.h"
/*[clinic]
/*[clinic input]
class dict
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
typedef struct {
/* Cached hash code of me_key. */
......@@ -2164,7 +2164,7 @@ dict_richcompare(PyObject *v, PyObject *w, int op)
return res;
}
/*[clinic]
/*[clinic input]
@coexist
dict.__contains__
......@@ -2173,7 +2173,7 @@ dict.__contains__
/
True if D has a key k, else False"
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(dict___contains____doc__,
"__contains__(key)\n"
......@@ -2184,7 +2184,7 @@ PyDoc_STRVAR(dict___contains____doc__,
static PyObject *
dict___contains__(PyObject *self, PyObject *key)
/*[clinic checksum: 3bbac5ce898ae630d9668fa1c8b3afb645ff22e8]*/
/*[clinic end generated code: checksum=3bbac5ce898ae630d9668fa1c8b3afb645ff22e8]*/
{
register PyDictObject *mp = (PyDictObject *)self;
Py_hash_t hash;
......
......@@ -47,10 +47,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <windows.h>
#endif
/*[clinic]
/*[clinic input]
class str
[clinic]*/
/*[clinic checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/* --- Globals ------------------------------------------------------------
......@@ -12860,7 +12860,7 @@ unicode_swapcase(PyObject *self)
return case_operation(self, do_swapcase);
}
/*[clinic]
/*[clinic input]
@staticmethod
str.maketrans as unicode_maketrans
......@@ -12882,7 +12882,7 @@ If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.
[clinic]*/
[clinic start generated code]*/
PyDoc_STRVAR(unicode_maketrans__doc__,
"maketrans(x, y=None, z=None)\n"
......@@ -12922,7 +12922,7 @@ exit:
static PyObject *
unicode_maketrans_impl(void *null, PyObject *x, PyObject *y, PyObject *z)
/*[clinic checksum: 7f76f414a0dfd0c614e0d4717872eeb520516da7]*/
/*[clinic end generated code: checksum=7f76f414a0dfd0c614e0d4717872eeb520516da7]*/
{
PyObject *new = NULL, *key, *value;
Py_ssize_t i = 0;
......
......@@ -291,10 +291,10 @@ class Language(metaclass=abc.ABCMeta):
class PythonLanguage(Language):
language = 'Python'
start_line = "#/*[{dsl_name}]"
start_line = "#/*[{dsl_name} input]"
body_prefix = "#"
stop_line = "#[{dsl_name}]*/"
checksum_line = "#/*[{dsl_name} checksum: {checksum}]*/"
stop_line = "#[{dsl_name} start generated code]*/"
checksum_line = "#/*[{dsl_name} end generated code: checksum={checksum}]*/"
def permute_left_option_groups(l):
......@@ -359,11 +359,12 @@ def permute_optional_groups(left, required, right):
class CLanguage(Language):
body_prefix = "#"
language = 'C'
start_line = "/*[{dsl_name}]"
start_line = "/*[{dsl_name} input]"
body_prefix = ""
stop_line = "[{dsl_name}]*/"
checksum_line = "/*[{dsl_name} checksum: {checksum}]*/"
stop_line = "[{dsl_name} start generated code]*/"
checksum_line = "/*[{dsl_name} end generated code: checksum={checksum}]*/"
def render(self, signatures):
function = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment