classification
Title: F-String parser uses raw allocator
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, lys.nikolaou, miss-islington, pablogsal
Priority: normal Keywords: patch

Created on 2020-06-26 20:56 by lys.nikolaou, last changed 2020-06-27 18:43 by miss-islington. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21173 merged lys.nikolaou, 2020-06-27 07:55
PR 21183 merged lys.nikolaou, 2020-06-27 18:17
PR 21184 merged lys.nikolaou, 2020-06-27 18:26
Messages (8)
msg372442 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-26 20:56
The f-string parser uses the raw allocator in various places. We had a very very brief discussion about this with Pablo and he suggested to change the new parser and the hand-written f-string parser to use the pymalloc allocator.

Eric, is there a specific reason the raw allocator was used?
msg372447 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-06-26 23:45
I don't think I put any thought into it. It was probably just in an example I was copying from.

I'm not familiar with the difference between those allocators. Why would pymalloc be preferred?
msg372448 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-27 00:18
> Why would pymalloc be preferred?

For such small and temporary string is normally faster because it will likely have pools of that size readily available and it will also benefit further allocation of the same pool size.
msg372455 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-06-27 07:57
Ok, I've opened a PR. Should be backport this to previous versions as well?
msg372464 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-06-27 12:18
I think backporting to 3.8 would be okay.
msg372470 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2020-06-27 17:47
New changeset 6dcbc2422de9e2a7ff89a4689572d84001e230b2 by Lysandros Nikolaou in branch 'master':
bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173)
https://github.com/python/cpython/commit/6dcbc2422de9e2a7ff89a4689572d84001e230b2
msg372474 - (view) Author: miss-islington (miss-islington) Date: 2020-06-27 18:35
New changeset 5193d0a665eb0944faae9fb20e2062cea0dc02e7 by Lysandros Nikolaou in branch '3.9':
[3.9] bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173) (GH-21183)
https://github.com/python/cpython/commit/5193d0a665eb0944faae9fb20e2062cea0dc02e7
msg372476 - (view) Author: miss-islington (miss-islington) Date: 2020-06-27 18:43
New changeset 749d3bc04177ff9e2ddfd58d919b84cb4f6cf894 by Lysandros Nikolaou in branch '3.8':
[3.8] bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173) (GH-21184)
https://github.com/python/cpython/commit/749d3bc04177ff9e2ddfd58d919b84cb4f6cf894
History
Date User Action Args
2020-06-27 18:43:44miss-islingtonsetmessages: + msg372476
2020-06-27 18:35:21miss-islingtonsetnosy: + miss-islington
messages: + msg372474
2020-06-27 18:27:40lys.nikolaousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-06-27 18:26:33lys.nikolaousetpull_requests: + pull_request20340
2020-06-27 18:17:08lys.nikolaousetpull_requests: + pull_request20339
2020-06-27 17:47:20pablogsalsetmessages: + msg372470
2020-06-27 12:18:12eric.smithsetmessages: + msg372464
2020-06-27 07:57:29lys.nikolaousetmessages: + msg372455
2020-06-27 07:55:21lys.nikolaousetkeywords: + patch
stage: patch review
pull_requests: + pull_request20331
2020-06-27 00:18:11pablogsalsetmessages: + msg372448
2020-06-26 23:45:55eric.smithsetmessages: + msg372447
2020-06-26 20:56:18lys.nikolaoucreate