__module__ of FunctionType

View: New views
3 Messages — Rating Filter:   Alert me  

__module__ of FunctionType

by Seo Sanghyeon-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Following program prints different result between CPython and IronPython:

def f(): pass
print type(f).__module__

CPython: __builtin__
IronPython: <property# __module__ on function>

This breaks codes which assume __module__ is a string.

--
Seo Sanghyeon
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: __module__ of FunctionType

by Dino Viehland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looks like this is because type.__module__ is not a data descriptor.

I believe I have a fix.

-----Original Message-----
From: users-bounces@... [mailto:users-bounces@...] On Behalf Of Seo Sanghyeon
Sent: Wednesday, June 17, 2009 3:04 AM
To: Discussion of IronPython
Subject: [IronPython] __module__ of FunctionType

Following program prints different result between CPython and IronPython:

def f(): pass
print type(f).__module__

CPython: __builtin__
IronPython: <property# __module__ on function>

This breaks codes which assume __module__ is a string.

--
Seo Sanghyeon
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: __module__ of FunctionType

by Dino Viehland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is now fixed in the latest sources (and strerror is now implemented as well).

-----Original Message-----
From: users-bounces@... [mailto:users-bounces@...] On Behalf Of Seo Sanghyeon
Sent: Wednesday, June 17, 2009 3:04 AM
To: Discussion of IronPython
Subject: [IronPython] __module__ of FunctionType

Following program prints different result between CPython and IronPython:

def f(): pass
print type(f).__module__

CPython: __builtin__
IronPython: <property# __module__ on function>

This breaks codes which assume __module__ is a string.

--
Seo Sanghyeon
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@...
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com