summaryrefslogtreecommitdiff
path: root/Python/getargs.c
AgeCommit message (Collapse)AuthorLines
2001-08-28The "O!" format code should implement an isinstance() testGuido van Rossum-1/+1
rather than a type equality test.
2001-08-17Patch #445762: Support --disable-unicodeMartin v. Löwis-1/+21
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled - check for Py_USING_UNICODE in all places that use Unicode functions - disables unicode literals, and the builtin functions - add the types.StringTypes list - remove Unicode literals from most tests.
2001-07-30Add _PyUnicode_AsDefaultEncodedString to unicodeobject.h.Jeremy Hylton-5/+0
And remove all the extern decls in the middle of .c files. Apparently, it was excluded from the header file because it is intended for internal use by the interpreter. It's still intended for internal use and documented as such in the header file.
2001-05-29Change cascaded if stmts to switch stmt in vgetargs1().Jeremy Hylton-19/+25
In the default branch, keep three ifs that are used if level == 0, the most common case. Note that first if here is a slight optimization for the 'O' format. Second part of SF patch 426072.
2001-05-29Internal refactoring of convertsimple() and friends.Jeremy Hylton-510/+509
Note that lots of code was re-indented. Replace two-step of convertsimple() and convertsimple1() with convertsimple() and helper converterr(), which is called to format error messages when convertsimple() fails. The old code did all the real work in convertsimple1(), but deferred error message formatting to conversimple(). The result was paying the price of a second function call on every call just to format error messages in the failure cases. Factor out of the buffer-handling code in convertsimple() and package it as convertbuffer(). Add two macros to ease readability of Unicode coversions, UNICODE_DEFAULT_ENCODING() and CONV_UNICODE, an error string. The convertsimple() routine had awful indentation problems, primarily because there were two tabs between the case line and the body of the case statements. This patch reformats the entire function to have a single tab between case line and case body, which makes the code easier to read (and consistent with ceval). The introduction of converterr() exacerbated the problem and prompted this fix. Also, eliminate non-standard whitespace after opening paren and before closing paren in a few if statements. (This checkin is part of SF patch 426072.)
2001-05-18Fix whitespace botch.Fred Drake-1/+1
2001-05-18vgetargs1() and vgetargskeywords(): Replace uses of PyTuple_Size() andJeremy Hylton-10/+8
PyTuple_GetItem() with PyTuple_GET_SIZE() and PyTuple_GET_ITEM(). The code has already done a PyTuple_Check().
2001-05-13Add support for Windows using "mbcs" as the default Unicode encoding when ↵Mark Hammond-1/+1
dealing with the file system. As discussed on python-dev and in patch 410465.
2001-05-02Added new parser markers 'et' and 'et#' which do not recode stringMarc-André Lemburg-4/+20
objects but instead assume that they use the requested encoding. This is needed on Windows to enable opening files by passing in Unicode file names.
2001-02-12Related to SF bug 132008 (PyList_Reverse blows up).Tim Peters-0/+2
_testcapimodule.c make sure PyList_Reverse doesn't blow up again getargs.c assert args isn't NULL at the top of vgetargs1 instead of waiting for a NULL-pointer dereference at the end
2001-01-25Better error message when non-dictionary received for **kwargJeremy Hylton-2/+7
2001-01-15This patch makes sure that the function name always appears in the errorKa-Ping Yee-26/+35
message, and tries to make the messages more consistent and helpful when the wrong number of arguments or duplicate keyword arguments are supplied. Comes with more tests for test_extcall.py and and an update to an error message in test/output/test_pyexpat.
2000-12-11vgetargskeywords(): Patch for memory leak identified in bug #119862.Barry Warsaw-0/+1
2000-12-01Clarified some of the error messages, esp. "read-only characterGuido van Rossum-17/+16
buffer" replaced by "string or read-only character buffer".
2000-09-26Rationalize use of limits.h, moving the inclusion to Python.h.Fred Drake-3/+0
Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
2000-09-21Special case the "s#" PyArg_Parse() token for Unicode objects:Marc-André Lemburg-26/+53
"s#" will now return a pointer to the default encoded string data of the Unicode object instead of a pointer to the raw UTF-16 data. The latter is still available via PyObject_AsReadBuffer(). The patch also adds an optimization for string objects which is based on the fact that string objects return the raw character data for getreadbuffer access and are always single-segment.
2000-09-15Added B format char to Py_BuildValue (same as b,h,i, but makesJack Jansen-1/+1
bgen-generated code work).
2000-09-08This patch hopefully fixes the problem with "es#" and "es" inMarc-André Lemburg-0/+2
PyArg_ParseTupleAndKeywords() and closes bug #113807.
2000-09-01REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum-9/+0
This should match the situation in the 1.6b1 tree.
2000-08-05Changed H specifier to mean "bitfield", i.e. any value fromJack Jansen-5/+27
-32768..65535 is acceptable. Added B specifier (with values from -128..255). No L added (which would have completed the set) because l already accepts any value (and the letter L is taken for quadwords).
2000-08-03This patch finalizes the move from UTF-8 to a default encoding inMarc-André Lemburg-4/+6
the Python Unicode implementation. The internal buffer used for implementing the buffer protocol is renamed to defenc to make this change visible. It now holds the default encoded version of the Unicode object and is calculated on demand (NULL otherwise). Since the default encoding defaults to ASCII, this will mean that Unicode objects which hold non-ASCII characters will no longer work on C APIs using the "s" or "t" parser markers. C APIs must now explicitly provide Unicode support via the "u", "U" or "es"/"es#" parser markers in order to work with non-ASCII Unicode strings. (Note: this patch will also have to be applied to the 1.6 branch of the CVS tree.)
2000-07-22Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters-95/+12
declarations yet, those come later.
2000-07-16Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters-1/+1
comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-12replace PyXXX_Length calls with PyXXX_Size callsJeremy Hylton-1/+1
2000-07-09Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters-20/+17
2000-07-06Added support for H (unsigned short) specifier in PyArg_ParseTuple andJack Jansen-1/+27
Py_BuildValue.
2000-07-01Jack Jansen, Mac patch:Guido van Rossum-0/+3
Include limits.h if we have it.
2000-06-30Change copyright notice - 2nd try.Guido van Rossum-6/+0
2000-06-30Change copyright notice.Guido van Rossum-21/+6
2000-06-28Vladimir Marangozov:Guido van Rossum-8/+8
This patch fixes a problem on AIX with the signed int case code in getargs.c, after Trent Mick's intervention about MIN/MAX overflow checks. The AIX compiler/optimizer generates bogus code with the default flags "-g -O" causing test_builtin to fail: int("10", 16) <> 16L. Swapping the two checks in the signed int code makes the problem go away. Also, make the error messages fit in 80 char lines in the source.
2000-05-09Trent Mick <trentm@activestate.com>:Fred Drake-12/+12
Limit the 'b' formatter of PyArg_ParseTuple to valid values of an unsigned char, i.e. [0,UCHAR_MAX]. It is expected that this is the common usage of 'b'. An OverflowError is raised if the parsed value is outside this range.
2000-05-08Trent Mick:Guido van Rossum-14/+44
Changes the 'b', 'h', and 'i' formatters in PyArg_ParseTuple to raise an Overflow exception if they overflow (previously they just silently overflowed). Changes by Guido: always accept values [0..255] (in addition to [CHAR_MIN..CHAR_MAX]) for 'b' format; changed some spaces into tabs in other code.
2000-05-03Brian Hooper <brian_takashi@hotmail.com>:Fred Drake-0/+32
Added 'u' and 'u#' tags for PyArg_ParseTuple - these turn a PyUnicodeObject argument into a Py_UNICODE * buffer, or a Py_UNICODE * buffer plus a length with the '#'. Also added an analog to 'U' for Py_BuildValue.
2000-04-27Marc-Andre Lemburg:Guido van Rossum-2/+7
Fixed a memory leak found by Fredrik Lundh. Instead of PyUnicode_AsUTF8String() we now use _PyUnicode_AsUTF8String() which returns the string object without incremented refcount (and assures that the so obtained object remains alive until the Unicode object is garbage collected).
2000-03-28Marc-Andre Lemburg:Guido van Rossum-2/+2
The attached patch set includes a workaround to get Python with Unicode compile on BSDI 4.x (courtesy Thomas Wouters; the cause is a bug in the BSDI wchar.h header file) and Python interfaces for the MBCS codec donated by Mark Hammond. Also included are some minor corrections w/r to the docs of the new "es" and "es#" parser markers (use PyMem_Free() instead of free(); thanks to Mark Hammond for finding these). The unicodedata tests are now in a separate file (test_unicodedata.py) to avoid problems if the module cannot be found.
2000-03-28Typo fixed by Mark Hammond.Guido van Rossum-2/+2
2000-03-24Marc-Andre Lemburg:Guido van Rossum-0/+118
Attached you find the latest update of the Unicode implementation. The patch is against the current CVS version. It includes the fix I posted yesterday for the core dump problem in codecs.c (was introduced by my previous patch set -- sorry), adds more tests for the codecs and two new parser markers "es" and "es#".
2000-03-10Marc-Andre Lemburg: support for Unicode strings; 'U' expects a UnicodeGuido van Rossum-1/+23
object.
1999-02-17Patch by Tommy Burnette to accept an arbitrary sequence when "(...)"Guido van Rossum-7/+10
is used in the format string, instead of requiring a tuple. This is in line with the general trend towards accepting arbitrary sequences.
1999-01-25Change rare occurrences of #if HAVE_LONG_LONG to #ifdef.Guido van Rossum-2/+2
1998-10-08Implement new format character 't#'. This is like s#, accepting anGuido van Rossum-0/+25
object that implements the buffer interface, but requires a buffer that contains 8-bit character data. Greg Stein.
1998-08-25Patch by Mark Hammond to support 64-bit ints on MS platforms.Guido van Rossum-6/+6
The MS compiler doesn't call it 'long long', it uses __int64, so a new #define, LONG_LONG, has been added and all occurrences of 'long long' are replaced with it.
1998-08-04Changes for BeOS, QNX and long long, by Chris Herborth.Guido van Rossum-0/+22
1998-05-15Another veeeeeery old patch...Guido van Rossum-9/+11
Date: Thu, 14 Sep 1995 12:18:20 -0400 From: Alan Morse <alan@dvcorp.com> To: python-list@cwi.nl Subject: getargs bug in 1.2 and 1.3 BETA We have found a bug in the part of the getargs code that we added and submitted, and which was incorporated into 1.1. The parsing of "O?" format specifiers is not handled correctly; there is no "else" for the "if" and therefore it can never fail. What's worse, the advancing of the varargs pointer is not handled properly, so from then on it is out of sync, wreaking all sorts of havoc. (If it had failed properly, then the out-of-sync varargs would not have been an issue.) Below is the context diff for the change. Note that I have made a few stylistic changes beyond adding the else case, namely: 1) Making the "O" case follow the convention established by the other format specifiers of getting all their vararg arguments before performing the test, rather than getting some before and some after the test passes. 2) Making the logic of the tests parallel, so the "if" part indicates that the format is accepted and the "else" part indicates that the format has failed. They were inconsistent with each other and with the the other format specifiers. -Alan Morse (amorse@dvcorp.com)
1998-04-10Make new gcc -Wall happyGuido van Rossum-1/+1
1998-01-19Protect PyErr_Format format string argument from overflow (ironically,Guido van Rossum-1/+1
the error was about a bad format string :-).
1997-12-19Oops -- '(' is also a legal start character of a new format...Guido van Rossum-0/+1
1997-12-09Add explicit check for correct next character in format at end ofGuido van Rossum-0/+7
format. This will complain about illegal formats like "O#" instead of ignoring the '#'.
1997-05-05Checkin of Jack's buffer mods.Guido van Rossum-25/+89
Not really checked, but didn't fail any tests either...
1997-05-05Fix old typo PyArgs_VaParse -> PyArg_VaParse.Guido van Rossum-2/+2
(Redoing the checking without merging in Jack's buffer mods.)