geoarrow / geoarrow-c

Experimental C and C++ implementation of the GeoArrow specification
http://geoarrow.org/geoarrow-c/
Apache License 2.0
23 stars 3 forks source link

[python] Prevent low-level classes to be instantiated (segfaults) #64

Closed jorisvandenbossche closed 12 months ago

jorisvandenbossche commented 1 year ago

This should probably not be done by a user, but we can avoid the __init__ being callable to prevent this:

In [22]: from geoarrow.c._lib import CVectorType

In [23]: CVectorType()
Out[23]: terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
Aborted (core dumped)
paleolimbot commented 1 year ago

Seems helpful to prevent!

Something like:

cdef class CVectorType:

    def __init__(self):
        # ??? something here?