2011/9/20 D. Barbier <bou...@gmail.com>

> On 2011/9/1 D. Barbier wrote:
> [...]
> >  $ LD_LIBRARY_PATH=$HOME/oce-dev/lib python test_all.py
> >  Traceback (most recent call last):
> >    File "test_all.py", line 29, in <module>
> >      import topology_operations_unittest
> >    File
> "/home/barbier/Projects/pythonocc/src/unittest/topology_operations_unittest.py",
> > line 34, in <module>
> >      from OCC.Utils.Construct import *
> >    File
> "/home/barbier/.local/lib/python2.6/site-packages/OCC/Utils/Construct.py",
> > line 50, in <module>
> >      from OCC.GEOMAlgo import GEOMAlgo_Splitter
> >  ImportError: No module named GEOMAlgo
>
> I modified Construct.py to not import GEOM,


You're right, the depency of Construct.py with GEOM should be removed. It's
a recent commit that is not consistent with the optional GEOM wrapper.


> but get now a segmentation fault:
>  testHash (wrapper_features_unittest.TestWrapperFeatures) ... Test:
> __hash__ overloading
>  Segmentation fault
>
> More precisely:
>  $ python
>  Python 2.6.7 (r267:88850, Aug  3 2011, 11:33:52)
>  [GCC 4.6.1] on linux2
>  Type "help", "copyright", "credits" or "license" for more information.
>  >>> import OCC.Standard
>  >>> s = OCC.Standard.Standard_Transient()
>  >>> hash1_s = s.__hash__()
>  >>> hash2_s = s.HashCode(pow(2,31)-1)
>  Segmentation fault
>
> But also:
>  $ python
>  Python 2.6.7 (r267:88850, Aug  3 2011, 11:33:52)
>  [GCC 4.6.1] on linux2
>  Type "help", "copyright", "credits" or "license" for more information.
>  >>> import OCC.Standard
>  >>> s = OCC.Standard.Standard_Transient()
>  >>> hash2_s = s.HashCode(pow(2,31)-1)
>  >>> hash1_s = s.__hash__()
>  Segmentation fault
>
> and even
>
>  $ python
>  Python 2.6.7 (r267:88850, Aug  3 2011, 11:33:52)
>  [GCC 4.6.1] on linux2
>  Type "help", "copyright", "credits" or "license" for more information.
>  >>> import OCC.Standard
>  >>> s = OCC.Standard.Standard_Transient()
>  >>> hash1_s = s.__hash__()
>  >>> hash1_s = s.__hash__()
>  Segmentation fault
>
> Any idea about what is going on?
>

When compiling pythonocc, you must pass -D__PYTHONOCCOCC_MAXINT__ integer.
It's equal to 2^32-1 on 32bit platforms, 2^64-1 on 64bit. This is computed
from the file environment.py (
https://github.com/tpaviot/pythonocc/blob/master/src/wrapper/environment.py)
called when compiling pythonocc from the setup.py script.

The __hash__() method does not take any argument. It is a wrapper for the
HashCode method and is is defined in the SWIG file as:

%extend Standard_Transient {

        Standard_Integer __hash__() {
        return $self->HashCode(__PYTHONOCC_MAXINT__);
        }
};

 (see for instance the file Standard.i at
https://github.com/tpaviot/pythonocc/blob/master/src/wrapper/SWIG/linux_darwin/Standard.i
).


> Denis
>

Thomas
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to