#1 build problems, Python 1.6b1 + CXX 5.0b

closed-fixed
None
5
2003-11-27
2000-08-29
Alex Martelli
No

Win/98, VC++6.0 SP4, Python 1.6b1 (ActivePython 1.0),
CXX 5.0b (just downloaded off here).

Some of these may be problems with distutils (how can
I be sure...?), but as they all seem to be typical
of interactions with CXX, I think they belong here
(though some might forward them to distutils of course?).

install of CXX itself goes fine; problems emerge
installing (building, actually) Demo.

A warning: D:\Python16\CXX-5.0b\Demo>python setup.py install
running install
running build
running build_py
warning: build_py: package init file '.\__init__.py' not found (or not a regular
file)
running build_ext

Seems right -- no __init__.py in sight although Demo is called a package...?

An error: cxx is not a known extension for distutils for
SVC++ on Windows. Fix/workaround: add '.cxx' to list
at line 180 of distutil's msvccompiler.py:

_cpp_extensions = ['.cc','.cpp','.cxx'] # AM000829

Should it be there, or should CXX's Demo have cpp or cc
extensions?

A warning: /GX is missing yet Demo exensively uses/needs
it (for the standard libraries). Fix/workaround: add
/GX to the option lines at lines 223-224 of msvccompiler.py.
I guess this one must be a distutils issue (although it's
only revealed by compiling C++ extensions, so some
liaison with CXX should be needed...?).

Crash trying out the example:

D:\Python16\CXX-5.0b\Demo>python
ActivePython 1.6, build 100 (ActiveState Tool Corp.)
based on Python 1.6b1 (#0, Aug 23 2000, 13:42:10) [MSC 32 bit (Intel)] on win32
Copyright (c) Corporation for National Research Initiatives.
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
>>> import CXX.example
CXX is installed.
The support files you need are in the PYTHON/etc/CXX directory.
The include files are in the distutils include path already.
Just refer to them as "CXX/CXX_Objects.h", etc.

abnormal program termination

D:\Python16\CXX-5.0b\Demo>

No idea on this (yet). What exactly is going wrong...?

Ready to help with further diagnosis/whatever, let me
know...!

Alex (aleaxit@yahoo.com)

Discussion

  • More details on the "abnormal program termination" as
    reported (I forced debuginfo into the .pyd and placed a
    DebugBreak call to be able to follow step by step). The
    set (PyImport_ImportModule at line 1805 of Objects.hxx
    is where it's dying. PyImport_ImportModule is being
    called with argument "example" [but, shouldn't it be "CXX.example"?] and returning 0 as a result. So, when
    set calls validate, at line 136 that throws Exception().
    But nobody's doing a try/catch and apparently that throw
    unchains several NT (SEH) exceptions, leading in the end to access violations and that rather uninformative error message. Anything more I can do to help diagnose...?

    Alex

     
  • Alex Martelli
    Alex Martelli
    2000-08-30

    Yes, the import CXX.example vs import example issue does
    definitely come into it. If example is imported as a
    module of its own rather than a submodule of the CXX
    package then the import itself terminates OK...:

    Microsoft(R) Windows NT(TM)
    (C) Copyright 1985-1996 Microsoft Corp.

    D:\>cd \python16

    D:\Python16>cd cxx

    D:\Python16\CXX>python
    ActivePython 1.6, build 100 (ActiveState Tool Corp.)
    based on Python 1.6b1 (#0, Aug 23 2000, 13:42:10) [MSC 32 bit (Intel)] on win32
    Copyright (c) Corporation for National Research Initiatives.
    Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
    >>> import example
    >>> dir(example)
    ['__doc__', '__file__', '__name__', 'a_constant', 'kw', 'r', 'sum', 'test']
    >>>

    and running example.test appears very good too:

    >>> example.test()
    Correctly caught CXX: type error.
    Exception value: CXX: type error.
    Exception traceback: None
    Numbers: ok
    String: ok
    List: ok
    Dict: ok
    Tuple: ok
    STL test: ok
    Extension object test: ok.
    Module test ok.
    >>>

    So it seems all about example "not knowing" it's supposed
    to be a submodule of CXX package (and some big issue with
    error handling for this specific error...?).

    I'll keep trying to use the new CXX and report any problems
    I may have (or should I use the newsgroup, or ... ???).

    Alex

     
  • Hi,
    When I was trying CXX with Python 2.0b1 on Win2k I did encounter crashes. I managed to fix the problem by modifying the constructor of the class PythonExtension (Extensions.hxx: line 448)
    to be like this:

    explicit PythonExtension()
    : PythonExtensionBase()
    {
    ob_refcnt = 1;
    ob_type = type_object();

    // every object must suport getattr
    behaviors().supportGetattr();

    PyObject_INIT(this, type_object() );
    }

    Kostas (karanikolas@cs.man.ac.uk)

     
    • status: open --> closed
     
    • assigned_to: nobody --> barry-scott
    • status: closed --> closed-fixed
     
  • Logged In: YES
    user_id=28665

    I think this has been fixed. There where a number of changes
    to allow an extension to be part of a package made.