Issue #20390: Small fixes and improvements for Argument Clinic.
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index cdaa837..30e0340 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -199,8 +199,8 @@
/*[clinic input]
output preset file
module _bz2
-class _bz2.BZ2Compressor
-class _bz2.BZ2Decompressor
+class _bz2.BZ2Compressor "BZ2Compressor *" "&BZ2Compressor_Type"
+class _bz2.BZ2Decompressor "BZ2Decompressor *" "&BZ2Decompressor_Type"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
@@ -209,7 +209,6 @@
/*[clinic input]
_bz2.BZ2Compressor.compress
- self: self(type="BZ2Compressor *")
data: Py_buffer
/
@@ -239,8 +238,6 @@
/*[clinic input]
_bz2.BZ2Compressor.flush
- self: self(type="BZ2Compressor *")
-
Finish the compression process.
Returns the compressed data left in internal buffers.
@@ -294,7 +291,6 @@
/*[clinic input]
_bz2.BZ2Compressor.__init__
- self: self(type="BZ2Compressor *")
compresslevel: int = 9
Compression level, as a number between 1 and 9.
/
@@ -472,7 +468,6 @@
/*[clinic input]
_bz2.BZ2Decompressor.decompress
- self: self(type="BZ2Decompressor *")
data: Py_buffer
/
@@ -511,8 +506,6 @@
/*[clinic input]
_bz2.BZ2Decompressor.__init__
- self: self(type="BZ2Decompressor *")
-
Create a decompressor object for decompressing data incrementally.
For one-shot decompression, use the decompress() function instead.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index d1b3019..534dcff 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -136,7 +136,7 @@
/*[clinic input]
module curses
-class curses.window
+class curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
@@ -605,10 +605,10 @@
{"addch", (PyCFunction)curses_window_addch, METH_VARARGS, curses_window_addch__doc__},
static PyObject *
-curses_window_addch_impl(PyObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr);
+curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr);
static PyObject *
-curses_window_addch(PyObject *self, PyObject *args)
+curses_window_addch(PyCursesWindowObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int group_left_1 = 0;
@@ -650,8 +650,8 @@
}
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 end generated code: checksum=f6eeada77a9ec085125f3a27e4a2095f2a4c50be]*/
+curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr)
+/*[clinic end generated code: checksum=e1cdbd4f4e42fc6b36fd4755d7e4bd5b58751ea1]*/
{
PyCursesWindowObject *cwself = (PyCursesWindowObject *)self;
int coordinates_group = group_left_1;
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 4dfb84c..b78725e 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -18,7 +18,7 @@
/*[clinic input]
module datetime
-class datetime.datetime
+class datetime.datetime "PyDateTime_DateTime *" "&PyDateTime_DateTimeType"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 6cf2328..88dae16 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -30,7 +30,7 @@
/*[clinic input]
module dbm
-class dbm.dbm
+class dbm.dbm "dbmobject *" "&Dbmtype"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
index fa5f73d..dabd81e 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -6,28 +6,13 @@
/*[clinic input]
module _pickle
-class _pickle.Pickler
-class _pickle.PicklerMemoProxy
-class _pickle.Unpickler
-class _pickle.UnpicklerMemoProxy
+class _pickle.Pickler "PicklerObject *" "&Pickler_Type"
+class _pickle.PicklerMemoProxy "PicklerMemoProxyObject *" "&PicklerMemoProxyType"
+class _pickle.Unpickler "UnpicklerObject *" "&Unpickler_Type"
+class _pickle.UnpicklerMemoProxy "UnpicklerMemoProxyObject *" "&UnpicklerMemoProxyType"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
-/*[python input]
-class PicklerObject_converter(self_converter):
- type = "PicklerObject *"
-
-class PicklerMemoProxyObject_converter(self_converter):
- type = "PicklerMemoProxyObject *"
-
-class UnpicklerObject_converter(self_converter):
- type = "UnpicklerObject *"
-
-class UnpicklerMemoProxyObject_converter(self_converter):
- type = "UnpicklerMemoProxyObject *"
-[python start generated code]*/
-/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
-
/* Bump this when new opcodes are added to the pickle protocol. */
enum {
HIGHEST_PROTOCOL = 4,
@@ -3878,8 +3863,6 @@
_pickle.Pickler.clear_memo
- self: PicklerObject
-
Clears the pickler's "memo".
The memo is the data structure that remembers which objects the
@@ -3923,7 +3906,6 @@
_pickle.Pickler.dump
- self: PicklerObject
obj: object
/
@@ -4018,7 +4000,6 @@
_pickle.Pickler.__init__
- self: PicklerObject
file: object
protocol: object = NULL
fix_imports: bool = True
@@ -4158,8 +4139,6 @@
/*[clinic input]
_pickle.PicklerMemoProxy.clear
- self: PicklerMemoProxyObject
-
Remove all items from memo.
[clinic start generated code]*/
@@ -4191,8 +4170,6 @@
/*[clinic input]
_pickle.PicklerMemoProxy.copy
- self: PicklerMemoProxyObject
-
Copy the memo to a new object.
[clinic start generated code]*/
@@ -4254,8 +4231,6 @@
/*[clinic input]
_pickle.PicklerMemoProxy.__reduce__
- self: PicklerMemoProxyObject
-
Implement pickle support.
[clinic start generated code]*/
@@ -6310,17 +6285,17 @@
{"load", (PyCFunction)_pickle_Unpickler_load, METH_NOARGS, _pickle_Unpickler_load__doc__},
static PyObject *
-_pickle_Unpickler_load_impl(PyObject *self);
+_pickle_Unpickler_load_impl(UnpicklerObject *self);
static PyObject *
-_pickle_Unpickler_load(PyObject *self, PyObject *Py_UNUSED(ignored))
+_pickle_Unpickler_load(UnpicklerObject *self, PyObject *Py_UNUSED(ignored))
{
return _pickle_Unpickler_load_impl(self);
}
static PyObject *
-_pickle_Unpickler_load_impl(PyObject *self)
-/*[clinic end generated code: checksum=fb1119422c5e03045d690d1cd6c457f1ca4c585d]*/
+_pickle_Unpickler_load_impl(UnpicklerObject *self)
+/*[clinic end generated code: checksum=5ccece694e9898856d916e0a87f0133d4537ebb9]*/
{
UnpicklerObject *unpickler = (UnpicklerObject*)self;
@@ -6347,7 +6322,6 @@
_pickle.Unpickler.find_class
- self: UnpicklerObject
module_name: object
global_name: object
/
@@ -6551,7 +6525,6 @@
_pickle.Unpickler.__init__
- self: UnpicklerObject
file: object
*
fix_imports: bool = True
@@ -6692,8 +6665,6 @@
/*[clinic input]
_pickle.UnpicklerMemoProxy.clear
- self: UnpicklerMemoProxyObject
-
Remove all items from memo.
[clinic start generated code]*/
@@ -6727,8 +6698,6 @@
/*[clinic input]
_pickle.UnpicklerMemoProxy.copy
- self: UnpicklerMemoProxyObject
-
Copy the memo to a new object.
[clinic start generated code]*/
@@ -6783,8 +6752,6 @@
/*[clinic input]
_pickle.UnpicklerMemoProxy.__reduce__
- self: UnpicklerMemoProxyObject
-
Implement pickling support.
[clinic start generated code]*/
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 776d6eb..41dca7d 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -528,11 +528,10 @@
/*[clinic input]
module _sre
-class _sre.SRE_Pattern
+class _sre.SRE_Pattern "PatternObject *" "&Pattern_Type"
_sre.SRE_Pattern.match as pattern_match
- self: self(type="PatternObject *")
pattern: object
pos: Py_ssize_t = 0
endpos: Py_ssize_t(c_default="PY_SSIZE_T_MAX") = sys.maxsize
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 7e0aef5..d9a22c5 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -393,7 +393,6 @@
/*[clinic input]
output preset file
module audioop
-class audioop.error
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
diff --git a/Modules/_bz2module.clinic.c b/Modules/clinic/_bz2module.c.h
similarity index 90%
rename from Modules/_bz2module.clinic.c
rename to Modules/clinic/_bz2module.c.h
index 68250af..1ba87cf 100644
--- a/Modules/_bz2module.clinic.c
+++ b/Modules/clinic/_bz2module.c.h
@@ -75,7 +75,8 @@
int return_value = -1;
int compresslevel = 9;
- if (!_PyArg_NoKeywords("BZ2Compressor", kwargs))
+ if (({self_name} == {self_type_object}) &&
+ !_PyArg_NoKeywords("BZ2Compressor", kwargs))
goto exit;
if (!PyArg_ParseTuple(args,
"|i:BZ2Compressor",
@@ -137,13 +138,15 @@
{
int return_value = -1;
- if (!_PyArg_NoPositional("BZ2Decompressor", args))
+ if (({self_name} == {self_type_object}) &&
+ !_PyArg_NoPositional("BZ2Decompressor", args))
goto exit;
- if (!_PyArg_NoKeywords("BZ2Decompressor", kwargs))
+ if (({self_name} == {self_type_object}) &&
+ !_PyArg_NoKeywords("BZ2Decompressor", kwargs))
goto exit;
return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self);
exit:
return return_value;
}
-/*[clinic end generated code: checksum=9bb33ae7d35494b7a5365f03f390e4b5b8b1bc49]*/
+/*[clinic end generated code: checksum=79ee0d9731dfe404baec35b704b2ca2179b9a6c0]*/
diff --git a/Modules/_lzmamodule.c b/Modules/clinic/_lzmamodule.c.h
similarity index 98%
rename from Modules/_lzmamodule.c
rename to Modules/clinic/_lzmamodule.c.h
index 4e18892..c8899c9 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -472,8 +472,8 @@
/*[clinic input]
output preset file
module _lzma
-class _lzma.LZMACompressor
-class _lzma.LZMADecompressor
+class _lzma.LZMACompressor "Compressor *" "&Compressor_type"
+class _lzma.LZMADecompressor "Decompressor *" "&Decompressor_type"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
diff --git a/Modules/audioop.clinic.c b/Modules/clinic/audioop.c.h
similarity index 100%
rename from Modules/audioop.clinic.c
rename to Modules/clinic/audioop.c.h
diff --git a/Modules/binascii.clinic.c b/Modules/clinic/binascii.c.h
similarity index 100%
rename from Modules/binascii.clinic.c
rename to Modules/clinic/binascii.c.h
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index ff13e0b..ca1620f 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -19,7 +19,7 @@
/*[clinic input]
module unicodedata
-class unicodedata.UCD
+class unicodedata.UCD 'PreviousDBVersion *' '&UCD_Type'
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
@@ -140,10 +140,10 @@
{"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
static PyObject *
-unicodedata_UCD_decimal_impl(PyObject *self, PyUnicodeObject *unichr, PyObject *default_value);
+unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value);
static PyObject *
-unicodedata_UCD_decimal(PyObject *self, PyObject *args)
+unicodedata_UCD_decimal(PreviousDBVersion *self, PyObject *args)
{
PyObject *return_value = NULL;
PyUnicodeObject *unichr;
@@ -160,15 +160,14 @@
}
static PyObject *
-unicodedata_UCD_decimal_impl(PyObject *self, PyUnicodeObject *unichr, PyObject *default_value)
-/*[clinic end generated code: checksum=01826b179d497d8fd3842c56679ecbd4faddaa95]*/
+unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value)
+/*[clinic end generated code: checksum=e1371a1a016e19fdd3cd2c1af1d1832df095f50b]*/
{
- PyUnicodeObject *v = (PyUnicodeObject *)unichr;
int have_old = 0;
long rc;
Py_UCS4 c;
- c = getuchar(v);
+ c = getuchar(unichr);
if (c == (Py_UCS4)-1)
return NULL;
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 24f1e39..78ee10b 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -83,8 +83,8 @@
/*[clinic input]
module zlib
-class zlib.Compress
-class zlib.Decompress
+class zlib.Compress "compobject *" "&Comptype"
+class zlib.Decompress "compobject *" "&Decomptype"
[clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
@@ -748,8 +748,6 @@
zlib.Decompress.decompress
- self: self(type="compobject *")
-
data: Py_buffer
The binary data to decompress.
max_length: uint = 0
@@ -1030,8 +1028,6 @@
/*[clinic input]
zlib.Compress.copy
- self: self(type="compobject *")
-
Return a copy of the compression object.
[clinic start generated code]*/