Title: Argument Clinic: add common converter to Py_ssize_t that accepts None
Type: enhancement Stage: patch review
Components: Argument Clinic, IO Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, larry, serhiy.storchaka, stutzbach
Priority: normal Keywords:

Created on 2017-03-19 11:28 by serhiy.storchaka, last changed 2017-03-19 11:37 by serhiy.storchaka.

Pull Requests
URL Status Linked Edit
PR 716 open serhiy.storchaka, 2017-03-19 11:37
Messages (1)
msg289847 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-19 11:28
Many methods in the io module accept int and None and convert the argument to Py_ssize_t. Proposed patch adds common Argument Clinic converter for that case. The Py_ssize_t converter now takes the accept argument that can be {int} (the default) or {int, NoneType}. In the latter case None is acceptable value which means using the default value.

Similar converter was previously used locally in the io module, now it is used also in the mmap module.

    size: Py_ssize_t(accept={int, NoneType}) = -1

    size: Py_ssize_t(accept={int, NoneType}, c_default="self->pos") = None
Date User Action Args
2017-03-19 11:37:31serhiy.storchakasetpull_requests: + pull_request636
2017-03-19 11:35:57serhiy.storchakalinkissue29819 dependencies
2017-03-19 11:28:47serhiy.storchakacreate