private-attribute-cpp 2.1.9__tar.gz → 2.1.11__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.9/private_attribute_cpp.egg-info → private_attribute_cpp-2.1.11}/PKG-INFO +1 -1
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/private_attribute.cpp +32 -28
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11/private_attribute_cpp.egg-info}/PKG-INFO +1 -1
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/setup.py +1 -1
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/LICENSE +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/MANIFEST.in +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/README.md +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/picosha2.h +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/private_attribute.pyi +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/private_attribute_cpp.egg-info/SOURCES.txt +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/private_attribute_cpp.egg-info/top_level.txt +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/setup.cfg +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_attr_classify_owner.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_class_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_gc_collect.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_private_abc.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_private_func.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_private_inheritance.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_private_method.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_private_wrap.py +0 -0
- {private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/tests/test_slots_cycle.py +0 -0
{private_attribute_cpp-2.1.9/private_attribute_cpp.egg-info → private_attribute_cpp-2.1.11}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.11
|
|
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
|
|
@@ -1802,11 +1802,14 @@ PrivateAttr_tp_clear(PyObject* self) noexcept
|
|
|
1802
1802
|
|
|
1803
1803
|
class KeepPythonException {
|
|
1804
1804
|
private:
|
|
1805
|
-
|
|
1806
|
-
PyObject*
|
|
1807
|
-
PyObject* tb;
|
|
1805
|
+
#if PY_VERSION_HEX < 0x030C0000
|
|
1806
|
+
PyObject* typ = NULL;
|
|
1807
|
+
PyObject* tb = NULL;
|
|
1808
|
+
#endif
|
|
1809
|
+
PyObject* exc = NULL;
|
|
1808
1810
|
public:
|
|
1809
1811
|
KeepPythonException() noexcept {
|
|
1812
|
+
if (PyErr_Occurred())
|
|
1810
1813
|
// under 3.12 use PyErr_Fetch
|
|
1811
1814
|
#if PY_VERSION_HEX < 0x030C0000
|
|
1812
1815
|
PyErr_Fetch(&typ, &exc, &tb);
|
|
@@ -1816,6 +1819,7 @@ public:
|
|
|
1816
1819
|
}
|
|
1817
1820
|
|
|
1818
1821
|
~KeepPythonException() noexcept {
|
|
1822
|
+
if (exc)
|
|
1819
1823
|
// under 3.12 use PyErr_Restore
|
|
1820
1824
|
#if PY_VERSION_HEX < 0x030C0000
|
|
1821
1825
|
PyErr_Restore(typ, exc, tb);
|
|
@@ -2407,9 +2411,12 @@ analyse_all_code(PyObject* obj, std::unordered_map<uintptr_t, PyObjectStorage>&
|
|
|
2407
2411
|
static std::string
|
|
2408
2412
|
real_class_name(const std::string& name, const std::string& class_name) noexcept
|
|
2409
2413
|
{
|
|
2414
|
+
size_t start_pos = class_name.find_first_not_of('_');
|
|
2415
|
+
std::string cleaned_class_name = (start_pos == std::string::npos) ? "" : class_name.substr(start_pos);
|
|
2416
|
+
|
|
2410
2417
|
// if the name starts with "__" but does not end with "__", change to _ClassName__name
|
|
2411
2418
|
if (name.length() >= 2 && name.substr(0, 2) == "__" && name.substr(name.length() - 2) != "__") {
|
|
2412
|
-
return "_" +
|
|
2419
|
+
return "_" + cleaned_class_name + name;
|
|
2413
2420
|
}
|
|
2414
2421
|
return name;
|
|
2415
2422
|
}
|
|
@@ -2885,9 +2892,22 @@ ensure_tp(PyTypeObject* type_instance) noexcept
|
|
|
2885
2892
|
static void
|
|
2886
2893
|
ensure_subclass_tp(PyTypeObject* type_instance) noexcept
|
|
2887
2894
|
{
|
|
2895
|
+
KeepPythonException _;
|
|
2888
2896
|
PyObject* subclasses = PyObject_CallMethod((PyObject*)&PyType_Type, "__subclasses__", "O", (PyObject*)type_instance);
|
|
2889
|
-
|
|
2890
|
-
|
|
2897
|
+
if (!subclasses) {
|
|
2898
|
+
PyObject* unraisable_missing = PyUnicode_FromString("type.__subclasses__()");
|
|
2899
|
+
PyErr_WriteUnraisable(unraisable_missing);
|
|
2900
|
+
Py_DECREF(unraisable_missing);
|
|
2901
|
+
return;
|
|
2902
|
+
}
|
|
2903
|
+
if (!PyList_Check(subclasses)) {
|
|
2904
|
+
PyErr_SetString(PyExc_TypeError, "type.__subclasses__() did not return a list");
|
|
2905
|
+
PyObject* unraisable_missing = PyUnicode_FromString("type.__subclasses__()");
|
|
2906
|
+
PyErr_WriteUnraisable(unraisable_missing);
|
|
2907
|
+
Py_DECREF(unraisable_missing);
|
|
2908
|
+
Py_DECREF(subclasses);
|
|
2909
|
+
return;
|
|
2910
|
+
}
|
|
2891
2911
|
Py_ssize_t list_len = PyList_GET_SIZE(subclasses);
|
|
2892
2912
|
for (Py_ssize_t i = 0; i < list_len; i++) {
|
|
2893
2913
|
PyObject* subclass = PyList_GetItem(subclasses, i);
|
|
@@ -4271,36 +4291,20 @@ atexit_register_clean_func(void) noexcept
|
|
|
4271
4291
|
if (!atexit) {
|
|
4272
4292
|
return -1;
|
|
4273
4293
|
}
|
|
4274
|
-
PyObject* register_func = PyObject_GetAttrString(atexit, "register");
|
|
4275
|
-
if (!register_func) {
|
|
4276
|
-
Py_DECREF(atexit);
|
|
4277
|
-
return -1;
|
|
4278
|
-
}
|
|
4279
4294
|
|
|
4280
4295
|
PyObject* func = PyCFunction_New(&clean_storage, NULL);
|
|
4281
4296
|
if (!func) {
|
|
4282
|
-
Py_DECREF(register_func);
|
|
4283
|
-
Py_DECREF(atexit);
|
|
4284
|
-
return -1;
|
|
4285
|
-
}
|
|
4286
|
-
PyObject* args = PyTuple_New(1);
|
|
4287
|
-
if (!args) {
|
|
4288
|
-
Py_DECREF(func);
|
|
4289
|
-
Py_DECREF(register_func);
|
|
4290
4297
|
Py_DECREF(atexit);
|
|
4291
4298
|
return -1;
|
|
4292
4299
|
}
|
|
4293
|
-
|
|
4294
|
-
PyObject* result =
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4300
|
+
|
|
4301
|
+
PyObject* result = PyObject_CallMethod(atexit, "register", "O", func);
|
|
4302
|
+
Py_DECREF(func);
|
|
4303
|
+
Py_DECREF(atexit);
|
|
4304
|
+
|
|
4305
|
+
if (!result) {
|
|
4299
4306
|
return -1;
|
|
4300
4307
|
}
|
|
4301
|
-
Py_DECREF(args);
|
|
4302
|
-
Py_DECREF(register_func);
|
|
4303
|
-
Py_DECREF(atexit);
|
|
4304
4308
|
Py_DECREF(result);
|
|
4305
4309
|
return 0;
|
|
4306
4310
|
}
|
{private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11/private_attribute_cpp.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.11
|
|
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.11',
|
|
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.9 → private_attribute_cpp-2.1.11}/tests/test_attr_classify_owner.py
RENAMED
|
File without changes
|
{private_attribute_cpp-2.1.9 → private_attribute_cpp-2.1.11}/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.9 → private_attribute_cpp-2.1.11}/tests/test_private_inheritance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|