List of commits:
Subject Hash Author Date (UTC)
bpo-29730: replace some calls to PyNumber_Check and improve some error messages (#650) 004251059b9c5e48d47cb30b94bcb92cb44d3adf Oren Milman 2017-03-12 22:37:05
Fix wrapping into StopIteration of return values in generators and coroutines (#644) b7c9150b68516878175e5373983189d6deea470c Yury Selivanov 2017-03-12 19:53:07
bpo-29742: asyncio get_extra_info() throws exception (#525) 2b27e2e6a35c3d3e369612b984017fe0d1bfcf0c Nikolay Kim 2017-03-12 19:23:30
bpo-28667: Fix a compile warning on FreeBSD when compare with FD_SETSIZE. (#501) 783d0c1a1c723733adcdf4249240246fc35a5bcb Serhiy Storchaka 2017-03-12 12:43:12
bpo-15695: Add PyAPI_FUNC() to _PyDict_SizeOf() declaration. (#639) bc44f045e6a801903bd7530a4fc5474e657832da Serhiy Storchaka 2017-03-12 12:15:54
bpo-26121: Revert to using the own implementations of lgamma and gamma on all platforms. (#637) 4125e5c60e24ffcff8031817dc60984335917f59 Serhiy Storchaka 2017-03-12 12:08:06
bpo-8256: Fixed possible failing or crashing input() (#517) c2cf12857187aa147c268651f10acd6da2c9cb74 Serhiy Storchaka 2017-03-12 11:50:36
bpo-26121: Use C library implementation for math functions erf() and erfc() on Windows. (#632) 4dadcd4ed7824c7904add78577e6a05864cfe493 Serhiy Storchaka 2017-03-12 11:39:22
bpo-29723: Add missing NEWS entry (#638) 27abb0e533a6f7ad195bd56b064c32164296a56e Nick Coghlan 2017-03-12 11:34:32
bpo-28692: Deprecate using non-integer value for selecting a plural form in gettext. (#507) f6595983e08fe20cf06a2535d74d912c6dbb044f Serhiy Storchaka 2017-03-12 11:15:01
bpo-20185: Convert the resource moduel to Argument Clinic. (#545) 1989763f0d0858ce6274f5e1d725b5b8da91a780 Serhiy Storchaka 2017-03-12 11:08:30
bpo-29723: Consistently configure sys.path[0] (#575) d2977a3ae2cc6802921b1e3b6e9d13fcfbda872d Nick Coghlan 2017-03-12 10:38:32
bpo-29798: Handle git worktree in `make patchcheck` (#629) 6a6d090612dd7deaac2bc0399fad743e5e2db606 Nick Coghlan 2017-03-12 09:37:09
bpo-15695: Implemented StgDict.__sizeof__(). (#509) 8999caeb003ed292011e98b8a30746cce787a125 Serhiy Storchaka 2017-03-12 09:12:30
bpo-24037: Add Argument Clinic converter `bool(accept={int})`. (#485) 202fda55c2dffe27125703225e5af92254602dc6 Serhiy Storchaka 2017-03-12 08:10:47
bpo-20185: Convert the marshal module to Argument Clinic. (#541) 0767ad40bfe83525d2ba290cc6eb7c97ce01cdd6 Serhiy Storchaka 2017-03-12 07:20:15
bpo-29746: Update marshal docs to Python 3. (#547) c611a5b1d4fab0123bf622f06c3bfa510221dc32 Serhiy Storchaka 2017-03-12 06:53:22
bpo-29763: Use support.unlink instead of os.unlink (GH-624) 93710c152e6bcfffdf2f1f15bb5f75b013aef422 Zachary Ware 2017-03-12 04:10:07
bpo-29656: Handle PR branches in 'make patchcheck' (#302) 482f7a274fa52b7ba34ff308cd9acdcac9f41ba5 Nick Coghlan 2017-03-12 03:19:08
bpo-26121: Use C library implementation for math functions: (#515) 97553fdf9daa8231eb05a1ca9933a2b03b0bdad0 Serhiy Storchaka 2017-03-11 21:37:16
Commit 004251059b9c5e48d47cb30b94bcb92cb44d3adf - bpo-29730: replace some calls to PyNumber_Check and improve some error messages (#650)
Author: Oren Milman
Author date (UTC): 2017-03-12 22:37
Committer name: Serhiy Storchaka
Committer date (UTC): 2017-03-12 22:37
Parent(s): b7c9150b68516878175e5373983189d6deea470c
Signer:
Signing key:
Signing status: N
Tree: c61cee2b14c069cf40ce39910980d338687f4bc7
File Lines added Lines deleted
Modules/_io/_iomodule.c 4 3
Modules/_io/bytesio.c 7 1
Modules/_io/stringio.c 5 3
Modules/mmapmodule.c 4 3
Objects/bytes_methods.c 19 15
File Modules/_io/_iomodule.c changed (mode: 100644) (index 8f0b72a55b..5d804ece79)
... ... _PyIO_ConvertSsize_t(PyObject *obj, void *result) {
549 549 if (obj == Py_None) { if (obj == Py_None) {
550 550 limit = -1; limit = -1;
551 551 } }
552 else if (PyNumber_Check(obj)) {
552 else if (PyIndex_Check(obj)) {
553 553 limit = PyNumber_AsSsize_t(obj, PyExc_OverflowError); limit = PyNumber_AsSsize_t(obj, PyExc_OverflowError);
554 if (limit == -1 && PyErr_Occurred())
554 if (limit == -1 && PyErr_Occurred()) {
555 555 return 0; return 0;
556 }
556 557 } }
557 558 else { else {
558 559 PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
559 "integer argument expected, got '%.200s'",
560 "argument should be integer or None, not '%.200s'",
560 561 Py_TYPE(obj)->tp_name); Py_TYPE(obj)->tp_name);
561 562 return 0; return 0;
562 563 } }
File Modules/_io/bytesio.c changed (mode: 100644) (index 0a0e5e72d7..59b917d0bd)
... ... _io_BytesIO_truncate_impl(bytesio *self, PyObject *arg)
578 578 /* Truncate to current position if no argument is passed. */ /* Truncate to current position if no argument is passed. */
579 579 size = self->pos; size = self->pos;
580 580 } }
581 else {
581 else if (PyIndex_Check(arg)) {
582 582 size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); size = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
583 583 if (size == -1 && PyErr_Occurred()) { if (size == -1 && PyErr_Occurred()) {
584 584 return NULL; return NULL;
585 585 } }
586 586 } }
587 else {
588 PyErr_Format(PyExc_TypeError,
589 "argument should be integer or None, not '%.200s'",
590 Py_TYPE(arg)->tp_name);
591 return NULL;
592 }
587 593
588 594 if (size < 0) { if (size < 0) {
589 595 PyErr_Format(PyExc_ValueError, PyErr_Format(PyExc_ValueError,
File Modules/_io/stringio.c changed (mode: 100644) (index 788dcb1984..a73171fd8f)
... ... _io_StringIO_truncate_impl(stringio *self, PyObject *arg)
458 458 CHECK_INITIALIZED(self); CHECK_INITIALIZED(self);
459 459 CHECK_CLOSED(self); CHECK_CLOSED(self);
460 460
461 if (PyNumber_Check(arg)) {
461 if (PyIndex_Check(arg)) {
462 462 size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); size = PyNumber_AsSsize_t(arg, PyExc_OverflowError);
463 if (size == -1 && PyErr_Occurred())
463 if (size == -1 && PyErr_Occurred()) {
464 464 return NULL; return NULL;
465 }
465 466 } }
466 467 else if (arg == Py_None) { else if (arg == Py_None) {
467 468 /* Truncate to current position if no argument is passed. */ /* Truncate to current position if no argument is passed. */
468 469 size = self->pos; size = self->pos;
469 470 } }
470 471 else { else {
471 PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'",
472 PyErr_Format(PyExc_TypeError,
473 "argument should be integer or None, not '%.200s'",
472 474 Py_TYPE(arg)->tp_name); Py_TYPE(arg)->tp_name);
473 475 return NULL; return NULL;
474 476 } }
File Modules/mmapmodule.c changed (mode: 100644) (index 7a94464e7b..7c15d377cf)
... ... mmap_convert_ssize_t(PyObject *obj, void *result) {
247 247 if (obj == Py_None) { if (obj == Py_None) {
248 248 limit = -1; limit = -1;
249 249 } }
250 else if (PyNumber_Check(obj)) {
250 else if (PyIndex_Check(obj)) {
251 251 limit = PyNumber_AsSsize_t(obj, PyExc_OverflowError); limit = PyNumber_AsSsize_t(obj, PyExc_OverflowError);
252 if (limit == -1 && PyErr_Occurred())
252 if (limit == -1 && PyErr_Occurred()) {
253 253 return 0; return 0;
254 }
254 255 } }
255 256 else { else {
256 257 PyErr_Format(PyExc_TypeError, PyErr_Format(PyExc_TypeError,
257 "integer argument expected, got '%.200s'",
258 "argument should be integer or None, not '%.200s'",
258 259 Py_TYPE(obj)->tp_name); Py_TYPE(obj)->tp_name);
259 260 return 0; return 0;
260 261 } }
File Objects/bytes_methods.c changed (mode: 100644) (index d5c4fe6346..85d9ceea52)
... ... _Py_bytes_maketrans(Py_buffer *frm, Py_buffer *to)
399 399 #include "stringlib/find.h" #include "stringlib/find.h"
400 400
401 401 /* /*
402 Wraps stringlib_parse_args_finds() and additionally checks whether the
403 first argument is an integer in range(0, 256).
402 Wraps stringlib_parse_args_finds() and additionally checks the first
403 argument type.
404 404
405 If this is the case, writes the integer value to the byte parameter
406 and sets subobj to NULL. Otherwise, sets the first argument to subobj
407 and doesn't touch byte. The other parameters are similar to those of
405 In case the first argument is a bytes-like object, sets it to subobj,
406 and doesn't touch the byte parameter.
407 In case it is an integer in range(0, 256), writes the integer value
408 to byte, and sets subobj to NULL.
409
410 The other parameters are similar to those of
408 411 stringlib_parse_args_finds(). stringlib_parse_args_finds().
409 412 */ */
410 413
 
... ... parse_args_finds_byte(const char *function_name, PyObject *args,
415 418 { {
416 419 PyObject *tmp_subobj; PyObject *tmp_subobj;
417 420 Py_ssize_t ival; Py_ssize_t ival;
418 PyObject *err;
419 421
420 422 if(!stringlib_parse_args_finds(function_name, args, &tmp_subobj, if(!stringlib_parse_args_finds(function_name, args, &tmp_subobj,
421 423 start, end)) start, end))
422 424 return 0; return 0;
423 425
424 if (!PyNumber_Check(tmp_subobj)) {
426 if (PyObject_CheckBuffer(tmp_subobj)) {
425 427 *subobj = tmp_subobj; *subobj = tmp_subobj;
426 428 return 1; return 1;
427 429 } }
428 430
429 ival = PyNumber_AsSsize_t(tmp_subobj, PyExc_OverflowError);
430 if (ival == -1) {
431 err = PyErr_Occurred();
432 if (err && !PyErr_GivenExceptionMatches(err, PyExc_OverflowError)) {
433 PyErr_Clear();
434 *subobj = tmp_subobj;
435 return 1;
436 }
431 if (!PyIndex_Check(tmp_subobj)) {
432 PyErr_Format(PyExc_TypeError,
433 "argument should be integer or bytes-like object, "
434 "not '%.200s'",
435 Py_TYPE(tmp_subobj)->tp_name);
436 return 0;
437 437 } }
438 438
439 ival = PyNumber_AsSsize_t(tmp_subobj, NULL);
440 if (ival == -1 && PyErr_Occurred()) {
441 return 0;
442 }
439 443 if (ival < 0 || ival > 255) { if (ival < 0 || ival > 255) {
440 444 PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)");
441 445 return 0; return 0;
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using git:
git clone git://git.rocketgit.com/user/benf_wspdigital/cpython

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main