8000 DOC: Add a note on the iso_c2py_map implementation · numpy/numpy@605c627 · GitHub
[go: up one dir, main page]

Skip to content

Commit 605c627

Browse files
committed
DOC: Add a note on the iso_c2py_map implementation
1 parent dc29583 commit 605c627

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

numpy/f2py/_isocbind.py

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -83,37 +83,42 @@
8383
'char': 'c', # char
8484
}
8585

86-
iso_c2py_map = {
87-
'int': 'int',
88-
'short int': 'int', # forced casting
89-
'long': 'int',
90-
'long long': 'long',
91-
'signed char': 'int', # forced casting
92-
'size_t': 'int', # approx Python int
93-
'int8_t': 'int', # forced casting
94-
'int16_t': 'int', # forced casting
95-
'int32_t': 'int',
96-
'int64_t': 'long',
97-
'int_least8_t': 'int', # forced casting
98-
'int_least16_t': 'int', # forced casting
99-
'int_least32_t': 'int',
100-
'int_least64_t': 'long',
101-
'int_fast8_t': 'int', # forced casting
102-
'int_fast16_t': 'int', # forced casting
103-
'int_fast32_t': 'int',
104-
'int_fast64_t': 'long',
105-
'intmax_t': 'long',
106-
'intptr_t': 'long',
107-
'ptrdiff_t': 'long',
108-
'float': 'float',
109-
'double': 'float', # forced casting
110-
'long double': 'float', # forced casting
111-
'float _Complex': 'complex', # forced casting
112-
'double _Complex': 'complex',
113-
'long double _Complex': 'complex', # forced casting
114-
'_Bool': 'bool',
115-
'char': 'bytes', # approx Python bytes
116-
}
86+
# TODO: At some point these should be included, but then they'd need special
87+
# handling in cfuncs.py e.g. needs[int64_t_from_pyobj] These are not very hard
88+
# to add, since they all derive from the base `int_from_pyobj`, e.g. the way
89+
# `short_from_pyobj` and others do
90+
iso_c2py_map = {}
91+
# iso_c2py_map = {
92+
# 'int': 'int',
93+
# 'short int': 'int', # forced casting
94+
# 'long': 'int',
95+
# 'long long': 'long',
96+
# 'signed char': 'int', # forced casting
97+
# 'size_t': 'int', # approx Python int
98+
# 'int8_t': 'int', # forced casting
99+
# 'int16_t': 'int', # forced casting
100+
# 'int32_t': 'int',
101+
# 'int64_t': 'long',
102+
# 'int_least8_t': 'int', # forced casting
103+
# 'int_least16_t': 'int', # forced casting
104+
# 'int_least32_t': 'int',
105+
# 'int_least64_t': 'long',
106+
# 'int_fast8_t': 'int', # forced casting
107+
# 'int_fast16_t': 'int', # forced casting
108+
# 'int_fast32_t': 'int',
109+
# 'int_fast64_t': 'long',
110+
# 'intmax_t': 'long',
111+
# 'intptr_t': 'long',
112+
# 'ptrdiff_t': 'long',
113+
# 'float': 'float',
114+
# 'double': 'float', # forced casting
115+
# 'long double': 'float', # forced casting
116+
# 'float _Complex': 'complex', # forced casting
117+
# 'double _Complex': 'complex',
118+
# 'long double _Complex': 'complex', # forced casting
119+
# '_Bool': 'bool',
120+
# 'char': 'bytes', # approx Python bytes
121+
# }
117122

118123
isoc_kindmap = {}
119124
for fortran_type, c_type_dict in iso_c_binding_map.items():

numpy/f2py/cfuncs.py

Lines c 6FEE hanged: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,8 @@
822822
}
823823
"""
824824

825+
# TODO: These should be dynamically generated, too many mapped to int things,
826+
# see note in _isocbind.py
825827
needs['char_from_pyobj'] = ['int_from_pyobj']
826828
cfuncs['char_from_pyobj'] = """
827829
static int

0 commit comments

Comments
 (0)
0