IronLanguages / IronLanguages/ironpython3
Keyword-only argument issues
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.8k
- Forks
- 316
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
Some issues I noticed while working on https://github.com/IronLanguages/ironpython3/issues/1015. The following examples need to be run in fresh ipy instances to exhibit the broken behavior.
- Bad error message for missing keyword arguments:
def test(*, a): return a
test() # throws TypeError: test() takes no arguments (0 given)
- When the call binds to a failure when a value in
__kwdefaults__is missing it still throws even if the value becomes available later on:
def test(*, a=1): return a
test.__kwdefaults__ = None
test() # throws TypeError as expected
test.__kwdefaults__ = {"a": 1}
assert test() == 1 # still throws the same TypeError as above
- Not finding a value in
__kwdefaults__should throw aTypeErrorinstead of returningNone:
def test(*, a=1): return a
assert test() == 1
test.__kwdefaults__ = None
test() # should throw but returns None instead
-
PythonFunction.CalculatedCachedCompat takes into account the number of arguments in
__kwdefaults__. I don't think this makes sense since__kwdefaults__can be changed any time and there's no way to know. -
More stuff I'm forgetting about...
Related PR: https://github.com/IronLanguages/ironpython3/pull/1018
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the four keyword-only argument examples in fresh ipy instances, then inspect PythonFunction.CalculatedCachedCompat and the behavior around kwdefaults. Done means the reported calls produce the correct TypeError behavior and changes to kwdefaults are reflected consistently; use the related PR as context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100