summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2014-01-25 20:43:29 -0800
committerLarry Hastings <larry@hastings.org>2014-01-25 20:43:29 -0800
commit1271e91660c0e2d99e82e687927f8510743cc441 (patch)
tree7fb8faf3e03a7cfa30c39e16333d83c10aaf69b9 /Modules
parent1acbbea4b411e10c893518fa455f4260e093da19 (diff)
downloadcpython-1271e91660c0e2d99e82e687927f8510743cc441.tar.gz
Issue #20390: Small fixes and improvements for Argument Clinic.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bz2module.c11
-rw-r--r--Modules/_cursesmodule.c10
-rw-r--r--Modules/_datetimemodule.c2
-rw-r--r--Modules/_dbmmodule.c2
-rw-r--r--Modules/_pickle.c49
-rw-r--r--Modules/_sre.c3
-rw-r--r--Modules/audioop.c1
-rw-r--r--Modules/clinic/_bz2module.c.h (renamed from Modules/_bz2module.clinic.c)11
-rw-r--r--Modules/clinic/_lzmamodule.c.h (renamed from Modules/_lzmamodule.c)4
-rw-r--r--Modules/clinic/audioop.c.h (renamed from Modules/audioop.clinic.c)0
-rw-r--r--Modules/clinic/binascii.c.h (renamed from Modules/binascii.clinic.c)0
-rw-r--r--Modules/unicodedata.c13
-rw-r--r--Modules/zlibmodule.c8
13 files changed, 35 insertions, 79 deletions
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index cdaa837ff0..30e034046c 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -199,8 +199,8 @@ error:
/*[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 @@ class _bz2.BZ2Decompressor
/*[clinic input]
_bz2.BZ2Compressor.compress
- self: self(type="BZ2Compressor *")
data: Py_buffer
/
@@ -239,8 +238,6 @@ _bz2_BZ2Compressor_compress_impl(BZ2Compressor *self, Py_buffer *data)
/*[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 @@ BZ2_Free(void* ctx, void *ptr)
/*[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 @@ error:
/*[clinic input]
_bz2.BZ2Decompressor.decompress
- self: self(type="BZ2Decompressor *")
data: Py_buffer
/
@@ -511,8 +506,6 @@ BZ2Decompressor_getstate(BZ2Decompressor *self, PyObject *noargs)
/*[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 d1b30198ff..534dcff681 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -136,7 +136,7 @@ typedef chtype attr_t; /* No attr_t type is available */
/*[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 @@ PyDoc_STRVAR(curses_window_addch__doc__,
{"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 @@ exit:
}
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 4dfb84cc48..b78725e3bb 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 6cf23287c9..88dae16560 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -30,7 +30,7 @@ static char *which_dbm = "Berkeley DB";
/*[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 fa5f73df10..dabd81e3ab 100644
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -6,28 +6,13 @@ PyDoc_STRVAR(pickle_module_doc,
/*[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 @@ dump(PicklerObject *self, PyObject *obj)
_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_clear_memo_impl(PicklerObject *self)
_pickle.Pickler.dump
- self: PicklerObject
obj: object
/
@@ -4018,7 +4000,6 @@ Pickler_clear(PicklerObject *self)
_pickle.Pickler.__init__
- self: PicklerObject
file: object
protocol: object = NULL
fix_imports: bool = True
@@ -4158,8 +4139,6 @@ typedef struct {
/*[clinic input]
_pickle.PicklerMemoProxy.clear
- self: PicklerMemoProxyObject
-
Remove all items from memo.
[clinic start generated code]*/
@@ -4191,8 +4170,6 @@ _pickle_PicklerMemoProxy_clear_impl(PicklerMemoProxyObject *self)
/*[clinic input]
_pickle.PicklerMemoProxy.copy
- self: PicklerMemoProxyObject
-
Copy the memo to a new object.
[clinic start generated code]*/
@@ -4254,8 +4231,6 @@ _pickle_PicklerMemoProxy_copy_impl(PicklerMemoProxyObject *self)
/*[clinic input]
_pickle.PicklerMemoProxy.__reduce__
- self: PicklerMemoProxyObject
-
Implement pickle support.
[clinic start generated code]*/
@@ -6310,17 +6285,17 @@ PyDoc_STRVAR(_pickle_Unpickler_load__doc__,
{"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_load_impl(PyObject *self)
_pickle.Unpickler.find_class
- self: UnpicklerObject
module_name: object
global_name: object
/
@@ -6551,7 +6525,6 @@ Unpickler_clear(UnpicklerObject *self)
_pickle.Unpickler.__init__
- self: UnpicklerObject
file: object
*
fix_imports: bool = True
@@ -6692,8 +6665,6 @@ typedef struct {
/*[clinic input]
_pickle.UnpicklerMemoProxy.clear
- self: UnpicklerMemoProxyObject
-
Remove all items from memo.
[clinic start generated code]*/
@@ -6727,8 +6698,6 @@ _pickle_UnpicklerMemoProxy_clear_impl(UnpicklerMemoProxyObject *self)
/*[clinic input]
_pickle.UnpicklerMemoProxy.copy
- self: UnpicklerMemoProxyObject
-
Copy the memo to a new object.
[clinic start generated code]*/
@@ -6783,8 +6752,6 @@ error:
/*[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 776d6eb2dd..41dca7d97d 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -528,11 +528,10 @@ sre_search(SRE_STATE* state, SRE_CODE* pattern)
/*[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 7e0aef58a8..d9a22c5a26 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -393,7 +393,6 @@ audioop_check_parameters(Py_ssize_t len, int size)
/*[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
index 68250af86c..1ba87cfb5c 100644
--- a/Modules/_bz2module.clinic.c
+++ b/Modules/clinic/_bz2module.c.h
@@ -75,7 +75,8 @@ _bz2_BZ2Compressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
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 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
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
index 4e1889278c..c8899c9abf 100644
--- a/Modules/_lzmamodule.c
+++ b/Modules/clinic/_lzmamodule.c.h
@@ -472,8 +472,8 @@ error:
/*[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
index 974fdb1df5..974fdb1df5 100644
--- a/Modules/audioop.clinic.c
+++ b/Modules/clinic/audioop.c.h
diff --git a/Modules/binascii.clinic.c b/Modules/clinic/binascii.c.h
index 3e4a468967..3e4a468967 100644
--- a/Modules/binascii.clinic.c
+++ b/Modules/clinic/binascii.c.h
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index ff13e0b3bb..ca1620feab 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 @@ PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
{"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 @@ exit:
}
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 24f1e3966f..78ee10b5a6 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -83,8 +83,8 @@ zlib_error(z_stream zst, int err, char *msg)
/*[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 @@ save_unconsumed_input(compobject *self, int err)
zlib.Decompress.decompress
- self: self(type="compobject *")
-
data: Py_buffer
The binary data to decompress.
max_length: uint = 0
@@ -1030,8 +1028,6 @@ PyZlib_flush(compobject *self, PyObject *args)
/*[clinic input]
zlib.Compress.copy
- self: self(type="compobject *")
-
Return a copy of the compression object.
[clinic start generated code]*/