8000 bpo-45953: Statically initialize the small ints. by ericsnowcurrently · Pull Request #30092 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-45953: Statically initialize the small ints. #30092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Do not clear _PyRuntime.global_objects in _PyRuntimeState_reset().
  • Loading branch information
ericsnowcurrently committed Dec 14, 2021
commit f2821bd8475046a78c5ab3392b3a1d8e5a245b8b
4 changes: 3 additions & 1 deletion Include/internal/pycore_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ typedef struct pyruntimestate {
struct _Py_unicode_runtime_ids unicode_ids;

struct _Py_global_objects global_objects;
// If anything gets added after global_objects then
// _PyRuntimeState_reset() needs to get updated to clear it.
} _PyRuntimeState;

#define _PyRuntimeState_INIT \
Expand All @@ -131,7 +133,7 @@ static inline void
_PyRuntimeState_reset(_PyRuntimeState *runtime)
{
/* Make it match _PyRuntimeState_INIT. */
memset(runtime, 0, sizeof(*runtime));
memset(runtime, 0, (size_t)&runtime->global_objects - (size_t)runtime);
_Py_global_objects_reset(&runtime->global_objects);
}

Expand Down
0