List of commits:
Subject Hash Author Date (UTC)
bpo-30125: Fix faulthandler.disable() on Windows (#1240) 46c2b81026bbf966c0898a1fa30d98c33673aea0 Victor Stinner 2017-04-21 16:06:13
bpo-30107: don't dump core on expected test_io crash (#1235) 2a1aed04b0943636f605543522e16cca1dc23e70 Victor Stinner 2017-04-21 15:59:23
bpo-30106: Fix test_asyncore.test_quick_connect() (#1234) a2c877c3985aba4adb19755e21f477e1c639cfd9 Victor Stinner 2017-04-21 11:51:53
bpo-30104: configure now detects when cc is clang (#1233) 35f3d240ee5f0958034bd500949b08764e36f4dc Victor Stinner 2017-04-21 10:35:24
bpo-30104: Use -fno-strict-aliasing on clang (#1221) 28205b203a4742c40080b4a2b4b2dcd800716edc Victor Stinner 2017-04-21 09:24:34
remove configure test for inline keyword (#1231) 791dc831198f3ecc1531f8e6f05debf4ce234d00 Benjamin Peterson 2017-04-21 06:52:19
bpo-29191: Add liblzma.vcxproj to pcbuild.sln and other missing entries (#1222) f60c9e54f501065f3be2a4cfb4c387dfa2f243a9 Segev Finer 2017-04-20 23:33:28
Add missing .gitignore entries for VS2015 IntelliSense DB (#1223) 8e675286a92f33837cfffac5914b5175dac5d573 Segev Finer 2017-04-20 23:32:26
bpo-29802: Fix reference counting in module-level struct functions (#1213) 40db90c1ce1a59d5f5f2894bb0ce32110000bf27 Serhiy Storchaka 2017-04-20 18:19:31
Only define get_zone() and get_gmtoff() if needed (#1193) 8f5cdfa9fc1bb6b4d9a33fc281987252f6398430 Victor Stinner 2017-04-20 11:41:09
support.threading_cleanup() log a warning on fail (#1195) d20324a7fab6734bae19b1f070b5c8aae5ff3612 Victor Stinner 2017-04-20 11:40:08
bpo-30108: Restore sys.path in test_site (#1197) b85c136903c6d2368162f7c4a58f258c9c69ead0 Victor Stinner 2017-04-20 11:39:39
bpo-12414: Update code_sizeof() to take in account co_extra memory. (#1168) b4dc6af7a7862a8996cffed30d39d6add5ee58a3 Dong-hee Na 2017-04-20 07:31:17
bpo-30109: Fix reindent.py (GH-1207) 58f3c9dc8f5626abe09ac9738c34f6ba99ce2972 Mariatta 2017-04-20 05:59:20
bpo-10379: Add %char examples to locale.format() docs (GH-1145) 6dbdedb0b18a5ca850ab8ce512fda24d5a9d0688 Berker Peksag 2017-04-20 04:38:43
Remove redundant comma in argparse HOWTO (#1141) 8526fb74edf5ac9ca175b7cdcb0d82bb8780d2cf Berker Peksag 2017-04-20 04:29:35
bpo-30078: Add an example of passing a path to unittest (#1178) f7e62cf8adfb8ab6a6a870903defe8ff218a0383 Louie Lu 2017-04-20 03:46:59
bpo-30106: Fix tearDown() of test_asyncore (#1194) 11470b6dcdbc170779499a4a040b93c842a0d194 Victor Stinner 2017-04-20 00:55:39
bpo-29887: test_normalization handles PermissionError (#1196) d13d54748d3a7db023d9db37223ea7d40bb8f8e3 Victor Stinner 2017-04-20 00:39:59
regrtest: always show before/after of modified env (#1192) ec4b17239d899550be4ee6104b61751bb3c70382 Victor Stinner 2017-04-19 22:57:30
Commit 46c2b81026bbf966c0898a1fa30d98c33673aea0 - bpo-30125: Fix faulthandler.disable() on Windows (#1240)
* bpo-30125: Cleanup faulthandler.c

* Use size_t type for iterators
* Add { ... }

* bpo-30125: Fix faulthandler.disable() on Windows

On Windows, faulthandler.disable() now removes the exception handler
installed by faulthandler.enable().
Author: Victor Stinner
Author date (UTC): 2017-04-21 16:06
Committer name: GitHub
Committer date (UTC): 2017-04-21 16:06
Parent(s): 2a1aed04b0943636f605543522e16cca1dc23e70
Signer:
Signing key:
Signing status: N
Tree: 8fe6be2610839b6be6b0d0b847497191a38a90eb
File Lines added Lines deleted
Lib/test/test_faulthandler.py 12 0
Modules/faulthandler.c 19 24
File Lib/test/test_faulthandler.py changed (mode: 100644) (index 28dd5f4e98..626e2458dc)
... ... class FaultHandlerTests(unittest.TestCase):
754 754 3, 3,
755 755 name) name)
756 756
757 @unittest.skipUnless(MS_WINDOWS, 'specific to Windows')
758 def test_disable_windows_exc_handler(self):
759 code = dedent("""
760 import faulthandler
761 faulthandler.enable()
762 faulthandler.disable()
763 code = faulthandler._EXCEPTION_ACCESS_VIOLATION
764 faulthandler._raise_exception(code)
765 """)
766 output, exitcode = self.get_output(code)
767 self.assertEqual(output, [])
768 self.assertEqual(exitcode, 0xC0000005)
757 769
758 770
759 771 if __name__ == "__main__": if __name__ == "__main__":
File Modules/faulthandler.c changed (mode: 100644) (index fc9490d0d4..dcfebf2781)
... ... static struct {
55 55 int fd; int fd;
56 56 int all_threads; int all_threads;
57 57 PyInterpreterState *interp; PyInterpreterState *interp;
58 #ifdef MS_WINDOWS
59 void *exc_handler;
60 #endif
58 61 } fatal_error = {0, NULL, -1, 0}; } fatal_error = {0, NULL, -1, 0};
59 62
60 63 #ifdef FAULTHANDLER_LATER #ifdef FAULTHANDLER_LATER
 
... ... faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
395 398
396 399 if (code == EXCEPTION_ACCESS_VIOLATION) { if (code == EXCEPTION_ACCESS_VIOLATION) {
397 400 /* disable signal handler for SIGSEGV */ /* disable signal handler for SIGSEGV */
398 size_t i;
399 for (i=0; i < faulthandler_nsignals; i++) {
401 for (size_t i=0; i < faulthandler_nsignals; i++) {
400 402 fault_handler_t *handler = &faulthandler_handlers[i]; fault_handler_t *handler = &faulthandler_handlers[i];
401 403 if (handler->signum == SIGSEGV) { if (handler->signum == SIGSEGV) {
402 404 faulthandler_disable_fatal_handler(handler); faulthandler_disable_fatal_handler(handler);
 
... ... faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
418 420 static int static int
419 421 faulthandler_enable(void) faulthandler_enable(void)
420 422 { {
421 size_t i;
422
423 423 if (fatal_error.enabled) { if (fatal_error.enabled) {
424 424 return 0; return 0;
425 425 } }
426 426 fatal_error.enabled = 1; fatal_error.enabled = 1;
427 427
428 for (i=0; i < faulthandler_nsignals; i++) {
428 for (size_t i=0; i < faulthandler_nsignals; i++) {
429 429 fault_handler_t *handler; fault_handler_t *handler;
430 430 #ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
431 431 struct sigaction action; struct sigaction action;
 
... ... faulthandler_enable(void)
462 462 } }
463 463
464 464 #ifdef MS_WINDOWS #ifdef MS_WINDOWS
465 AddVectoredExceptionHandler(1, faulthandler_exc_handler);
465 assert(fatal_error.exc_handler == NULL);
466 fatal_error.exc_handler = AddVectoredExceptionHandler(1, faulthandler_exc_handler);
466 467 #endif #endif
467 468 return 0; return 0;
468 469 } }
 
... ... faulthandler_py_enable(PyObject *self, PyObject *args, PyObject *kwargs)
504 505 static void static void
505 506 faulthandler_disable(void) faulthandler_disable(void)
506 507 { {
507 unsigned int i;
508 fault_handler_t *handler;
509
510 508 if (fatal_error.enabled) { if (fatal_error.enabled) {
511 509 fatal_error.enabled = 0; fatal_error.enabled = 0;
512 for (i=0; i < faulthandler_nsignals; i++) {
510 for (size_t i=0; i < faulthandler_nsignals; i++) {
511 fault_handler_t *handler;
513 512 handler = &faulthandler_handlers[i]; handler = &faulthandler_handlers[i];
514 513 faulthandler_disable_fatal_handler(handler); faulthandler_disable_fatal_handler(handler);
515 514 } }
516 515 } }
517
516 #ifdef MS_WINDOWS
517 if (fatal_error.exc_handler != NULL) {
518 RemoveVectoredExceptionHandler(fatal_error.exc_handler);
519 fatal_error.exc_handler = NULL;
520 }
521 #endif
518 522 Py_CLEAR(fatal_error.file); Py_CLEAR(fatal_error.file);
519 523 } }
520 524
 
... ... faulthandler_user(int signum)
777 781 static int static int
778 782 check_signum(int signum) check_signum(int signum)
779 783 { {
780 unsigned int i;
781
782 for (i=0; i < faulthandler_nsignals; i++) {
784 for (size_t i=0; i < faulthandler_nsignals; i++) {
783 785 if (faulthandler_handlers[i].signum == signum) { if (faulthandler_handlers[i].signum == signum) {
784 786 PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
785 787 "signal %i cannot be registered, " "signal %i cannot be registered, "
 
... ... faulthandler_stack_overflow(PyObject *self)
1122 1124 static int static int
1123 1125 faulthandler_traverse(PyObject *module, visitproc visit, void *arg) faulthandler_traverse(PyObject *module, visitproc visit, void *arg)
1124 1126 { {
1125 #ifdef FAULTHANDLER_USER
1126 unsigned int signum;
1127 #endif
1128
1129 1127 #ifdef FAULTHANDLER_LATER #ifdef FAULTHANDLER_LATER
1130 1128 Py_VISIT(thread.file); Py_VISIT(thread.file);
1131 1129 #endif #endif
1132 1130 #ifdef FAULTHANDLER_USER #ifdef FAULTHANDLER_USER
1133 1131 if (user_signals != NULL) { if (user_signals != NULL) {
1134 for (signum=0; signum < NSIG; signum++)
1132 for (size_t signum=0; signum < NSIG; signum++)
1135 1133 Py_VISIT(user_signals[signum].file); Py_VISIT(user_signals[signum].file);
1136 1134 } }
1137 1135 #endif #endif
 
... ... int _PyFaulthandler_Init(void)
1342 1340
1343 1341 void _PyFaulthandler_Fini(void) void _PyFaulthandler_Fini(void)
1344 1342 { {
1345 #ifdef FAULTHANDLER_USER
1346 unsigned int signum;
1347 #endif
1348
1349 1343 #ifdef FAULTHANDLER_LATER #ifdef FAULTHANDLER_LATER
1350 1344 /* later */ /* later */
1351 1345 if (thread.cancel_event) { if (thread.cancel_event) {
 
... ... void _PyFaulthandler_Fini(void)
1363 1357 #ifdef FAULTHANDLER_USER #ifdef FAULTHANDLER_USER
1364 1358 /* user */ /* user */
1365 1359 if (user_signals != NULL) { if (user_signals != NULL) {
1366 for (signum=0; signum < NSIG; signum++)
1360 for (size_t signum=0; signum < NSIG; signum++) {
1367 1361 faulthandler_unregister(&user_signals[signum], signum); faulthandler_unregister(&user_signals[signum], signum);
1362 }
1368 1363 PyMem_Free(user_signals); PyMem_Free(user_signals);
1369 1364 user_signals = NULL; user_signals = NULL;
1370 1365 } }
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/benf_wspdigital/cpython

Clone this repository using git:
git clone git://git.rocketgit.com/user/benf_wspdigital/cpython

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main