cpython/Lib/test/test_free_threading
Neil Schemenauer 1b15c89a17
gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838)
* Add `_PyDictKeys_StringLookupSplit` which does locking on dict keys and
  use in place of `_PyDictKeys_StringLookup`.

* Change `_PyObject_TryGetInstanceAttribute` to use that function
  in the case of split keys.

* Add `unicodekeys_lookup_split` helper which allows code sharing
  between `_Py_dict_lookup` and `_PyDictKeys_StringLookupSplit`.

* Fix locking for `STORE_ATTR_INSTANCE_VALUE`.  Create
  `_GUARD_TYPE_VERSION_AND_LOCK` uop so that object stays locked and
  `tp_version_tag` cannot change.

* Pass `tp_version_tag` to `specialize_dict_access()`, ensuring
  the version we store on the cache is the correct one (in case of
  it changing during the specalize analysis).

* Split `analyze_descriptor` into `analyze_descriptor_load` and
  `analyze_descriptor_store` since those don't share much logic.
  Add `descriptor_is_class` helper function.

* In `specialize_dict_access`, double check `_PyObject_GetManagedDict()`
  in case we race and dict was materialized before the lock.

* Avoid borrowed references in `_Py_Specialize_StoreAttr()`.

* Use `specialize()` and `unspecialize()` helpers.

* Add unit tests to ensure specializing happens as expected in FT builds.

* Add unit tests to attempt to trigger data races (useful for running under TSAN).

* Add `has_split_table` function to `_testinternalcapi`.
2024-12-19 10:21:17 -08:00
..
__init__.py gh-120659: Skip `test_freethreading` with GIL (#120660) 2024-06-18 15:56:20 +02:00
test_code.py gh-127020: Make `PyCode_GetCode` thread-safe for free threading (#127043) 2024-11-21 11:00:50 -05:00
test_dict.py gh-124470: Fix crash when reading from object instance dictionary while replacing it (#122489) 2024-11-21 10:41:19 -06:00
test_gc.py gh-125859: Fix crash when `gc.get_objects` is called during GC (#125882) 2024-10-24 09:33:11 -04:00
test_list.py gh-124402: Speed up test_free_threading and test_super (#124491) 2024-09-26 10:53:17 +02:00
test_methodcaller.py gh-127065: Make methodcaller thread-safe and re-entrant (GH-127746) 2024-12-11 10:06:07 -05:00
test_monitoring.py gh-124402: Speed up test_free_threading and test_super (#124491) 2024-09-26 10:53:17 +02:00
test_races.py gh-115999: Specialize `STORE_ATTR` in free-threaded builds. (gh-127838) 2024-12-19 10:21:17 -08:00
test_slots.py gh-117657: TSAN Fix races in `PyMember_Get` and `PyMember_Set` for C extensions (GH-123211) 2024-12-03 09:41:53 -05:00
test_str.py gh-120417: Remove unused imports in tests (part 2) (#120630) 2024-06-17 21:05:37 +02:00
test_tokenize.py gh-120317: Lock around global state in the tokenize module (#120318) 2024-07-16 11:35:57 +02:00
test_type.py gh-127316: fix incorrect assertion in setting `__class__` in free-threading (#127399) 2024-11-29 21:44:20 +05:30
test_zip.py gh-123271: Make builtin zip method safe under free-threading (#123272) 2024-08-27 15:22:43 -04:00