summaryrefslogtreecommitdiffstats
path: root/Tools/clinic/clinic.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/clinic/clinic.py')
-rwxr-xr-xTools/clinic/clinic.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index 53108b1..1d570f1 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -2650,12 +2650,20 @@ class unsigned_long_long_converter(CConverter):
if not bitwise:
fail("Unsigned long long must be bitwise (for now).")
+
class Py_ssize_t_converter(CConverter):
type = 'Py_ssize_t'
- default_type = int
- format_unit = 'n'
c_ignored_default = "0"
+ def converter_init(self, *, accept={int}):
+ if accept == {int}:
+ self.format_unit = 'n'
+ self.default_type = int
+ elif accept == {int, NoneType}:
+ self.converter = '_Py_convert_optional_to_ssize_t'
+ else:
+ fail("Py_ssize_t_converter: illegal 'accept' argument " + repr(accept))
+
class slice_index_converter(CConverter):
type = 'Py_ssize_t'