Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Python 3.12.0b1 #313

Closed
freakboy3742 opened this issue May 27, 2023 · 4 comments
Closed

Incompatibility with Python 3.12.0b1 #313

freakboy3742 opened this issue May 27, 2023 · 4 comments
Labels
bug A crash or error in behavior.

Comments

@freakboy3742
Copy link
Member

freakboy3742 commented May 27, 2023

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).

@freakboy3742 freakboy3742 added the bug A crash or error in behavior. label May 27, 2023
@freakboy3742
Copy link
Member Author

freakboy3742 commented May 28, 2023

I've narrowed the cause down to python/cpython#104270. Trying to work out a reproduction case that triggered the problem.

@freakboy3742
Copy link
Member Author

Reproduction case found, and logged as python/cpython#105035.

@freakboy3742
Copy link
Member Author

This has been fixed upstream, and should be included in 3.12.0b2.

@freakboy3742
Copy link
Member Author

3.12.0b2 and b3 have been released, and CI builds indicate this issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior.
Projects
None yet
Development

No branches or pull requests

1 participant