[Ironpython-users] IronPython, Daily Digest 3/28/2012
no_reply at codeplex.com
no_reply at codeplex.com
Thu Mar 29 09:52:07 CEST 2012
Hi ironpython,
Here's your Daily Digest of new issues for project "IronPython".
In today's digest:ISSUES
1. [New issue] datetime does not handle reverse comparisons correctly
2. [Status update] datetime does not handle reverse comparisons correctly
3. [Status update] Implement rest of datetime module
4. [New comment] [2.7 Beta 2] deepcopy(time(9, 0)) != time(9, 0)
5. [New issue] Restricted AppDomain and os.py module
6. [New comment] pyc.py: generates exes which fail on using std python libs
7. [New comment] pyc.py: generates exes which fail on using std python libs
----------------------------------------------
ISSUES
1. [New issue] datetime does not handle reverse comparisons correctly
http://ironpython.codeplex.com/workitem/32501
User jdhardy has proposed the issue:
"date can properly handle comparisons such as 'dt == []', but '[] == dt' is incorrect (get NotImplemented, should raise TypeError).
I don't think the issue lies with datetime; I think that comparisons aren't quite right for the other types ((), [], {})."-----------------
2. [Status update] datetime does not handle reverse comparisons correctly
http://ironpython.codeplex.com/workitem/32501
User jdhardy has updated the issue:
Status has changed from Active to Closed with the following comment,
"It helps if the branch I'm working in isn't buggy. Whoops."-----------------
3. [Status update] Implement rest of datetime module
http://ironpython.codeplex.com/workitem/17470
User jdhardy has updated the issue:
Status has changed from Active to Closed with the following comment,
"__rdiv__ and __rfloordiv__ are also spurious. Marking this one closed; it's been done for a while."-----------------
4. [New comment] [2.7 Beta 2] deepcopy(time(9, 0)) != time(9, 0)
http://ironpython.codeplex.com/workitem/30274
User jdhardy has commented on the issue:
"Fixed in 020ef3a.
(I promise the next one won't take a year.)"-----------------
5. [New issue] Restricted AppDomain and os.py module
http://ironpython.codeplex.com/workitem/32502
User FrankSch1 has proposed the issue:
"Hi,
it seams that importing os.py in an restricted AppDomain fails with some error in WeakRef.
Sample code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Security;
using System.Security.Policy;
using System.Security.Permissions;
using System.Reflection;
using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
namespace SimpleAD
{
class Program
{
static void Main(string[] args)
{
string pyLibPath = @"<PathToIPLibFolder>";
string code = @"
print 'Importing sys and addding lib path'
import sys
sys.path.append('"+pyLibPath+@"')
print 'Importing os'
import os
print 'OS Name',os.name
print 'Done'
";
StrongName fullTrustAssembly =
typeof(Program).Assembly.Evidence.GetHostEvidence<StrongName>();
Evidence evi = AppDomain.CurrentDomain.Evidence;
AppDomainSetup adSetup = new AppDomainSetup();
adSetup.ApplicationBase =
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
/* THIS IS WORKING !
PermissionSet permSet = new
PermissionSet(PermissionState.Unrestricted);
*/
PermissionSet permSet = new
PermissionSet(PermissionState.None);
permSet.AddPermission(new
SecurityPermission(SecurityPermissionFlag.Execution));
permSet.AddPermission(new
ReflectionPermission(PermissionState.Unrestricted));
FileIOPermission libPerm = new
FileIOPermission(PermissionState.None);
libPerm.AddPathList(FileIOPermissionAccess.PathDiscovery |
FileIOPermissionAccess.Read, adSetup.ApplicationBase); // Assembly Path
libPerm.AddPathList(FileIOPermissionAccess.PathDiscovery |
FileIOPermissionAccess.Read, pyLibPath); // Iron-Python
Lib Path
permSet.AddPermission(libPerm);
AppDomain restricted =
AppDomain.CreateDomain("Sandbox",evi,adSetup,permSet,fullTrustAssembly);
Dictionary<string, object> options = new Dictionary<string,
object>();
ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(options);
ScriptRuntime runtime =
ScriptRuntime.CreateRemote(restricted, setup);
ScriptEngine engine = runtime.GetEngine("Python");
try
{
engine.Execute(code);
}
catch (Exception e)
{
(new PermissionSet(PermissionState.Unrestricted)).Assert();
Console.WriteLine("Error:" + e.ToString());
CodeAccessPermission.RevertAssert();
}
Console.ReadLine();
}
}
}
This is the exception which seams to point at the root cause of the issue:
[System.Security.SecurityException] = {"Request failed."}
at Microsoft.Scripting.Utils.WeakHandle..ctor(Object target, Boolean
trackResurrection)
at IronPython.Runtime.WeakRefTracker.CallbackInfo..ctor(Object
callback, Object weakRef)
at IronPython.Runtime.WeakRefTracker.ChainCallback(Object callback,
Object weakRef)
at IronPython.Runtime.WeakRefTracker..ctor(Object callback, Object
weakRef)
at
IronPython.Modules.PythonWeakRef.WeakRefHelpers.InitializeWeakRef(Object
self, Object target, Object callback)
at IronPython.Modules.PythonWeakRef.ref..ctor(Object object, Object
callback)
at IronPython.Modules.PythonWeakRef.ref..ctor(Object object)
at IronPython.Modules.PythonWeakRef.ref.__new__(CodeContext context,
PythonType cls, Object object)
at System.Func`4.Invoke(T1 arg1, T2 arg2, T3 arg3)
at
Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame
frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame
frame)"-----------------
6. [New comment] pyc.py: generates exes which fail on using std python libs
http://ironpython.codeplex.com/workitem/32420
User slide_o_mix has commented on the issue:
"So you think it would be good to have a way of embedding the stdlib as a zip into the executable instead of compiling it all up?"-----------------
7. [New comment] pyc.py: generates exes which fail on using std python libs
http://ironpython.codeplex.com/workitem/32420
User ddewaleffe has commented on the issue:
"My primary concern is to be able to produce a real standalone exe. 1 file to copy somewhere. No requirement to copy/install anything else. Dont care if big...
This first trial I made sort of partly work. For instance it works on:
import os.path
print "Hello"
print os.path.realpath('.')
print "running on", os.name
print "Bye"
But it does not (no error message at all) for pyc.py. Don't know why at the moment. It surely worth looking at why it fails....
Looking at the list of dependencies pulled in in each case, they are many.... so why not include the whole of stdlib at once instead of trying to analyze it by parsing at every compilation. This compiled version could be cached to avoid doing it every time...
Now we have 2 ways to do this:
a. package the zip file and rely on zimpimport doing its work
b. compile all the files of the library and package them all in the executable"
----------------------------------------------
----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.
To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20120329/4309cab3/attachment.html>
More information about the Ironpython-users
mailing list