Skip to content

kwargs error in recent py/runtime commits #8473

@stephanelsmith

Description

@stephanelsmith

Updating to master, noticed a new issue relating to kwargs. Last working commit is bb70874. On commit 1e99d29, I get a core dump, and 783b1a8 onwards, I get a TypeError.

I'm running IDF v4.4. I'm running this on ESP S3.

ERROR 2e3f204 (HEAD -> master, origin/master, origin/HEAD) py/runtime: Use size_t/ssize_t instead of uint/int.
4768518 tests/basics/fun_callstardblstar: Add coverage test.
9b74d71 py/runtime: Drop new_alloc < 4 check.
3679a47 py/runtime: Do not overallocate when len is known.
ERROR 783b1a8 py/runtime: Allow multiple *args in a function call.
LoadProhibited 1e99d29 py/runtime: Allow multiple **args in a function call.
PASS bb70874 py/vm: Prevent array bound warning when using -MP_OBJ_ITER_BUF_NSLOTS.

Here's the test case. This schtick on this one is direct instantiation of kwargs is working fine. Which is why it probably passed test cases (and why this was a little tricky to find). But when you pass kwargs through a function, I see the issue.

def kwargs_test1(kwargs):
    KwargsTest(**kwargs)
class KwargsTest():
    def __init__(self, hello            = None,
                       world            = False,
                       ):
        pass

kwargs = {'hello':True}

#direct instantiation works across commits
KwargsTest(**kwargs)
# <KwargsTest object at 3d832510>

#calling via function causes error on new commits
kwargs_test1(kwargs=kwargs)
# on commit bb7087411 and earlier, no error.
# on commit 1e99d29f3 core panic
# on commit 783b1a868 and owwards, I get this:
# Traceback (most recent call last):
  # File "<stdin>", line 1, in <module>
  # File "main.py", line 189, in kwargs_test1
# TypeError: can't convert dict to int


Metadata

Metadata

Assignees

No one assigned

    Labels

    py-coreRelates to py/ directory in source

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy