classification
Title: Pass explicitly tstate to function calls
Type: Stage: patch review
Components: Interpreter Core Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: petr.viktorin, vstinner
Priority: normal Keywords: patch

Created on 2019-10-30 14:31 by vstinner, last changed 2020-02-11 16:50 by petr.viktorin.

Pull Requests
URL Status Linked Edit
PR 16997 merged vstinner, 2019-10-30 14:46
PR 17046 merged vstinner, 2019-11-04 17:11
PR 17050 merged vstinner, 2019-11-04 23:52
PR 17052 merged vstinner, 2019-11-05 00:46
PR 17089 merged vstinner, 2019-11-08 09:48
PR 17131 merged vstinner, 2019-11-12 20:41
PR 17183 merged vstinner, 2019-11-15 23:33
PR 17185 merged vstinner, 2019-11-15 23:45
PR 17990 merged vstinner, 2020-01-13 16:26
PR 18222 merged vstinner, 2020-01-27 22:54
PR 18399 merged vstinner, 2020-02-07 10:01
PR 18461 merged vstinner, 2020-02-11 13:10
Messages (18)
msg355716 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-30 14:31
Follow-up of bpo-36710 for function calls.
msg355717 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-30 15:00
PR 16997 is a first step. The second step will be to pass tstate to:

* _PyObject_Vectorcall()
* _PyObject_MakeTpCall()
* _Py_CheckFunctionResult()

(I have a local branch that I have to rewrite on top of PR 16997.)
msg355974 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-04 18:48
New changeset f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613 by Victor Stinner in branch 'master':
bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)
https://github.com/python/cpython/commit/f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613
msg355984 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-04 23:51
New changeset be434dc0380d9f5c7c800de9943cc46d55fd9491 by Victor Stinner in branch 'master':
bpo-38644: Pass tstate to Py_EnterRecursiveCall() (GH-16997)
https://github.com/python/cpython/commit/be434dc0380d9f5c7c800de9943cc46d55fd9491
msg355987 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-05 00:22
New changeset 17269090940aa20f6079a6b9f27ae319f8cdae14 by Victor Stinner in branch 'master':
bpo-38644: Pass tstate to _Py_CheckFunctionResult() (GH-17050)
https://github.com/python/cpython/commit/17269090940aa20f6079a6b9f27ae319f8cdae14
msg356234 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-08 09:05
New changeset 7e433733175e76627d46ed9bdab543860cd1452d by Victor Stinner in branch 'master':
bpo-38644: Add _PyObject_VectorcallTstate() (GH-17052)
https://github.com/python/cpython/commit/7e433733175e76627d46ed9bdab543860cd1452d
msg356495 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-12 22:23
I started a thread on python-dev about this issue:
"Pass the Python thread state to internal C functions"
https://mail.python.org/archives/list/python-dev@python.org/thread/PQBGECVGVYFTVDLBYURLCXA3T7IPEHHO/
msg356597 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-14 11:20
New changeset b9e681261cd5ce6db0a79461c58d7cc52cfa4902 by Victor Stinner in branch 'master':
bpo-38644: Add _PyEval_EvalFrame() with tstate (GH-17131)
https://github.com/python/cpython/commit/b9e681261cd5ce6db0a79461c58d7cc52cfa4902
msg356601 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-14 12:36
New changeset 4d231bcc77ac8ce7d11bda0804130dcdd678f710 by Victor Stinner in branch 'master':
bpo-38644: Add _PyObject_Call() (GH-17089)
https://github.com/python/cpython/commit/4d231bcc77ac8ce7d11bda0804130dcdd678f710
msg356732 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-16 00:03
New changeset b5e170f127b57d5b0a4fb58f316acd6191509dce by Victor Stinner in branch 'master':
bpo-38644: Add _PyEval_EvalCode() (GH-17183)
https://github.com/python/cpython/commit/b5e170f127b57d5b0a4fb58f316acd6191509dce
msg356734 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-16 00:04
New changeset 51edf8aaa2e17626f9690ed29d25945fc03016b9 by Victor Stinner in branch 'master':
bpo-38644: Cleanup ceval.h (GH-17185)
https://github.com/python/cpython/commit/51edf8aaa2e17626f9690ed29d25945fc03016b9
msg356878 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-11-18 16:37
One further step would be to change the VECTORCALL/FASTCALL calling convention to pass tstate. But I am not sure what is the risk to do that in Python 3.9? Cython uses FASTCALL internally for example.
msg359916 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-13 16:09
> One further step would be to change the VECTORCALL/FASTCALL calling convention to pass tstate. But I am not sure what is the risk to do that in Python 3.9? Cython uses FASTCALL internally for example.

I started a thread on python-dev:
https://mail.python.org/archives/list/python-dev@python.org/thread/PIXJAJPWKDGHSQD65VOO2B7FDLU2QLHH/

I also wrote an article on this issue, "Pass the Python thread state explicitly":
https://vstinner.github.io/cpython-pass-tstate.html
msg359920 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-13 17:47
New changeset 2b1df4592e1691017414337514c6e378eb639498 by Victor Stinner in branch 'master':
bpo-38644: Pass tstate to _Py_FinishPendingCalls() (GH-17990)
https://github.com/python/cpython/commit/2b1df4592e1691017414337514c6e378eb639498
msg360835 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-01-28 02:37
New changeset 61f4db8c56ca4b7e60050d96ecc255cfb03d92a0 by Victor Stinner in branch 'master':
bpo-38644: Pass tstate in ceval.c (GH-18222)
https://github.com/python/cpython/commit/61f4db8c56ca4b7e60050d96ecc255cfb03d92a0
msg361558 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-07 10:23
New changeset 877ea88934a5164be4d9f15207694fad4173d87d by Victor Stinner in branch 'master':
bpo-38644: Add Py_EnterRecursiveCall() to python3.def (GH-18399)
https://github.com/python/cpython/commit/877ea88934a5164be4d9f15207694fad4173d87d
msg361559 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-02-07 10:24
> One further step would be to change the VECTORCALL/FASTCALL calling convention to pass tstate.

My first strong motivation is to get None singleton from tstate. It's now being discussed in bpo-39511: "[subinterpreters] Per-interpreter singletons (None, True, False, etc.)".
msg361825 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2020-02-11 16:50
New changeset f3fda374685dffa31ebda9e681e00ef7032b8a1d by Victor Stinner in branch 'master':
bpo-38644: Rephrase What's New entry (GH-18461)
https://github.com/python/cpython/commit/f3fda374685dffa31ebda9e681e00ef7032b8a1d
History
Date User Action Args
2020-02-11 16:50:14petr.viktorinsetnosy: + petr.viktorin
messages: + msg361825
2020-02-11 13:10:51vstinnersetpull_requests: + pull_request17835
2020-02-07 10:24:48vstinnersetmessages: + msg361559
2020-02-07 10:23:00vstinnersetmessages: + msg361558
2020-02-07 10:01:18vstinnersetpull_requests: + pull_request17775
2020-01-28 02:37:49vstinnersetmessages: + msg360835
2020-01-27 22:54:51vstinnersetpull_requests: + pull_request17602
2020-01-13 17:47:06vstinnersetmessages: + msg359920
2020-01-13 16:26:58vstinnersetpull_requests: + pull_request17393
2020-01-13 16:09:54vstinnersetmessages: + msg359916
2019-11-18 16:37:50vstinnersetmessages: + msg356878
2019-11-16 00:04:47vstinnersetmessages: + msg356734
2019-11-16 00:03:25vstinnersetmessages: + msg356732
2019-11-15 23:45:02vstinnersetpull_requests: + pull_request16692
2019-11-15 23:33:32vstinnersetpull_requests: + pull_request16690
2019-11-14 12:36:28vstinnersetmessages: + msg356601
2019-11-14 11:20:51vstinnersetmessages: + msg356597
2019-11-12 22:23:13vstinnersetmessages: + msg356495
2019-11-12 20:41:16vstinnersetpull_requests: + pull_request16641
2019-11-08 09:48:10vstinnersetpull_requests: + pull_request16598
2019-11-08 09:05:25vstinnersetmessages: + msg356234
2019-11-05 00:46:04vstinnersetpull_requests: + pull_request16566
2019-11-05 00:22:14vstinnersetmessages: + msg355987
2019-11-04 23:52:50vstinnersetpull_requests: + pull_request16564
2019-11-04 23:51:26vstinnersetmessages: + msg355984
2019-11-04 18:48:37vstinnersetmessages: + msg355974
2019-11-04 17:11:41vstinnersetpull_requests: + pull_request16559
2019-10-30 15:00:20vstinnersetmessages: + msg355717
2019-10-30 14:46:20vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request16524
2019-10-30 14:31:24vstinnercreate