diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-19 17:37:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-19 17:37:40 (GMT) |
commit | 80ec8364f15857c405ef0ecb1e758c8fc6b332f7 (patch) | |
tree | bf8bfdbf42d3c2aeca0f085777979f873427c642 /Tools | |
parent | a5af6e1af77ee0f9294c5776478a9c24d9fbab94 (diff) | |
download | cpython-80ec8364f15857c405ef0ecb1e758c8fc6b332f7.zip cpython-80ec8364f15857c405ef0ecb1e758c8fc6b332f7.tar.gz cpython-80ec8364f15857c405ef0ecb1e758c8fc6b332f7.tar.bz2 |
bpo-29748: Added the slice index converter in Argument Clinic. (#549)
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/clinic/clinic.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 3d51c1d..55faf1e 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -2659,6 +2659,18 @@ class Py_ssize_t_converter(CConverter): c_ignored_default = "0" +class slice_index_converter(CConverter): + type = 'Py_ssize_t' + + def converter_init(self, *, accept={int, NoneType}): + if accept == {int}: + self.converter = '_PyEval_SliceIndex' + elif accept == {int, NoneType}: + self.converter = '_PyEval_SliceIndexOrNone' + else: + fail("slice_index_converter: illegal 'accept' argument " + repr(accept)) + + class float_converter(CConverter): type = 'float' default_type = float |