summaryrefslogtreecommitdiff
path: root/Python/getargs.c
AgeCommit message (Collapse)AuthorLines
2019-10-21[2.7] bpo-38540: Fix possible leak in PyArg_Parse for "es#" and "et#". ↵Serhiy Storchaka-1/+13
(GH-16869). (GH-16877) (cherry picked from commit 5bc6a7c06eda20ba131ecba6752be0506d310181)
2018-07-11[2.7] bpo-23927: Make getargs.c skipitem() skipping 'w*'. (GH-8192). (GH-8255)Serhiy Storchaka-1/+1
(cherry picked from commit 504373c59b48f1ea12132d515459022730db6047) Also backport tests for skipitem() and handling errors.
2016-07-01Issue #23908: os functions, open() and the io.FileIO constructor now rejectSerhiy Storchaka-1/+18
unicode paths with embedded null character on Windows instead of silently truncate them.
2016-02-08Issue #26198: Fixed error messages for some argument parsing errors.Serhiy Storchaka-12/+21
Fixed the documented about buffer overflow error for "es#" and "et#" format units.
2012-09-10Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641Christian Heimes-0/+1
2012-03-22Issue #10538. Put a reference to the source object in the Py_buffer whenKristján Valur Jónsson-1/+1
converting the old buffer for PyArgs_ParseTuple with *s
2011-05-03Issue #8651: PyArg_Parse*() functions raise an OverflowError if the fileVictor Stinner-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 bytes).
2011-05-03Issue #8651: Fix "z#" format of PyArg_Parse*() function: the size was notVictor Stinner-4/+5
written if PY_SSIZE_T_CLEAN is defined.
2010-05-09Untabify C files. Will watch buildbots.Antoine Pitrou-1501/+1501
2010-04-0614 years later, we still don't know what it's for.Antoine Pitrou-10/+0
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).
2010-03-25Backported PyCapsule from 3.1, and converted most uses ofLarry Hastings-8/+26
CObject to PyCapsule.
2010-01-01Issue #5080: turn the DeprecationWarning from float arguments passedMark Dickinson-2/+19
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.
2009-08-01- Issue #6624: yArg_ParseTuple with "s" format when parsing argument withSean Reifscheider-1/+1
NUL: Bogus TypeError detail string.
2009-04-05#5580: no need to use parentheses when converterr() argument is actually a ↵Georg Brandl-1/+1
type description.
2008-12-22fix #4720: the format to PyArg_ParseTupleAndKeywords can now start with '|'Benjamin Peterson-1/+1
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.