10000 ctypes_patch breaks with Python 3.13.0a6 · Issue #444 · beeware/rubicon-objc · GitHub
[go: up one dir, main page]

Skip to content
ctypes_patch breaks with Python 3.13.0a6 #444
@freakboy3742

Description

@freakboy3742

Describe the bug

As of Python3.13.0a6, the ctypes patch used to allow struct return values no longer works.

Steps to reproduce

Run the test suite on Python 3.13.0a6.

There will be 7 test failures, all of the form:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 651, in run
    self._callTestMethod(testMethod)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
    if method() is not None:
       ~~~~~~^^
  File "/Users/runner/work/rubicon-objc/rubicon-objc/tests/test_ctypes_patch.py", line 96, in test_patch_idempotent
    ctypes_patch.make_callback_returnable(TestStruct)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/runner/work/rubicon-objc/rubicon-objc/.tox/py/lib/python3.13/site-packages/rubicon/objc/ctypes_patch.py", line 197, in make_callback_returnable
    stgdict = get_stgdict_of_type(ctype)
              ~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/Users/runner/work/rubicon-objc/rubicon-objc/.tox/py/lib/python3.13/site-packages/rubicon/objc/ctypes_patch.py", line 175, in get_stgdict_of_type
    raise TypeError(
        f"The given type's dict must be a StgDict, not {type(stgdict).__module__}.{type(stgdict).__qualname__}"
    )
TypeError: The given type's dict must be a StgDict, not builtins.dict

Expected behavior

Test suite should pass.

Screenshots

No response

Environment

  • Operating System: macOS
  • Python version: 3.13.0a6

Logs

No response

Additional context

Test suite passes with 3.13.0a5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0