Commit Graph

93400 Commits

Author SHA1 Message Date
Victor Stinner 2025d7839b Py_FatalError: disable faulthandler earlier
Issue #26563: Py_FatalError: disable faulthandler before trying to flush
sys.stdout and sys.stderr.
2016-03-16 23:19:15 +01:00
Victor Stinner 861d9abfcf faulthandler now works in non-Python threads
Issue #26563:

* Add _PyGILState_GetInterpreterStateUnsafe() function: the single
  PyInterpreterState used by this process' GILState implementation.
* Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from
  autoInterpreterState in last resort. The function now accepts NULL for interp
  and current_tstate parameters.
* test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
2016-03-16 22:45:24 +01:00
Victor Stinner c36674a2c5 Fix usage of PyMem_Malloc() in os.stat()
Issue #26563: Replace PyMem_Malloc() with PyMem_RawMalloc() in the Windows
implementation of os.stat(), since the code is called without holding the GIL.
2016-03-16 14:30:16 +01:00
Victor Stinner ad524375af Fail if PyMem_Malloc() is called without holding the GIL
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.
2016-03-16 12:12:53 +01:00
Victor Stinner 013024ef67 Fix compilation error of traceback.c on Windows
Issue #26564.
2016-03-16 09:43:14 +01:00
Martin Panter 32f2eb4941 Issue #21042: Revert Linux find_library() to return just filename
This reverts most of revision 3092cf163eb4. The change worked on x86
architectures, but did not work on ARM, probably due to extra ABI flags in
the ldconfig output.
2016-03-17 07:50:22 +00:00
Martin Panter ec195fba5b Issue #26499: Merge HTTPResponse fix from 3.5 2016-03-17 07:05:34 +00:00
Victor Stinner 82f04e2dfd regrtest: Fix module.__path__
Issue #26538: libregrtest: Fix setup_tests() to keep module.__path__ type
(_NamespacePath), don't convert to a list.

Add _NamespacePath.__setitem__() method to importlib._bootstrap_external.
2016-03-15 23:08:44 +01:00
Victor Stinner 6453e9ed0a Issue #26564: Fix test_capi 2016-03-15 23:36:28 +01:00
Victor Stinner ffcf1a54d3 Oops, revert unwanted change used to create an example
Issue #26564.
2016-03-15 22:49:40 +01:00
Victor Stinner 0611c26a58 On memory error, dump the memory block traceback
Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a
memory block was allocated on memory block. Use the tracemalloc module to get
the traceback.
2016-03-15 22:22:13 +01:00
Victor Stinner af584a02a5 Merge 3.5 (_tracemalloc) 2016-03-15 21:57:23 +01:00
Victor Stinner 9528334e16 _tracemalloc: store lineno as unsigned int
Issue #26564. Cleanup the code, lineno is never negative.
2016-03-15 21:57:02 +01:00
Victor Stinner 89e7cdcb9c Enhance and rewrite traceback dump C functions
Issue #26564:

* Expose _Py_DumpASCII() and _Py_DumpDecimal() in traceback.h
* Change the type of the second _Py_DumpASCII() parameter from int to unsigned
  long
* Rewrite _Py_DumpDecimal() and dump_hexadecimal() to write directly characters
  in the expected order, avoid the need of reversing the string.
* dump_hexadecimal() limits width to the size of the buffer
* _Py_DumpASCII() does nothing if the object is not a Unicode string
* dump_frame() wrtites "???" as the line number if the line number is negative
2016-03-15 21:49:37 +01:00
Victor Stinner b380010782 Merge 3.5 (test_faulthandler) 2016-03-15 17:24:13 +01:00
Victor Stinner 57003f81ea faulthandler: Test Py_FatalError() with GIL released
Issue #26558.
2016-03-15 17:23:35 +01:00
Victor Stinner 7105e9f3de _tracemalloc: filename cannot be NULL 2016-03-15 14:28:04 +01:00
Victor Stinner 32eb840a42 Issue #26566: Rewrite test_signal.InterProcessSignalTests
* Add Lib/test/signalinterproctester.py
* Don't disable the garbage collector anymore
* Don't use os.fork() with a subprocess to not inherit existing signal handlers
  or threads: start from a fresh process
* Don't use UNIX kill command to send a signal but Python os.kill()
* Use a timeout of 10 seconds to wait for the signal instead of 1 second
* Always use signal.pause(), instead of time.wait(1), to wait for a signal
* Use context manager on subprocess.Popen
* remove code to retry on EINTR: it's no more needed since the PEP 475
* remove unused function exit_subprocess()
* Cleanup the code
2016-03-15 11:12:35 +01:00
Antoine Pitrou 58f2bd86fb Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. 2016-03-15 10:52:51 +01:00
Antoine Pitrou 62b6a0d70c Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. 2016-03-15 10:48:28 +01:00
Robert Collins bfef0be420 #25320: Handle sockets in directories unittest discovery is scanning.
Patch from Victor van den Elzen.
2016-03-15 13:33:28 +13:00
Robert Collins ecd5383891 #25320: Handle sockets in directories unittest discovery is scanning.
Patch from Victor van den Elzen.
2016-03-15 13:29:17 +13:00
Victor Stinner c4aec3628b Check the GIL in PyObject_Malloc()
Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is
held when the function is called.
2016-03-14 22:26:53 +01:00
Victor Stinner 8a1be61849 Add more checks on the GIL
Issue #10915, #15751, #26558:

* PyGILState_Check() now returns 1 (success) before the creation of the GIL and
  after the destruction of the GIL. It allows to use the function early in
  Python initialization and late in Python finalization.
* Add a flag to disable PyGILState_Check(). Disable PyGILState_Check() when
  Py_NewInterpreter() is called
* Add assert(PyGILState_Check()) to: _Py_dup(), _Py_fstat(), _Py_read()
  and _Py_write()
2016-03-14 22:07:55 +01:00
Victor Stinner 08572f68a9 Issue #26516: Fix test_capi on AIX
Fix regex for parse a pointer address.
2016-03-14 21:55:43 +01:00
Victor Stinner 0ab7d0978b Merge 3.5 (test_venv) 2016-03-14 18:22:12 +01:00
Victor Stinner 87d6e1364c Fix test_venv on FreeBSD buildbot
Ignore pip warning in test_venv.test_with_venv().
2016-03-14 18:21:58 +01:00
Victor Stinner 21b47117ac _pickle: Fix load_counted_tuple(), use Py_ssize_t for size
Fix a warning on Windows 64-bit.
2016-03-14 18:09:39 +01:00
Victor Stinner c44f70770b posix_getcwd(): limit to INT_MAX on Windows
It's more to fix a conversion warning during compilation, I don't think that
Windows support current working directory larger than 2 GB ...
2016-03-14 18:07:53 +01:00
Victor Stinner 3719779765 Merge 3.5 (test_site) 2016-03-14 17:47:30 +01:00
Victor Stinner 21d0e1b5fc Skip test_site if USER_SITE cannot be created
Issue #17758: Skip test_site if site.USER_SITE directory doesn't exist and
cannot be created.
2016-03-14 17:47:03 +01:00
Victor Stinner b3adb1adeb Issue #26516: Fix test_capi on 32-bit system
On 32-bit system, only 4 bytes after dumped for the tail.
2016-03-14 17:40:09 +01:00
Victor Stinner a1bc28a91d Issue #26516: Fix test_capi on Windows
Pointers are formatted differently.
2016-03-14 17:10:36 +01:00
Victor Stinner d222653f8f Issue #26558: Remove useless check in tracemalloc
The first instruction of tracemalloc_add_trace() is traceback_new() which
already checks the GIL.
2016-03-14 17:01:32 +01:00
Victor Stinner 4ddee7f5fd Fix Py_FatalError() if called without the GIL
Issue #26558: If Py_FatalError() is called without the GIL, don't try to print
the current exception, nor try to flush stdout and stderr: only dump the
traceback of Python threads.
2016-03-14 16:53:12 +01:00
Victor Stinner 791da1cc26 Fix Py_FatalError() if called without the GIL
Issue #26558: If Py_FatalError() is called without the GIL, don't try to print
the current exception, nor try to flush stdout and stderr: only dump the
traceback of Python threads.
2016-03-14 16:53:12 +01:00
Victor Stinner 34be807ca4 Add PYTHONMALLOC env var
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.
2016-03-14 12:04:26 +01:00
Serhiy Storchaka c877658d1f Issue #20556: Used specific assert methods in threading tests. 2016-03-14 10:40:14 +02:00
Serhiy Storchaka 8c0f0c5c1e Issue #20556: Used specific assert methods in threading tests. 2016-03-14 10:28:59 +02:00
Berker Peksag 04bc5b9e48 Issue #747320: Use email.utils.formatdate() to avoid code duplication
in BaseHTTPRequestHandler

Initial patch by karlcow.
2016-03-14 06:06:03 +02:00
Berker Peksag 0647ef05eb Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR 2016-03-14 05:48:28 +02:00
Berker Peksag 20be53e5b5 Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR 2016-03-14 05:48:02 +02:00
Ezio Melotti 4c9375b65f #24918: merge with 3.5. 2016-03-13 11:41:45 +02:00
Ezio Melotti f2b9a39813 #24918: fix CSS for code blocks when a side box is present. Patch by Manvi B. 2016-03-13 11:41:05 +02:00
Raymond Hettinger 5f6209a3c6 merge 2016-03-13 00:12:49 -08:00
Raymond Hettinger a503f7092f Minor recipe edit: convert "while 1" to "while True". 2016-03-13 00:12:31 -08:00
Ezio Melotti 0ce835fc7e #25687: merge with 3.5. 2016-03-13 09:40:55 +02:00
Ezio Melotti 8dea74f12a #25687: clarify that errors in tearDown increase the total number of reported errors. Initial patch by HyeSoo Park. 2016-03-13 09:40:09 +02:00
Raymond Hettinger 7dc830e988 merge 2016-03-12 22:58:44 -08:00
Raymond Hettinger 4d02896609 Issue #26548: Minor fix to awkward wording in docs 2016-03-12 22:58:24 -08:00