summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement PEP 393.Martin v. Löwis2011-09-281-21/+25
|
* Issue #12380: PyArg_ParseTuple now accepts a bytearray for the 'c' format.Eli Bendersky2011-07-291-0/+2
| | | | | | | 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 #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead ofVictor Stinner2011-03-211-26/+22
| | | | | PyOS_snprintf() to avoid temporary buffer allocated on the stack and a conversion from bytes to Unicode.
* Remove useless argument of _PyUnicode_AsDefaultEncodedString()Victor Stinner2011-03-021-1/+1
|
* Issue #8914: fix various warnings from the Clang static analyzer v254.Brett Cannon2011-02-221-3/+2
|
* Issue #8992: convertsimple() doesn't need to fill msgbuf if an error occurredVictor Stinner2011-01-041-38/+41
| | | | Return msgbug on error is enough.
* Issue #8992: Simplify addcleanup() APIVictor Stinner2011-01-041-13/+15
| | | | Don't need to handle unknown destructor anymore.
* Issue #8651: PyArg_Parse*() functions raise an OverflowError if the fileVictor Stinner2011-01-041-1/+11
| | | | | doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int (length bigger than 2^31-1).
* handle dict subclasses gracefully in PyArg_ValidateKeywordArgumentsBenjamin Peterson2010-11-171-1/+1
|
* Issue #2443: Added a new macro, Py_VA_COPY, which is equivalent to C99Alexander Belopolsky2010-08-111-36/+4
| | | | | va_copy, but available on all python platforms. Untabified a few unrelated files.
* Issue #8991: convertbuffer() rejects discontigious buffersVictor Stinner2010-07-281-21/+8
|
* Issue #8850: Remove "w" and "w#" formats from PyArg_Parse*() functions, useVictor Stinner2010-06-251-47/+17
| | | | "w*" format instead. Add tests for "w*" format.
* getbuffer(): release the buffer on error (if the buffer is not contiguous)Victor Stinner2010-06-241-0/+1
|
* PyArg_Parse*() functions: factorize code for s/z and u/Z formatsVictor Stinner2010-06-241-96/+25
|
* Issue #8949: "z" format of PyArg_Parse*() functions doesn't accept bytesVictor Stinner2010-06-241-5/+0
| | | | objects, as described in the documentation.
* getargs.c: remove last reference to "t#" formatVictor Stinner2010-06-131-1/+0
| | | | "t#" format was removed from convertitem() (convertsimple) but not skipitem().
* Issue #8592: PyArg_Parse*() functions raise a TypeError for "y", "u" and "Z"Victor Stinner2010-06-131-3/+17
| | | | | 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-17/+3
| | | | | instead of warning. This makes it consistent with the other integer codes.
* Issue #8838, #8339: Remove codecs.charbuffer_encode() and "t#" parsing formatVictor Stinner2010-06-081-40/+1
| | | | | Remove last references to the "char buffer" of the buffer protocol from Python3.
* PyArg_Parse*("Z#") raises an error for unknown typeVictor Stinner2010-06-081-3/+4
| | | | | | | instead of ignoring the error and leave the pointer to the string and the size unchanged (not initialized). Fix also the type in the error message of "Z", "Z#" and "Y" formats.
* convertsimple(): call PyErr_NoMemory() on PyMem_NEW() failureVictor Stinner2010-06-061-0/+2
| | | | Raise a more revelant error (MemoryError instead of TypeError)
* Simplify getbuffer(): convertbuffer() fails anyway if bf_getbuffer is NULLVictor Stinner2010-06-061-19/+11
|
* Remove dead codeVictor Stinner2010-05-291-12/+1
|
* Issue #8837: Remove "O?" format of PyArg_Parse*() functions. The format is noVictor Stinner2010-05-281-11/+0
| | | | used anymore and it was never documented.
* Issue #6697: Fix a crash if a keyword contains a surrogateVictor Stinner2010-05-191-6/+9
|
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-1656/+1656
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* prevent the dict constructor from accepting non-string keyword args #8419Benjamin Peterson2010-04-241-0/+15
| | | | | This adds PyArg_ValidateKeywordArguments, which checks that keyword arguments are all strings, using an optimized method if possible.
* Merged revisions 79837 via svnmerge fromAntoine Pitrou2010-04-061-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r79837 | antoine.pitrou | 2010-04-06 17:38:25 +0200 (mar., 06 avril 2010) | 19 lines 14 years later, we still don't know what it's for. Spotted by the PyPy developers. Original commit is: branch: trunk user: guido date: Mon Aug 19 21:32:04 1996 +0200 files: Python/getargs.c description: [svn r6499] Support for keyword arguments (PyArg_ParseTupleAndKeywords) donated by Geoff Philbrick <philbric@delphi.hks.com> (slightly changed by me). Also a little change to make the file acceptable to K&R C compilers (HPUX, SunOS 4.x). ........
* Merged revisions 77218 via svnmerge fromMark Dickinson2010-01-011-1/+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. ........
* Issue #7414: Add missing 'case 'C'' to skipitem() in getargs.c. ThisMark Dickinson2009-12-031-0/+1
| | | | | | was causing PyArg_ParseTupleAndKeywords(args, kwargs, "|CC", ...) to fail with a RuntimeError. Thanks Case Van Horsen for tracking down the source of this error.
* Issue 7147 - remove ability to attempt to build Python without complex ↵Skip Montanaro2009-10-181-4/+0
| | | | number support (was broken anyway)
* - Issue #6624: yArg_ParseTuple with "s" format when parsing argument withSean Reifscheider2009-08-011-1/+1
| | | | NUL: Bogus TypeError detail string.
* Issue #6012: Add cleanup support to O& argument parsing.Martin v. Löwis2009-05-291-1/+47
|
* add a replacement API for PyCObject, PyCapsule #5630Benjamin Peterson2009-05-051-8/+26
| | | | | | All stdlib modules with C-APIs now use this. Patch by Larry Hastings
* Merged revisions ↵Benjamin Peterson2009-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,71299,71329,71397-71398,71486 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70980 | jack.diederich | 2009-04-01 15:26:13 -0500 (Wed, 01 Apr 2009) | 3 lines bounds check arguments to mmap.move(). All of them. Really. fixes crasher on OS X 10.5 ........ r71059 | mark.dickinson | 2009-04-02 13:39:37 -0500 (Thu, 02 Apr 2009) | 2 lines sys.long_info attributes should be ints, not longs ........ r71225 | georg.brandl | 2009-04-05 06:54:07 -0500 (Sun, 05 Apr 2009) | 1 line #5580: no need to use parentheses when converterr() argument is actually a type description. ........ r71234 | georg.brandl | 2009-04-05 08:16:35 -0500 (Sun, 05 Apr 2009) | 1 line Whitespace normalization. ........ r71241 | georg.brandl | 2009-04-05 09:48:49 -0500 (Sun, 05 Apr 2009) | 1 line #5471: fix expanduser() for $HOME set to "/". ........ r71243 | georg.brandl | 2009-04-05 10:14:29 -0500 (Sun, 05 Apr 2009) | 1 line #5432: make plistlib docstring a raw string, since it contains examples with backslash escapes. ........ r71249 | georg.brandl | 2009-04-05 11:30:43 -0500 (Sun, 05 Apr 2009) | 1 line #5444: adapt make.bat to new htmlhelp output file name. ........ r71251 | georg.brandl | 2009-04-05 12:17:42 -0500 (Sun, 05 Apr 2009) | 1 line #5298: clarify docs about GIL by using more consistent wording. ........ r71255 | georg.brandl | 2009-04-05 13:34:58 -0500 (Sun, 05 Apr 2009) | 1 line #602893: add indicator for current line in cgitb that doesnt rely on styling alone. ........ r71266 | georg.brandl | 2009-04-05 15:23:13 -0500 (Sun, 05 Apr 2009) | 1 line Normalize issue referencing style. ........ r71299 | gregory.p.smith | 2009-04-05 18:43:58 -0500 (Sun, 05 Apr 2009) | 3 lines Fixes issue5705: os.setuid() and friends did not accept the same range of values that pwd.getpwnam() returns. ........ r71329 | benjamin.peterson | 2009-04-06 16:53:33 -0500 (Mon, 06 Apr 2009) | 1 line add create_connection to __all__ #5711 ........ r71397 | georg.brandl | 2009-04-08 11:36:39 -0500 (Wed, 08 Apr 2009) | 1 line Remove redundant backtick. ........ r71398 | georg.brandl | 2009-04-08 11:39:04 -0500 (Wed, 08 Apr 2009) | 1 line Update ignore file for suspicious builder. ........ r71486 | andrew.kuchling | 2009-04-11 11:18:14 -0500 (Sat, 11 Apr 2009) | 1 line Re-word ........
* make 'c' only accept bytes and 'C' only unicode #5499Benjamin Peterson2009-04-021-10/+4
|
* Merged revisions ↵Benjamin Peterson2008-12-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 67889-67892,67895,67898,67904-67907,67912,67918,67920-67921,67923-67924,67926-67927,67930,67943 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ................ r67889 | benjamin.peterson | 2008-12-20 19:04:32 -0600 (Sat, 20 Dec 2008) | 1 line sphinx.web is long gone ................ r67890 | benjamin.peterson | 2008-12-20 19:12:26 -0600 (Sat, 20 Dec 2008) | 1 line update readme ................ r67891 | benjamin.peterson | 2008-12-20 19:14:47 -0600 (Sat, 20 Dec 2008) | 1 line there are way too many places which need to have the current version added ................ r67892 | benjamin.peterson | 2008-12-20 19:29:32 -0600 (Sat, 20 Dec 2008) | 9 lines Merged revisions 67809 via svnmerge from svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r67809 | benjamin.peterson | 2008-12-15 21:54:45 -0600 (Mon, 15 Dec 2008) | 1 line fix logic error ........ ................ r67895 | neal.norwitz | 2008-12-21 08:28:32 -0600 (Sun, 21 Dec 2008) | 2 lines Add Tarek for work on distutils. ................ r67898 | benjamin.peterson | 2008-12-21 15:00:53 -0600 (Sun, 21 Dec 2008) | 1 line compute DISTVERSION with patchlevel.py ................ r67904 | benjamin.peterson | 2008-12-22 14:44:58 -0600 (Mon, 22 Dec 2008) | 1 line less attitude ................ r67905 | benjamin.peterson | 2008-12-22 14:51:15 -0600 (Mon, 22 Dec 2008) | 1 line fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|' ................ r67906 | benjamin.peterson | 2008-12-22 14:52:53 -0600 (Mon, 22 Dec 2008) | 1 line add NEWS note ................ r67907 | benjamin.peterson | 2008-12-22 16:12:19 -0600 (Mon, 22 Dec 2008) | 1 line silence compiler warning ................ r67912 | georg.brandl | 2008-12-23 06:37:21 -0600 (Tue, 23 Dec 2008) | 2 lines Fix missing "svn" command. ................ r67918 | georg.brandl | 2008-12-23 09:44:25 -0600 (Tue, 23 Dec 2008) | 2 lines Markup fix. ................ r67920 | benjamin.peterson | 2008-12-23 14:09:28 -0600 (Tue, 23 Dec 2008) | 1 line use a global variable, so the compiler doesn't optimize the assignment out ................ r67921 | benjamin.peterson | 2008-12-23 14:12:33 -0600 (Tue, 23 Dec 2008) | 1 line make global static ................ r67923 | benjamin.peterson | 2008-12-24 09:10:27 -0600 (Wed, 24 Dec 2008) | 1 line #4736 BufferRWPair.closed shouldn't try to call another property as a function ................ r67924 | benjamin.peterson | 2008-12-24 10:10:05 -0600 (Wed, 24 Dec 2008) | 1 line pretend exceptions don't exist a while longer ................ r67926 | tarek.ziade | 2008-12-24 13:10:05 -0600 (Wed, 24 Dec 2008) | 1 line fixed #4400 : distutils .pypirc default generated file was broken. ................ r67927 | benjamin.peterson | 2008-12-26 17:26:30 -0600 (Fri, 26 Dec 2008) | 1 line python version is included in file name now ................ r67930 | hirokazu.yamamoto | 2008-12-26 22:19:48 -0600 (Fri, 26 Dec 2008) | 2 lines Issue #4740: Use HIGHEST_PROTOCOL in pickle test. (There is no behavior difference in 2.x because HIGHEST_PROTOCOL == 2) ................ r67943 | alexandre.vassalotti | 2008-12-27 04:02:59 -0600 (Sat, 27 Dec 2008) | 2 lines Fix bogus unicode tests in pickletester. ................
* string -> bytes in error message #4745Benjamin Peterson2008-12-271-1/+1
|
* #3668: When PyArg_ParseTuple correctly parses a s* format, but raises anAntoine Pitrou2008-08-291-16/+47
| | | | | | | exception afterwards (for a subsequent parameter), the user code will not call PyBuffer_Release() and memory will leak. Reviewed by Amaury Forgeot d'Arc.
* Fix #3651 various memory leaks when using the buffer interfaceBenjamin Peterson2008-08-271-10/+11
| | | | | by Amaury Forgeot d'Arc Reviewer: Antoine Pitrou
* Merged revisions 66006 via svnmerge fromNeal Norwitz2008-08-241-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes) ........ r66006 | neal.norwitz | 2008-08-23 22:04:52 -0700 (Sat, 23 Aug 2008) | 25 lines Fix: * crashes on memory allocation failure found with failmalloc * memory leaks found with valgrind * compiler warnings in opt mode which would lead to invalid memory reads * problem using wrong name in decimal module reported by pychecker Update the valgrind suppressions file with new leaks that are small/one-time leaks we don't care about (ie, they are too hard to fix). TBR=barry TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes) in opt mode: valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \ ./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \ -x test_logging test_ssl test_multiprocessing valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \ ./python -E -tt ./Lib/test/regrtest.py test_multiprocessing for i in `seq 1 4000` ; do LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \ ./python -c pass done At least some of these fixes should probably be backported to 2.5. ........
* Merged revisions 65654 via svnmerge fromMartin v. Löwis2008-08-131-11/+108
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r65654 | martin.v.loewis | 2008-08-12 16:49:50 +0200 (Tue, 12 Aug 2008) | 6 lines Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple, by denying s# to parse objects that have a releasebuffer procedure, and introducing s*. More module might need to get converted to use s*. ........
* Rename PyUnicode_AsString -> _PyUnicode_AsString andMarc-André Lemburg2008-08-071-1/+1
| | | | | | | | | PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark them for interpreter internal use only. We'll have to rework these APIs or create new ones for the purpose of accessing the UTF-8 representation of Unicode objects for 3.1.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-22/+22
|
* Renamed PyBytes to PyByteArrayChristian Heimes2008-05-261-3/+3
|
* #2895: don't crash with bytes as keyword argument names.Georg Brandl2008-05-161-1/+1
|
* #2798: PyArg_ParseTuple did not correctly handle the "s" code in case of ↵Amaury Forgeot d'Arc2008-05-121-8/+8
| | | | | | | | | | unicode strings with chars outside the 7bit ascii (s# was already correct). This is necessary to allow python run from a non-ASCII directory, and seems enough on some platforms, probably where the default PyUnicode encoding (utf-8) is also the default filesystem encoding.
* Fixed a memory leak introduced in r62462Christian Heimes2008-05-081-1/+3
|
* Issue 2440: remove the guard around the handling of case 'n' in getargs.c's ↵Trent Nelson2008-04-221-4/+1
| | | | convertsimple() such that we always treat it as an index type, regardless of whether or not sizeof(size_t) == sizeof(long). Fix the test_args2.Signed_TestCase.test_n() such that it tests for adherence to PEP 357 (don't try and coerce objects that don't have nb_index slots but do have nb_int slots (i.e. floats) into indexes 'just because we can'). Three other commits are related to this one: r62269 and r62279, which were changes to PyNumber_Index (among other things) to check for nb_int slots when we lack nb_index slots -- and r62292, which is when I reverted these changes after various people pointed out that the test was in fact wrong, not the code.
* Issue 2440: revert r62269 and r62279. These changes were made in an effort ↵Trent Nelson2008-04-111-2/+4
| | | | to fix test_args2.Signed_TestCase.test_n(), which was failing on Windows x64 on the following line: 'self.failUnlessEqual(99, getargs_n(Long()))'. Although the two commits *did* fix the test on Windows x64, it's become clear that it's the test that's incorrect, and the changes to PyNumber_Index() in particular were not warranted (and actually violate PEP 357). This commit will get us back to where we were at r62268, before I started butchering things.