Commit Graph

110 Commits

Author SHA1 Message Date
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 499dfcf29d Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of
PyOS_snprintf().
2011-03-21 13:26:24 +01:00
Antoine Pitrou 5bffa79c22 Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
a buffer struct having a NULL data pointer.
2011-02-24 20:50:49 +00:00
Victor Stinner ca1e7ec344 test_unicode: use ctypes to test PyUnicode_FromFormat()
Instead of _testcapi.format_unicode() because it has a limited API: it requires
exactly one argument of type unicode.
2011-01-05 00:19:28 +00:00
Victor Stinner 0fcab4a3ed Issue #9566: use Py_ssize_t instead of int 2011-01-04 12:59:15 +00:00
Alexander Belopolsky e239d23e8c Issue #6697: Fixed instances of _PyUnicode_AsString() result not checked for NULL 2010-12-08 23:31:48 +00:00
Martin v. Löwis 4d0d471a80 Merge branches/pep-0384. 2010-12-03 20:14:31 +00:00
Victor Stinner 3e2b7171bf Issue #10359: Remove ";" after function definition, invalid in ISO C 2010-11-09 09:32:19 +00:00
Antoine Pitrou 29aad0005d Issue #10185: use Py_hash_t instead of long 2010-10-23 19:42:38 +00:00
Victor Stinner beb4135b8c PyUnicode_AsWideCharString() takes a PyObject*, not a PyUnicodeObject*
All unicode functions uses PyObject* except PyUnicode_AsWideChar(). Fix the
prototype for the new function PyUnicode_AsWideCharString().
2010-10-07 01:02:42 +00:00
Victor Stinner 46c7b3b283 Issue #8670: Rename testcapi unicode test methods
* test_aswidechar() => unicode_aswidechar()
 * test_aswidecharstring() => unicode_aswidecharstring()
2010-10-02 11:49:31 +00:00
Victor Stinner ea3f305a25 Oops, revert unwanted _testcapi changes of r85174 2010-10-02 11:46:20 +00:00
Victor Stinner 749261e241 Issue #8670: ctypes.c_wchar supports non-BMP characters with 32 bits wchar_t 2010-10-02 11:25:35 +00:00
Victor Stinner 1c24bd0252 Issue #8870: PyUnicode_AsWideCharString() doesn't count the trailing nul character
And write unit tests for PyUnicode_AsWideChar() and PyUnicode_AsWideCharString().
2010-10-02 11:03:13 +00:00
Victor Stinner 1205f2774e Issue #9738: PyUnicode_FromFormat() and PyErr_Format() raise an error on
a non-ASCII byte in the format string.

Document also the encoding.
2010-09-11 00:54:47 +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 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
Jeffrey Yasskin ea7b748891 Fix test_capi in !pydebug mode, where my original attempt segfaulted without
producing the expected error message.  The test only tests what it's supposed
to test in pydebug mode though.  Fixes issue 8726.
2010-05-17 16:59:23 +00:00
Jeffrey Yasskin 8e0bdfd1d4 Make PyErr_Occurred return NULL if there is no current thread. Previously it
would Py_FatalError, which called PyErr_Occurred, resulting in a semi-infinite
recursion.

Fixes issue 3605.
2010-05-13 18:31:05 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Mark Dickinson 5fc16b469e Merged revisions 79661 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79661 | mark.dickinson | 2010-04-03 11:27:05 +0100 (Sat, 03 Apr 2010) | 14 lines

  Fix a couple of issues with the test_structmembersType class in _testcapimodule

   - rename to _test_structmembersType to avoid the class being automatically
     called by test_capi

   - allow space for trailing NUL in inplace_member field of all_structmembers

   - use T_STRING_INPLACE instead of T_INPLACE_STRING as keyword argument
     to _test_structmembersType initializer

   - don't attempt to initialize inplace_member field if T_STRING_INPLACE
     argument wasn't supplied.
........
2010-04-03 10:49:56 +00:00
Benjamin Peterson 80d8fd85a9 Merged revisions 79642,79644 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79642 | benjamin.peterson | 2010-04-02 20:08:34 -0500 (Fri, 02 Apr 2010) | 1 line

  split out large test function
........
  r79644 | benjamin.peterson | 2010-04-02 20:28:57 -0500 (Fri, 02 Apr 2010) | 1 line

  give TypeError when trying to set T_STRING_INPLACE
........
2010-04-03 01:40:24 +00:00
Mark Dickinson d59b41641e Issue #8014: Fix PyLong_As<c-integer-type> methods not to produce an
internal error on non-integer input: they now raise TypeError instead.
This is needed for attributes declared via PyMemberDefs.
2010-03-13 11:34:40 +00:00
Mark Dickinson bb13fbf92a Revert an earlier attempt (r76810) to fix the intermittent test_capi failures fixed in r78172. 2010-02-13 18:37:34 +00:00
Mark Dickinson edff7af1cf Issue #7924: Fix an intermittent 'XXX undetected error' crash in
test_capi, due to test_capsule failing to clear an exception.  Many
thanks to Florent Xicluna for the diagnosis and fix.
2010-02-13 18:34:53 +00:00
Antoine Pitrou 8f0b31ae4c Followup to r77918: fix build under Windows. 2010-02-04 17:02:07 +00:00
Benjamin Peterson 16323988ba Merged revisions 77866-77867 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77866 | benjamin.peterson | 2010-01-30 17:26:05 -0600 (Sat, 30 Jan 2010) | 1 line

  move test outside WITH_THREAD section
........
  r77867 | benjamin.peterson | 2010-01-30 17:28:38 -0600 (Sat, 30 Jan 2010) | 1 line

  be robust against test being run over and over (such as -R)
........
2010-02-03 01:13:41 +00:00
Antoine Pitrou 05b7c5644c Merged revisions 77916 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77916 | antoine.pitrou | 2010-02-02 23:36:17 +0100 (mar., 02 févr. 2010) | 4 lines

  Issue #7385: Fix a crash in `MemoryView_FromObject` when
  `PyObject_GetBuffer` fails.  Patch by Florent Xicluna.
........
2010-02-02 22:47:00 +00:00
Mark Dickinson 93f562c4f9 Merged revisions 77842 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77842 | mark.dickinson | 2010-01-30 10:08:33 +0000 (Sat, 30 Jan 2010) | 4 lines

  Issue #7767: Add new C-API function PyLong_AsLongLongAndOverflow, a
  long long variant of PyLong_AsLongAndOverflow.  Patch by Case Van
  Horsen.
........
2010-01-30 10:30:15 +00:00
Benjamin Peterson 8667a9b6ea Python strings ending with '\0' should not be equivalent to their C counterparts in PyUnicode_CompareWithASCIIString 2010-01-09 21:45:28 +00:00
Georg Brandl 1e28a27f84 Merged revisions 77088 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77088 | georg.brandl | 2009-12-28 09:34:58 +0100 (Mo, 28 Dez 2009) | 1 line

  #7033: add new API function PyErr_NewExceptionWithDoc, for easily giving new exceptions a docstring.
........
2009-12-28 08:41:01 +00:00
Mark Dickinson 309aa2dcb4 Keep PyLong_AsLongAndOverflow documentation and implementation in sync
between py3k and trunk;  merge new tests from trunk to py3k.
(See issue #7528.)
2009-12-21 12:37:06 +00:00
Mark Dickinson 1554b18b5a Merged revisions 76930 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76930 | mark.dickinson | 2009-12-20 15:57:56 +0000 (Sun, 20 Dec 2009) | 1 line

  Add missing tests for PyArg_Parse* with format 'h'
........
2009-12-20 16:03:30 +00:00
Benjamin Peterson 91d58bd146 Merged revisions 76822,76824 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76822 | benjamin.peterson | 2009-12-13 15:21:43 -0600 (Sun, 13 Dec 2009) | 1 line

  initialize to NULL
........
  r76824 | benjamin.peterson | 2009-12-13 15:27:53 -0600 (Sun, 13 Dec 2009) | 1 line

  add a test of loading the datetime capi
........
2009-12-13 21:30:54 +00:00
Mark Dickinson 6d138f1f45 Make sure that test_capsule always returns NULL on error; this may
help diagnose the sporadic test_capi failures on Solaris.
2009-12-13 20:03:21 +00:00
Mark Dickinson f08173bb93 Issue #7414: Add missing 'case 'C'' to skipitem() in getargs.c. This
was causing PyArg_ParseTupleAndKeywords(args, kwargs, "|CC", ...) to
fail with a RuntimeError.  Thanks Case Van Horsen for tracking down
the source of this error.
2009-12-03 10:59:46 +00:00
Mark Dickinson 6ce4a9a9f2 Merged revisions 76308 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76308 | mark.dickinson | 2009-11-15 16:18:58 +0000 (Sun, 15 Nov 2009) | 3 lines

  Issue #7228:  Add '%lld' and '%llu' support to PyFormat_FromString,
  PyFormat_FromStringV and PyErr_Format.
........
2009-11-16 17:00:11 +00:00
Benjamin Peterson 481b85ae24 remove shadowing declartion 2009-10-27 21:14:50 +00:00
Alexandre Vassalotti 7b82b40a47 Merged revisions 72487-72488,72879 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72487 | jeffrey.yasskin | 2009-05-08 17:51:06 -0400 (Fri, 08 May 2009) | 7 lines

  PyCode_NewEmpty:
  Most uses of PyCode_New found by http://www.google.com/codesearch?q=PyCode_New
  are trying to build an empty code object, usually to put it in a dummy frame
  object. This patch adds a PyCode_NewEmpty wrapper which lets the user specify
  just the filename, function name, and first line number, instead of also
  requiring lots of code internals.
........
  r72488 | jeffrey.yasskin | 2009-05-08 18:23:21 -0400 (Fri, 08 May 2009) | 13 lines

  Issue 5954, PyFrame_GetLineNumber:
  Most uses of PyCode_Addr2Line
  (http://www.google.com/codesearch?q=PyCode_Addr2Line) are just trying to get
  the line number of a specified frame, but there's no way to do that directly.
  Forcing people to go through the code object makes them know more about the
  guts of the interpreter than they should need.

  The remaining uses of PyCode_Addr2Line seem to be getting the line from a
  traceback (for example,
  http://www.google.com/codesearch/p?hl=en#u_9_nDrchrw/pygame-1.7.1release/src/base.c&q=PyCode_Addr2Line),
  which is replaced by the tb_lineno field.  So we may be able to deprecate
  PyCode_Addr2Line entirely for external use.
........
  r72879 | jeffrey.yasskin | 2009-05-23 19:23:01 -0400 (Sat, 23 May 2009) | 14 lines

  Issue #6042:
  lnotab-based tracing is very complicated and isn't documented very well.  There
  were at least 3 comment blocks purporting to document co_lnotab, and none did a
  very good job. This patch unifies them into Objects/lnotab_notes.txt which
  tries to completely capture the current state of affairs.

  I also discovered that we've attached 2 layers of patches to the basic tracing
  scheme. The first layer avoids jumping to instructions that don't start a line,
  to avoid problems in if statements and while loops.  The second layer
  discovered that jumps backward do need to trace at instructions that don't
  start a line, so it added extra lnotab entries for 'while' and 'for' loops, and
  added a special case for backward jumps within the same line. I replaced these
  patches by just treating forward and backward jumps differently.
........
2009-07-21 04:30:03 +00:00
Martin v. Löwis c15bdef819 Issue #6012: Add cleanup support to O& argument parsing. 2009-05-29 14:47:46 +00:00
Benjamin Peterson b43d32552d Merged revisions 72367 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72367 | benjamin.peterson | 2009-05-05 18:00:48 -0500 (Tue, 05 May 2009) | 1 line

  tabify :(
........
2009-05-05 23:14:15 +00:00
Benjamin Peterson b173f7853e add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this.

Patch by Larry Hastings
2009-05-05 22:31:58 +00:00
Benjamin Peterson f172637bc7 Merged revisions 72357 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72357 | benjamin.peterson | 2009-05-05 16:09:21 -0500 (Tue, 05 May 2009) | 4 lines

  fix running test_capi with -R ::

  Also, fix a refleak in the test that was preventing running. :)
........
2009-05-05 21:11:54 +00:00
Mark Dickinson 725bfd8489 Issue #5914: Add new C-API function PyOS_string_to_double, to complement
PyOS_double_to_string, and deprecate PyOS_ascii_strtod and PyOS_ascii_atof.
2009-05-03 20:33:40 +00:00
Mark Dickinson 081dfee4f1 Issue 4474: On platforms with sizeof(wchar_t) == 4 and
sizeof(Py_UNICODE) == 2, PyUnicode_FromWideChar now converts
each character outside the BMP to the appropriate surrogate pair.

Thanks Victor Stinner for the patch.
2009-03-18 14:47:41 +00:00
Mark Dickinson e94c679df0 Issue #1717: rename tp_compare to tp_reserved. I'll change the
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00
Benjamin Peterson a54c9090ac Merged revisions 68425,68461,68498 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68425 | benjamin.peterson | 2009-01-08 20:56:32 -0600 (Thu, 08 Jan 2009) | 1 line

  fix markup
........
  r68461 | kristjan.jonsson | 2009-01-09 15:35:16 -0600 (Fri, 09 Jan 2009) | 2 lines

  Issue 4293:  Make Py_AddPendingCall() thread safe
  Add test cases and documentation
........
  r68498 | benjamin.peterson | 2009-01-10 13:08:49 -0600 (Sat, 10 Jan 2009) | 1 line

  fix encoding
........
2009-01-13 02:11:23 +00:00
Hirokazu Yamamoto 8ebab5df63 Merged revisions 68097,68099 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68097 | hirokazu.yamamoto | 2008-12-31 14:24:37 +0900 | 1 line

  Fixed compile error on windows.
........
  r68099 | hirokazu.yamamoto | 2008-12-31 14:47:19 +0900 | 1 line

  Just inserted blank line.
........
2008-12-31 06:05:46 +00:00
Nick Coghlan f1f2f686fe Recorded merge of revisions 68051 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68051 | nick.coghlan | 2008-12-30 11:18:48 +1000 (Tue, 30 Dec 2008) | 1 line

  Issue #4701: implicitly call PyType_Ready from PyObject_Hash
........
2008-12-30 07:29:12 +00:00