Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Prev Previous commit
Next Next commit
Merge branch 'master' into accept-bool
  • Loading branch information
serhiy-storchaka committed Aug 26, 2020
commit 5aab3dce0328c72617806291725fe3f3960b2b84
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Other Language Changes
:meth:`~object.__index__` method).
(Contributed by Serhiy Storchaka in :issue:`37999`.)

* All builtin and extension functions and methods now accept arguments of any
type instead of just :class:`bool` and :class:`int` for boolean parameters.
(Contributed by Serhiy Storchaka in :issue:`15999`.)


New Modules
===========
Expand Down
17 changes: 14 additions & 3 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,20 @@ Other Language Changes
ignored for empty strings.
(Contributed by Victor Stinner in :issue:`37388`.)

* All builtin and extension functions and methods now accept arguments of any
type instead of just :class:`bool` and :class:`int` for boolean parameters.
(Contributed by Serhiy Storchaka in :issue:`15999`.)
* ``"".replace("", s, n)`` now returns ``s`` instead of an empty string for
all non-zero ``n``. It is now consistent with ``"".replace("", s)``.
There are similar changes for :class:`bytes` and :class:`bytearray` objects.
(Contributed by Serhiy Storchaka in :issue:`28029`.)

* Any valid expression can now be used as a :term:`decorator`. Previously, the
grammar was much more restrictive. See :pep:`614` for details.
(Contributed by Brandt Bucher in :issue:`39702`.)

* Improved help for the :mod:`typing` module. Docstrings are now shown for
all special forms and special generic aliases (like ``Union`` and ``List``).
Using :func:`help` with generic alias like ``List[int]`` will show the help
for the correspondent concrete type (``list`` in this case).
(Contributed by Serhiy Storchaka in :issue:`40257`.)


New Modules
Expand Down
48 changes: 24 additions & 24 deletions Modules/_codecsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,15 @@ _codecs_escape_encode_impl(PyObject *module, PyObject *data,
/*[clinic input]
_codecs.utf_7_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=0cd3a944a32a4089 input=b5fba42f7922078d]*/
/*[clinic end generated code: output=0cd3a944a32a4089 input=dbf8c8998102dc7d]*/
{
Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeUTF7Stateful(data->buf, data->len,
Expand All @@ -272,15 +272,15 @@ _codecs_utf_7_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_8_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=10f74dec8d9bb8bf input=043c24dea5ec9c7c]*/
/*[clinic end generated code: output=10f74dec8d9bb8bf input=ca06bc8a9c970e25]*/
{
Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeUTF8Stateful(data->buf, data->len,
Expand All @@ -292,15 +292,15 @@ _codecs_utf_8_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_16_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=783b442abcbcc2d0 input=b4bb29bf325ed922]*/
/*[clinic end generated code: output=783b442abcbcc2d0 input=5b0f52071ba6cadc]*/
{
int byteorder = 0;
/* This is overwritten unless final is true. */
Expand All @@ -314,15 +314,15 @@ _codecs_utf_16_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_16_le_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=899b9e6364379dcd input=83c12efe12fb4260]*/
/*[clinic end generated code: output=899b9e6364379dcd input=115bd8c7b783d0bf]*/
{
int byteorder = -1;
/* This is overwritten unless final is true. */
Expand All @@ -336,15 +336,15 @@ _codecs_utf_16_le_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_16_be_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_16_be_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=49f6465ea07669c8 input=7a1ee86e2e48b3e4]*/
/*[clinic end generated code: output=49f6465ea07669c8 input=63131422b01f9cb4]*/
{
int byteorder = 1;
/* This is overwritten unless final is true. */
Expand Down Expand Up @@ -374,7 +374,7 @@ _codecs.utf_16_ex_decode
static PyObject *
_codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int byteorder, int final)
/*[clinic end generated code: output=0f385f251ecc1988 input=955e8d9cd5dfe9f7]*/
/*[clinic end generated code: output=0f385f251ecc1988 input=f368a51cf384bf4c]*/
{
/* This is overwritten unless final is true. */
Py_ssize_t consumed = data->len;
Expand All @@ -390,15 +390,15 @@ _codecs_utf_16_ex_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_32_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=2fc961807f7b145f input=624fcb504074bab6]*/
/*[clinic end generated code: output=2fc961807f7b145f input=fcdf3658c5e9b5f3]*/
{
int byteorder = 0;
/* This is overwritten unless final is true. */
Expand All @@ -412,15 +412,15 @@ _codecs_utf_32_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_32_le_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=ec8f46b67a94f3e6 input=846d386727d4e74a]*/
/*[clinic end generated code: output=ec8f46b67a94f3e6 input=12220556e885f817]*/
{
int byteorder = -1;
/* This is overwritten unless final is true. */
Expand All @@ -434,15 +434,15 @@ _codecs_utf_32_le_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.utf_32_be_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_utf_32_be_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=ff82bae862c92c4e input=461cf256c580e397]*/
/*[clinic end generated code: output=ff82bae862c92c4e input=2bc669b4781598db]*/
{
int byteorder = 1;
/* This is overwritten unless final is true. */
Expand Down Expand Up @@ -472,7 +472,7 @@ _codecs.utf_32_ex_decode
static PyObject *
_codecs_utf_32_ex_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int byteorder, int final)
/*[clinic end generated code: output=6bfb177dceaf4848 input=c11c2c8386296376]*/
/*[clinic end generated code: output=6bfb177dceaf4848 input=4a2323d0013620df]*/
{
Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeUTF32Stateful(data->buf, data->len,
Expand Down Expand Up @@ -576,15 +576,15 @@ _codecs_charmap_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.mbcs_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=39b65b8598938c4b input=c065a414c4469c8e]*/
/*[clinic end generated code: output=39b65b8598938c4b input=f144ad1ed6d8f5a6]*/
{
Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeMBCSStateful(data->buf, data->len,
Expand All @@ -595,15 +595,15 @@ _codecs_mbcs_decode_impl(PyObject *module, Py_buffer *data,
/*[clinic input]
_codecs.oem_decode
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
const char *errors, int final)
/*[clinic end generated code: output=da1617612f3fcad8 input=00a4294837793f55]*/
/*[clinic end generated code: output=da1617612f3fcad8 input=629bf87376d211b4]*/
{
Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeCodePageStateful(CP_OEMCP,
Expand All @@ -615,15 +615,15 @@ _codecs_oem_decode_impl(PyObject *module, Py_buffer *data,
_codecs.code_page_decode
codepage: int
data: Py_buffer
errors: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = None
final: bool = False
/
[clinic start generated code]*/

static PyObject *
_codecs_code_page_decode_impl(PyObject *module, int codepage,
Py_buffer *data, const char *errors, int final)
/*[clinic end generated code: output=53008ea967da3fff input=6b274299b45ced3c]*/
/*[clinic end generated code: output=53008ea967da3fff input=6a32589b0658c277]*/
{
Py_ssize_t consumed = data->len;
PyObject *decoded = PyUnicode_DecodeCodePageStateful(codepage,
Expand Down
8 changes: 4 additions & 4 deletions Modules/_io/_iomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ _io.open
file: object
mode: str = "r"
buffering: int = -1
encoding: str(accept={str, NoneType}) = NULL
errors: str(accept={str, NoneType}) = NULL
newline: str(accept={str, NoneType}) = NULL
encoding: str(accept={str, NoneType}) = None
errors: str(accept={str, NoneType}) = None
newline: str(accept={str, NoneType}) = None
closefd: bool = True
opener: object = None

Expand Down Expand Up @@ -231,7 +231,7 @@ static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
int buffering, const char *encoding, const char *errors,
const char *newline, int closefd, PyObject *opener)
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=e3995ddfcc587eb0]*/
/*[clinic end generated code: output=aefafc4ce2b46dc0 input=0c278af772658dd6]*/
{
unsigned i;

Expand Down
2 changes: 1 addition & 1 deletion Modules/_io/clinic/_iomodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Modules/_io/clinic/fileio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Modules/_io/clinic/textio.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Modules/_io/textio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ _io.TextIOWrapper.__init__
buffer: object
encoding: str(accept={str, NoneType}) = None
errors: object = None
newline: str(accept={str, NoneType}) = NULL
newline: str(accept={str, NoneType}) = None
line_buffering: bool = False
write_through: bool = False

Expand Down Expand Up @@ -1074,7 +1074,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
const char *encoding, PyObject *errors,
const char *newline, int line_buffering,
int write_through)
/*[clinic end generated code: output=72267c0c01032ed2 input=ad7234e548e219b7]*/
/*[clinic end generated code: output=72267c0c01032ed2 input=9f5f02e6f5e5053e]*/
{
PyObject *raw, *codec_info = NULL;
_PyIO_State *state = NULL;
Expand Down
14 changes: 7 additions & 7 deletions Modules/_multiprocessing/clinic/semaphore.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.