quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Dumpleton (JIRA)" <j...@apache.org>
Subject [jira] Created: (MODPYTHON-11) Cross contamination of modules
Date Fri, 28 Jan 2005 09:00:17 GMT
Cross contamination of modules

         Key: MODPYTHON-11
         URL: http://issues.apache.org/jira/browse/MODPYTHON-11
     Project: mod_python
        Type: Bug
    Versions: 3.1.3    
    Reporter: Graham Dumpleton
    Priority: Minor

This carries on from MODPYTHON-10. In fixing MODPYTHON-10, this problem 
is likely to be addressed. Text taken from mailing list.

Cross contamination of modules

For the above case, change the code in "subdir-1/index.py" to:

  subdir1 = None
  def index():
    return "subdir-1",globals().keys()

and "subdir-2/index.py" to:

  subdir2 = None
  def index():
    return "subdir-2",globals().keys()

Accessing "subdir-1" the result is:

  ('subdir-1', ['index', '__mtime__', '__builtins__',
   '__file__', 'subdir1', '__name__', '__doc__'])

Now accessing "subdir-2" the result is:

  ('subdir-2', ['index', '__mtime__', '__builtins__',
   '__file__', 'subdir2', 'subdir1', '__name__', '__doc__'])

Back to "subdir-1" again:

  ('subdir-1', ['index', '__mtime__', '__builtins__',
   '__file__', 'subdir2', 'subdir1', '__name__', '__doc__'])

Because modules of the same name are reimported on top of the existing
module you can end up with cross contamination of modules in respect of
global variables, functions, class definitions, module imports etc.

The most obvious problem this causes with publisher, is that one can
suddenly have appear in a module a function from a different module. This
function then becomes accessible using an appropriate URL via the module
in which it doesn't belong.

Overall this is annoying and could be problematic for those unaware.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
If you want more information on JIRA, or have a bug to report see:

View raw message