summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_capi.py
Commit message (Collapse)AuthorAgeFilesLines
...
* bpo-35983: skip trashcan for subclasses (GH-11841)Jeroen Demeyer2019-05-101-0/+43
| | | | | Add new trashcan macros to deal with a double deallocation that could occur when the `tp_dealloc` of a subclass calls the `tp_dealloc` of a base class and that base class uses the trashcan mechanism. Patch by Jeroen Demeyer.
* bpo-36611: Disable serialno field of debug memory allocators (#12796)Victor Stinner2019-04-121-2/+2
| | | | | | | | | | | Omit serialno field from debug hooks on Python memory allocators to reduce the memory footprint by 5%. Enable tracemalloc to get the traceback where a memory block has been allocated when a fatal memory error is logged to decide where to put a breakpoint. Compile Python with PYMEM_DEBUG_SERIALNO defined to get back the field.
* bpo-33608: Revert "Factor out a private, per-interpreter ↵Eric Snow2019-04-121-1/+1
| | | | | _Py_AddPendingCall()." (gh-12806) This reverts commit f13c5c8b9401a9dc19e95d8b420ee100ac022208 (gh-12360).
* bpo-33608: Factor out a private, per-interpreter _Py_AddPendingCall(). ↵Eric Snow2019-04-121-1/+1
| | | | | (gh-12360) This is effectively an un-revert of #11617 and #12024 (reverted in #12159). Portions of those were merged in other PRs (with lower risk) and this represents the remainder. Note that I found 3 different bugs in the original PRs and have fixed them here.
* bpo-36389: Change PyMem_SetupDebugHooks() constants (GH-12782)Victor Stinner2019-04-111-4/+4
| | | | | Modify CLEANBYTE, DEADDYTE and FORBIDDENBYTE constants: use 0xCD, 0xDD and 0xFD, rather than 0xCB, 0xBB and 0xFB, to use the same byte patterns than Windows CRT debug malloc() and free().
* bpo-36389: _PyObject_IsFreed() now also detects uninitialized memory (GH-12770)Victor Stinner2019-04-111-0/+23
| | | | | | | | | Replace _PyMem_IsFreed() function with _PyMem_IsPtrFreed() inline function. The function is now way more efficient, it became a simple comparison on integers, rather than a short loop. It detects also uninitialized bytes and "forbidden bytes" filled by debug hooks on memory allocators. Add unit tests on _PyObject_IsFreed().
* bpo-35059: Enhance _PyObject_AssertFailed() (GH-10642)Victor Stinner2018-11-211-1/+1
| | | | | | Enhance _PyObject_AssertFailed() * Exchange 'expr' and 'msg' parameters * 'expr' and 'func' arguments can now be NULL
* bpo-29564:_PyMem_DumpTraceback() suggests enabling tracemalloc (GH-10510)Victor Stinner2018-11-131-0/+4
| | | | | If tracemalloc is not tracing Python memory allocations, _PyMem_DumpTraceback() now suggests to enable tracemalloc to get the traceback where the memory block has been allocated.
* bpo-9263: _Py_NegativeRefcount() use _PyObject_AssertFailed() (GH-10109)Victor Stinner2018-10-261-2/+3
| | | | _Py_NegativeRefcount() now uses _PyObject_AssertFailed() to dump the object to help debugging.
* bpo-35059: Add Py_STATIC_INLINE() macro (GH-10093)Victor Stinner2018-10-251-0/+17
| | | | | | | | | * Add Py_STATIC_INLINE() macro to declare a "static inline" function. If the compiler supports it, try to always inline the function even if no optimization level was specified. * Modify pydtrace.h to use Py_STATIC_INLINE() when WITH_DTRACE is not defined. * Add an unit test on Py_DECREF() to make sure that _Py_NegativeRefcount() reports the correct filename.
* bpo-34272: Move argument parsing tests from test_capi to test_getargs2. ↵Serhiy Storchaka2018-08-061-180/+3
| | | | (GH-8567)
* bpo-23927: Make getargs.c skipitem() skipping 'w*'. (GH-8192)Serhiy Storchaka2018-07-111-0/+32
|
* bpo-32030: Rework memory allocators (#4625)Victor Stinner2017-11-291-2/+1
| | | | | | | | | | | | | | | | | | | | * Fix _PyMem_SetupAllocators("debug"): always restore allocators to the defaults, rather than only caling _PyMem_SetupDebugHooks(). * Add _PyMem_SetDefaultAllocator() helper to set the "default" allocator. * Add _PyMem_GetAllocatorsName(): get the name of the allocators * main() now uses debug hooks on memory allocators if Py_DEBUG is defined, rather than calling directly malloc() * Document default memory allocators in C API documentation * _Py_InitializeCore() now fails with a fatal user error if PYTHONMALLOC value is an unknown memory allocator, instead of failing with a fatal internal error. * Add new tests on the PYTHONMALLOC environment variable * Add support.with_pymalloc() * Add the _testcapi.WITH_PYMALLOC constant and expose it as support.with_pymalloc(). * sysconfig.get_config_var('WITH_PYMALLOC') doesn't work on Windows, so replace it with support.with_pymalloc(). * pythoninfo: add _testcapi collector for pymem
* bpo-32136: Separate embedding tests from C API tests (GH-4567)Nick Coghlan2017-11-271-186/+1
| | | | | | | | | Some parts of the C API are only relevant to larger applications embedding CPython as a runtime engine. The helpers to test those APIs are already separated out into Programs/_testembed.c, this update moves the associated test cases out into their own dedicated test file.
* bpo-32096: Remove obj and mem from _PyRuntime (#4532)Victor Stinner2017-11-241-0/+10
| | | | | | | | | | | | | | | | | bpo-32096, bpo-30860: Partially revert the commit 2ebc5ce42a8a9e047e790aefbf9a94811569b2b6: * Move structures back from Include/internal/mem.h to Objects/obmalloc.c * Remove _PyObject_Initialize() and _PyMem_Initialize() * Remove Include/internal/pymalloc.h * Add test_capi.test_pre_initialization_api(): Make sure that it's possible to call Py_DecodeLocale(), and then call Py_SetProgramName() with the decoded string, before Py_Initialize(). PyMem_RawMalloc() and Py_DecodeLocale() can be called again before _PyRuntimeState_Init(). Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
* test_capi.test__testcapi() becomes more verbose (#4197)Victor Stinner2017-10-311-4/+9
| | | | Write the name of each subtest on a new line to help debugging when a test does crash Python.
* bpo-28280: Make PyMapping_Keys(), PyMapping_Values() and PyMapping_Items() ↵Oren Milman2017-10-081-1/+45
| | | | always return a list (#3840)
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-8/+2
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-30695: Add set_nomemory(start, stop) to _testcapi (GH-2406)xdegaye2017-07-011-1/+33
|
* bpo-28180: Fix test_capi.test_forced_io_encoding() (#2155)Victor Stinner2017-06-131-1/+1
| | | | | Don't run Python in an empty environment, but copy the current environment and set PYTHONIOENCODING. So the test works also on Python compiled in shared mode (using libpython).
* bpo-28180: Implementation for PEP 538 (#659)Nick Coghlan2017-06-111-19/+16
| | | | | | | | | | - new PYTHONCOERCECLOCALE config setting - coerces legacy C locale to C.UTF-8, C.utf8 or UTF-8 by default - always uses C.UTF-8 on Android - uses `surrogateescape` on stdin and stdout in the coercion target locales - configure option to disable locale coercion at build time - configure option to disable C locale warning at build time
* bpo-30447: Fix/skip the subinterpreters test on some platforms. (#1791)Eric Snow2017-05-251-43/+42
|
* bpo-29102: Add a unique ID to PyInterpreterState. (#1639)Eric Snow2017-05-231-5/+86
|
* bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (#1316)Serhiy Storchaka2017-05-031-18/+41
|
* bpo-30065: Fixed arguments validation in _posixsubprocess.fork_exec(). (#1110)Serhiy Storchaka2017-04-191-3/+3
|
* bpo-29951: Include function name for some error messages in ↵Michael Seifert2017-04-091-4/+4
| | | | | | | `PyArg_ParseTuple*` (#916) Also changed format specifier for function name from "%s" to "%.200s" and exception messages should start with lowercase letter.
* Issue #24932: Use proper command line parsing in _testembedSteve Dower2017-01-021-1/+1
|
* Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raisingSerhiy Storchaka2016-10-211-2/+2
| | | | | | | | new exception with setting current exception as __cause__. _PyErr_FormatFromCause(exception, format, args...) is equivalent to Python raise exception(format % args) from sys.exc_info()[1]
* Issue #28484: Skip tests if GIL is not used or multithreading is disabledMartin Panter2016-10-201-0/+1
|
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-5/+5
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now supportSerhiy Storchaka2016-06-091-0/+25
| | | | positional-only and keyword parameters in the same function.
* Issue #27076: Merge spelling from 3.5Martin Panter2016-05-261-1/+1
|\
| * Issue #27076: Doc, comment and tests spelling fixesMartin Panter2016-05-261-1/+1
| | | | | | | | Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
* | Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"Serhiy Storchaka2016-05-201-0/+3
|\ \ | |/ | | | | format unit.
| * Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"Serhiy Storchaka2016-05-201-0/+3
| | | | | | | | format unit.
* | Fail if PyMem_Malloc() is called without holding the GILVictor Stinner2016-03-161-4/+13
| | | | | | | | | | Issue #26563: Debug hooks on Python memory allocators now raise a fatal error if functions of the PyMem_Malloc() family are called without holding the GIL.
* | Issue #26564: Fix test_capiVictor Stinner2016-03-151-0/+2
| |
* | Check the GIL in PyObject_Malloc()Victor Stinner2016-03-141-9/+21
| | | | | | | | | | Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is held when the function is called.
* | Issue #26516: Fix test_capi on AIXVictor Stinner2016-03-141-1/+1
| | | | | | | | Fix regex for parse a pointer address.
* | Issue #26516: Fix test_capi on 32-bit systemVictor Stinner2016-03-141-11/+9
| | | | | | | | On 32-bit system, only 4 bytes after dumped for the tail.
* | Issue #26516: Fix test_capi on WindowsVictor Stinner2016-03-141-4/+8
| | | | | | | | Pointers are formatted differently.
* | Add PYTHONMALLOC env varVictor Stinner2016-03-141-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | Issue #26516: * Add PYTHONMALLOC environment variable to set the Python memory allocators and/or install debug hooks. * PyMem_SetupDebugHooks() can now also be used on Python compiled in release mode. * The PYTHONMALLOCSTATS environment variable can now also be used on Python compiled in release mode. It now has no effect if set to an empty string. * In debug mode, debug hooks are now also installed on Python memory allocators when Python is configured without pymalloc.
* | Issue #26312: SystemError is now raised in all programming bugs with usingSerhiy Storchaka2016-02-111-2/+2
| | | | | | | | | | PyArg_ParseTupleAndKeywords(). RuntimeError did raised before in some programming bugs.
* | Issue #26198: ValueError is now raised instead of TypeError on bufferSerhiy Storchaka2016-02-071-2/+2
|/ | | | | overflow in parsing "es#" and "et#" format units. SystemError is now raised instead of TypeError on programmical error in parsing format string.
* Issue #26198: Fixed error messages for some argument parsing errors.Serhiy Storchaka2016-02-071-1/+1
| | | | | Fixed the documented about buffer overflow error for "es#" and "et#" format units.
* Issue #25800: Merge with 3.4Zachary Ware2015-12-051-1/+2
|\
| * Issue #25800: Fix running test_capi directlyZachary Ware2015-12-051-1/+2
| |
* | Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-1/+1
| | | | | | | | Patch by Christie Wilson.
* | Issue #20586: Argument Clinic now ensures signatures on functions without ↵Zachary Ware2015-04-131-1/+5
| | | | | | | | docstrings.
* | Issue #23799: Added test.support.start_threads() for running and cleaning upSerhiy Storchaka2015-04-011-9/+5
|\ \ | |/ | | | | multiple threads.