Michael Felt <aixto...@felt.demon.nl> added the comment:

On 02/08/2019 11:57, Michael Felt wrote:
> On 02/08/2019 11:48, Ronald Oussoren wrote:
>> Ronald Oussoren <ronaldousso...@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. :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue18049>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to