Skip to content

Commit 709e7a8

Browse files
committed
Remove option, always access wrapped members as shared refs
1 parent 7752f2c commit 709e7a8

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

bin/c++2py.in

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ parser.add_argument('--includes', '-I', action='append', help='Includes to pass
3737
parser.add_argument('--system_includes', '-isystem', action='append', help='System includes to pass to clang')
3838
parser.add_argument('--cxxflags', default = '', help='Options to pass to clang')
3939
parser.add_argument('--target_file_only', action='store_true', help='Disable recursion into included header files')
40-
parser.add_argument('--wrapped_members_as_shared_refs', action='store_true', help='Disable recursion into included header files')
4140

4241
args = parser.parse_args()
4342

@@ -78,8 +77,7 @@ W= Cpp2Desc(filename = args.filename,
7877
shell_command = shell_command,
7978
parse_all_comments = args.parse_all_comments,
8079
namespace_to_factor= (), # unused now
81-
target_file_only = args.target_file_only,
82-
wrapped_members_as_shared_refs = args.wrapped_members_as_shared_refs
80+
target_file_only = args.target_file_only
8381
)
8482

8583
# Make the desc file

cpp2py/cpp2desc.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Cpp2Desc:
88
""" """
99
def __init__(self, filename, namespaces=(), classes= (), namespace_to_factor= (), appname= '',
1010
modulename = '', moduledoc ='', use_properties = False, members_read_only = True, converters = (),
11-
compiler_options=None, includes= None, system_includes= None, libclang_location = None, shell_command = '', parse_all_comments = True, target_file_only = False, wrapped_members_as_shared_refs = False):
11+
compiler_options=None, includes= None, system_includes= None, libclang_location = None, shell_command = '', parse_all_comments = True, target_file_only = False):
1212
"""
1313
Parse the file at construction
1414
@@ -59,12 +59,9 @@ def __init__(self, filename, namespaces=(), classes= (), namespace_to_factor= ()
5959
6060
target_file_only : bool
6161
Neglect any included files during desc generation [default = False]
62-
63-
wrapped_members_as_shared_refs : bool
64-
For classes with members which are a wrapped type, do not copy them on access but return them as shared references instead. Note that members with types that are only converted (e.g. std::vector) will continue to be copied on access [default = False]
6562
"""
66-
for x in ['filename', 'namespaces', 'classes', 'namespace_to_factor', 'appname', 'modulename', 'moduledoc',
67-
'use_properties', 'members_read_only', 'shell_command', 'target_file_only', 'wrapped_members_as_shared_refs']:
63+
for x in ['filename', 'namespaces', 'classes', 'namespace_to_factor', 'appname', 'modulename', 'moduledoc',
64+
'use_properties', 'members_read_only', 'shell_command', 'target_file_only']:
6865
setattr(self, x, locals()[x])
6966
self.DE = dependency_analyzer.DependencyAnalyzer(converters)
7067
# parse the file

cpp2py/mako/desc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from cpp2py.wrap_generator import *
44

55
# The module
6-
module = module_(full_name = "${W.modulename}", doc = r"${doc.replace_latex(W.moduledoc)}", app_name = "${W.appname}", wrapped_members_as_shared_refs = ${W.wrapped_members_as_shared_refs})
6+
module = module_(full_name = "${W.modulename}", doc = r"${doc.replace_latex(W.moduledoc)}", app_name = "${W.appname}")
77

88
# Imports
99
%if import_list:

cpp2py/mako/wrap.cxx

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#include<iostream> //for std::cout...
55
using dcomplex = std::complex<double>;
66

7-
// global options
8-
constexpr bool wrapped_members_as_shared_refs = ${int(module.wrapped_members_as_shared_refs)};
9-
107
// first the basic stuff
118
#include <cpp2py.hpp>
129
#include <cpp2py/converters/string.hpp>

cpp2py/wrap_generator.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ class module_ :
680680
"""
681681
Representation of a module
682682
"""
683-
def __init__(self, full_name, doc = '', app_name = None, wrapped_members_as_shared_refs = False) :
683+
def __init__(self, full_name, doc = '', app_name = None) :
684684
"""
685685
Parameters
686686
----------
@@ -693,7 +693,6 @@ def __init__(self, full_name, doc = '', app_name = None, wrapped_members_as_sha
693693
694694
"""
695695
self.full_name = full_name if app_name is None or app_name=="triqs" else app_name+"."+full_name
696-
self.wrapped_members_as_shared_refs = wrapped_members_as_shared_refs
697696
self.name = full_name.rsplit('.',1)[-1]
698697
self.doc = doc
699698
self.classes = {} # dict : string -> class_. Key is the Python type

include/cpp2py/py_converter.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ namespace cpp2py {
115115
if (p == nullptr) return NULL;
116116
py_type *self = (py_type *)p->tp_alloc(p, 0);
117117
if (self != NULL) {
118-
if constexpr (is_ref && wrapped_members_as_shared_refs) {
118+
if constexpr (is_ref) {
119119
// Keep parent alive for lifetime of self
120120
if (parent != nullptr) {
121121
self->parent = parent;

0 commit comments

Comments
 (0)