Skip to content

Commit c23dc90

Browse files
committed
Fixed CachedProperty.kwargs being shared.
1 parent 6309dd3 commit c23dc90

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

src/core/modules/core/core_cache.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
//-----------------------------------------------------------------------------
3737
CCachedProperty::CCachedProperty(
3838
object fget=object(), object fset=object(), object fdel=object(), object doc=object(),
39-
bool unbound=false, boost::python::tuple args=boost::python::tuple(), dict kwargs=dict())
39+
bool unbound=false, boost::python::tuple args=boost::python::tuple(), object kwargs=object())
4040
{
4141
set_getter(fget);
4242
set_setter(fset);
@@ -46,7 +46,11 @@ CCachedProperty::CCachedProperty(
4646
m_bUnbound = unbound;
4747

4848
m_args = args;
49-
m_kwargs = kwargs;
49+
50+
if (!kwargs.is_none())
51+
m_kwargs = extract<dict>(kwargs);
52+
else
53+
m_kwargs = dict();
5054
}
5155

5256

@@ -335,7 +339,7 @@ void CCachedProperty::__setitem__(str item, object value)
335339

336340
CCachedProperty *CCachedProperty::wrap_descriptor(
337341
object descriptor, object owner, str name,
338-
bool unbound, boost::python::tuple args, dict kwargs)
342+
bool unbound, boost::python::tuple args, object kwargs)
339343
{
340344
CCachedProperty *pProperty = new CCachedProperty(
341345
descriptor.attr("__get__"), descriptor.attr("__set__"), descriptor.attr("__delete__"),

src/core/modules/core/core_cache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CCachedProperty
4242
public:
4343
CCachedProperty(
4444
object fget, object fset, object fdel, object doc, bool unbound,
45-
boost::python::tuple args, dict kwargs
45+
boost::python::tuple args, object kwargs
4646
);
4747

4848
static object _callable_check(object function, const char *szName);
@@ -77,7 +77,7 @@ class CCachedProperty
7777

7878
static CCachedProperty *wrap_descriptor(
7979
object descriptor, object owner=object(), str name=str(),
80-
bool unbound=false, boost::python::tuple args=boost::python::tuple(), dict kwargs=dict()
80+
bool unbound=false, boost::python::tuple args=boost::python::tuple(), object kwargs=object()
8181
);
8282

8383
private:

src/core/modules/core/core_cache_wrap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ void export_cached_property(scope _cache)
5454
{
5555
class_<CCachedProperty, CCachedProperty *> CachedProperty(
5656
"CachedProperty",
57-
init<object, object, object, object, bool, boost::python::tuple, dict>(
57+
init<object, object, object, object, bool, boost::python::tuple, object>(
5858
(
5959
arg("self"), arg("fget")=object(), arg("fset")=object(), arg("fdel")=object(), arg("doc")=object(),
60-
arg("unbound")=false, arg("args")=boost::python::tuple(), arg("kwargs")=dict()
60+
arg("unbound")=false, arg("args")=boost::python::tuple(), arg("kwargs")=object()
6161
),
6262
"Represents a property attribute that is only"
6363
" computed once and cached.\n"

0 commit comments

Comments
 (0)