# Process finished with exit code -1073741819 (0xC0000005)

**URL:** <https://numba.discourse.group/t/process-finished-with-exit-code-1073741819-0xc0000005/556>\
**Category:** Support: What is this error message?\
**Created:** [February 25, 2021, 3:03pm UTC](https://numba.discourse.group/t/process-finished-with-exit-code-1073741819-0xc0000005/556 "2021-02-25T15:03:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![numbaproblems](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@numbaproblems](https://numba.discourse.group/u/numbaproblems)\
**Post date:** [February 25, 2021, 3:03pm UTC](https://numba.discourse.group/t/process-finished-with-exit-code-1073741819-0xc0000005/556/1 "2021-02-25T15:03:49Z")

</div>

Hello, I have a problem that is driving me crazy for the past days.

I have a function that uses jit (intersects\_numba) which is called in another function (ray\_intersection) that is used for ray tracing. If I obtain the objects that are arguments in the ray tracing function by simply creating them as outputs of other individual functions the script runs without any problems.  
The problem occurs when I create those objects in a function that contains inside the smaller functions and I have all the objects as outputs of that said function.  
After I do that, even though the objects are the same in the two cases, PyCharm is crashing in the intersects\_numba function.

The code that I will share is the smallest reproducible one that I could create to show the error, since the full code is confidential.

```
from shapely.geometry import Polygon, Point, LineString
import numpy as np
from shapely.geos import lgeos
from numba import jit

GEOSContains_ctypes = lgeos._lgeos.GEOSContains_r
GEOSIntersects_r = lgeos._lgeos.GEOSIntersects_r
GEOS_HANDLE = lgeos.geos_handle

def get_all(polygon_a):
    polygon_shapely_a = np.array([Polygon(section_polygon) for section_polygon in polygon_a])
    polygon_geom = np.array([x._geom for x in polygon_shapely_a])

    return polygon_geom

@jit(nopython=True)
def intersects_numba(p_geom, array_geom, geos_handle):
    n = array_geom.shape[0]
    res = np.array([GEOSIntersects_r(geos_handle, p_geom, array_geom[i]) for i in range(n)])
    return res

def ray_intersection(ray_geom, polygon_geom):
    int_array = []
    for ii, line_string in enumerate(ray_geom):
        bool_array = intersects_numba(line_string, polygon_geom, GEOS_HANDLE)
        print(bool_array)
        int_array.append(bool_array)
    return int_array

def rt_arrays(ray, polygon_geom):
    linestring_ray = [LineString(linestring) for linestring in ray]
    geom_ray = np.array([x._geom for x in linestring_ray])
    int_arr = ray_intersection(geom_ray, polygon_geom)
    a = 2 + 2
    return a

polygon_list = [[[0.0, 0.0], [2500.0, 0.0], [2493.91, 174.391], [0.0, 0.0]],
                [[0.0, 0.0], [2493.91, 174.391], [2475.67, 347.933], [0.0, 0.0]],
                [[0.0, 0.0], [2475.67, 347.933], [2445.369, 519.779], [0.0, 0.0]],
                [[0.0, 0.0], [2445.369, 519.779], [2403.154, 689.093], [0.0, 0.0]],
                [[0.0, 0.0], [2403.154, 689.093], [2349.232, 855.05], [0.0, 0.0]],
                [[0.0, 0.0], [2349.232, 855.05], [2283.864, 1016.842], [0.0, 0.0]],
                [[0.0, 0.0], [2283.864, 1016.842], [2207.369, 1173.679], [0.0, 0.0]],
                [[0.0, 0.0], [2207.369, 1173.679], [2120.12, 1324.798], [0.0, 0.0]],
                [[0.0, 0.0], [2120.12, 1324.798], [2022.542, 1469.463], [0.0, 0.0]],
                [[0.0, 0.0], [2022.542, 1469.463], [1915.111, 1606.969], [0.0, 0.0]],
                [[0.0, 0.0], [1915.111, -1606.969], [2022.542, -1469.463], [0.0, 0.0]],
                [[0.0, 0.0], [2022.542, -1469.463], [2120.12, -1324.798], [0.0, 0.0]],
                [[0.0, 0.0], [2120.12, -1324.798], [2207.369, -1173.679], [0.0, 0.0]],
                [[0.0, 0.0], [2207.369, -1173.679], [2283.864, -1016.842], [0.0, 0.0]],
                [[0.0, 0.0], [2283.864, -1016.842], [2349.232, -855.05], [0.0, 0.0]],
                [[0.0, 0.0], [2349.232, -855.05], [2403.154, -689.093], [0.0, 0.0]],
                [[0.0, 0.0], [2403.154, -689.093], [2445.369, -519.779], [0.0, 0.0]],
                [[0.0, 0.0], [2445.369, -519.779], [2475.67, -347.933], [0.0, 0.0]],
                [[0.0, 0.0], [2475.67, -347.933], [2493.91, -174.391], [0.0, 0.0]],
                [[0.0, 0.0], [2493.91, -174.391], [2500.0, 0.0], [0.0, 0.0]]]
ray = [[[3.603, 16.128, 11.55], [2003.603, 16.128, 11.55]],
       [[3.603, 16.128, 11.55], [2003.2983900000002, 51.03281, 11.55]]]

polygon_geom_a = get_all(polygon_list)
a = rt_arrays(ray, polygon_geom_a)

```

> Process finished with exit code -1073741819 (0xC0000005)

If I don’t use the get\_all() function to create the polygon\_geom object (In reality I create some other objects as well) the script is executed without a problem.

```
polygon_shapely_a = np.array([Polygon(section_polygon) for section_polygon in polygon_list])
polygon_geom_a = np.array([x._geom for x in polygon_shapely_a])

a = rt_arrays(ray, polygon_geom_a)

```

`Process finished with exit code 0`

I’d appreciate any help on this, If I wasn’t specific enough I’ll answer your questions. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![sklam](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/sklam/32/9_2.png) [@sklam](https://numba.discourse.group/u/sklam)\
**Post date:** [February 26, 2021, 3:15pm UTC](https://numba.discourse.group/t/process-finished-with-exit-code-1073741819-0xc0000005/556/2 "2021-02-26T15:15:52Z")

</div>

When I remove the `@jit` decorator, I see there’s an error in:

```python
  File "iss_discourse.py", line 21, in <listcomp>
    res = np.array([GEOSIntersects_r(geos_handle, p_geom, array_geom[i]) for i in range(n)])
ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

```

---

<div class="post-metadata">

**Author:** ![numbaproblems](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@numbaproblems](https://numba.discourse.group/u/numbaproblems)\
**Post date:** [February 26, 2021, 8:48pm UTC](https://numba.discourse.group/t/process-finished-with-exit-code-1073741819-0xc0000005/556/4 "2021-02-26T20:48:33Z")

</div>

That is because Cython doesn’t recognize the int64 data type. Numba does though.
