Skip to content

Incompatibility with Python 3.12.0b1 #313

@freakboy3742

Description

@freakboy3742

Describe the bug

Python 3.12.0b1 appears to have introduced something that breaks Rubicon; from rubicon.objc import NSObject raises a TypeError.

Steps to reproduce

  1. from rubicon.objc import NSObject
  2. See error
Traceback (most recent call last):
  File "/Users/rkm/beeware/rubicon/objc/testbed.py", line 3, in <module>
    from rubicon.objc import NSObject, objc_method
  File "/Users/rkm/beeware/rubicon/objc/src/rubicon/objc/__init__.py", line 33, in <module>
    from . import api, collections, runtime, types
  File "/Users/rkm/beeware/rubicon/objc/src/rubicon/objc/api.py", line 1694, in <module>
    NSNumber = ObjCClass("NSNumber")
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rkm/beeware/rubicon/objc/src/rubicon/objc/api.py", line 1402, in __new__
    self = super().__new__(cls, ptr, objc_class_name, (ObjCInstance,), new_attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/rkm/beeware/rubicon/objc/src/rubicon/objc/api.py", line 927, in __new__
    super(ObjCInstance, type(self)).__setattr__(self, "ptr", object_ptr)
TypeError:  expected 2 arguments, got 3

Expected behavior

The import should succeed.

Screenshots

No response

Environment

  • Operating System: macOS Ventura 13.3.1
  • Python version: 3.12.0b1
  • Software versions:

Logs

No response

Additional context

There was no problem with 3.12.0a7; I haven't narrowed down the change that has caused the problem, and the Python 3.12 release notes don't have anything that is an obvious candidate (to me, anyway).

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