Commit 275a9f2
committed
test_thread: cover real-world consumer patterns
Two FT-only tests for code paths identified by reviewing pythonnet's
downstream consumers (QuantConnect/Lean, Rhino.Inside, Speckle) and
the historical issue tracker:
test_concurrent_clr_delegate_invocation_from_python
Python callables wrapped as distinct CLR delegate types
(PublicDelegate, StringDelegate, BoolDelegate) and invoked
concurrently from worker threads. Canonical embedder pattern
for callbacks/event handlers; hits DelegateManager.GetDispatcher
(the Reflection.Emit lock added in 92072bd) and the GIL
re-acquisition path in Dispatcher.Dispatch.
test_concurrent_generic_type_binding
36 distinct Dictionary[K,V] / List[K] type-arg pairs resolved
concurrently from N threads. Targets the open-issue family
#2269 (ClassManager hash collision crash),
#1407 (ClassManager perf regression with MaybeType keys), and
#821 (generic resolution race). Exercises ClassManager.cache,
TypeManager.cache, GenericUtil.mapping, and the generic-binding
fast path simultaneously.
Both are @freethreaded_only because the cumulative pytest state
under GIL builds trips the same pre-existing CPython 3.11/3.12/3.13
GC crash that gates the other high-contention tests in this file.1 parent 8f92c22 commit 275a9f2
1 file changed
Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
250 | 307 | | |
251 | 308 | | |
252 | 309 | | |
| |||
0 commit comments