summaryrefslogtreecommitdiff
path: root/Modules/_testcapimodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-34567: pythoninfo gets coreconfig (GH-9043)Victor Stinner2018-09-031-0/+155
| | | | | | * Add _testcapi.get_coreconfig() to get the _PyCoreConfig of the interpreter * test.pythoninfo now gets the core configuration using _testcapi.get_coreconfig()
* bpo-34523: Support surrogatepass in locale codecs (GH-8995)Victor Stinner2018-08-291-0/+94
| | | | | | | | | | | | | | | | | | | | Add support for the "surrogatepass" error handler in PyUnicode_DecodeFSDefault() and PyUnicode_EncodeFSDefault() for the UTF-8 encoding. Changes: * _Py_DecodeUTF8Ex() and _Py_EncodeUTF8Ex() now support the surrogatepass error handler (_Py_ERROR_SURROGATEPASS). * _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() now use the _Py_error_handler enum instead of "int surrogateescape" to pass the error handler. These functions now return -3 if the error handler is unknown. * Add unit tests on _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx() in test_codecs. * Rename get_error_handler() to _Py_GetErrorHandler() and expose it as a private function. * _freeze_importlib doesn't need config.filesystem_errors="strict" workaround anymore.
* Make GenericAlias_Type and Generic_Type static. (GH-8076)Benjamin Peterson2018-07-031-2/+2
|
* Don't export pending_threadfunc from _testcapi. (GH-8075)Benjamin Peterson2018-07-031-1/+2
|
* Replace _PyGC_REFS macros with higher level macros (GH-6852)INADA Naoki2018-05-171-2/+1
| | | | Only gcmodule.c uses _PyGC_REFS* macros now. This makes easy to read GC code.
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-76/+71
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* Test that new_timezone can return the UTC singleton (gh-5318)Paul Ganssle2018-02-221-0/+24
|
* Cleanup dangling reference in get_timezone_utc_capi (#5317)Paul Ganssle2018-01-251-0/+2
|
* bpo-10381: Add timezone to datetime C API (#5032)Paul Ganssle2018-01-241-0/+87
| | | | | | | | | | | | | | | | | | * Add timezone to datetime C API * Add documentation for timezone C API macros * Add dedicated tests for datetime type check macros * Remove superfluous C API test * Drop support for TimeZoneType in datetime C API * Expose UTC singleton to the datetime C API * Update datetime C-API documentation to include links * Add reference count information for timezone constructors
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-221-0/+8
|
* bpo-32226: Fix memory leak in generic_alias_dealloc() (#5212)Victor Stinner2018-01-171-0/+1
|
* bpo-32226: Make __class_getitem__ an automatic class method. (#5098)Serhiy Storchaka2018-01-051-6/+2
|
* Add tests for using PEP560 with classes implemented in C. (#4883)Serhiy Storchaka2017-12-161-0/+85
| | | Based on tests from #4878
* bpo-32030: Rework memory allocators (#4625)Victor Stinner2017-11-291-0/+19
| | | | | | | | | | | | | | | | | | | | * 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
* Add the const qualifier to "char *" variables that refer to literal strings. ↵Serhiy Storchaka2017-11-111-1/+1
| | | | (#4370)
* bpo-31784: Implement PEP 564: add time.time_ns() (#3989)Victor Stinner2017-11-021-21/+40
| | | | | | | | | | | | | | | | | | | | | | | | | Add new time functions: * time.clock_gettime_ns() * time.clock_settime_ns() * time.monotonic_ns() * time.perf_counter_ns() * time.process_time_ns() * time.time_ns() Add new _PyTime functions: * _PyTime_FromTimespec() * _PyTime_FromNanosecondsObject() * _PyTime_FromTimeval() Other changes: * Add also os.times() tests to test_os. * pytime_fromtimeval() and pytime_fromtimeval() now return _PyTime_MAX or _PyTime_MIN on overflow, rather than undefined behaviour * _PyTime_FromNanoseconds() parameter type changes from long long to _PyTime_t
* bpo-18835: Cleanup pymalloc (#4200)Victor Stinner2017-10-311-7/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | Cleanup pymalloc: * Rename _PyObject_Alloc() to pymalloc_alloc() * Rename _PyObject_FreeImpl() to pymalloc_free() * Rename _PyObject_Realloc() to pymalloc_realloc() * pymalloc_alloc() and pymalloc_realloc() don't fallback on the raw allocator anymore, it now must be done by the caller * Add "success" and "failed" labels to pymalloc_alloc() and pymalloc_free() * pymalloc_alloc() and pymalloc_free() don't update num_allocated_blocks anymore: it should be done in the caller * _PyObject_Calloc() is now responsible to fill the memory block allocated by pymalloc with zeros * Simplify pymalloc_alloc() prototype * _PyObject_Realloc() now calls _PyObject_Malloc() rather than calling directly pymalloc_alloc() _PyMem_DebugRawAlloc() and _PyMem_DebugRawRealloc(): * document the layout of a memory block * don't increase the serial number if the allocation failed * check for integer overflow before computing the total size * add a 'data' variable to make the code easiler to follow test_setallocators() of _testcapimodule.c now test also the context.
* bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327)xdegaye2017-10-261-0/+63
|
* bpo-31786: Make functions in the select module blocking when timeout is a ↵Pablo Galindo2017-10-171-1/+2
| | | | small negative value. (#4003)
* bpo-28280: Make PyMapping_Keys(), PyMapping_Values() and PyMapping_Items() ↵Oren Milman2017-10-081-0/+22
| | | | always return a list (#3840)
* bpo-25658: Implement PEP 539 for Thread Specific Storage (TSS) API (GH-1362)Masayuki Yamamoto2017-10-061-0/+56
| | | | | | | | | See PEP 539 for details. Highlights of changes: - Add Thread Specific Storage (TSS) API - Document the Thread Local Storage (TLS) API as deprecated - Update code that used TLS API to use TSS API
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-11/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-31243: Fixed PyArg_ParseTuple failure checks. (#3171)Oren Milman2017-08-291-16/+30
|
* bpo-31173: Rewrite WSTOPSIG test of test_subprocess (#3055)Victor Stinner2017-08-101-0/+22
| | | | | | | | | | | | | 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.
* bpo-30866: Add _testcapi.stack_pointer() (#2601)Victor Stinner2017-07-101-0/+8
|
* bpo-30695: Add set_nomemory(start, stop) to _testcapi (GH-2406)xdegaye2017-07-011-0/+128
|
* bpo-30054: Expose tracemalloc C API (#1236)Victor Stinner2017-06-201-5/+5
| | | | | | | | | * Make PyTraceMalloc_Track() and PyTraceMalloc_Untrack() functions public (remove the "_" prefix) * Remove the _PyTraceMalloc_domain_t type: use directly unsigned int. * Document methods Note: methods are already tested in test_tracemalloc.
* bpo-30524: Write unit tests for FASTCALL (#2022)Victor Stinner2017-06-091-0/+101
| | | | | | | Test C functions: * _PyObject_FastCall() * _PyObject_FastCallDict() * _PyObject_FastCallKeywords()
* bpo-30039: Don't run signal handlers while resuming a yield from stack (#1081)Nathaniel J. Smith2017-05-171-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* bpo-30184: Add tests for invalid use of PyArg_ParseTupleAndKeywords. (#1316)Serhiy Storchaka2017-05-041-2/+2
|
* convert from long long to PyLong loselessly (#1106)Benjamin Peterson2017-04-131-1/+1
|
* fix an error message and a comment in _testcapimodule.c (GH-392)orenmn2017-03-021-2/+3
|
* bpo-29548: Fix some inefficient call API usage (GH-97)INADA Naoki2017-02-161-1/+1
|
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-2/+1
| | | | possible but Coccinelle couldn't find opportunity.
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-24/+12
| | | | possible. Patch is writen with Coccinelle.
* Issue #28822: Adjust indices handling of PyUnicode_FindChar().Xiang Zhang2016-12-201-0/+22
|
* Merge 3.6Victor Stinner2016-12-151-0/+14
|\
| * 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.
* | Use _PyObject_CallNoArg()Victor Stinner2016-12-061-1/+1
| | | | | | | | | | | | | | Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable)
* | Issue #19569: Compiler warnings are now emitted if use most of deprecatedSerhiy Storchaka2016-11-201-8/+4
| | | | | | | | functions.
* | 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 #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.
| * | Issue #28123: _PyDict_GetItem_KnownHash() now can raise an exception asSerhiy Storchaka2016-11-061-0/+21
| | | | | | | | | | | | PyDict_GetItemWithError(). Patch by Xiang Zhang.
* | | Issue #28379: Removed redundant check.Serhiy Storchaka2016-10-091-4/+0
|/ / | | | | | | 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.