Skip to content

Commit fc193e8

Browse files
committed
Distinguish native and fallback thread argument binding
Keep the native legacy-parser conversion-order assertion unchanged. No-thread builds load a frozen Python function, so check its normal unexpected-keyword error explicitly instead of expecting C-parser conversion order. Assisted-by: OpenAI Codex:model version not exposed
1 parent a5d2485 commit fc193e8

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎extra_tests/snippets/vm_argument_errors.py‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import itertools
1313
import math
1414
import operator
15+
import sys
1516
import typing
1617
import weakref
1718

@@ -396,9 +397,20 @@ def test_custom_parsers_preserve_their_conversion_boundaries():
396397
except ImportError:
397398
pass
398399
else:
399-
# This legacy parser converts daemon before rejecting unknown names.
400-
with assert_raises(RuntimeError):
401-
_thread.start_joinable_thread(None, daemon=FailingBool(), unexpected=1)
400+
if "_thread" in sys.builtin_module_names:
401+
# This legacy parser converts daemon before rejecting unknown names.
402+
with assert_raises(RuntimeError):
403+
_thread.start_joinable_thread(None, daemon=FailingBool(), unexpected=1)
404+
else:
405+
# The no-thread fallback is a Python function, not a native parser.
406+
check(
407+
TypeError,
408+
"start_joinable_thread() got an unexpected keyword argument 'unexpected'",
409+
_thread.start_joinable_thread,
410+
None,
411+
daemon=FailingBool(),
412+
unexpected=1,
413+
)
402414

403415
# Native dispatch must allow the custom parser to choose its diagnostic.
404416
check(

0 commit comments

Comments
 (0)