This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients Michael.Felt
Date 2019-01-26.12:57:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548507478.7.0.863105799643.issue35828@roundup.psfhosted.org>
In-reply-to
Content
OK, I have gone as far back as "where" in dbx can bring me.

Could this, somehow, be related with changes made in issue-33015 ?

In any case, does it seem correct that "pthread_wrapper(void *arg) can be correct if arg is nil?

  +155  /* bpo-33015: pythread_callback struct and pythread_wrapper() cast
  +156     "void func(void *)" to "void* func(void *)": always return NULL.
  +157
  +158     PyThread_start_new_thread() uses "void func(void *)" type, whereas
  +159     pthread_create() requires a void* return value. */
  +160  typedef struct {
  +161      void (*func) (void *);
  +162      void *arg;
  +163  } pythread_callback;
  +164
  +165  static void *
  +166  pythread_wrapper(void *arg)
  +167  {
  +168      /* copy func and func_arg and free the temporary structure */
  +169      pythread_callback *callback = arg;
  +170      void (*func)(void *) = callback->func;
  +171      void *func_arg = callback->arg;
  +172      PyMem_RawFree(arg);
  +173
  +174      func(func_arg);
  +175      return NULL;
  +176  }

(dbx) print boot
0x2030cab0
(dbx) which boot
_threadmodule.t_bootstrap.boot
(dbx) print boot
0x2030cab0
(dbx) print *boot
(interp = 0x2030cb00, func = 0xcbcbcbcb, args = 0x1018c460, keyw = 0xcbcbcbcb, tstate = 0xcbcbcbcb)
(dbx) which arg
thread.pythread_wrapper.arg
(dbx) print arg
(nil)
(dbx) print *arg
reference through nil pointer
(dbx) which callback
thread.pythread_wrapper.callback
(dbx) print callback
0x2030cb00
(dbx) print *callback
(func = 0x2030cb50, arg = 0x35000000)

I am "nervous" when it comes to accepting a value such as 0xcbcbcbcb or 0xdbdbdbdb as values for pointers to objects - or even "int" or unsigned values - look so "specific pattern" like.

Suggestions on how to look at this "better" would be appreciated.

Michael
History
Date User Action Args
2019-01-26 12:58:00Michael.Feltsetrecipients: + Michael.Felt
2019-01-26 12:57:58Michael.Feltsetmessageid: <1548507478.7.0.863105799643.issue35828@roundup.psfhosted.org>
2019-01-26 12:57:58Michael.Feltlinkissue35828 messages
2019-01-26 12:57:58Michael.Feltcreate