Issue222836

classification
Title: package\__init__ making changes to sys.modules
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: bckfnn
Priority: low Keywords:

Created on 2000-11-18.19:24:21 by bckfnn, last changed 2000-11-18.19:24:21 by bckfnn.

Messages
msg119 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.19:24:21
A small difference between JPython 1.1b4 and CPython 1.5.2. In CPython a package
initialization can change its own slot in sys.modules. This allow
pkg\__init__.py to controll what will be returned by a "import pkg". In JPython
"import pkg" always return the PyModule containing the pkg.__init__.

PMW uses this trick to return a specifik version of of the PMW toolkit.


------------------ FILE: test173.py ------------------ 

import test173p
print test173p

------------------ END ------------------ 

------------------ FILE: test173p\__init__.py ------------------ 

import sys 
sys.modules['test173p'] = sys

------------------ END ------------------ 


Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import test173
<module 'sys' (built-in)>
>>>


JPython 1.1beta4 on java1.3beta (JIT: null)
Copyright (C) 1997-1999 Corporation for National Research Initiatives
>>> import test173
<module test173p at 2864404>
>>>
History
Date User Action Args
2000-11-18 19:24:21bckfnncreate