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 eric.snow
Recipients eric.snow, ncoghlan, vstinner
Date 2019-02-09.02:00:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1549677619.84.0.322696563838.issue35949@roundup.psfhosted.org>
In-reply-to
Content
(also see issue #35886)

In November Victor created the Include/cpython directory and moved a decent amount of public (but not limited) API there.  This included the PyThreadState struct.  I'd like to move it into the "internal" headers since it is somewhat coupled to the internal runtime implementation.  The alternative is extra complexity.  I ran into this while working on another issue.

There are 2 problems, however, with PyThreadState which make a move potentially challenging.  In fact, they could be (but probably aren't) cause for moving it back to Include/pystate.h.

1. the docs say: "The only public data member is PyInterpreterState *interp, which points to this thread’s interpreter state."
2. the struct has 6 fields that are exposed (likely unintentionally) in "stable" header files via the following macros:

  # Include/object.h
  Py_TRASHCAN_SAFE_BEGIN
  Py_TRASHCAN_SAFE_END
  Include.ceval.h
  Py_EnterRecursiveCall
  Py_LeaveRecursiveCall
  _Py_MakeRecCheck
  Py_ALLOW_RECURSION
  Py_END_ALLOW_RECURSION

I'm not sure how that factors into the stable ABI (PyThreadState wasn't ever guarded by Py_LIMITED_API).  However, keep in mind that Victor already moved PyThreadState out of the "stable" headers in November.

I'm fine with sorting out the situation with the macros if that's okay to do.  Likewise the promised field ("interp") should be solvable one way or another (e.g. remove it or use a private struct).

...or we could do nothing or (if the change in Novemver is a problem) move it back to Include/pystate.h.
History
Date User Action Args
2019-02-09 02:00:22eric.snowsetrecipients: + eric.snow, ncoghlan, vstinner
2019-02-09 02:00:19eric.snowsetmessageid: <1549677619.84.0.322696563838.issue35949@roundup.psfhosted.org>
2019-02-09 02:00:19eric.snowlinkissue35949 messages
2019-02-09 02:00:19eric.snowcreate