Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-127266: avoid data races when updating type slots#131174

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nascheme merged 54 commits intopython:mainfromnascheme:gh-127266-type-slots-ts
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
54 commits
Select commitHold shift + click to select a range
0e995ad
wip: update type slots, stop-the-world
naschemeMar 12, 2025
b173f17
Remove unneeded atomics for tp_flags.
naschemeMar 13, 2025
d4ce112
Use stop-the-world for tp_flag changes too.
naschemeMar 13, 2025
44eb332
Remove 'world_stops' and 'sys._get_world_stops'.
naschemeMar 14, 2025
d132fab
Improve code comments.
naschemeMar 14, 2025
658bcd5
Remove TSAN suppressions that seem unneeded.
naschemeMar 14, 2025
ef2f07b
Add NEWS file.
naschemeMar 14, 2025
ce8536d
Use mutex rather than critical sections.
naschemeMar 22, 2025
b97a4b4
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeMar 26, 2025
ca00e74
Fix non-debug build.
naschemeMar 26, 2025
6db4542
Improve comments.
naschemeMar 26, 2025
398ac14
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeMar 27, 2025
75d6b71
Avoid unused function warning.
naschemeMar 27, 2025
895a86a
Remove unwanted suppression (bad merge).
naschemeMar 31, 2025
65e40f4
Fixes based on review feedback.
naschemeMar 31, 2025
b68f1a1
Remove spurious assert().
naschemeMar 31, 2025
9976b32
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeApr 1, 2025
1b84486
Omit mutex_tid member from default build.
naschemeApr 1, 2025
2af9e49
Remove Py_TPFLAGS_EXPOSED flag and related logic.
naschemeApr 1, 2025
f65e87c
Improve comment for TYPE_LOCK.
naschemeApr 1, 2025
395a6d3
Re-add the ASSERT_NEW_OR_STOPPED() asserts.
naschemeApr 1, 2025
e4f87e5
Further cleanups of the locking in typeobject.
naschemeApr 3, 2025
2a66555
Fix data race in resolve_slotdups().
naschemeApr 3, 2025
2efac26
Fix comment.
naschemeApr 3, 2025
f7d2d36
Make the init of tp_dict thread-safe.
naschemeApr 9, 2025
f3fd35a
Do some addtional locking simplification.
naschemeApr 9, 2025
57c2a44
Avoid acquiring the types mutex if version is set.
naschemeApr 10, 2025
7c0ccf5
Add check_invalid_reentrancy() call.
naschemeApr 17, 2025
4fa77bb
Fix additional re-entrancy issues found.
naschemeApr 17, 2025
caf6554
Add comment explaining class_name() code.
naschemeApr 17, 2025
803d703
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeApr 17, 2025
90ea541
Use atomic load to avoid thread safety issue.
naschemeApr 17, 2025
0dc0faf
Fix default debug build.
naschemeApr 17, 2025
956e5d1
Move declaration to avoid syntax error.
naschemeApr 17, 2025
2bb710c
Remove _PyType_GetVersionForCurrentState, unused.
naschemeApr 21, 2025
3a9bc96
Fix for possible re-entrancy in has_custom_mro().
naschemeApr 21, 2025
d742a53
Use correct FT_ATOMIC_ macro.
naschemeApr 21, 2025
e7480c3
Remove TSAN suppression for 'assign_version_tag'.
naschemeApr 21, 2025
e2ea281
Small efficiency fix for types_mutex_set_owned().
naschemeApr 21, 2025
935bfca
Revert to using critical section with TYPE_LOCK.
naschemeApr 21, 2025
1cff448
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeApr 21, 2025
a81e9e3
Invalidate type cache before calling watchers.
naschemeApr 21, 2025
f5df0c3
Fixes for type_modified_unlocked().
naschemeApr 22, 2025
7db281c
Major re-work, TYPE_LOCK protects more things.
naschemeApr 22, 2025
da2a0ad
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeApr 23, 2025
986f23a
Fix non-debug build.
naschemeApr 23, 2025
c404ed4
Revert unneeded code changes.
naschemeApr 23, 2025
55af4ba
Merge branch 'origin/main' into gh-127266-type-slots-ts
naschemeApr 23, 2025
0eb77da
Restore comment
naschemeApr 24, 2025
16f15b2
Revert more changes.
naschemeApr 24, 2025
0c328cc
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeApr 25, 2025
64547e9
Reduce item list size for a few tests.
naschemeApr 25, 2025
fff1bd2
Merge 'origin/main' into gh-127266-type-slots-ts
naschemeApr 28, 2025
5672352
Minor code tidy.
naschemeApr 28, 2025
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
PrevPrevious commit
NextNext commit
Fix non-debug build.
  • Loading branch information
@nascheme
nascheme committedMar 26, 2025
commitca00e74171ecbfce4b3dbf1b1b6b26f3db1ef776
1 change: 1 addition & 0 deletionsInclude/internal/pycore_typeobject.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,7 @@ extern "C" {
#define _Py_TYPE_BASE_VERSION_TAG (2<<16)
#define _Py_MAX_GLOBAL_TYPE_VERSION_TAG (_Py_TYPE_BASE_VERSION_TAG - 1)


/* runtime lifecycle */

extern PyStatus _PyTypes_InitTypes(PyInterpreterState *);
Expand Down
4 changes: 2 additions & 2 deletionsObjects/typeobject.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,12 +72,10 @@ class object "PyObject *" "&PyBaseObject_Type"
// modifying these, in order to avoid data races.
#define TYPE_LOCK &PyInterpreterState_Get()->types.mutex

#ifdef Py_DEBUG
// Used to check for correct use of the TYPE_LOCK mutex. It is a simple
// mutex and does not support re-entrancy. If we already hold the lock and
// try to acquire it again with the same thread, it is a bug on the code.
#define TYPE_LOCK_TID &PyInterpreterState_Get()->types.mutex_tid
#endif

static bool
types_world_is_stopped(void)
Expand DownExpand Up@@ -110,12 +108,14 @@ types_start_world(void)
assert(!types_world_is_stopped());
}

#ifdef Py_DEBUG
static bool
types_mutex_is_owned(void)
{
PyThread_ident_t tid = PyThread_get_thread_ident_ex();
return _Py_atomic_load_ullong_relaxed(TYPE_LOCK_TID) == tid;
}
#endif

static void
types_mutex_set_owned(PyThread_ident_t tid)
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp