List of commits:
Subject Hash Author Date (UTC)
bpo-29548: Recommend PyObject_Call APIs over PyEval_Call APIs. (GH-75) aa289a59ff6398110e1122877c073c9354ee53db INADA Naoki 2017-03-14 09:00:59
bpo-28856: Let %b format for bytes support objects that follow the buffer protocol (GH-546) 7e2a54cdd977078b40b82182e46b201f8163f659 Xiang Zhang 2017-03-14 07:07:15
ftplib.FTP.retrbinary callback gets a bytes, not a str (GH-652) 9e52c907b5511393ab7e44321e9521fe0967e34d Jelle Zijlstra 2017-03-13 02:51:27
fix the name of argument to ftplib.FTP.set_pasv and fix wording (GH-653) 7bb6ac76b27efc7260b17b03362f60a4106a4805 Jelle Zijlstra 2017-03-13 02:19:00
bpo-29756: Improve documentation for list methods that compare items by equality (GH-572) b2d77175d1317494b4238b4e07426d310fbf1d19 Xiang Zhang 2017-03-13 02:09:16
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
Commit aa289a59ff6398110e1122877c073c9354ee53db - bpo-29548: Recommend PyObject_Call APIs over PyEval_Call APIs. (GH-75)
PyEval_Call* APIs are not documented and they doesn't respect PY_SSIZE_T_CLEAN.
So add comment block which recommends PyObject_Call* APIs to ceval.h.

This commit also changes PyEval_CallMethod and PyEval_CallFunction
implementation same to PyObject_CallMethod and PyObject_CallFunction
to reduce future maintenance cost. Optimization to avoid temporary
tuple are copied too.

PyEval_CallFunction(callable, "i", (int)i) now calls callable(i) instead of
raising TypeError. But accepting this edge case is backward compatible.
Author: INADA Naoki
Author date (UTC): 2017-03-14 09:00
Committer name: GitHub
Committer date (UTC): 2017-03-14 09:00
Parent(s): 7e2a54cdd977078b40b82182e46b201f8163f659
Signer:
Signing key:
Signing status: N
Tree: 9861df74503cb7556be87ec43642efb5c4790748
File Lines added Lines deleted
Include/ceval.h 6 0
Objects/call.c 24 33
File Include/ceval.h changed (mode: 100644) (index e4be595469..8760fe50b7)
... ... extern "C" {
7 7
8 8 /* Interface to random parts in ceval.c */ /* Interface to random parts in ceval.c */
9 9
10 /* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction
11 * and PyEval_CallMethod are kept for backward compatibility: PyObject_Call(),
12 * PyObject_CallFunction() and PyObject_CallMethod() are recommended to call
13 * a callable object.
14 */
15
10 16 PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
11 17 PyObject *callable, PyObject *callable,
12 18 PyObject *args, PyObject *args,
File Objects/call.c changed (mode: 100644) (index a4af816e30..f1b14080ff)
... ... PyObject_CallFunction(PyObject *callable, const char *format, ...)
940 940 } }
941 941
942 942
943 /* PyEval_CallFunction is exact copy of PyObject_CallFunction.
944 * This function is kept for backward compatibility.
945 */
943 946 PyObject * PyObject *
944 947 PyEval_CallFunction(PyObject *callable, const char *format, ...) PyEval_CallFunction(PyObject *callable, const char *format, ...)
945 948 { {
946 va_list vargs;
947 PyObject *args;
948 PyObject *res;
949
950 va_start(vargs, format);
951
952 args = Py_VaBuildValue(format, vargs);
953 va_end(vargs);
954
955 if (args == NULL)
956 return NULL;
949 va_list va;
950 PyObject *result;
957 951
958 res = PyEval_CallObject(callable, args);
959 Py_DECREF(args);
952 va_start(va, format);
953 result = _PyObject_CallFunctionVa(callable, format, va, 0);
954 va_end(va);
960 955
961 return res;
956 return result;
962 957 } }
963 958
964 959
 
... ... PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
1015 1010 } }
1016 1011
1017 1012
1013 /* PyEval_CallMethod is exact copy of PyObject_CallMethod.
1014 * This function is kept for backward compatibility.
1015 */
1018 1016 PyObject * PyObject *
1019 1017 PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
1020 1018 { {
1021 va_list vargs;
1022 PyObject *meth;
1023 PyObject *args;
1024 PyObject *res;
1025
1026 meth = PyObject_GetAttrString(obj, name);
1027 if (meth == NULL)
1028 return NULL;
1029
1030 va_start(vargs, format);
1019 va_list va;
1020 PyObject *callable, *retval;
1031 1021
1032 args = Py_VaBuildValue(format, vargs);
1033 va_end(vargs);
1022 if (obj == NULL || name == NULL) {
1023 return null_error();
1024 }
1034 1025
1035 if (args == NULL) {
1036 Py_DECREF(meth);
1026 callable = PyObject_GetAttrString(obj, name);
1027 if (callable == NULL)
1037 1028 return NULL; return NULL;
1038 }
1039 1029
1040 res = PyEval_CallObject(meth, args);
1041 Py_DECREF(meth);
1042 Py_DECREF(args);
1030 va_start(va, format);
1031 retval = callmethod(callable, format, va, 0);
1032 va_end(va);
1043 1033
1044 return res;
1034 Py_DECREF(callable);
1035 return retval;
1045 1036 } }
1046 1037
1047 1038
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