{"id":6079,"library":"pyobjc-framework-carbon","title":"PyObjC Carbon Framework","description":"PyObjC-framework-carbon provides Python bindings for the Carbon framework on macOS. Carbon is an older API set largely deprecated by Apple in favor of Cocoa. This library is part of the larger PyObjC project, which offers comprehensive Objective-C-Python bridging and wrappers for numerous macOS frameworks. The current version is 12.1, and PyObjC typically releases new versions in sync with major macOS SDK updates and Python version support changes.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","objective-c","carbon","frameworks","gui","legacy"],"install":[{"cmd":"pip install pyobjc-framework-carbon","lang":"bash","label":"Install pyobjc-framework-carbon"}],"dependencies":[{"reason":"Provides the core Objective-C bridge for all PyObjC framework bindings.","package":"pyobjc-core","optional":false}],"imports":[{"symbol":"GetCurrentEventLoop","correct":"from Carbon.Events import GetCurrentEventLoop"}],"quickstart":{"code":"import objc\nfrom Carbon.Events import GetCurrentEventLoop\n\ndef main():\n    # Attempt to get the current Carbon event loop.\n    # Note: Carbon APIs are largely deprecated on macOS and might not behave as expected\n    # or even be available in newer OS versions/SDKs.\n    try:\n        event_loop = GetCurrentEventLoop()\n        print(f\"Successfully retrieved Carbon Event Loop reference: {event_loop}\")\n        print(f\"Type: {type(event_loop)}\")\n    except objc.error as e:\n        print(f\"Could not retrieve Carbon Event Loop. Error: {e}\")\n        print(\"This is expected behavior on modern macOS as Carbon APIs are deprecated.\")\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    main()\n","lang":"python","description":"This quickstart attempts to retrieve a reference to the current Carbon Event Loop using a direct Carbon C API call wrapped by PyObjC. It includes error handling to acknowledge that Carbon APIs are deprecated on modern macOS and might not always succeed."},"warnings":[{"fix":"Migrate your application logic to use Cocoa (AppKit/Foundation) frameworks instead of Carbon. Consult Apple's documentation for equivalent Cocoa APIs.","message":"The Carbon framework, which pyobjc-framework-carbon wraps, is largely deprecated and removed by Apple from macOS. Many APIs may not function as expected or be available on modern macOS versions/SDKs. Relying on Carbon APIs for new development is strongly discouraged.","severity":"breaking","affected_versions":"All versions of `pyobjc-framework-carbon` when used on modern macOS."},{"fix":"Upgrade your Python environment to version 3.10 or newer. PyObjC generally follows Python's end-of-life cycle.","message":"PyObjC 12.0 (and by extension, pyobjc-framework-carbon 12.0 and newer) dropped support for Python 3.9. Projects must use Python 3.10 or later.","severity":"breaking","affected_versions":"pyobjc-core >= 12.0"},{"fix":"Review custom `objc` class initializers and `alloc`/`init` patterns for potential memory management changes when upgrading from `pyobjc-core < 11.1`. Ensure references are managed as expected under the new ARC rules.","message":"PyObjC 11.1 aligned its Automatic Reference Counting (ARC) behavior for initializer methods with `clang`'s documentation. Methods in the 'init' family now correctly 'steal' a reference to `self` and return a new reference. This might subtly change memory management behavior for custom Objective-C subclasses implemented in Python.","severity":"gotcha","affected_versions":"pyobjc-core >= 11.1"},{"fix":"Thoroughly test custom `objc` class implementations, especially those overriding both `__init__` and `__new__`, when upgrading PyObjC. Consult the 10.3.x release notes for precise behavior changes.","message":"Behavior related to `__init__` and `__new__` methods in custom `objc` classes changed in PyObjC 10.3 and was partially reverted in 10.3.1. Specifically, 10.3 prevented calling `__init__` when PyObjC's `__new__` was used, which broke some projects. While 10.3.1 reintroduced `__init__` support when `__new__` is user-implemented, complex interactions can still arise.","severity":"gotcha","affected_versions":"pyobjc-core 10.3, potentially specific edge cases in 10.3.1"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}