Serhiy Storchaka
578c3955e0
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
...
Only __index__ should be used to make integer conversions lossless.
2020-05-26 18:43:38 +03:00
Serhiy Storchaka
cd8295ff75
bpo-39943: Add the const qualifier to pointers on non-mutable PyUnicode data. (GH-19345)
2020-04-11 10:48:40 +03:00
Dong-hee Na
87ec86c425
bpo-37207: Add _PyArg_NoKwnames() helper function (GH-18980)
2020-03-16 15:06:20 +01:00
Victor Stinner
a102ed7d2f
bpo-39573: Use Py_TYPE() macro in Python and Include directories (GH-18391)
...
Replace direct access to PyObject.ob_type with Py_TYPE().
2020-02-07 02:24:48 +01:00
Sebastian Berg
75bb07e92b
bpo-39028: Performance enhancement in keyword extraction (GH-17576)
...
All keywords should first be checked for pointer identity. Only
after that failed for all keywords (unlikely) should unicode
equality be used.
The original code would call unicode equality on any non-matching
keyword argument. Meaning calling it often e.g. when a function
has many kwargs but only the last one is provided.
2019-12-18 15:51:22 +09:00
Serhiy Storchaka
5bc6a7c06e
bpo-38540: Fix possible leak in PyArg_Parse for "es#" and "et#". (GH-16869)
2019-10-21 11:35:07 +03:00
Vinay Sajip
0b60f64e43
bpo-11410: Standardize and use symbol visibility attributes across POSIX and Windows. (GH-16347)
2019-10-15 08:26:12 +01:00
Jordon Xu
2ec7010206
bpo-37752: Delete redundant Py_CHARMASK in normalizestring() (GH-15095)
2019-09-10 17:04:08 +01:00
Rémi Lapeyre
4901fe274b
bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593)
2019-08-29 17:49:08 +03:00
Raymond Hettinger
aef9ad82f7
bpo-37942: Improve argument clinic float converter (GH-15470)
2019-08-24 19:10:39 -07:00
Jeroen Demeyer
0567786d26
bpo-37540: vectorcall: keyword names must be strings (GH-14682)
...
The fact that keyword names are strings is now part of the vectorcall and `METH_FASTCALL` protocols. The biggest concrete change is that `_PyStack_UnpackDict` now checks that and raises `TypeError` if not.
CC @markshannon @vstinner
https://bugs.python.org/issue37540
2019-08-16 03:41:27 -07:00
Inada Naoki
d3c72a223a
bpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)
...
We will remove int support from 3.10 or 4.0.
2019-03-23 21:04:40 +09:00
Serhiy Storchaka
1b0393d5b7
bpo-36127: Fix compiler warning in _PyArg_UnpackKeywords(). (GH-12353)
2019-03-16 19:45:00 +02:00
Serhiy Storchaka
3191391515
bpo-36127: Argument Clinic: inline parsing code for keyword parameters. (GH-12058)
2019-03-14 10:32:22 +02:00
Serhiy Storchaka
2c0d3f4547
bpo-36254: Fix yet one invalid use of %d in format string in C. (GH-12318)
2019-03-14 10:06:05 +02:00
Serhiy Storchaka
f2f55e7f03
bpo-36282: Improved error message for too much positional arguments. (GH-12310)
2019-03-13 23:03:22 +02:00
Serhiy Storchaka
d53fe5f407
bpo-36254: Fix invalid uses of %d in format strings in C. (GH-12264)
2019-03-13 22:59:55 +02:00
Serhiy Storchaka
a24107b04c
bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)
2019-02-25 17:59:46 +02:00
Serhiy Storchaka
6a44f6eef3
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)
...
Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
2019-02-25 17:57:58 +02:00
Serhiy Storchaka
4fa9591025
bpo-35582: Argument Clinic: inline parsing code for positional parameters. (GH-11313)
2019-01-11 16:01:14 +02:00
Serhiy Storchaka
32d96a2b5b
bpo-23867: Argument Clinic: inline parsing code for a single positional parameter. (GH-9689)
2018-12-25 13:23:47 +02:00
Xtreak
6326278e8a
bpo-34193: Fix pluralization in getargs.c and test cases. (GH-8438)
2018-12-21 16:45:13 +02:00
Victor Stinner
ec13b9322d
bpo-35081: Add Include/internal/pycore_tupleobject.h (GH-10705)
...
Move _PyTuple_ITEMS() to a new header file:
Include/internal/pycore_tupleobject.h
2018-11-25 23:56:17 +01:00
Victor Stinner
d17a693fa0
bpo-35199: Add an internal _PyTuple_ITEMS() macro (GH-10434)
...
* _PyTuple_ITEMS() gives access to the tuple->ob_item field and cast the
first argument to PyTupleObject*. This internal macro is only usable if
Py_BUILD_CORE is defined.
* Replace &PyTuple_GET_ITEM(ob, 0) with _PyTuple_ITEMS(ob).
* Replace PyTuple_GET_ITEM(op, 1) with &_PyTuple_ITEMS(ob)[1].
2018-11-09 16:56:48 +01:00
Xtreak
1426daa4fe
bpo-34127: Fix grammar in error message with respect to argument count (GH-8395)
2018-07-22 13:13:26 -07:00
Serhiy Storchaka
504373c59b
bpo-23927: Make getargs.c skipitem() skipping 'w*'. (GH-8192)
2018-07-11 17:41:43 +03:00
Leo Arias
c3d9508ff2
bpo-32746: Fix multiple typos (GH-5144)
...
Fix typos found by codespell in docs, docstrings, and comments.
2018-02-03 19:36:10 -05:00
Serhiy Storchaka
a5552f023e
bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. ( #4746 )
2017-12-15 13:11:11 +02:00
Benjamin Peterson
2bb69a5b4e
bpo-31373: remove overly strict float range checks ( #3486 )
...
This undoes a853a8ba78
except for the pytime.c
parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be
rounded into finite floats. Tests were added to very this behavior.
2017-09-10 23:50:46 -07:00
Benjamin Peterson
a853a8ba78
bpo-31373: fix undefined floating-point demotions ( #3396 )
2017-09-07 11:13:59 -07:00
Oren Milman
bf9075a0c5
bpo-31229: Fixed wrong error messages when too many keyword arguments are received. ( #3180 )
2017-08-23 21:16:48 +03:00
Stefan Krah
f432a3234f
bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. ( #3157 )
2017-08-21 13:09:59 +02:00
Segev Finer
e7bc7aac3d
bpo-9566: Fix a warning in Python/getargs.c ( #2890 )
2017-07-26 08:58:25 -07:00
Serhiy Storchaka
7e60192fe0
Remove _PyArg_NoStackKeywords(). ( #2641 )
2017-07-10 10:25:34 +02:00
Serhiy Storchaka
f9f1ccace3
Fix regression in error message introduced in bpo-29951. ( #2028 )
...
* Fix regression in error message introduced in bpo-29951.
* Add test.
* Make the test more strong.
2017-06-09 18:27:06 +02:00
Serhiy Storchaka
5eb788bf7f
bpo-30534: Fixed error messages when pass keyword arguments ( #1901 )
...
to functions implemented in C that don't support this.
Also unified error messages for functions that don't take positional or keyword
arguments.
2017-06-06 18:45:22 +03:00
Michael Seifert
64c8f705c0
bpo-29951: Include function name for some error messages in `PyArg_ParseTuple*` ( #916 )
...
Also changed format specifier for function name from "%s" to "%.200s"
and exception messages should start with lowercase letter.
2017-04-09 10:47:12 +03:00
Serhiy Storchaka
68a001dd59
Issue #29460 : _PyArg_NoKeywords(), _PyArg_NoStackKeywords() and
...
_PyArg_NoPositional() now are macros.
2017-02-06 10:41:46 +02:00
Victor Stinner
fdbc397f4d
Issue #29286 : Rename private PyArg_UnpackStack_impl() to unpack_stack()
...
Rename also "l" argument to "nargs".
2017-02-01 17:42:18 +01:00
Serhiy Storchaka
1741441649
Issue #29029 : Speed up processing positional arguments in
...
PyArg_ParseTupleAndKeywords(), _PyArg_ParseTupleAndKeywordsFast() and like.
2017-01-17 10:07:25 +02:00
Victor Stinner
fe54dd8a08
Add _PyArg_UnpackStack() function helper
...
Issue #29286 .
2017-01-17 02:33:55 +01:00
Victor Stinner
29d39cc8f5
Add _PyArg_NoStackKeywords() helper function
...
Issue #29286 . Similar to _PyArg_NoKeywords(), but expects a tuple of keyword
names, instead of a dict.
2017-01-17 01:40:01 +01:00
Victor Stinner
6518a93cb1
Add _PyArg_ParseStack() helper function
...
Issue #29286 . Function similar to PyArg_ParseTuple(), but uses a C array of
PyObject* to pass arguments. Don't support the compatibility mode.
2017-01-17 01:29:49 +01:00
Victor Stinner
3e1fad6913
Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywords
...
Issue #29286 .
2017-01-17 01:29:01 +01:00
Victor Stinner
c0083fc47d
Rename keywords to kwargs in getargs.c
...
Issue #29029 . Patch written by Serhiy Storchaka.
2017-01-17 00:37:42 +01:00
Victor Stinner
80ab22fa2c
Cleanup getargs.c
...
Factorize argument checks in:
* vgetargskeywordsfast()
* vgetargskeywordsfast_impl()
2017-01-16 23:16:47 +01:00
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
2016-12-16 16:18:57 +02:00
Serhiy Storchaka
460bd0d284
Issue #19569 : Compiler warnings are now emitted if use most of deprecated
...
functions.
2016-11-20 12:16:46 +02:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
3b73ea1278
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:19:20 +02:00
Serhiy Storchaka
f4934ea77d
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:17:58 +02:00
Christian Heimes
2f2fee19ec
va_end() all va_copy()ed va_lists.
2016-09-21 11:37:27 +02:00
Benjamin Peterson
0c21214f3e
replace usage of Py_VA_COPY with the (C99) standard va_copy
2016-09-20 20:39:33 -07:00
Benjamin Peterson
4eef505064
Backed out changeset 3934e070c9db
2016-09-10 17:04:36 -07:00
Victor Stinner
c7454ff5fc
Issue #27810 : Fix getargs.c compilation on Windows
2016-09-09 20:56:52 -07:00
Benjamin Peterson
819a46f33a
fix export of size_t parse stack function
2016-09-09 20:45:06 -07:00
Victor Stinner
f0ccbbbc57
Emit METH_FASTCALL code in Argument Clinic
...
Issue #27810 :
* Modify vgetargskeywordsfast() to work on a C array of PyObject* rather than
working on a tuple directly.
* Add _PyArg_ParseStack()
* Argument Clinic now emits code using the new METH_FASTCALL calling convention
2016-09-09 17:40:38 -07:00
Victor Stinner
a9efb2f56e
Add METH_FASTCALL calling convention
...
Issue #27810 : Add a new calling convention for C functions:
PyObject* func(PyObject *self, PyObject **args,
Py_ssize_t nargs, PyObject *kwnames);
Where args is a C array of positional arguments followed by values of keyword
arguments. nargs is the number of positional arguments, kwnames are keys of
keyword arguments. kwnames can be NULL.
2016-09-09 17:40:22 -07:00
Benjamin Peterson
af580dff4a
replace PY_LONG_LONG with long long
2016-09-06 10:46:49 -07:00
Benjamin Peterson
ed4aa83ff7
require a long long data type ( closes #27961 )
2016-09-05 17:44:18 -07:00
Serhiy Storchaka
9171a8b4ce
Issue #27574 : Decreased an overhead of parsing keyword arguments in functions
...
implemented with using Argument Clinic.
2016-08-14 10:52:18 +03:00
Serhiy Storchaka
f41b82fb19
Issue #26282 : PyArg_ParseTupleAndKeywords() and Argument Clinic now support
...
positional-only and keyword parameters in the same function.
2016-06-09 16:30:29 +03:00
Serhiy Storchaka
21a663ea28
Issue #26057 : Got rid of nonneeded use of PyUnicode_FromObject().
2016-04-13 15:37:23 +03:00
Raymond Hettinger
942302371c
Minor code cleanup for PyArg_UnpackTuple.
2016-03-26 03:02:48 -07:00
Serhiy Storchaka
a9725f86a9
Issue #26312 : SystemError is now raised in all programming bugs with using
...
PyArg_ParseTupleAndKeywords(). RuntimeError did raised before in some
programming bugs.
2016-02-11 12:41:40 +02:00
Serhiy Storchaka
4cd63ef67a
Issue #26198 : ValueError is now raised instead of TypeError on buffer
...
overflow in parsing "es#" and "et#" format units. SystemError is now raised
instead of TypeError on programmical error in parsing format string.
2016-02-08 01:22:47 +02:00
Serhiy Storchaka
3e17c788a8
Issue #26198 : Fixed error messages for some argument parsing errors.
2016-02-08 01:20:21 +02:00
Serhiy Storchaka
c4b813d05d
Issue #26198 : Fixed error messages for some argument parsing errors.
...
Fixed the documented about buffer overflow error for "es#" and "et#" format
units.
2016-02-08 01:06:11 +02:00
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
2015-12-25 20:01:53 +02:00
Serhiy Storchaka
db46fea8b6
Fixed error message for the "u#" format code.
2015-04-19 21:13:00 +03:00
Serhiy Storchaka
d6e53dab86
Fixed error message for the "u#" format code.
2015-04-19 21:11:30 +03:00
Serhiy Storchaka
92bf919ed0
Issue #22581 : Use more "bytes-like object" throughout the docs and comments.
2014-12-05 22:26:10 +02:00
Serhiy Storchaka
b757c83ec6
Issue #22581 : Use more "bytes-like object" throughout the docs and comments.
2014-12-05 22:25:22 +02:00
R David Murray
861470c836
#16518 : Bring error messages in harmony with docs ("bytes-like object")
...
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required. (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
2014-10-05 11:47:01 -04:00
Serhiy Storchaka
d8a1447c99
Issue #22215 : Now ValueError is raised instead of TypeError when str or bytes
...
argument contains not permitted null character or byte.
2014-09-06 20:07:17 +03:00
Victor Stinner
98ea54c35c
Issue #22156 : Fix "comparison between signed and unsigned integers" compiler
...
warnings in the Python/ subdirectory.
2014-08-15 23:30:40 +02:00
Benjamin Peterson
40be9e5100
remove dynamic initializer lists for c89 compliance ( closes #20595 )
2014-02-11 10:09:27 -05:00
Larry Hastings
b7ccb20423
Issue #20294 : Argument Clinic now supports argument parsing for __new__ and
...
__init__ functions.
2014-01-18 23:50:21 -08:00
Victor Stinner
cb29ec5f74
PY_FORMAT_SIZE_T should not be used with PyErr_Format(), PyErr_Format("%zd") is
...
portable
2013-11-18 02:05:31 +01:00
Victor Stinner
74387f5cac
Use Py_ssize_t type for sizes in getargs.c
...
Fix compiler warnings on Windows 64-bit
2013-11-18 01:21:12 +01:00
Victor Stinner
79ed4c744a
remove an outdated comment
...
The comment is meaningless since changeset 4e985a96a612.
2013-11-07 00:53:56 +01:00
Georg Brandl
142ad666dc
Re #18521 : move array bounds check before array access.
2013-10-14 07:01:11 +02:00
Victor Stinner
9550ef30e3
Issue #9566 : Fix compilater warnings on Windows 64-bit
2013-06-05 01:18:13 +02:00
Richard Oudkerk
25296ce5de
Use PY_FORMAT_SIZE_T because Visual Studio does not understand %zd format.
2013-05-18 17:35:19 +01:00
Victor Stinner
84bb1cf994
Fix compilater warnings on Windows 64-bit
2013-05-17 00:12:04 +02:00
Antoine Pitrou
7056cb2867
Issue #17170 : speed up PyArg_ParseTuple[AndKeywords] a bit.
2013-02-17 01:04:57 +01:00
Antoine Pitrou
c73c561181
Issue #17173 : Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
...
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:14:42 +01:00
Antoine Pitrou
4de7457009
Issue #17173 : Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
...
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag).
2013-02-09 23:11:27 +01:00
Christian Heimes
879329d66e
Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641
2012-09-10 13:17:23 +02:00
Christian Heimes
48d8d21438
Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641
2012-09-10 13:16:45 +02:00
Victor Stinner
a1b0c9fc4d
PyArg_Parse*("U"): ensure that the Unicode string is ready
2012-05-29 12:30:29 +02:00
Larry Hastings
a34790104c
Issue #14746 : Remove redundant paragraphs from skipitem() in Python/getargs.c.
2012-05-08 23:52:03 -07:00
Larry Hastings
d3f424fe45
Merge from 3.2. Issue #14749 : Add support for 'Z' to skipitem().
2012-05-08 03:54:05 -07:00
Larry Hastings
d9e4a414d7
Issue #14749 : Add support for 'Z' to skipitem() in Python/getargs.c.
2012-05-08 03:51:18 -07:00
Larry Hastings
10ba07a39e
Issue #14705 : Added support for the new 'p' format unit to skipitem().
2012-05-07 02:44:50 -07:00
Larry Hastings
faf91e75ab
Issue #14705 : Add 'p' format character to PyArg_ParseTuple* for bool support.
2012-05-05 16:54:29 -07:00
Larry Hastings
83a9f48699
Issue #14328 : Add keyword-only parameters to PyArg_ParseTupleAndKeywords.
...
They're optional-only for now (unlike in pure Python) but that's all
I needed. The syntax can easily be relaxed if we want to support
required keyword-only arguments for extension types in the future.
2012-03-20 20:06:16 +00:00
Benjamin Peterson
01feaecbfa
plug memory leak ( closes #14325 )
2012-03-16 13:25:58 -05:00
Benjamin Peterson
eb74918685
kill capsule names that we don't need anymore
2012-03-16 12:24:01 -05:00
Benjamin Peterson
f7c132158d
use memory macros
2012-03-16 12:23:39 -05:00