private-attribute-cpp 2.1.17__tar.gz → 2.1.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {private_attribute_cpp-2.1.17/private_attribute_cpp.egg-info → private_attribute_cpp-2.1.18}/PKG-INFO +1 -1
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/private_attribute.cpp +118 -47
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18/private_attribute_cpp.egg-info}/PKG-INFO +1 -1
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/setup.py +1 -1
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/LICENSE +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/MANIFEST.in +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/README.md +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/picosha2.h +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/private_attribute.pyi +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/SOURCES.txt +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/private_attribute_cpp.egg-info/top_level.txt +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/setup.cfg +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_attr_classify_owner.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_class_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_gc_collect.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_abc.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_func.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_inheritance.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_method.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_wrap.py +0 -0
- {private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_slots_cycle.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.18
|
|
4
4
|
Summary: A Python package that provides a way to define private attributes in C++ implementation.
|
|
5
5
|
Home-page: https://github.com/Locked-chess-official/private_attribute_cpp
|
|
6
6
|
Author: HuangHaoHua
|
|
@@ -1120,41 +1120,67 @@ PrivateWrap_descrset(PyObject* obj, PyObject* name, PyObject* value) noexcept
|
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
1122
1122
|
|
|
1123
|
+
static int
|
|
1124
|
+
PrivateWrap_traverse(PyObject* obj, visitproc visit, void* arg) noexcept
|
|
1125
|
+
{
|
|
1126
|
+
PrivateWrapObject* self = (PrivateWrapObject*)obj;
|
|
1127
|
+
if (self->result) {
|
|
1128
|
+
Py_VISIT(self->result);
|
|
1129
|
+
}
|
|
1130
|
+
if (self->func_list) {
|
|
1131
|
+
Py_VISIT(self->func_list);
|
|
1132
|
+
}
|
|
1133
|
+
return 0;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
static int
|
|
1137
|
+
PrivateWrap_clear(PyObject* obj) noexcept
|
|
1138
|
+
{
|
|
1139
|
+
PrivateWrapObject* self = (PrivateWrapObject*)obj;
|
|
1140
|
+
if (self->result) {
|
|
1141
|
+
Py_CLEAR(self->result);
|
|
1142
|
+
}
|
|
1143
|
+
if (self->func_list) {
|
|
1144
|
+
Py_CLEAR(self->func_list);
|
|
1145
|
+
}
|
|
1146
|
+
return 0;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1123
1149
|
static PyTypeObject PrivateWrapType = {
|
|
1124
1150
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
1125
|
-
"_PrivateWrap",
|
|
1126
|
-
sizeof(PrivateWrapObject),
|
|
1127
|
-
0,
|
|
1128
|
-
(destructor)PrivateWrap_dealloc,
|
|
1129
|
-
0,
|
|
1130
|
-
0,
|
|
1131
|
-
0,
|
|
1132
|
-
0,
|
|
1133
|
-
0,
|
|
1134
|
-
0,
|
|
1135
|
-
0,
|
|
1136
|
-
0,
|
|
1137
|
-
0,
|
|
1138
|
-
(ternaryfunc)PrivateWrap_call,
|
|
1139
|
-
0,
|
|
1140
|
-
PrivateWrap_getattro,
|
|
1141
|
-
0,
|
|
1142
|
-
0,
|
|
1143
|
-
Py_TPFLAGS_DEFAULT,
|
|
1144
|
-
"private_attribute._PrivateWrap",
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
0,
|
|
1148
|
-
0,
|
|
1149
|
-
0,
|
|
1150
|
-
0,
|
|
1151
|
-
0,
|
|
1152
|
-
PrivateWrap_members,
|
|
1153
|
-
PrivateWrap_getset,
|
|
1154
|
-
0,
|
|
1155
|
-
0,
|
|
1156
|
-
PrivateWrap_descrget,
|
|
1157
|
-
PrivateWrap_descrset,
|
|
1151
|
+
"_PrivateWrap", // tp_name
|
|
1152
|
+
sizeof(PrivateWrapObject), // tp_basicsize
|
|
1153
|
+
0, // tp_itemsize
|
|
1154
|
+
(destructor)PrivateWrap_dealloc, // tp_dealloc
|
|
1155
|
+
0, // tp_print
|
|
1156
|
+
0, // tp_getattr
|
|
1157
|
+
0, // tp_setattr
|
|
1158
|
+
0, // tp_reserved
|
|
1159
|
+
0, // tp_repr
|
|
1160
|
+
0, // tp_as_number
|
|
1161
|
+
0, // tp_as_sequence
|
|
1162
|
+
0, // tp_as_mapping
|
|
1163
|
+
0, // tp_hash
|
|
1164
|
+
(ternaryfunc)PrivateWrap_call, // tp_call
|
|
1165
|
+
0, // tp_str
|
|
1166
|
+
PrivateWrap_getattro, // tp_getattro
|
|
1167
|
+
0, // tp_setattro
|
|
1168
|
+
0, // tp_as_buffer
|
|
1169
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, // tp_flags
|
|
1170
|
+
"private_attribute._PrivateWrap", // tp_doc
|
|
1171
|
+
PrivateWrap_traverse, // tp_traverse
|
|
1172
|
+
PrivateWrap_clear, // tp_clear
|
|
1173
|
+
0, // tp_richcompare
|
|
1174
|
+
0, // tp_weaklistoffset
|
|
1175
|
+
0, // tp_iter
|
|
1176
|
+
0, // tp_iternext
|
|
1177
|
+
0, // tp_methods
|
|
1178
|
+
PrivateWrap_members, // tp_members
|
|
1179
|
+
PrivateWrap_getset, // tp_getset
|
|
1180
|
+
0, // tp_base
|
|
1181
|
+
0, // tp_dict
|
|
1182
|
+
PrivateWrap_descrget, // tp_descr_get
|
|
1183
|
+
PrivateWrap_descrset, // tp_descr_set
|
|
1158
1184
|
};
|
|
1159
1185
|
|
|
1160
1186
|
static PrivateWrapObject*
|
|
@@ -1171,7 +1197,7 @@ PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list) noexcept
|
|
|
1171
1197
|
}
|
|
1172
1198
|
|
|
1173
1199
|
PrivateWrapObject *self =
|
|
1174
|
-
|
|
1200
|
+
PyObject_GC_New(PrivateWrapObject, &PrivateWrapType);
|
|
1175
1201
|
self->func_list = list;
|
|
1176
1202
|
Py_INCREF(list);
|
|
1177
1203
|
|
|
@@ -1207,7 +1233,7 @@ static PyObject*
|
|
|
1207
1233
|
PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject* /* kwgs */) noexcept
|
|
1208
1234
|
{
|
|
1209
1235
|
PyObject *func;
|
|
1210
|
-
if (!PyArg_ParseTuple(args, "O", &func)) return NULL;
|
|
1236
|
+
if (!PyArg_ParseTuple(args, "O:private_attribute.PrivateWrapProxy.__call__", &func)) return NULL;
|
|
1211
1237
|
if(PyObject_TypeCheck(func, &PrivateWrapType)) {
|
|
1212
1238
|
return (PyObject*)PrivateWrap_New(
|
|
1213
1239
|
self->decorator,
|
|
@@ -1262,6 +1288,22 @@ class MyClass(PrivateAttrBase):
|
|
|
1262
1288
|
```
|
|
1263
1289
|
)";
|
|
1264
1290
|
|
|
1291
|
+
static int
|
|
1292
|
+
PrivateWrapProxy_traverse(PrivateWrapProxyObject *self, visitproc visit, void *arg) noexcept
|
|
1293
|
+
{
|
|
1294
|
+
Py_VISIT(self->decorator);
|
|
1295
|
+
Py_VISIT(self->func_list);
|
|
1296
|
+
return 0;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
static int
|
|
1300
|
+
PrivateWrapProxy_clear(PrivateWrapProxyObject *self) noexcept
|
|
1301
|
+
{
|
|
1302
|
+
Py_CLEAR(self->decorator);
|
|
1303
|
+
Py_CLEAR(self->func_list);
|
|
1304
|
+
return 0;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1265
1307
|
static PyTypeObject PrivateWrapProxyType = {
|
|
1266
1308
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
1267
1309
|
"private_attribute.PrivateWrapProxy", // tp_name
|
|
@@ -1282,10 +1324,10 @@ static PyTypeObject PrivateWrapProxyType = {
|
|
|
1282
1324
|
0, // tp_getattro
|
|
1283
1325
|
0, // tp_setattro
|
|
1284
1326
|
0, // tp_as_buffer
|
|
1285
|
-
Py_TPFLAGS_DEFAULT
|
|
1327
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,// tp_flags
|
|
1286
1328
|
PrivateWrapProxy_doc, // tp_doc
|
|
1287
|
-
|
|
1288
|
-
|
|
1329
|
+
(traverseproc)PrivateWrapProxy_traverse,// tp_traverse
|
|
1330
|
+
(inquiry)PrivateWrapProxy_clear, // tp_clear
|
|
1289
1331
|
0, // tp_richcompare
|
|
1290
1332
|
0, // tp_weaklistoffset
|
|
1291
1333
|
0, // tp_iter
|
|
@@ -1310,7 +1352,7 @@ PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject* /*kwds*/) noe
|
|
|
1310
1352
|
PyObject *decorator;
|
|
1311
1353
|
PyObject *orig = NULL;
|
|
1312
1354
|
|
|
1313
|
-
if (!PyArg_ParseTuple(args, "O|O", &decorator, &orig))
|
|
1355
|
+
if (!PyArg_ParseTuple(args, "O|O:private_attribute.PrivateWrapProxy", &decorator, &orig))
|
|
1314
1356
|
return NULL;
|
|
1315
1357
|
|
|
1316
1358
|
self = (PrivateWrapProxyObject*)type->tp_alloc(type, 0);
|
|
@@ -2522,7 +2564,7 @@ need_analyse_type(PyObject* type) noexcept
|
|
|
2522
2564
|
}
|
|
2523
2565
|
|
|
2524
2566
|
static bool
|
|
2525
|
-
PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationData& data) noexcept
|
|
2567
|
+
PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationData& data, const std::string& func_name = "") noexcept
|
|
2526
2568
|
{
|
|
2527
2569
|
static const char* invalid_name[] = {"__private_attrs__", "__slots__", "__getattribute__", "__getattr__", "__init__",
|
|
2528
2570
|
"__setattr__", "__delattr__", "__name__", "__module__", "__doc__", "__getstate__", "__setstate__",
|
|
@@ -2534,7 +2576,11 @@ PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationDa
|
|
|
2534
2576
|
}
|
|
2535
2577
|
|
|
2536
2578
|
// only parse name, bases, attrs
|
|
2537
|
-
|
|
2579
|
+
std::string parse = "OOO";
|
|
2580
|
+
if (func_name.length() > 0) {
|
|
2581
|
+
parse += ":" + func_name;
|
|
2582
|
+
}
|
|
2583
|
+
if (!PyArg_ParseTuple(args, parse.c_str(), &data.name, &data.bases, &data.attrs)) {
|
|
2538
2584
|
return false;
|
|
2539
2585
|
}
|
|
2540
2586
|
Py_INCREF(data.name);
|
|
@@ -3069,7 +3115,7 @@ PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
|
|
|
3069
3115
|
PrivateAttrCreationData data;
|
|
3070
3116
|
PyObject* new_type = nullptr;
|
|
3071
3117
|
|
|
3072
|
-
if (!PrivateAttrType_preprocess(args, kwds, data)) {
|
|
3118
|
+
if (!PrivateAttrType_preprocess(args, kwds, data, "private_attribute.PrivateAttrType")) {
|
|
3073
3119
|
return nullptr;
|
|
3074
3120
|
}
|
|
3075
3121
|
|
|
@@ -3705,6 +3751,31 @@ static PyMethodDef PrivateTempObject_methods[] = {
|
|
|
3705
3751
|
{NULL}
|
|
3706
3752
|
};
|
|
3707
3753
|
|
|
3754
|
+
static int
|
|
3755
|
+
PrivateTempObject_traverse(PyObject* self, visitproc visit, void* arg) noexcept
|
|
3756
|
+
{
|
|
3757
|
+
PrivateTempObject* tmp = (PrivateTempObject*)self;
|
|
3758
|
+
if (tmp->tmp) {
|
|
3759
|
+
PrivateAttrCreationData* data = tmp->tmp;
|
|
3760
|
+
if (!data->cleared) {
|
|
3761
|
+
Py_VISIT(data->attrs_copy);
|
|
3762
|
+
Py_VISIT(data->base_kwds);
|
|
3763
|
+
Py_VISIT(data->attrs);
|
|
3764
|
+
}
|
|
3765
|
+
}
|
|
3766
|
+
return 0;
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
static int
|
|
3770
|
+
PrivateTempObject_clear(PyObject* self) noexcept
|
|
3771
|
+
{
|
|
3772
|
+
PrivateTempObject* tmp = (PrivateTempObject*)self;
|
|
3773
|
+
if (tmp->tmp && !tmp->tmp->cleared) {
|
|
3774
|
+
tmp->tmp->clear();
|
|
3775
|
+
}
|
|
3776
|
+
return 0;
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3708
3779
|
static PyTypeObject PrivateTempType = {
|
|
3709
3780
|
PyVarObject_HEAD_INIT(NULL, 0)
|
|
3710
3781
|
"private_attribute._PrivateTemp", // tp_name
|
|
@@ -3725,10 +3796,10 @@ static PyTypeObject PrivateTempType = {
|
|
|
3725
3796
|
0, //tp_getattro
|
|
3726
3797
|
0, //tp_setattro
|
|
3727
3798
|
0, //tp_as_buffer
|
|
3728
|
-
Py_TPFLAGS_DEFAULT, //tp_flags
|
|
3799
|
+
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, //tp_flags
|
|
3729
3800
|
0, //tp_doc
|
|
3730
|
-
|
|
3731
|
-
|
|
3801
|
+
PrivateTempObject_traverse, //tp_traverse
|
|
3802
|
+
PrivateTempObject_clear, //tp_clear
|
|
3732
3803
|
0, //tp_richcompare
|
|
3733
3804
|
0, //tp_weaklistoffset
|
|
3734
3805
|
0, //tp_iter
|
|
@@ -3742,12 +3813,12 @@ static PyObject*
|
|
|
3742
3813
|
prepare_for_PrivateAttr(PyObject* /*self*/, PyObject* args, PyObject* kwargs) noexcept
|
|
3743
3814
|
{
|
|
3744
3815
|
PrivateAttrCreationData* tmp_data = new PrivateAttrCreationData();
|
|
3745
|
-
if (!PrivateAttrType_preprocess(args, kwargs, *tmp_data)) {
|
|
3816
|
+
if (!PrivateAttrType_preprocess(args, kwargs, *tmp_data, "private_attribute.prepare")) {
|
|
3746
3817
|
tmp_data->clear();
|
|
3747
3818
|
delete tmp_data;
|
|
3748
3819
|
return NULL;
|
|
3749
3820
|
}
|
|
3750
|
-
PrivateTempObject* tmp =
|
|
3821
|
+
PrivateTempObject* tmp = PyObject_GC_New(PrivateTempObject, &PrivateTempType);
|
|
3751
3822
|
if (!tmp) {
|
|
3752
3823
|
tmp_data->clear();
|
|
3753
3824
|
delete tmp_data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.18
|
|
4
4
|
Summary: A Python package that provides a way to define private attributes in C++ implementation.
|
|
5
5
|
Home-page: https://github.com/Locked-chess-official/private_attribute_cpp
|
|
6
6
|
Author: HuangHaoHua
|
|
@@ -24,7 +24,7 @@ readme = open('README.md').read()
|
|
|
24
24
|
|
|
25
25
|
setup(
|
|
26
26
|
name='private_attribute_cpp',
|
|
27
|
-
version='2.1.
|
|
27
|
+
version='2.1.18',
|
|
28
28
|
author="HuangHaoHua",
|
|
29
29
|
author_email="13140752715@example.com",
|
|
30
30
|
description='A Python package that provides a way to define private attributes in C++ implementation.',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_attr_classify_owner.py
RENAMED
|
File without changes
|
{private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_class_private_attrs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{private_attribute_cpp-2.1.17 → private_attribute_cpp-2.1.18}/tests/test_private_inheritance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|