summaryrefslogtreecommitdiff
path: root/Python/getargs.c
AgeCommit message (Collapse)AuthorLines
2010-05-09Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou-1485/+1485
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. ........
2009-04-05Merged revisions ↵Georg Brandl-1/+1
71058,71149-71150,71212,71214-71216,71222,71225,71234,71237-71238,71240-71241,71243,71249,71251 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r71058 | georg.brandl | 2009-04-02 20:09:04 +0200 (Do, 02 Apr 2009) | 3 lines PyErr_NormalizeException may not set an error, so convert the PyErr_SetObject call on hitting the recursion limit into just assigning it to the arguments provided. ........ r71149 | georg.brandl | 2009-04-04 15:42:39 +0200 (Sa, 04 Apr 2009) | 1 line #5642: clarify map() compatibility to the builtin. ........ r71150 | georg.brandl | 2009-04-04 15:45:49 +0200 (Sa, 04 Apr 2009) | 1 line #5601: clarify that webbrowser is not meant for file names. ........ r71212 | georg.brandl | 2009-04-05 12:24:20 +0200 (So, 05 Apr 2009) | 1 line #1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions. ........ r71214 | georg.brandl | 2009-04-05 12:29:57 +0200 (So, 05 Apr 2009) | 1 line Normalize spelling of Mac OS X. ........ r71215 | georg.brandl | 2009-04-05 12:32:26 +0200 (So, 05 Apr 2009) | 1 line Avoid sure signs of a diseased mind. ........ r71216 | georg.brandl | 2009-04-05 12:41:02 +0200 (So, 05 Apr 2009) | 1 line #1718017: document the relation of os.path and the posixpath, ntpath etc. modules better. ........ r71222 | georg.brandl | 2009-04-05 13:07:14 +0200 (So, 05 Apr 2009) | 1 line #5615: make it possible to configure --without-threads again. ........ r71225 | georg.brandl | 2009-04-05 13:54:07 +0200 (So, 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 15:16:35 +0200 (So, 05 Apr 2009) | 1 line Whitespace normalization. ........ r71237 | georg.brandl | 2009-04-05 16:24:52 +0200 (So, 05 Apr 2009) | 1 line #1326077: fix traceback formatting of SyntaxErrors. This fixes two differences with formatting coming from Python: a) the reproduction of location details in the error message if no line text is given, b) the prefixing of the last line by one space. ........ r71238 | georg.brandl | 2009-04-05 16:25:41 +0200 (So, 05 Apr 2009) | 1 line Add NEWS entry for r71237. ........ r71240 | georg.brandl | 2009-04-05 16:40:06 +0200 (So, 05 Apr 2009) | 1 line #5370: doc update about unpickling objects with custom __getattr__ etc. methods. ........ r71241 | georg.brandl | 2009-04-05 16:48:49 +0200 (So, 05 Apr 2009) | 1 line #5471: fix expanduser() for $HOME set to "/". ........ r71243 | georg.brandl | 2009-04-05 17:14:29 +0200 (So, 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 18:30:43 +0200 (So, 05 Apr 2009) | 1 line #5444: adapt make.bat to new htmlhelp output file name. ........ r71251 | georg.brandl | 2009-04-05 19:17:42 +0200 (So, 05 Apr 2009) | 1 line #5298: clarify docs about GIL by using more consistent wording. ........
2008-12-27Merged revisions ↵Benjamin Peterson-1/+1
67898,67904-67907,67912,67918,67920-67921,67923-67924,67927,67930,67932,67943 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ 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 ........ 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) ........ r67932 | alexandre.vassalotti | 2008-12-27 00:36:10 -0600 (Sat, 27 Dec 2008) | 5 lines Remove unnecessary casts related to unicode_decode_call_errorhandler. Make the _PyUnicode_Resize macro a static function. These changes are needed to avoid breaking strict aliasing rules. ........ r67943 | alexandre.vassalotti | 2008-12-27 04:02:59 -0600 (Sat, 27 Dec 2008) | 2 lines Fix bogus unicode tests in pickletester. ........
2008-08-29#3668: When PyArg_ParseTuple correctly parses a s* format, but raises anAntoine Pitrou-15/+41
exception afterwards (for a subsequent parameter), the user code will not call PyBuffer_Release() and memory will leak. Reviewed by Amaury Forgeot d'Arc.
2008-08-24Fix:Neal Norwitz-3/+7
* 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.
2008-08-12Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,Martin v. Löwis-9/+123
by denying s# to parse objects that have a releasebuffer procedure, and introducing s*. More module might need to get converted to use s*.
2008-06-09This reverts r63675 based on the discussion in this thread:Gregory P. Smith-31/+31
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
2008-05-26Renamed PyString to PyBytesChristian Heimes-31/+31
2008-02-26Patch #1691070 from Roger Upole: Speed up PyArg_ParseTupleAndKeywords() and ↵Christian Heimes-154/+109
improve error msg My tests don't show the promised speed up of 10%. The code is as fast as the old code for simple cases and slightly faster for complex cases with several of args and kwargs. But the patch simplifies the code, too.
2008-02-26Whitespace normalizationNeal Norwitz-6/+6
2007-11-30Issue #1521: on 64bit platforms, str.decode fails on very long strings.Amaury Forgeot d'Arc-3/+4
The t# and w# formats were not correctly handled. Will backport.
2006-10-04Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo-3/+4
* unified the way intobject, longobject and mystrtoul handle values around -sys.maxint-1. * in general, trying to entierely avoid overflows in any computation involving signed ints or longs is extremely involved. Fixed a few simple cases where a compiler might be too clever (but that's all guesswork). * more overflow checks against bad data in marshal.c. * 2.5 specific: fixed a number of places that were still confusing int and Py_ssize_t. Some of them could potentially have caused "real-world" breakage. * list.pop(x): fixing overflow issues on x was messy. I just reverted to PyArg_ParseTuple("n"), which does the right thing. (An obscure test was trying to give a Decimal to list.pop()... doesn't make sense any more IMHO) * trying to write a few tests...
2006-09-21Fix typo.Walter Dörwald-1/+1
2006-08-09Introduce an upper bound on tuple nesting depth inGeorg Brandl-0/+3
C argument format strings; fixes rest of #1523610.
2006-07-26Part of bug #1523610: fix miscalculation of buffer length.Georg Brandl-2/+10
Also add a guard against NULL in converttuple and add a test case (that previously would have crashed).
2006-06-08Argh. "integer" is a very confusing word ;)Georg Brandl-2/+2
Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int".
2006-06-08Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds ↵Georg Brandl-2/+2
checking.
2006-04-18C++ compiler cleanup: cast...Skip Montanaro-2/+2
2006-04-14Make Py_BuildValue, PyObject_CallFunction andMartin v. Löwis-0/+12
PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
2006-04-14SF Bug #1454485, array.array('u') could crash the interpreter whenNeal Norwitz-5/+2
passing a string. Martin already fixed the actual crash by ensuring Py_UNICODE is unsigned. As discussed on python-dev, this fix removes the possibility of creating a unicode string from a raw buffer. There is an outstanding question of how to fix the crash in 2.4.
2006-04-13Add a test for Py_ssize_t. Correct typo in getargs.c.Georg Brandl-2/+2
2006-04-12avoid C++ name mangling for the _Py.*SizeT functionsAnthony Baxter-0/+6
2006-03-01Fix C99-ism, and add XXX to commentThomas Wouters-1/+1
2006-03-01Use %zd format characters for Py_ssize_t types.Thomas Wouters-6/+6
2006-03-01Use Py_ssize_t for PyArg_UnpackTuple arguments.Martin v. Löwis-2/+2
2006-02-27Revert backwards-incompatible const changes.Martin v. Löwis-10/+11
2006-02-20Based on discussion with Martin and Thomas on python-checkinsNeal Norwitz-1/+1
add a Py_SAFE_DOWNCAST() to make the code correct.
2006-02-19Fix compiler warning on amd64. We can't use zd here since this isNeal Norwitz-2/+2
ultimately going to snprintf() not the python string formatter. Right?
2006-02-16Use Py_ssize_t to count theMartin v. Löwis-2/+2
2006-02-15Merge ssize_t branch.Martin v. Löwis-60/+202
2006-01-20typoGeorg Brandl-1/+1
2005-12-19Remove extra parensNeal Norwitz-1/+1
2005-12-19Fix SF bug #1072182, problems with signed characters.Neal Norwitz-4/+4
Most of these can be backported.
2005-12-10Add const to several API functions that take char *.Jeremy Hylton-46/+44
In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
2005-09-14Complete format code support in getargs.c::skipitem(), which is called whenGeorg Brandl-59/+39
evaluating keyword arguments.
2005-08-26Disallow keyword arguments for type constructors that don't use them.Georg Brandl-0/+26
(fixes bug #1119418)
2005-03-30I suppose a bug report or even a fix would be a better response, butMichael W. Hudson-1/+2
commit a yelp about a noted flaw the error messages for METH_KEYWORDS functions under some circumstances.
2005-03-03Revert previous checkin on getargs 'L' code. Try to convert allMartin v. Löwis-1/+0
numbers in PyLong_AsLongLong, and update test suite accordingly. Backported to 2.4.
2005-03-03Clear internal call error in 'L' format. Fixes #723201.Martin v. Löwis-0/+1
Backported to 2.4.
2004-08-07FixMichael W. Hudson-9/+7
[ 991812 ] PyArg_ParseTuple can miss errors with warnings as exceptions as suggested in the report. This is definitely a 2.3 candidate (as are most of the checkins I've made in the last month...)
2004-07-10Add PyArg_VaParseTupleAndKeywords(). Document this function andBrett Cannon-0/+36
PyArg_VaParse(). Closes patch #550732. Thanks Greg Chapman.
2003-05-03Patch #684981: Add cleanup capability for argument parsers. Fixes 501716.Martin v. Löwis-28/+90
2003-04-18Roll back changes to 'h' format code -- too much breaks. OtherGuido van Rossum-5/+5
changes stay.
2003-04-17SF # 595026: support for masks in getargs.c.Thomas Heller-27/+49
New functions: unsigned long PyInt_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); unsigned long PyLong_AsUnsignedLongMask(PyObject *); unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); New and changed format codes: b unsigned char 0..UCHAR_MAX B unsigned char none ** h unsigned short 0..USHRT_MAX H unsigned short none ** i int INT_MIN..INT_MAX I * unsigned int 0..UINT_MAX l long LONG_MIN..LONG_MAX k * unsigned long none L long long LLONG_MIN..LLONG_MAX K * unsigned long long none Notes: * New format codes. ** Changed from previous "range-and-a-half" to "none"; the range-and-a-half checking wasn't particularly useful. New test test_getargs2.py, to verify all this.
2003-03-29Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis-6/+6
2003-02-04If a float is passed where a int is expected, issue a DeprecationWarningNeil Schemenauer-12/+25
instead of raising a TypeError. Closes #660144 (again).
2003-01-24Raise a TypeError if a float is passed when an integer is specified.Neil Schemenauer-6/+24
Calling PyInt_AsLong() on a float truncates it which is almost never the desired behavior. This closes SF bug #660144.
2002-11-21Wrap uargs declaration in a #ifdef Py_USING_UNICODE, so thatWalter Dörwald-0/+2
the --disable-unicode build doesn't complain about an unused variable.
2002-07-28Patch #554716: Use __va_copy where available.Martin v. Löwis-0/+4
2002-04-04Fix by Greg Chapman from SF bug 534347: Potential AV in vgetargskeywords.Guido van Rossum-1/+7
Bugfix candidate.