summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
Commit message (Collapse)AuthorAgeFilesLines
* #5580: no need to use parentheses when converterr() argument is actually a ↵Georg Brandl2009-04-051-1/+1
| | | | type description.
* fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|'Benjamin Peterson2008-12-221-1/+1
|
* #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.