Commits

Bob Ippolito committed 83d5f61

The ``str`` bridge is now disabled by default

Comments (0)

Files changed (3)

Modules/objc/module.m

 int PyObjC_VerboseLevel = 0;
 PyObject* PyObjCClass_DefaultModule = NULL;
 PyObject* PyObjC_NSNumberWrapper = NULL;
-int PyObjC_StrBridgeEnabled = 1;
+int PyObjC_StrBridgeEnabled = 0;
 
 static NSAutoreleasePool* global_release_pool = nil;
 
 <p>An overview of the relevant changes in new, and older, releases.</p>
 <h2><a name="version-1-3-2005-03">Version 1.3 (2005-03-??)</a></h2>
 <ul>
+<li>The <code><span>str</span></code> bridge is now disabled by default, and will issue 
+<code><span>objc.PyObjCStrBridgeWarning</span></code> warnings.  To promote these to an
+exception, do the following:<pre>
+import objc
+import warnings
+warnings.filterwarnings('error', objc.PyObjCStrBridgeWarning)
+</pre>
+<p>To enable the str bridge, without warnings, use:</p>
+<pre>
+import objc
+objc.setStrBridgeEnabled(True)
+</pre>
+<p>In PyObjC 1.4, this warning will go away, and <code><span>str</span></code> objects will not be
+usable as <code><span>NSString</span></code> instances.  To pass text across the bridge,
+always use <code><span>unicode</span></code>.</p>
+</li>
 <li>New <code><span>objc.pyobjc_id</span></code> function that returns a the id of the underlying
 NSObject as an integer.  (Python wrapper objects are often made on the
 fly, meaning <code><span>id(obj)</span></code> is not constant during the lifetime of the
 <code><span>objc.createOpaquePointerType(name,</span> <span>typestr,</span> <span>doc)</span></code>.  The same function is 
 also exposed in the C-API.</p>
 </li>
+<li>Wrappers for C-structs how have a <code><span>__typestr__</span></code> attribute on their type.
+This attribute contains the encoded Objective-C type of the struct.<p>The default <code><span>__init__</span></code> for struct-wrappers now initializes fields with an 
+appropriate default value, instead of <code><span>None</span></code>.</p>
+<p>New wrappers can now be created from Python using the function
+<code><span>objc.createStructType(name,</span> <span>typestr,</span> <span>fieldnames,</span> <span>doc)</span></code>. The same
+function is also exposed in the C API (and has been for a while).</p>
+</li>
 </ul>
 <h2><a name="version-1-2-2004-12-29">Version 1.2 (2004-12-29)</a></h2>
 <ul>
 Version 1.3 (2005-03-??)
 ------------------------
 
+- The ``str`` bridge is now disabled by default, and will issue 
+  ``objc.PyObjCStrBridgeWarning`` warnings.  To promote these to an
+  exception, do the following::
+
+      import objc
+      import warnings
+      warnings.filterwarnings('error', objc.PyObjCStrBridgeWarning)
+
+  To enable the str bridge, without warnings, use::
+
+      import objc
+      objc.setStrBridgeEnabled(True)
+
+  In PyObjC 1.4, this warning will go away, and ``str`` objects will not be
+  usable as ``NSString`` instances.  To pass text across the bridge,
+  always use ``unicode``.
+
 - New ``objc.pyobjc_id`` function that returns a the id of the underlying
   NSObject as an integer.  (Python wrapper objects are often made on the
   fly, meaning ``id(obj)`` is not constant during the lifetime of the