Visitar URL original
Issue 45482: [C API] Move _PyNamespace_New() to the internal C API - Python tracker
The Wayback Machine - https://web.archive.org/web/20220324082904/https://bugs.python.org/issue45482

➜

This issue tracker will soon become read-only and move to GitHub.
For a smoother transition, remember to log in and link your GitHub username to your profile.
For more information, see this post about the migration.

classification
Title: [C API] Move _PyNamespace_New() to the internal C API
Type: Stage: resolved
Components: C API Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2021-10-15 08:00 by vstinner, last changed 2021-10-15 13:22 by vstinner. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 28970 closed vstinner, 2021-10-15 08:55
PR 28975 merged vstinner, 2021-10-15 11:25
Messages (4)
msg403984 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-15 08:00
Python has a types.SimpleNamespace type which is convenient to cheap a "simple namespace". I propose to make its C API public (but exclude it from the limited C API): add PySimpleNamespace_New() function.

It's currently used in:

* Modules/timemodule.c: time.get_clock_info(name)
* Python/sysmodule.c: sys.implementation

It's also used in:

* Python/import.c: _PyImport_BootstrapImp()
* Modules/_testmultiphase.c: createfunc_nonmodule() used as the Py_mod_create slot
msg403992 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-15 09:26
I created this issue while cleaning the C API. I'm not fully convinced that PySimpleNamespace_New() must be made public.

The other choice is to move the function to the internal C API.
msg404004 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-15 11:26
> The other choice is to move the function to the internal C API.

I created GH-28975 for that.
msg404013 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-10-15 13:21
New changeset 354c35220d25a893e502014478f6739dad6897f3 by Victor Stinner in branch 'main':
bpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975)
https://github.com/python/cpython/commit/354c35220d25a893e502014478f6739dad6897f3
History
Date User Action Args
2021-10-15 13:22:28vstinnersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
title: [C API] Add PySimpleNamespace_New() function -> [C API] Move _PyNamespace_New() to the internal C API
2021-10-15 13:21:25vstinnersetmessages: + msg404013
2021-10-15 11:26:47vstinnersetmessages: + msg404004
2021-10-15 11:25:37vstinnersetpull_requests: + pull_request27263
2021-10-15 09:26:21vstinnersetmessages: + msg403992
2021-10-15 08:55:53vstinnersetkeywords: + patch
stage: patch review
pull_requests: + pull_request27258
2021-10-15 08:00:51vstinnercreate