Commit Graph

155 Commits

Author SHA1 Message Date
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Christian Heimes 865d12a2d9 Fix warning: ‘ptr2’ may be used uninitialized in this function 2013-08-02 11:10:51 +02:00
Christian Heimes 4efdb4177e Test Py_IncRef() and Py_DecRef() C functions 2013-07-31 02:36:43 +02:00
Antoine Pitrou 796564c27b Issue #18112: PEP 442 implementation (safe object finalization). 2013-07-30 19:59:21 +02:00
Christian Heimes ebf4204e84 Handle yet another potential failure in testcapi
CID 1058280
2013-07-26 15:54:13 +02:00
Christian Heimes 66eda26a72 Handle yet another potential failure in testcapi
CID 1058280
2013-07-26 15:54:07 +02:00
Christian Heimes dd6f3899f7 remove surplus and wrong Py_DECREF() introduced in 33891989c9cf 2013-07-26 15:26:26 +02:00
Christian Heimes ec2309b03d remove surplus and wrong Py_DECREF() introduced in 33891989c9cf 2013-07-26 15:26:18 +02:00
Christian Heimes cb7ca526e8 Fix memory leaks and add checks for failing malloc() calls to testcapi module
CID 1058288
Fix declaration-after-statement of d49f65ff4f3c
2013-07-26 15:07:34 +02:00
Christian Heimes 3205e74d88 Fix declaration-after-statement of d49f65ff4f3c 2013-07-26 15:06:48 +02:00
Christian Heimes 7e138027ff Fix memory leaks and add checks for failing malloc() calls to testcapi module
CID 1058288
2013-07-26 15:03:50 +02:00
Christian Heimes 5e3de55b01 Fix possible NULL pointer dereferences in testcapi module
CID 1058280
CID 1058282
CID 1058284
2013-07-26 14:52:26 +02:00
Christian Heimes ff369a5595 Fix possible NULL pointer dereferences in testcapi module
CID 1058280
CID 1058282
CID 1058284
2013-07-26 14:52:18 +02:00
Christian Heimes 3f95bdcdbe Add missing check of PyDict_SetItem()'s return value
CID 486659
2013-07-20 15:01:36 +02:00
Christian Heimes 97cb67b9ca Add missing check of PyDict_SetItem()'s return value
CID 486659
2013-07-20 15:01:26 +02:00
Victor Stinner 0507bf56f0 Issue #3329: Implement the PEP 445
Add new enum:

* PyMemAllocatorDomain

Add new structures:

* PyMemAllocator
* PyObjectArenaAllocator

Add new functions:

* PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
* PyMem_GetAllocator(), PyMem_SetAllocator()
* PyObject_GetArenaAllocator(), PyObject_SetArenaAllocator()
* PyMem_SetupDebugHooks()

Changes:

* PyMem_Malloc()/PyObject_Realloc() now always call malloc()/realloc(), instead
  of calling PyObject_Malloc()/PyObject_Realloc() in debug mode.
* PyObject_Malloc()/PyObject_Realloc() now falls back to
  PyMem_Malloc()/PyMem_Realloc() for allocations larger than 512 bytes.
* Redesign debug checks on memory block allocators as hooks, instead of using C
  macros
2013-07-07 02:05:46 +02:00
Victor Stinner 36f01ad9ac Revert changeset 6661a8154eb3: Issue #3329: Add new APIs to customize memory allocators
The new API require more discussion.
2013-06-15 03:37:01 +02:00
Victor Stinner 4d7056258b Issue #3329: Add new APIs to customize memory allocators
* Add a new PyMemAllocators structure
* New functions:

  - PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory
    allocator functions
  - PyMem_GetRawAllocators(), PyMem_SetRawAllocators()
  - PyMem_GetAllocators(), PyMem_SetAllocators()
  - PyMem_SetupDebugHooks()
  - _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators()

* Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0)
* Add unit test for new get/set allocators functions
* PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if
  size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls
  back on PyMem_Realloc() instead of realloc()
* PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(),
  instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
2013-06-15 00:37:46 +02:00
Benjamin Peterson da5eb5a31c don't expand the operand to Py_XINCREF/XDECREF/CLEAR/DECREF multiple times (closes #17206)
A patch from Illia Polosukhin.
2013-05-27 14:46:14 -07:00
Ezio Melotti 03e667d15a Fix memory leak introduced in 15190138d3f3. 2013-03-07 21:18:45 +02:00
Victor Stinner e5c0533b58 Issue #17223: Add another test to check that _PyUnicode_Ready() rejects
code points bigger than U+10ffff
2013-03-06 00:39:03 +01:00
Stefan Krah e6996ed5d9 Issue #16145: Support legacy strings in the _csv module. 2012-11-02 14:44:20 +01:00
Jesus Cea 6e1d2b6e78 Closes #16126: PyErr_Format format mismatch in _testcapimodule.c 2012-10-04 16:06:30 +02:00
Larry Hastings 22701e86d0 Issue #15589: Ensure double-alignment for brute-force capi argument parser test
that occasionally uses doubles.
2012-08-08 14:52:22 -07:00
Larry Hastings 8f904daee9 Issue #14769: test_capi now has SkipitemTest, which cleverly checks
for "parity" between PyArg_ParseTuple() and the Python/getargs.c static
function skipitem() for all possible "format units".
2012-06-22 03:56:29 -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 6fe20b3aee Issue #14127: Add st_{cma}time_ns fields to os.stat() result object. 2012-04-19 15:07:49 -07:00
Martin v. Löwis aa2efcb0bc Issue #14098: New functions PyErr_GetExcInfo and PyErr_SetExcInfo.
Patch by Stefan Behnel.
2012-04-19 14:33:43 +02: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
Victor Stinner 5d272cc6a2 Close #14180: Factorize code to convert a number of seconds to time_t, timeval or timespec
time.ctime(), gmtime(), time.localtime(), datetime.date.fromtimestamp(),
datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
raises an OverflowError, instead of a ValueError, if the timestamp does not fit
in time_t.

datetime.datetime.fromtimestamp() and datetime.datetime.utcfromtimestamp() now
round microseconds towards zero instead of rounding to nearest with ties going
away from zero.
2012-03-13 13:35:55 +01:00
Victor Stinner 643cd68ea4 Issue #13964: signal.sigtimedwait() timeout is now a float instead of a tuple
Add a private API to convert an int or float to a C timespec structure.
2012-03-02 22:54:03 +01:00
Stefan Krah 9a2d99e28a - Issue #10181: New memoryview implementation fixes multiple ownership
and lifetime issues of dynamically allocated Py_buffer members (#9990)
  as well as crashes (#8305, #7433). Many new features have been added
  (See whatsnew/3.3), and the documentation has been updated extensively.
  The ndarray test object from _testbuffer.c implements all aspects of
  PEP-3118, so further development towards the complete implementation
  of the PEP can proceed in a test-driven manner.

  Thanks to Nick Coghlan, Antoine Pitrou and Pauli Virtanen for review
  and many ideas.

- Issue #12834: Fix incorrect results of memoryview.tobytes() for
  non-contiguous arrays.

- Issue #5231: Introduce memoryview.cast() method that allows changing
  format and shape without making a copy of the underlying memory.
2012-02-25 12:24:21 +01:00
Brett Cannon b6855683cc Check for errors in creating sub-interpreters when testing the C API. 2012-02-03 12:08:03 -05:00
Antoine Pitrou 7422b22e5e Test running of code in a sub-interpreter
(prelude to issue #6531).
2012-01-18 00:22:06 +01:00
Antoine Pitrou 2f828f2c88 Test running of code in a sub-interpreter
(prelude to issue #6531).
2012-01-18 00:21:11 +01:00
Victor Stinner e3b47152a4 Write tests for invalid characters (U+00110000)
Test the following functions:

 * codecs.raw_unicode_escape_decode()
 * PyUnicode_FromWideChar()
 * PyUnicode_FromUnicode()
 * "unicode_internal" and "unicode_escape" decoders
2011-12-09 20:49:49 +01:00
Victor Stinner 42bf77537e Rewrite PyUnicode_EncodeDecimal() to use the new Unicode API
Add tests for PyUnicode_EncodeDecimal() and
PyUnicode_TransformDecimalToASCII().
2011-11-21 22:52:58 +01:00
Victor Stinner 8ef18872b4 test_widechar() uses the new Unicode API
PyUnicode_GET_SIZE() => PyUnicode_GET_LENGTH()
2011-11-21 02:06:57 +01:00
Victor Stinner 2b979bfa3c Use PyUnicode_CompareWithASCIIString() instead of Py_UNICODE_strcmp() to avoid
the deprecate Py_UNICODE type
2011-11-20 19:32:09 +01:00
Victor Stinner 639418812f Use the new Py_ARRAY_LENGTH macro 2011-09-29 00:42:28 +02:00
Martin v. Löwis d63a3b8beb Implement PEP 393. 2011-09-28 07:41:54 +02:00
Nadeem Vawda 3d5881ec2b Issue #12909: Make PyLong_As* functions consistent in their use of exceptions.
PyLong_AsDouble() and PyLong_AsUnsignedLongLong() now raise TypeError (rather
than SystemError) when passed a non-integer argument, matching the behavior of
all the other PyLong_As*() functions.
2011-09-07 21:40:26 +02:00
Victor Stinner ab1d16b456 Issue #13093: Fix error handling on PyUnicode_EncodeDecimal()
* Add tests for PyUnicode_EncodeDecimal() and PyUnicode_TransformDecimalToASCII()
 * Remove the unused "e" variable in replace()
2011-11-22 01:45:37 +01: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 499dfcf29d Issue #10833: Use PyUnicode_FromFormat() and PyErr_Format() instead of
PyOS_snprintf().
2011-03-21 13:26:24 +01:00
Antoine Pitrou 915605c59a Merged revisions 88550 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88550 | antoine.pitrou | 2011-02-24 21:50:49 +0100 (jeu., 24 févr. 2011) | 4 lines

  Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
  a buffer struct having a NULL data pointer.
........
2011-02-24 20:53:48 +00: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