Author Michael.Felt
Recipients Michael.Felt, matrixise, miss-islington, ned.deily, ronaldoussoren, steve.dower, vstinner
Date 2019-08-02.10:17:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <b0ca87f2-45df-2593-cf9f-27c25ba91594@felt.demon.nl>
In-reply-to <4d7ec648-de38-168f-2f45-0878e93ab879@felt.demon.nl>
Content
On 02/08/2019 11:57, Michael Felt wrote:
> On 02/08/2019 11:48, Ronald Oussoren wrote:
>> Ronald Oussoren <ronaldoussoren@mac.com> added the comment:
>>
>> That code is only called if THREAD_STACK_SIZE is defined. The block I mention defines it for macOS and FreeBSD, but not for other platforms. I therefore expect that this code is not used on AIX (which would be easy enough to verify by adding an #error to the block you mention.
> Should have been watching mail - I'll look at this asap.

Actually, it is defined for "most" platforms...

root@x066:[/data/prj/python/python3-3.9]make
xlc_r -c  -DNDEBUG -O -I/opt/include -O2 -qmaxmem=-1    
-I../git/python3-3.9/Include/internal -IObjects -IInclude -IPython -I.
-I../git/python3-3.9/Include -I/opt/include   -DPy_BUILD_CORE -o
Python/thread.o ../git/python3-3.9/Python/thread.c
"../git/python3-3.9/Python/thread_pthread.h", line 255.2: 1506-205 (S)
#error "Not expected"
make: *** [Makefile:1706: Python/thread.o] Error 1

At the top of the file:

/* The POSIX spec requires that use of pthread_attr_setstacksize
   be conditional on _POSIX_THREAD_ATTR_STACKSIZE being defined. */
#ifdef _POSIX_THREAD_ATTR_STACKSIZE
#ifndef THREAD_STACK_SIZE
#define THREAD_STACK_SIZE       0       /* use default stack size */
#endif

/* The default stack size for new threads on OSX and BSD is small enough
that
 * we'll get hard crashes instead of 'maximum recursion depth exceeded'
 * exceptions.
 *
 * The default stack sizes below are the empirically determined minimal
stack
 * sizes where a simple recursive function doesn't cause a hard crash.
 */

So, the block is executed - but the size is 0 aka default.

As a first attempt - I'll take the FreeBSD size going:

michael@x071:[/data/prj/python/git/python3-3.9]git diff
diff --git a/Python/thread_pthread.h b/Python/thread_pthread.h
index 994e35b..83b7e77 100644
--- a/Python/thread_pthread.h
+++ b/Python/thread_pthread.h
@@ -47,6 +47,10 @@
 #undef  THREAD_STACK_SIZE
 #define THREAD_STACK_SIZE       0x400000
 #endif
+#if defined(_AIX) && defined(THREAD_STACK_SIZE) && THREAD_STACK_SIZE == 0
+#undef  THREAD_STACK_SIZE
+#define THREAD_STACK_SIZE       0x400000
+#endif
 /* for safety, ensure a viable minimum stacksize */
 #define THREAD_STACK_MIN        0x8000  /* 32 KiB */
 #else  /* !_POSIX_THREAD_ATTR_STACKSIZE */

And with this - the test passes. :)
History
Date User Action Args
2019-08-02 10:17:47Michael.Feltsetrecipients: + Michael.Felt, ronaldoussoren, vstinner, ned.deily, steve.dower, matrixise, miss-islington
2019-08-02 10:17:47Michael.Feltlinkissue18049 messages
2019-08-02 10:17:47Michael.Feltcreate