Commit Graph

234 Commits

Author SHA1 Message Date
R David Murray 861470c836 #16518: Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like
object' in all the contexts where bytes, bytearray, memoryview, etc are used.
This patch (by Ezio Melotti) completes that work by changing the error
messages that previously reported that certain types did "not support the
buffer interface" to instead say that a bytes-like object is required.  (The
glossary entry for bytes-like object references the discussion of the buffer
protocol in the docs.)
2014-10-05 11:47:01 -04:00
Serhiy Storchaka d8a1447c99 Issue #22215: Now ValueError is raised instead of TypeError when str or bytes
argument contains not permitted null character or byte.
2014-09-06 20:07:17 +03:00
Victor Stinner 98ea54c35c Issue #22156: Fix "comparison between signed and unsigned integers" compiler
warnings in the Python/ subdirectory.
2014-08-15 23:30:40 +02:00
Benjamin Peterson 40be9e5100 remove dynamic initializer lists for c89 compliance (closes #20595) 2014-02-11 10:09:27 -05:00
Larry Hastings b7ccb20423 Issue #20294: Argument Clinic now supports argument parsing for __new__ and
__init__ functions.
2014-01-18 23:50:21 -08:00
Victor Stinner cb29ec5f74 PY_FORMAT_SIZE_T should not be used with PyErr_Format(), PyErr_Format("%zd") is
portable
2013-11-18 02:05:31 +01:00
Victor Stinner 74387f5cac Use Py_ssize_t type for sizes in getargs.c
Fix compiler warnings on Windows 64-bit
2013-11-18 01:21:12 +01:00
Victor Stinner 79ed4c744a remove an outdated comment
The comment is meaningless since changeset 4e985a96a612.
2013-11-07 00:53:56 +01:00
Georg Brandl 142ad666dc Re #18521: move array bounds check before array access. 2013-10-14 07:01:11 +02:00
Victor Stinner 9550ef30e3 Issue #9566: Fix compilater warnings on Windows 64-bit 2013-06-05 01:18:13 +02:00
Richard Oudkerk 25296ce5de Use PY_FORMAT_SIZE_T because Visual Studio does not understand %zd format. 2013-05-18 17:35:19 +01:00
Victor Stinner 84bb1cf994 Fix compilater warnings on Windows 64-bit 2013-05-17 00:12:04 +02:00
Antoine Pitrou 7056cb2867 Issue #17170: speed up PyArg_ParseTuple[AndKeywords] a bit. 2013-02-17 01:04:57 +01:00
Antoine Pitrou c73c561181 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag), mpdecimal (needs to build without Python.h).
2013-02-09 23:14:42 +01:00
Antoine Pitrou 4de7457009 Issue #17173: Remove uses of locale-dependent C functions (isalpha() etc.) in the interpreter.
I've left a couple of them in: zlib (third-party lib), getaddrinfo.c
(doesn't include Python.h, and probably obsolete), _sre.c (legitimate
use for the re.LOCALE flag).
2013-02-09 23:11:27 +01:00
Christian Heimes 879329d66e Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641 2012-09-10 13:17:23 +02:00
Christian Heimes 48d8d21438 Added missing va_end in error branch of PyArg_UnpackTuple(). CID 486641 2012-09-10 13:16:45 +02:00
Victor Stinner a1b0c9fc4d PyArg_Parse*("U"): ensure that the Unicode string is ready 2012-05-29 12:30:29 +02:00
Larry Hastings a34790104c Issue #14746: Remove redundant paragraphs from skipitem() in Python/getargs.c. 2012-05-08 23:52:03 -07:00
Larry Hastings d3f424fe45 Merge from 3.2. Issue #14749: Add support for 'Z' to skipitem(). 2012-05-08 03:54:05 -07:00
Larry Hastings d9e4a414d7 Issue #14749: Add support for 'Z' to skipitem() in Python/getargs.c. 2012-05-08 03:51:18 -07:00
Larry Hastings 10ba07a39e Issue #14705: Added support for the new 'p' format unit to skipitem(). 2012-05-07 02:44:50 -07:00
Larry Hastings faf91e75ab Issue #14705: Add 'p' format character to PyArg_ParseTuple* for bool support. 2012-05-05 16:54:29 -07:00
Larry Hastings 83a9f48699 Issue #14328: Add keyword-only parameters to PyArg_ParseTupleAndKeywords.
They're optional-only for now (unlike in pure Python) but that's all
I needed.  The syntax can easily be relaxed if we want to support
required keyword-only arguments for extension types in the future.
2012-03-20 20:06:16 +00:00
Benjamin Peterson 01feaecbfa plug memory leak (closes #14325) 2012-03-16 13:25:58 -05:00
Benjamin Peterson eb74918685 kill capsule names that we don't need anymore 2012-03-16 12:24:01 -05:00
Benjamin Peterson f7c132158d use memory macros 2012-03-16 12:23:39 -05:00
Benjamin Peterson 7ed67270a8 check result of PyMem_New 2012-03-16 12:21:02 -05:00
Jean-Paul Calderone c961b4abaa Issue #14325: Stop using python lists, capsules, and the garbage collector to deal with PyArg_Parse* cleanup. 2012-03-16 08:51:42 -04:00
Victor Stinner 9d663d0788 convertsimple(): "str without bytes" => "str without characters" 2011-10-13 23:25:03 +02:00
Victor Stinner beac78bb24 Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE() 2011-10-11 21:55:01 +02:00
Victor Stinner e1335c711c Fix usage og PyUnicode_READY() 2011-10-04 20:53:03 +02:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Eli Bendersky 906b88fb2a Issue #12380: PyArg_ParseTuple now accepts a bytearray for the 'c' format.
As a side effect, this now allows the rjust, ljust and center methods of
bytes and bytearray to accept a bytearray argument.

Patch by Petri Lehtinen
2011-07-29 07:05:08 +03:00
Victor Stinner 6ced7c4333 Issue #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead of
PyOS_snprintf() to avoid temporary buffer allocated on the stack and a
conversion from bytes to Unicode.
2011-03-21 18:15:42 +01:00
Victor Stinner f3fd733f92 Remove useless argument of _PyUnicode_AsDefaultEncodedString() 2011-03-02 01:03:11 +00:00
Brett Cannon b94767ff44 Issue #8914: fix various warnings from the Clang static analyzer v254. 2011-02-22 20:15:44 +00:00
Victor Stinner 6ab8e8298e Issue #8992: convertsimple() doesn't need to fill msgbuf if an error occurred
Return msgbug on error is enough.
2011-01-04 11:16:49 +00:00
Victor Stinner a093d0d6a9 Issue #8992: Simplify addcleanup() API
Don't need to handle unknown destructor anymore.
2011-01-04 11:16:48 +00:00
Victor Stinner b3c9e073fc Issue #8651: PyArg_Parse*() functions raise an OverflowError if the file
doesn't have PY_SSIZE_T_CLEAN define and the size doesn't fit in an int
(length bigger than 2^31-1).
2011-01-04 02:07:34 +00:00
Benjamin Peterson f609654b0e handle dict subclasses gracefully in PyArg_ValidateKeywordArguments 2010-11-17 22:33:12 +00:00
Alexander Belopolsky f0f45142d5 Issue #2443: Added a new macro, Py_VA_COPY, which is equivalent to C99
va_copy, but available on all python platforms.  Untabified a few
unrelated files.
2010-08-11 17:31:17 +00:00
Victor Stinner 8182b717db Issue #8991: convertbuffer() rejects discontigious buffers 2010-07-28 00:40:58 +00:00
Victor Stinner 25e8ec4724 Issue #8850: Remove "w" and "w#" formats from PyArg_Parse*() functions, use
"w*" format instead. Add tests for "w*" format.
2010-06-25 00:02:38 +00:00
Victor Stinner 21e09487ac getbuffer(): release the buffer on error (if the buffer is not contiguous) 2010-06-24 22:57:10 +00:00
Victor Stinner 3c9e6e9375 PyArg_Parse*() functions: factorize code for s/z and u/Z formats 2010-06-24 22:31:12 +00:00
Victor Stinner 4aae1ebab2 Issue #8949: "z" format of PyArg_Parse*() functions doesn't accept bytes
objects, as described in the documentation.
2010-06-24 22:08:25 +00:00
Victor Stinner 510b6227a7 getargs.c: remove last reference to "t#" format
"t#" format was removed from convertitem() (convertsimple) but not skipitem().
2010-06-13 20:31:26 +00:00
Victor Stinner 06e49dd029 Issue #8592: PyArg_Parse*() functions raise a TypeError for "y", "u" and "Z"
formats if the string contains a null byte/character. Write unit tests for
string formats.
2010-06-13 18:21:50 +00:00
Mark Dickinson c73013127b Issue #8950: Make PyArg_Parse* with 'L' code raise for float inputs,
instead of warning.  This makes it consistent with the other integer
codes.
2010-06-10 16:05:10 +00:00