[IronPython] IronPython 2.6 CodePlex Source Update

Dino Viehland dinov at microsoft.com
Fri May 15 19:50:41 CEST 2009


This should probably look more like the CTypes changes below but because I just ran the push script on a machine it doesn't usually run on there's a bunch of extra noise.



Fixes a bunch of issues w/ ctypes and makes a module that’s available by default.  We now pass 318 out of 366 tests (86%).  Also fixing __debug__ from being wrong as reported by Curt.

CTypes test changes:
                As we drive towards ctypes being passing all tests I’ve started updating tests that we are unlikely to ever pass.  These are the get ref count tests, tests that depend on Python26.dll, and I’ve also changed tests to be like their 3.0 versions when bytes/Unicode differences are hitting us.

CTypes changes:
                Add support for marshaling Bytes objects
                Fix calling convention on cast/string_at functions/memmove/memset
                Fix pointer casting
                LoadLibrary should throw if it fails
                Implement more top-level ctypes functions (call_function, call_cdeclfunction, check_hresult, resize, make sizeof work w/ resize)
                Implement keepRefs support – SetValue now returns a value if the object should be kept alive, array, Field, and other assigners save the value in the MemoryHolder dictionary
                Implement from_buffer/from_buffer_copy on various types
                Add IPythonBufferable interface so buffers can be created from cdata objects
                Add arg # checks on functions, add support for validating the return values in all the ways ctypes supports
                Fix getting values of arrays and function pointers – we need to return CType instances
                Support negative slices on pointers
                Add anonymous field support

Array module:   Implement array.buffer_info().  Needed to switch over to managing the array data ourselves instead of using a List<T>.  Then when anyone requests the address of the buffer we simply pin it and use a GC handle to get it’s address until the ArrayData gets collected.
Binascii: implemented hexlify for bytes



-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of dinov at microsoft.com
Sent: Friday, May 15, 2009 10:45 AM
To: users at lists.ironpython.com
Subject: [IronPython] IronPython 2.6 CodePlex Source Update

This is an automated email letting you know that sources
have recently been pushed out.  You can download these newer
sources directly from http://ironpython.codeplex.com/SourceControl/changeset/view/50535.

MODIFIED SOURCES
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/NativeFunctions.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/PointerType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/CFuncPtr.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/Field.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/_ctypes.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/CFuncPtrType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/Array.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/INativeType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/Pointer.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/CData.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/ArrayType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/MemoryHolder.cs
        $/IronPython/IronPython_Main/Readme.html
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/UnionType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/SimpleCData.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/ModuleOps.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/SimpleType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes_test.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/_ctypes/StructType.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/array.cs
        $/IronPython/IronPython_Main/Src/IronPython.Modules/binascii.cs
        $/IronPython/IronPython_Main/Src/IronPython/Runtime/Bytes.cs
        $/IronPython/IronPython_Main/Src/IronPython/Hosting/Python.cs
        $/IronPython/IronPython_Main/Src/IronPython/Runtime/Builtin.cs
        $/IronPython/IronPython_Main/Src/IronPython/Hosting/PythonCommandLine.cs
        $/IronPython/IronPython_Main/Src/IronPython/Runtime/Operations/PythonOps.cs
        $/IronPython/IronPython_Main/Src/IronPython/Runtime/PythonBuffer.cs

CHECKIN COMMENTS
--------------------------------------------------------------------------------
Changeset Id: 870956
Date: 5/13/2009 4:39:31 PM

(dinov) Adds sys._getframe support, updates our version numbers for the upcoming beta release, and adds a –X:Python30 flag for features which should be like Python 3k (currently just bytes indexing).

_getframe support is implemented as 2 command line options.  The first –X:Frames enables light-weight frames which can be used to walk the stack.  The 2nd, -X:FullFrames, enables frames w/ locals also available and therefore has a much higher performance cost.

The frames tracking logic it’s self gets inserted into the generated function bodies.  We maintain a thread local object which tracks the frames inside a List<FunctionStack> where FunctionStack is a struct.  This means the usual case of pushing a new frame will run allocation free once a thread has reached it’s normal maximum operating depth.  Long term we can combine frames w/ recursion enforcement but this change does not do that.  Frames get added to functions, classes, and modules.  For classes and modules we currently don’t have a code object associated with the frame – just the locals/globals.  We also don’t currently track the line number in the frame (it’s a little tricky given that we are storing the frames in a struct).  When the user calls _getframe we actually go ahead and create a linked list of TracebackFrame objects on-demand.  _getframe is now unavailable entirely unless one of these command line options is passed – this means the namedtuple usage of getframe no longer breaks us.  We also get tons of new attributes on our traceback frame objects.  A number of tests are also updated to use –X:Frames when running because they require sys._getframe to be available.

Also fixing CallTarget0 and friends so that Michael’s book will not be broken.  This is just removing PythonFunction from them, killing all of them except for CallTarget0, and switching over to using Func<> for all Python call targets.



(Shelveset: AddFrameSupportFinal;REDMOND\dinov | SNAP CheckinId: m9101)
--------------------------------------------------------------------------------
Changeset Id: 870839
Date: 5/13/2009 3:51:19 PM

(dfugate) * CP21976 (test_pyc.ps1) - fully enabled regression
* CP22259 (test_buffer.py) - extended regression.  Not fixed
* test_builtinfunc.py (test_zip) - extended regression
* CP22017 (test_cStringIO.py) - moved regression to its own test case
* test_file.py (test_write_buffer) - cleaned up
* test_tuple.py (test_compare_to_none) - extended regression


(Shelveset: CP59;REDMOND\dfugate | SNAP CheckinId: 8354)
--------------------------------------------------------------------------------
Changeset Id: 869226
Date: 5/12/2009 7:10:04 PM

(dfugate) * CP19675 (regressions.py) - extended regression
* test_cliclass.py - extended a regression
* test_doc.py - small refactoring and added a regression for CP21360
* test_methoddispatch.py - improved test_security_crypto a bit
* CP20956 (test_namebinding.py) - extended regression.  Not fixed
* test_set.py:
  - moved 'isPython25' definition to iptest.test_env
  - improved test_equality
* test_str.py - improved test_subclass_ctor


(Shelveset: CP58;REDMOND\dfugate | SNAP CheckinId: 8328)
--------------------------------------------------------------------------------
Changeset Id: 869126
Date: 5/12/2009 6:04:15 PM

(dinov) This fixes an import bug reported by Harry related to pygments – when we do an import we currently resolve the module and then return it.  We’re supposed to go back into sys.modules and lookup the module again.  This enables a module to publish a new object back into sys.modules under the modules name and have that object returned from the import machinery.  This change is the change in the importer where we’re tracking “finalName” and the final import look which used to be “now import the b.c” and is now “now import the a.b.c”.

Also adding support for __package__ (PEP 366 http://www.python.org/dev/peps/pep-0366/, codeplex work item #19541 - 2.6: add __package__ attribute to modules).  This is automatically set when an explicit relative import happens and it is consulted when doing any form of a relative import.  It also gets set via imp.new_module and on built-in modules.

Tests in test_import are fixed as is CodePlex bug #21912 (Relative imports from functions should throw ValueError, not SyntaxError).  Test_import fixes include detecting recursive reload and “from .x import *” is now legal.

We also now match the exception CPython reports when trying to import a filename – this fixes 2.6 work item 19586 (2.6: __import__ shouldn't allow filenames).

To pass a reasonable amount of the test_import bugs I had to made some tweaks to _warnings.  First formatwarning/showwarning aren’t part of the C module so I’ve made these internal.  We still have an implementation of these simply for when we’re running w/o CPython’s warnings.py.  Today this still occurs w/ our test_warnings.py test.  Then I’ve changed it to look up showwarnings  in the actual warnings module.  Finally I needed to make PerformModuleReload only create it’s state once – Cpython’s test_warnings imports this multiple times and gets the same filters list.

Also renaming ReflectedPackageOps -> NamespaceTrackerOps.


(Shelveset: FixImportAndAddPackageFinal;REDMOND\dinov | SNAP CheckinId: 8326)
--------------------------------------------------------------------------------
Changeset Id: 867352
Date: 5/11/2009 8:10:04 PM

(dinov) DLR outer layer (just making a couple of helpers more accessible) & IronPython

Implements instance binding for common instance members which we can easily support pre-compiled rules for:
                This EXCLUDES com objects and IDOs and any strongly typed literals other than List/string (we hit list and string during startup), types w/ GetBoundMember/GetCustomMember dynamic lookups
                It includes methods, events, properties (using reflected caller).  Fields are always compiled still.
                The biggest win is obviously methods in that for say “l = []; l.append” we no longer need to generate code.

Also fixes Seo’s problem w/ interactive code vs. statements and Jeff’s problem w/ >= 14 arguments all w/ defaults.



(Shelveset: FastInstanceBindingFinal2;REDMOND\dinov | SNAP CheckinId: 8310)
--------------------------------------------------------------------------------
Changeset Id: 867020
Date: 5/11/2009 4:49:17 PM

(dfugate) * Dev10 409920 (test_namebinding.py) - non-repro with today's bits
* Dev10 148342 (test_sys.py) - partially fixed.  Still missing sys.__excepthook__
* iptest.assert_util - preserve_syspath was misspelled
* renamed Modes.ps1 to ConsoleFlags.ps1 and enhanced the "ipy.exe -h" test
* test_dict.py - added verification for test_dict_inherit
* CodePlex 20251 (test_doc.py) - added a regression test.  Fixed
* test_math.py - added test_log_neg
* test_namebinding.py - enabled a block of code under -X:Interpret mode
* interop.com.apps.word - minor refactoring plus a regression test for test_word_basic
* moved/renamed test_mode_20.GenericTest


(Shelveset: CP57;REDMOND\dfugate | SNAP CheckinId: 8309)

_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the Ironpython-users mailing list