summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
Commit message (Collapse)AuthorAgeFilesLines
* Merged revisions ↵Georg Brandl2009-04-051-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. ........
* Merged revisions ↵Benjamin Peterson2008-12-271-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. ........
* #3668: When PyArg_ParseTuple correctly parses a s* format, but raises anAntoine Pitrou2008-08-291-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.
* Fix:Neal Norwitz2008-08-241-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.
* Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,Martin v. Löwis2008-08-121-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*.
* This reverts r63675 based on the discussion in this thread:Gregory P. Smith2008-06-091-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.
* Renamed PyString to PyBytesChristian Heimes2008-05-261-31/+31
|
* Patch #1691070 from Roger Upole: Speed up PyArg_ParseTupleAndKeywords() and ↵Christian Heimes2008-02-261-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.
* Whitespace normalizationNeal Norwitz2008-02-261-6/+6
|
* Issue #1521: on 64bit platforms, str.decode fails on very long strings.Amaury Forgeot d'Arc2007-11-301-3/+4
| | | | | | The t# and w# formats were not correctly handled. Will backport.
* Forward-port of r52136,52138: a review of overflow-detecting code.Armin Rigo2006-10-041-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...
* Fix typo.Walter Dörwald2006-09-211-1/+1
|
* Introduce an upper bound on tuple nesting depth inGeorg Brandl2006-08-091-0/+3
| | | | C argument format strings; fixes rest of #1523610.
* Part of bug #1523610: fix miscalculation of buffer length.Georg Brandl2006-07-261-2/+10
| | | | | Also add a guard against NULL in converttuple and add a test case (that previously would have crashed).
* Argh. "integer" is a very confusing word ;)Georg Brandl2006-06-081-2/+2
| | | | | Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int".
* Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds ↵Georg Brandl2006-06-081-2/+2
| | | | checking.
* C++ compiler cleanup: cast...Skip Montanaro2006-04-181-2/+2
|
* Make Py_BuildValue, PyObject_CallFunction andMartin v. Löwis2006-04-141-0/+12
| | | | PyObject_CallMethod aware of PY_SSIZE_T_CLEAN.
* SF Bug #1454485, array.array('u') could crash the interpreter whenNeal Norwitz2006-04-141-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.
* Add a test for Py_ssize_t. Correct typo in getargs.c.Georg Brandl2006-04-131-2/+2
|
* avoid C++ name mangling for the _Py.*SizeT functionsAnthony Baxter2006-04-121-0/+6
|
* Fix C99-ism, and add XXX to commentThomas Wouters2006-03-011-1/+1
|
* Use %zd format characters for Py_ssize_t types.Thomas Wouters2006-03-011-6/+6
|
* Use Py_ssize_t for PyArg_UnpackTuple arguments.Martin v. Löwis2006-03-011-2/+2
|
* Revert backwards-incompatible const changes.Martin v. Löwis2006-02-271-10/+11
|
* Based on discussion with Martin and Thomas on python-checkinsNeal Norwitz2006-02-201-1/+1
| | | | add a Py_SAFE_DOWNCAST() to make the code correct.
* Fix compiler warning on amd64. We can't use zd here since this isNeal Norwitz2006-02-191-2/+2
| | | | ultimately going to snprintf() not the python string formatter. Right?
* Use Py_ssize_t to count theMartin v. Löwis2006-02-161-2/+2
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-60/+202
|
* typoGeorg Brandl2006-01-201-1/+1
|
* Remove extra parensNeal Norwitz2005-12-191-1/+1
|
* Fix SF bug #1072182, problems with signed characters.Neal Norwitz2005-12-191-4/+4
| | | | Most of these can be backported.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-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 *.
* Complete format code support in getargs.c::skipitem(), which is called whenGeorg Brandl2005-09-141-59/+39
| | | | evaluating keyword arguments.
* Disallow keyword arguments for type constructors that don't use them.Georg Brandl2005-08-261-0/+26
| | | | (fixes bug #1119418)
* I suppose a bug report or even a fix would be a better response, butMichael W. Hudson2005-03-301-1/+2
| | | | | commit a yelp about a noted flaw the error messages for METH_KEYWORDS functions under some circumstances.
* Revert previous checkin on getargs 'L' code. Try to convert allMartin v. Löwis2005-03-031-1/+0
| | | | | numbers in PyLong_AsLongLong, and update test suite accordingly. Backported to 2.4.
* Clear internal call error in 'L' format. Fixes #723201.Martin v. Löwis2005-03-031-0/+1
| | | | Backported to 2.4.
* FixMichael W. Hudson2004-08-071-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...)
* Add PyArg_VaParseTupleAndKeywords(). Document this function andBrett Cannon2004-07-101-0/+36
| | | | | | PyArg_VaParse(). Closes patch #550732. Thanks Greg Chapman.
* Patch #684981: Add cleanup capability for argument parsers. Fixes 501716.Martin v. Löwis2003-05-031-28/+90
|
* Roll back changes to 'h' format code -- too much breaks. OtherGuido van Rossum2003-04-181-5/+5
| | | | changes stay.
* SF # 595026: support for masks in getargs.c.Thomas Heller2003-04-171-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.
* Rename LONG_LONG to PY_LONG_LONG. Fixes #710285.Martin v. Löwis2003-03-291-6/+6
|
* If a float is passed where a int is expected, issue a DeprecationWarningNeil Schemenauer2003-02-041-12/+25
| | | | instead of raising a TypeError. Closes #660144 (again).
* Raise a TypeError if a float is passed when an integer is specified.Neil Schemenauer2003-01-241-6/+24
| | | | | Calling PyInt_AsLong() on a float truncates it which is almost never the desired behavior. This closes SF bug #660144.
* Wrap uargs declaration in a #ifdef Py_USING_UNICODE, so thatWalter Dörwald2002-11-211-0/+2
| | | | | the --disable-unicode build doesn't complain about an unused variable.
* Patch #554716: Use __va_copy where available.Martin v. Löwis2002-07-281-0/+4
|
* Fix by Greg Chapman from SF bug 534347: Potential AV in vgetargskeywords.Guido van Rossum2002-04-041-1/+7
| | | | Bugfix candidate.
* Fixed "u#" parser marker to pass through Unicode objects as-is withoutMarc-André Lemburg2002-01-091-2/+6
| | | | | | going through the buffer interface API. Added tests for this to the _testcapi module and updated docs.