summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getargs2.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-94938: Fix errror detection of unexpected keyword arguments ↵Serhiy Storchaka2022-07-281-0/+27
| | | | | | | | | | | | | | | (GH-94999) (GH-95353) When keyword argument name is an instance of a str subclass with overloaded methods __eq__ and __hash__, the former code could not find the name of an extraneous keyword argument to report an error, and _PyArg_UnpackKeywords() returned success without setting the corresponding cell in the linearized arguments array. But since the number of expected initialized cells is determined as the total number of passed arguments, this lead to reading NULL as a keyword parameter value, that caused SystemError or crash or other undesired behavior. (cherry picked from commit ebad53a4dc1bb591820724a22cef9b8459185b5f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931)Miss Islington (bot)2022-07-181-3/+13
| | | | | (cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-94864: Fix PyArg_Parse* with deprecated format units "u" and "Z" (GH-94902)Serhiy Storchaka2022-07-171-0/+13
| | | It returned 1 (success) when warnings are turned into exceptions.
* bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)Inada Naoki2021-05-071-0/+7
| | | | `convertitem()` raises `SystemError` when '#' is used without `PY_SSIZE_T_CLEAN`. This commit makes `skipitem()` raise it too.
* bpo-36346: Emit DeprecationWarning for PyArg_Parse() with 'u' or 'Z'. (GH-20927)Inada Naoki2021-02-221-24/+59
| | | | | Emit DeprecationWarning when PyArg_Parse*() is called with 'u', 'Z' format. See PEP 623.
* bpo-36346: Make using the legacy Unicode C API optional (GH-21437)Serhiy Storchaka2020-07-101-0/+4
| | | | Add compile time option USE_UNICODE_WCHAR_CACHE. Setting it to 0 makes the interpreter not using the wchar_t cache and the legacy Unicode C API.
* bpo-40275: Use new test.support helper submodules in tests (GH-21412)Hai Shi2020-07-091-1/+2
|
* bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)Serhiy Storchaka2020-05-261-32/+16
| | | | Only __index__ should be used to make integer conversions lossless.
* bpo-20092. Use __index__ in constructors of int, float and complex. (GH-13108)Serhiy Storchaka2019-06-011-0/+6
|
* bpo-36048: Use __index__() instead of __int__() for implicit conversion if ↵Serhiy Storchaka2019-02-251-8/+101
| | | | | | available. (GH-11952) Deprecate using the __int__() method in implicit conversions of Python numbers to C integers.
* bpo-34193: Fix pluralization in getargs.c and test cases. (GH-8438)Xtreak2018-12-211-4/+4
|
* bpo-34272: Move argument parsing tests from test_capi to test_getargs2. ↵Serhiy Storchaka2018-08-061-1/+179
| | | | (GH-8567)
* bpo-31373: remove overly strict float range checks (#3486)Benjamin Peterson2017-09-111-0/+6
| | | | | This undoes a853a8ba7850381d49b284295dd6f0dc491dbe44 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.
* bpo-29951: Include function name for some error messages in ↵Michael Seifert2017-04-091-6/+7
| | | | | | | `PyArg_ParseTuple*` (#916) Also changed format specifier for function name from "%s" to "%.200s" and exception messages should start with lowercase letter.
* bpo-29894: Deprecate returning an instance of complex subclass from ↵Serhiy Storchaka2017-03-241-1/+2
| | | | | __complex__. (#798) In a future versions of Python this can be an error.
* Issue #28086: Single var-positional argument of tuple subtype was passedSerhiy Storchaka2016-09-221-1/+1
| | | | unscathed to the C-defined function. Now it is converted to exact tuple.
* Fixes test_getargs2 to get the buildbots working again.Steve Dower2016-09-121-1/+1
|
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-6/+6
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* more PY_LONG_LONG to long longBenjamin Peterson2016-09-081-5/+0
|
* Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now supportSerhiy Storchaka2016-06-091-0/+33
| | | | positional-only and keyword parameters in the same function.
* Issue #26983: float() now always return an instance of exact float.Serhiy Storchaka2016-06-031-2/+4
| | | | | | The deprecation warning is emitted if __float__ returns an instance of a strict subclass of float. In a future versions of Python this can be an error.
* Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codesSerhiy Storchaka2016-05-161-1/+159
|\ | | | | | | in PyArg_ParseTuple().
| * Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codesSerhiy Storchaka2016-05-161-1/+159
| | | | | | | | in PyArg_ParseTuple().
| * Backported tests for issue #18531.Serhiy Storchaka2016-05-161-0/+56
| |
* | Issue #18531: Single var-keyword argument of dict subtype was passedSerhiy Storchaka2016-05-081-0/+56
| | | | | | | | unscathed to the C-defined function. Now it is converted to exact dict.
* | Issue #26198: ValueError is now raised instead of TypeError on bufferSerhiy Storchaka2016-02-071-4/+4
|/ | | | | overflow in parsing "es#" and "et#" format units. SystemError is now raised instead of TypeError on programmical error in parsing format string.
* Issue #26198: Added tests for "es", "et", "es#", "et#" and "C" format unitsSerhiy Storchaka2016-01-281-42/+135
| | | | of PyArg_Parse*() functions.
* Issue #22883: Got rid of outdated references to PyInt and PyString in comments.Serhiy Storchaka2015-02-171-2/+2
|
* Issue #22215: Now ValueError is raised instead of TypeError when str or bytesSerhiy Storchaka2014-09-061-5/+5
| | | | argument contains not permitted null character or byte.
* Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-0/+2
|\
| * Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-0/+2
| |
| * Issue #17576: Removed deprecation warnings added in changeset 618cca51a27e.Serhiy Storchaka2013-12-141-16/+8
| |
* | Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-0/+70
|\ \ | |/ | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
| * Issue #17576: Deprecation warning emitted now when __int__() or __index__()Serhiy Storchaka2013-12-111-0/+70
| | | | | | | | | | return not int instance. Introduced _PyLong_FromNbInt() and refactored PyLong_As*() functions.
* | Update various test modules to use unittest.main() for test discoveryBrett Cannon2013-06-131-20/+6
| | | | | | | | instead of manually listing tests for test.support.run_unittest().
* | Issue #17516: use comment syntax for comments, instead of multiline stringVictor Stinner2013-03-261-31/+29
|/
* Issue #14705: Add 'p' format character to PyArg_ParseTuple* for bool support.Larry Hastings2012-05-051-0/+31
|
* Issue #14328: Add keyword-only parameters to PyArg_ParseTupleAndKeywords.Larry Hastings2012-03-201-1/+73
| | | | | | 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.
* Issue #12380: PyArg_ParseTuple now accepts a bytearray for the 'c' format.Eli Bendersky2011-07-291-0/+9
| | | | | | | As a side effect, this now allows the rjust, ljust and center methods of bytes and bytearray to accept a bytearray argument. Patch by Petri Lehtinen
* Issue #10451: memoryview objects could allow to mutate a readable buffer.Antoine Pitrou2011-01-181-1/+3
| | | | Initial patch by Ross Lagerwall.
* #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-201-9/+9
|
* Issue #8850: Remove "w" and "w#" formats from PyArg_Parse*() functions, useVictor Stinner2010-06-251-0/+10
| | | | "w*" format instead. Add tests for "w*" format.
* Issue #8949: "z" format of PyArg_Parse*() functions doesn't accept bytesVictor Stinner2010-06-241-1/+1
| | | | objects, as described in the documentation.
* Issue #8592: PyArg_Parse*() functions raise a TypeError for "y", "u" and "Z"Victor Stinner2010-06-131-1/+129
| | | | | formats if the string contains a null byte/character. Write unit tests for string formats.
* Issue #8950: Make PyArg_Parse* with 'L' code raise for float inputs,Mark Dickinson2010-06-101-16/+1
| | | | | instead of warning. This makes it consistent with the other integer codes.
* Issue #6697: Fix a crash if a keyword contains a surrogateVictor Stinner2010-05-191-0/+14
|
* Merged revisions 77218 via svnmerge fromMark Dickinson2010-01-011-11/+17
| | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r77218 | mark.dickinson | 2010-01-01 17:27:30 +0000 (Fri, 01 Jan 2010) | 5 lines Issue #5080: turn the DeprecationWarning from float arguments passed to integer PyArg_Parse* format codes into a TypeError. Add a DeprecationWarning for floats passed with the 'L' format code, which didn't previously have a warning. ........
* Merged revisions 76930 via svnmerge fromMark Dickinson2009-12-201-1/+16
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r76930 | mark.dickinson | 2009-12-20 15:57:56 +0000 (Sun, 20 Dec 2009) | 1 line Add missing tests for PyArg_Parse* with format 'h' ........
* Issue #7435: Remove duplicate int/long tests, and otherMark Dickinson2009-12-051-25/+0
| | | | references to long in py3k. Patch provided by flox.
* convert old fail* assertions to assert*Benjamin Peterson2009-06-301-71/+71
|