Skip to content

Commit c70fd36

Browse files
authored
use dtype's fields PyObject* now (#170)
* use dtype's fields PyObject* now * bump version for this to 3.4.4
1 parent c03f987 commit c70fd36

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/pdal/PyArray.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ Array::Array(PyArrayObject* array) : m_array(array), m_rowMajor(true)
9797
PyArray_Descr *dtype = PyArray_DTYPE(m_array);
9898
npy_intp ndims = PyArray_NDIM(m_array);
9999
npy_intp *shape = PyArray_SHAPE(m_array);
100-
int numFields = (dtype->fields == Py_None) ?
100+
101+
PyObject* fields = PyDataType_FIELDS(dtype);
102+
int numFields = (fields == Py_None) ?
101103
0 :
102-
static_cast<int>(PyDict_Size(dtype->fields));
104+
static_cast<int>(PyDict_Size(fields));
103105

104106
int xyz = 0;
105107
if (numFields == 0)
@@ -110,7 +112,7 @@ Array::Array(PyArrayObject* array) : m_array(array), m_rowMajor(true)
110112
}
111113
else
112114
{
113-
PyObject *names_dict = dtype->fields;
115+
PyObject *names_dict = fields;
114116
PyObject *names = PyDict_Keys(names_dict);
115117
PyObject *values = PyDict_Values(names_dict);
116118
if (!names || !values)

src/pdal/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__all__ = ["Pipeline", "Stage", "Reader", "Filter", "Writer", "dimensions", "info"]
2-
__version__ = '3.4.3'
2+
__version__ = '3.4.4'
33

44
from . import libpdalpython
55
from .drivers import inject_pdal_drivers

src/pdal/__main__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def print_version(args):
4848

4949
line = '----------------------------------------------------------------------------------------------------------------------------\n'
5050
version = f'PDAL version {pdal_version}\nPython bindings version {__version__}\n'
51-
plugin = f"Environment-set PDAL_DRIVER_PATH: {os.environ['PDAL_DRIVER_PATH']}"
51+
driver_path = 'PDAL_DRIVER_PATH not set!'
52+
if 'PDAL_DRIVER_PATH' in os.environ:
53+
driver_path = os.environ['PDAL_DRIVER_PATH']
54+
plugin = f"Environment-set PDAL_DRIVER_PATH: {driver_path}"
5255
output = f'{line}{version}{plugin}\n{line}\n{debug}'
5356
print (output)
5457

0 commit comments

Comments
 (0)