summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
Commit message (Collapse)AuthorAgeFilesLines
* [3.6] bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327). ↵xdegaye2017-10-261-0/+63
| | | | | (#4135) (cherry picked from commit 56d1f5ca32892c7643eb8cee49c40c1644f1abfe)
* [3.6] bpo-30695: Add set_nomemory(start, stop) to _testcapi (GH-2406) (#4083)Miss Islington (bot)2017-10-231-0/+128
| | | (cherry picked from commit 85f643023fed3d4e2fb8e399f9ad57f3a65ef237)
* [3.6] bpo-31786: Make functions in the select module blocking when timeout ↵Pablo Galindo2017-10-181-1/+2
| | | | | is a small negative value. (GH-4003). (#4022) (cherry picked from commit 2c15b29aea5d6b9c61aa42d2c24a07ff1edb4b46)
* [3.6] bpo-31243: Fixed PyArg_ParseTuple failure checks. (GH-3171) (#3233)Oren Milman2017-08-291-16/+30
| | | (cherry picked from commit ba7d7365215d791025d1efd25393c91404f2cfc8)
* bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055) (#3070)Victor Stinner2017-08-111-0/+21
| | | | | | | | | | | | | | The current test_child_terminated_in_stopped_state() function test creates a child process which calls ptrace(PTRACE_TRACEME, 0, 0) and then crash (SIGSEGV). The problem is that calling os.waitpid() in the parent process is not enough to close the process: the child process remains alive and so the unit test leaks a child process in a strange state. Closing the child process requires non-trivial code, maybe platform specific. Remove the functional test and replaces it with an unit test which mocks os.waitpid() using a new _testcapi.W_STOPCODE() function to test the WIFSTOPPED() path. (cherry picked from commit 7b7c6dcfff6a35333988a3c74c895ed19dff2e09)
* [3.6] bpo-30039: Don't run signal handlers while resuming a yield from stack ↵Yury Selivanov2017-06-091-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-1081) (#1640) If we have a chain of generators/coroutines that are 'yield from'ing each other, then resuming the stack works like: - call send() on the outermost generator - this enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode - which calls send() on the next generator - which enters _PyEval_EvalFrameDefault, which re-executes the YIELD_FROM opcode - ...etc. However, every time we enter _PyEval_EvalFrameDefault, the first thing we do is to check for pending signals, and if there are any then we run the signal handler. And if it raises an exception, then we immediately propagate that exception *instead* of starting to execute bytecode. This means that e.g. a SIGINT at the wrong moment can "break the chain" – it can be raised in the middle of our yield from chain, with the bottom part of the stack abandoned for the garbage collector. The fix is pretty simple: there's already a special case in _PyEval_EvalFrameEx where it skips running signal handlers if the next opcode is SETUP_FINALLY. (I don't see how this accomplishes anything useful, but that's another story.) If we extend this check to also skip running signal handlers when the next opcode is YIELD_FROM, then that closes the hole – now the exception can only be raised at the innermost stack frame. This shouldn't have any performance implications, because the opcode check happens inside the "slow path" after we've already determined that there's a pending signal or something similar for us to process; the vast majority of the time this isn't true and the new check doesn't run at all.. (cherry picked from commit ab4413a7e9bda95b6fcd517073e2a51dafaa1624)
* bpo-30524: Write unit tests for FASTCALL (#2022) (#2030)Victor Stinner2017-06-091-0/+101
| | | | | | | | Test C functions: * _PyObject_FastCall() * _PyObject_FastCallDict() * _PyObject_FastCallKeywords() (cherry picked from commit 3b5cf85edc188345668f987c824a2acb338a7816)
* [3.6] bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. ↵Serhiy Storchaka2017-05-041-2/+2
| | | | | (GH-1316). (#1441) (cherry picked from commit 5f161fd86dd5bb936a1a2a13391b13b7e59ec201)
* convert from long long to PyLong loselessly (#1106) (#1121)Benjamin Peterson2017-04-131-1/+1
|
* Fix a memory leak in split-table dictionariesVictor Stinner2016-12-151-0/+14
| | | | | | | Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not convert combined table into split table. Patch written by INADA Naoki.
* Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-1/+1
|\ | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
| * Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-1/+1
| | | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* | Issue #28123: _PyDict_GetItem_KnownHash() now can raise an exception asSerhiy Storchaka2016-11-061-0/+21
| | | | | | | | PyDict_GetItemWithError(). Patch by Xiang Zhang.
* | Merge from 3.5.Serhiy Storchaka2016-10-081-0/+34
|\ \ | |/
| * Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters().Serhiy Storchaka2016-10-081-0/+34
| | | | | | | | Patch by Xiang Zhang.
* | Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().Serhiy Storchaka2016-10-021-0/+31
|\ \ | |/ | | | | Original patch by Xiang Zhang.
| * Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().Serhiy Storchaka2016-10-021-0/+31
| | | | | | | | Original patch by Xiang Zhang.
| * Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Martin Panter2016-09-071-1/+1
| |
* | Add a new private version to the builtin dict typeVictor Stinner2016-09-081-0/+16
| | | | | | | | | | | | | | Issue #26058: Add a new private version to the builtin dict type, incremented at each dictionary creation and at each dictionary change. Implementation of the PEP 509.
* | make sure expected values are interpreted as doublesBenjamin Peterson2016-09-081-1/+1
| |
* | replace Py_(u)intptr_t with the c99 standard typesBenjamin Peterson2016-09-061-8/+8
| |
* | replace Python aliases for standard integer types with the standard integer ↵Benjamin Peterson2016-09-061-8/+8
| | | | | | | | types (#17884)
* | require standard int types to be defined (#17884)Benjamin Peterson2016-09-061-8/+0
| |
* | replace PY_LONG_LONG with long longBenjamin Peterson2016-09-061-19/+19
| |
* | Avoid calling functions with an empty string as format stringVictor Stinner2016-09-061-2/+2
| | | | | | | | Directly pass NULL rather than an empty string.
* | require a long long data type (closes #27961)Benjamin Peterson2016-09-061-26/+2
| |
* | Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
| |
* | Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now supportSerhiy Storchaka2016-06-091-0/+18
| | | | | | | | positional-only and keyword parameters in the same function.
* | Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"Serhiy Storchaka2016-05-201-0/+95
|\ \ | |/ | | | | format unit.
| * Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N"Serhiy Storchaka2016-05-201-0/+95
| | | | | | | | format unit.
* | Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codesSerhiy Storchaka2016-05-161-0/+63
|\ \ | |/ | | | | in PyArg_ParseTuple().
| * Issue #26995: Added tests for "f", "d", "D", "S", "Y", and "U" format codesSerhiy Storchaka2016-05-161-0/+63
| | | | | | | | in PyArg_ParseTuple().
| * Backported tests for issue #18531.Serhiy Storchaka2016-05-161-0/+22
| |
* | Issue #18531: Single var-keyword argument of dict subtype was passedSerhiy Storchaka2016-05-081-0/+22
| | | | | | | | unscathed to the C-defined function. Now it is converted to exact dict.
* | Issue #26588: remove debug traces from _tracemalloc.Victor Stinner2016-03-221-14/+0
| |
* | Issue #26588: add debug tracesVictor Stinner2016-03-221-0/+14
| | | | | | | | Try to debug random failure on buildbots.
* | Add C functions _PyTraceMalloc_Track()Victor Stinner2016-03-221-0/+75
| | | | | | | | | | | | | | | | Issue #26530: * Add C functions _PyTraceMalloc_Track() and _PyTraceMalloc_Untrack() to track memory blocks using the tracemalloc module. * Add _PyTraceMalloc_GetTraceback() to get the traceback of an object.
* | Fail if PyMem_Malloc() is called without holding the GILVictor Stinner2016-03-161-0/+19
| | | | | | | | | | 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.
* | Check the GIL in PyObject_Malloc()Victor Stinner2016-03-141-0/+15
| | | | | | | | | | Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is held when the function is called.
* | Add PYTHONMALLOC env varVictor Stinner2016-03-141-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 #26198: Added tests for "es", "et", "es#", "et#" and "C" format unitsSerhiy Storchaka2016-01-281-1/+93
|\ \ | |/ | | | | of PyArg_Parse*() functions.
| * Issue #26198: Added tests for "es", "et", "es#", "et#" and "C" format unitsSerhiy Storchaka2016-01-281-1/+93
| | | | | | | | of PyArg_Parse*() functions.
* | Fix indentation of continuation lines.Georg Brandl2016-01-181-2/+2
| |
* | Issue #25923: Added the const qualifier to static constant arrays.Serhiy Storchaka2015-12-251-2/+2
| |
* | Merge 3.5 (sys.setrecursionlimit)Victor Stinner2015-10-121-0/+10
|\ \ | |/
| * sys.setrecursionlimit() now raises RecursionErrorVictor Stinner2015-10-121-0/+10
| | | | | | | | | | | | | | Issue #25274: sys.setrecursionlimit() now raises a RecursionError if the new recursion limit is too low depending at the current recursion depth. Modify also the "lower-water mark" formula to make it monotonic. This mark is used to decide when the overflowed flag of the thread state is reset.
* | Fix test_time on platform with 32-bit time_t typeVictor Stinner2015-09-101-0/+1
| | | | | | | | Filter values which would overflow when converted to a C time_t type.
* | Issue #23517: fromtimestamp() and utcfromtimestamp() methods ofVictor Stinner2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | datetime.datetime now round microseconds to nearest with ties going to nearest even integer (ROUND_HALF_EVEN), as round(float), instead of rounding towards -Infinity (ROUND_FLOOR). pytime API: replace _PyTime_ROUND_HALF_UP with _PyTime_ROUND_HALF_EVEN. Fix also _PyTime_Divide() for negative numbers. _PyTime_AsTimeval_impl() now reuses _PyTime_Divide() instead of reimplementing rounding modes.
* | Issue #23517: Add "half up" rounding mode to the _PyTime APIVictor Stinner2015-09-011-1/+3
|/
* Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().Antoine Pitrou2015-06-231-0/+13
|\