[IronPython] IronPython 1.0 Beta 9

Dino Viehland dinov at exchange.microsoft.com
Thu Jul 13 00:26:51 CEST 2006

Hello IronPython Community,

We have just released IronPython 1.0 Beta 9. This release focuses primarily on fixing bugs resolving around compatibility with CPython, finalizing the public API surface, and improving the new method binder.  There's also some significant performance improvements as well as the runtime support required to use the pickle module.
One of the most significant changes is the final updates to the hosting API.  The hosting APIs have removed the concept of a ModuleScope and replaced it with a normal dictionary.  Here is a sample of how you can use the new hosting APIs:

       EngineOptions engineOptions = new EngineOptions();
       engineOptions.ShowClrExceptions = true; // do some customization
       PythonEngine engine = new PythonEngine(engineOptions);
       Dictionary<string, object> globals = new Dictionary<string, object>();
       globals["x"] = 1; // set a global variable
       EngineModule module = engine.CreateModule("MyModule", globals, true);
       module.Globals["y"] = 2; // set another global variable
       Dictionary<string, object> locals = new Dictionary<string, object>();
       locals["z"] = 3; // set a local variable
       engine.Compile("result = x+y+z").Execute(module, locals);
       Console.WriteLine(engine.EvaluateAs<int>("result", module, locals));

We've also added new PythonEngine.CreateMethod and PythonEngine.CreateLambda methods.  These allow you to bind either a set of Python statements or a single expression to a delegate.  The parameters of the delegate are exposed to the Python code, and the delegate can be re-bound to different modules at runtime providing a quick way to provide different inputs to your cached Python code.

Finally we've introduced a change to the clr.Reference type for passing values to reference and out parameters.  This type is now a generic type that you instantiate like any other (e.g. clr.Reference[int]).  It contains a Value property that is strongly typed and can be used for picking overloads amongst multiple out/ref parameters.

You can download the release from: http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=IronPython&ReleaseId=97

We'd like to thank everyone in the community for your bug reports and suggestions that helped make this a better release: Andrzej Krzywda, Brandon Furtwangler, cbrochu, Davy Mitchell, Greg Chapman, Paparipote, JesseK, Jonathan Jacobs, Jörgen Stenarson, Keith J. Farmer, Michael Foord, mfenniak, py_sunil, Seo Sanghyeon, sharerj, Syzmon Kobalczyk.

Thanks and keep in touch,
The IronPython Team

More complete list of changes and bug fixes:
CodePlex 522 - Inheritance Cycle Not Detected.
Renamed IronPythonConsole to ipy and IronPythonWindow to ipyw
AST no longer exposes public fields
Bugfix 341 - Unify code in ReflectedPackage and ReflectedAssembly
Bugfix 351 -Regex: back-matching of groups is not translated into .NET Regex correctly
Bugfix 354 - Behavior of globals incompatible with CPython
Bugfix 443 - keyword confusion on list.__init__
Bugfix 448 - Runtime error accessing members of collection objects (e.g., Folders) in Outlook Object Model
Bugfix 520 - Lists compare against Tuple's
Cleaned up code formatting
Bugfix 444 - Binding: Cannot override a method with an out parameter
CodeDom array handling fixed
PythonEngine.Execute can take filename for improved debugging
Bugfix: AssertionError runs input through String.Format mishandling { and }
-X:PassExceptions added for improved debugging under the debugger
Removed file.isatty API because we can't properly implement it
Force test_assert to run in a new console w/o optimizations
Bugfix: CodePlex 350 - We allow calling a constructor with incorrect number of arguments
enforce only strings are returned from __hex__/__oct__
Bugfix 537 - Passing function to form.Invoke raised null reference exception in Ops.GetDelegate. We throw TypeError with a good exception message
Bugfix 551 - SystemError exception on dir(class.function). This already works
Bugfix 561 - Empty module includes None. DictionaryUnionEnumerator was not moving to the next enumerator correctly. Also added asserts so that users of DictionaryUnionEnumerator cannot call Current without first calling MoveNext.
Bugfix 562 - getattr(object(), None) complains that we don't have that attribute. SymbolTable.StringToId should throw for null input
Bugfix 564 - Issue in  method list.__init__
Fixed missing methods on NoneType
Improved -X:ILDebug command line option
Bugfix: del builtinTypeInstance.__class__ should throw TypeError, but del builtinTypeInstance.__anyotherattribute__ should throw an AttributeError
Bugfix - 'mystr'.{encode|decode}('raw_unicode_escape') now works with underscores as well as dashes
Bugfix - _codecs.raw_unicode_escape_{encode|decode} is no longer unimplemented
Bugfix: Dictionary<K,T> returns invalid data instead of throwing an exception if its enumerated without calling MoveNext first.
Bugfix 452 - Reconsider the current default of __repr__ for .NET objects
Bugfix 453 - Different behaviour with locale module (Cpython vs IronPython)
Bugfix 519 - chr != System.Char
Bugfix -     Entering a comment line in the interactive console causes an exception
Bugfix 355 - Consider routing console output via the SystemState
Bugfix 567 - co_flags doesn't work with compile
Bugfix 577 - import problem
Bugfix 606 - Missing __hash__ on builtin types
Bugfix 623 - Warnings when compiled w/ Mono
Bugfix - Method Binder: pass None to methods asking for params array
Bugfix 619 - Private explicit interface implementation methods can clober public methods when there are a lot of the explicit interface implementation methods
Tutorial Update: Added a 7th Tutorial describing how to use Python standard library in IronPython
Bugfix 605 - IronPython incorrectly allows assignment to readonly fields
Bugfix - Assert when evaluating __init__, and __dict__ incorrectly resolves to __builtins__.__dict__
Bugfix - Inconsistency in attribute access checks (AttributeError vs TypeError, permitted vs disallowed) between CPython and IronPython
Bugfix: isinstance doesn't use __class__ and __bases__ correctly
Bugfix - expand method was not dealing with \g<> properly
Bugfix - start and end methods were not returning the corrent index for 'None' group matches
Bugfix - methods dealing with groups now throw an index error when a group cannot be found
Bugfix 462 - Explicit interface properties are always getting long-names
Bugfix 676 - implement datetime.datetime (test_datetime not yet enabled)
Bugfix - 677 - set().add(None) returns set that NoneType
Bugfix - globals() and locals caused StackOverflowException.
Bugfix - Inconsistency in treating int and long as dictionary key from Cpython
Python2.5  other language feature addition: str.partition/rpartition, str.startswith()/str.endswith()
Bugfix - uncomment line 48 of sbs_simple_compare.py and make it pass
Bugfix - MethodBinder: expect TypeError (not OverflowError) when pass Decimal.MinVaule to Int32 arg
Bugfix - Method Binder: passing extensible int with negative number where UInt32 is asked
Bugfix - Method Binder: how to treat Nullable<int> as parameter type? same as int?
Python 2.5 other language features : any/all
FxCop cleanup on primary public API surface (IronPython.Hosting, IronPython.Compiler.*, IronPython.CodeDom, IronPython.Exceptions)
Bugfix - Binding: Document and cleanup conversions / binding rules
Bugfix - Method Binder: choose between ref int32 and (int32, defaultvalue/params array)
decimal operator on BigInteger
CodeGen emits calls to ConvertToXXX directly where available, rather than via ConvertToValueType
Many of the ConvertToXXX are now generated (cases without fast paths and __xxx__ fallbacks)
Enum conversion is gone
TryConvertFromNull is gone (never used)
ConvertToBigInteger generated
TryConvertXXX marked internal, those not used are not generated and new comment says "do not use"
The generated ConvertToXXX have the first "if" check for the target type.
int() now takes decimal parameter, yielding int or long whichever fits
Python 2.5 min/max feature updates
Codeplex 789 - derived class iterator is not called
Misc. tutorial improvements
Bugfix: issues with list.__rmul__
Bugfix: 544 - Calling method's w/ arguments from C#
Bugfix: 779 - Nested types aren't visble w/o importing clr
Bugfix: 766 - CLR methods are visible on some builtin types even if clr module isn't imported
Bugfix: 777 - Bad exception thrown when doing tuple-style assignment from None
Bugfix: 794 - .ctors and __new__ should support __overloads__
Bugfix: 438 - os functions raise wrong exception types
Bugfix: 774 - Cannot compare sets using cmp in IronPython
Bugfix: 696 - -X:MTA yields ArgumentOutOfRangeException
Conversion cleanup, SuperConsole removed from ipyw.exe
Performance improvement: Changed Uninitialized to be a singleton class.
In lined uninitialized checks for local variables.
Names are passed by string to CheckInitializedOrBuiltin.
GetBuiltinOrThrow is inlined into the body of CheckInitializedOrBuiltin.
ModuleScope removed in favor of IDictionary<string,object>
EngineOptions and CompiledCode being added/moved to the IronPython.Hosting namespace
Added new CompiledCode.Execute method
PythonEngine.ExecuteFileOptimized has been broken up into PythonEngine.CreateOptimziedModule and OptimizedEngineModule.Execute
Renamed __overloads__ to just Overloads
Bugfix: clr.Reference shouldn't convert to boolean and should handle ValueTypes
Disabling conversion to IEnumerator, enabling IEnumerable
Many test coverage improvements for method binding
Bugfix: 780 - Make Array Str & repr identical (both dispay repr)
Bugfix: 810 - builtin function len thows wrong exception
Bugfix: 811 - str.rfind can raise index errors
Bugfix 813 - Builtin eval with dict subclass as locals does not work as in CPython 2.4:
Bugfix 1103 - test_descr: Two more mro inconsistencies
Method Binder: pass in clr.Reference(100) when overloads ask for "ref Int32" and "ref object" - clr.Reference replaced with clr.Reference[T]
Confusing exception when constructing generic type incorrectly

More information about the Ironpython-users mailing list