FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-90111: Minor Cleanup for Runtime-Global Objects by ericsnowcurrently · Pull Request #100254 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .h  (3) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 4 additions & 4 deletions Include/internal/pycore_global_objects.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ extern "C" {

struct _Py_cached_objects {
PyObject *str_replace_inf;

PyObject *interned_strings;
};

#define _Py_GLOBAL_OBJECT(NAME) \
_PyRuntime.global_objects.NAME
_PyRuntime.static_objects.NAME
#define _Py_SINGLETON(NAME) \
_Py_GLOBAL_OBJECT(singletons.NAME)

struct _Py_global_objects {
struct _Py_static_objects {
struct {
/* Small integers are preallocated in this array so that they
* can be shared.
Expand All @@ -59,8 +61,6 @@ struct _Py_global_objects {
PyHamtNode_Bitmap hamt_bitmap_node_empty;
_PyContextTokenMissing context_token_missing;
} singletons;

PyObject *interned;
};

#define _Py_INTERP_CACHED_OBJECT(interp, NAME) \
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_runtime.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ typedef struct pyruntimestate {

/* All the objects that are shared by the runtime's interpreters. */
struct _Py_cached_objects cached_objects;
struct _Py_global_objects global_objects;
struct _Py_static_objects static_objects;

/* The following fields are here to avoid allocation during init.
The data is exposed through _PyRuntimeState pointer fields.
Expand Down
2 changes: 1 addition & 1 deletion Include/internal/pycore_runtime_init.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extern "C" {
.types = { \
.next_version_tag = 1, \
}, \
.global_objects = { \
.static_objects = { \
.singletons = { \
.small_ints = _Py_small_ints_INIT, \
.bytes_empty = _PyBytes_SIMPLE_INIT(0, 0), \
Expand Down
4 changes: 2 additions & 2 deletions Objects/unicodeobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ static inline PyObject* unicode_new_empty(void)
*/
static inline PyObject *get_interned_dict(void)
{
return _PyRuntime.global_objects.interned;
return _Py_CACHED_OBJECT(interned_strings);
}

static inline void set_interned_dict(PyObject *dict)
{
_PyRuntime.global_objects.interned = dict;
_Py_CACHED_OBJECT(interned_strings) = dict;
}

#define _Py_RETURN_UNICODE_EMPTY() \
Expand Down

Back | FazBrowse Home | New Git URL