Commit cb8fdf3
committed
Fix Event.emit dispatch bugs: empty kwargs list and positional arg duplication
Two bugs fixed:
1. connect(callback, []) with empty list silently dropped callbacks
instead of connecting a no-argument wrapper. The len(kwargs) > 0
guard skipped connection entirely.
2. In emit: positional args were incorrectly duplicated as keyword args
for native psygnal callbacks, causing TypeError in callbacks like
WidgetBase.disconnect() which accept *args but not **kwargs.
Fixed by dispatching native callbacks with raw positional+keyword args
and wrapper callbacks with keyword-only args.
Additionally, single positional emit args are now mapped to 'obj' keyword
for wrapper-based callbacks, matching the universal HyperSpy convention.
Add regression tests for Event.emit dispatch edge cases
- Empty kwargs list with no-arg wrapper
- Positional emit args not duplicated as keywords for native callbacks
- Positional emit args mapped to 'obj' keyword for wrapped callbacks
Assisted-by: opencode/glm-5.21 parent c996c8c commit cb8fdf3
2 files changed
Lines changed: 117 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
243 | 252 | | |
244 | 253 | | |
245 | 254 | | |
| |||
253 | 262 | | |
254 | 263 | | |
255 | 264 | | |
256 | | - | |
| 265 | + | |
257 | 266 | | |
258 | 267 | | |
259 | 268 | | |
| |||
262 | 271 | | |
263 | 272 | | |
264 | 273 | | |
265 | | - | |
| 274 | + | |
266 | 275 | | |
267 | | - | |
| 276 | + | |
268 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
269 | 290 | | |
270 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
271 | 296 | | |
272 | 297 | | |
273 | 298 | | |
| |||
290 | 315 | | |
291 | 316 | | |
292 | 317 | | |
293 | | - | |
| 318 | + | |
294 | 319 | | |
295 | 320 | | |
296 | 321 | | |
297 | 322 | | |
298 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
299 | 330 | | |
300 | 331 | | |
301 | 332 | | |
302 | 333 | | |
303 | 334 | | |
304 | 335 | | |
305 | | - | |
| 336 | + | |
306 | 337 | | |
307 | 338 | | |
308 | 339 | | |
| |||
458 | 489 | | |
459 | 490 | | |
460 | 491 | | |
461 | | - | |
462 | | - | |
463 | | - | |
| 492 | + | |
| 493 | + | |
464 | 494 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
469 | 508 | | |
470 | 509 | | |
471 | 510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
458 | 519 | | |
459 | 520 | | |
460 | 521 | | |
| |||
0 commit comments