8000 BUG, ENH: Fix ``iso_c_binding`` type maps and fix ``bind(c)`` support by HaoZeke · Pull Request #24555 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG, ENH: Fix iso_c_binding type maps and fix bind(c) support #24555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MAINT: Move into private module
  • Loading branch information
HaoZeke committed Aug 26, 2023
commit e2a230b5a94063e8e8a11bea10de7956ec762d50
41 changes: 41 additions & 0 deletions numpy/f2py/_isocbind.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
iso_c_binding_map = {
'integer': {
'c_int': 'int',
'c_short': 'short int',
'c_long': 'long int',
'c_long_long': 'long long int',
'c_signed_char': 'signed char',
'c_size_t': 'size_t',
'c_int8_t': 'int8_t',
'c_int16_t': 'int16_t',
'c_int32_t': 'int32_t',
'c_int64_t': 'int64_t',
'c_int_least8_t': 'int_least8_t',
'c_int_least16_t': 'int_least16_t',
'c_int_least32_t': 'int_least32_t',
'c_int_least64_t': 'int_least64_t',
'c_int_fast8_t': 'int_fast8_t',
'c_int_fast16_t': 'int_fast16_t',
'c_int_fast32_t': 'int_fast32_t',
'c_int_fast64_t': 'int_fast64_t',
'c_intmax_t': 'intmax_t',
'c_intptr_t': 'intptr_t',
'c_ptrdiff_t': 'intptr_t',
},
'real': {
'c_float': 'float',
'c_double': 'double',
'c_long_double': 'long double'
},
'complex': {
'c_float_complex': 'float _Complex',
'c_double_complex': 'double _Complex',
'c_long_double_complex': 'long double _Complex'
},
'logical': {
'c_bool': '_Bool'
},
'character': {
'c_char': 'char'
}
}
43 changes: 1 addition & 42 deletions numpy/f2py/capi_maps.py
4A12
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
from .crackfortran import markoutercomma
from . import cb_rules
from ._isocbind import iso_c_binding_map

# The environment provided by auxfuncs.py is needed for some calls to eval.
# As the needed functions cannot be determined by static inspection of the
Expand Down Expand Up @@ -130,48 +131,6 @@
'byte': {'': 'char'},
}

iso_c_binding_map = {
'integer': {
'c_int': 'int',
'c_short': 'short int',
'c_long': 'long int',
'c_long_long': 'long long int',
'c_signed_char': 'signed char',
'c_size_t': 'size_t',
'c_int8_t': 'int8_t',
'c_int16_t': 'int16_t',
'c_int32_t': 'int32_t',
'c_int64_t': 'int64_t',
'c_int_least8_t': 'int_least8_t',
'c_int_least16_t': 'int_least16_t',
'c_int_least32_t': 'int_least32_t',
'c_int_least64_t': 'int_least64_t',
'c_int_fast8_t': 'int_fast8_t',
'c_int_fast16_t': 'int_fast16_t',
'c_int_fast32_t': 'int_fast32_t',
'c_int_fast64_t': 'int_fast64_t',
'c_intmax_t': 'intmax_t',
'c_intptr_t': 'intptr_t',
'c_ptrdiff_t': 'intptr_t',
},
'real': {
'c_float': 'float',
'c_double': 'double',
'c_long_double': 'long double'
},
'complex': {
'c_float_complex': 'float _Complex',
'c_double_complex': 'double _Complex',
'c_long_double_complex': 'long double _Complex'
},
'logical': {
'c_bool': '_Bool'
},
'character': {
'c_char': 'char'
}
}

f2cmap_all = deep_merge(f2cmap_all, iso_c_binding_map)
f2cmap_default = copy.deepcopy(f2cmap_all)

Expand Down
0