[Python.NET] [PythonNet] 5/ 2 Resolve "Strange errors"

Collector: Python for .NET Issue ... pythondotnet at python.org
Fri Apr 1 05:19:37 CEST 2005


Issue #5 Update (Resolve) "Strange errors"
 Status Resolved, General/bug medium
To followup, visit:
  http://www.zope.org/Members/Brian/PythonNet/Collector/5

==============================================================
= Resolve - Entry #2 by Brian on Mar 31, 2005 10:19 pm

 Status: Pending => Resolved

This is fixed for b6 - due to an ill-advised decref 
of globals that only happens when the CLR module is 
imported into an existing Python interpreter...

-BL
________________________________________
= Request - Entry #1 by Anonymous User on Mar 1, 2005 5:35 pm

There seems to be some sort of strange crash occurring when importing CLR in the interactive prompt.  It doesn't occur when executing a script from a file or in shells like PyCrust.  Also, it does not happen at all in Python 2.3/PythonNET beta 3.

Importing CLR seems to wreak havoc with the interpreter:

    Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import CLR
    >>> print dir()
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    NameError: name 'dir' is not defined
    >>> print dir(__import__)
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    NameError: name 'dir' is not defined
    >>> print __import__
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    NameError: name '__import__' is not defined
    >>> __import__
    Fatal Python error: GC object already tracked
    
    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

Keeping a reference to globals() seems to suppress it:

    D:\Python24>python.exe
    Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> a=globals()
    >>> import CLR
    >>> dir()
    ['CLR', '__builtins__', '__doc__', '__name__', 'a']
    >>> __import__
    <built-in function __import__>

==============================================================



More information about the PythonDotNet mailing list