private-attribute-cpp 2.1.14__tar.gz → 2.1.16__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.
Files changed (24) hide show
  1. {private_attribute_cpp-2.1.14/private_attribute_cpp.egg-info → private_attribute_cpp-2.1.16}/PKG-INFO +1 -1
  2. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/private_attribute.cpp +13 -7
  3. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16/private_attribute_cpp.egg-info}/PKG-INFO +1 -1
  4. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/setup.py +1 -1
  5. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/LICENSE +0 -0
  6. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/MANIFEST.in +0 -0
  7. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/README.md +0 -0
  8. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/picosha2.h +0 -0
  9. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/private_attribute.pyi +0 -0
  10. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/private_attribute_cpp.egg-info/SOURCES.txt +0 -0
  11. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
  12. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
  13. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/private_attribute_cpp.egg-info/top_level.txt +0 -0
  14. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/setup.cfg +0 -0
  15. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_attr_classify_owner.py +0 -0
  16. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_class_private_attrs.py +0 -0
  17. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_gc_collect.py +0 -0
  18. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_private_abc.py +0 -0
  19. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_private_attrs.py +0 -0
  20. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_private_func.py +0 -0
  21. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_private_inheritance.py +0 -0
  22. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_private_method.py +0 -0
  23. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/tests/test_private_wrap.py +0 -0
  24. {private_attribute_cpp-2.1.14 → private_attribute_cpp-2.1.16}/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.14
3
+ Version: 2.1.16
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
@@ -3188,9 +3188,14 @@ new_type_tp_setattro(PyObject* self, PyObject* name, PyObject* value) noexcept
3188
3188
  return result;
3189
3189
  }
3190
3190
 
3191
+ static bool has_init_slots = false;
3192
+
3191
3193
  static int
3192
3194
  init_all_slots() noexcept
3193
3195
  {
3196
+ if (has_init_slots || PyType_Type.tp_setattro == new_type_tp_setattro) {
3197
+ return 0;
3198
+ }
3194
3199
  original_type_tp_setattro = PyType_Type.tp_setattro;
3195
3200
  PyObject* original_setattr = PyObject_GetAttrString((PyObject*)&PyType_Type, "__setattr__");
3196
3201
  if (!original_setattr) {return -1;}
@@ -3209,6 +3214,7 @@ init_all_slots() noexcept
3209
3214
  if (!all_metaclasses) {return -1;}
3210
3215
  if (!PyList_Check(all_metaclasses)) {
3211
3216
  Py_DECREF(all_metaclasses);
3217
+ has_init_slots = true;
3212
3218
  return 0;
3213
3219
  }
3214
3220
  Py_ssize_t list_len = PyList_GET_SIZE(all_metaclasses);
@@ -3220,6 +3226,7 @@ init_all_slots() noexcept
3220
3226
  }
3221
3227
  }
3222
3228
  Py_DECREF(all_metaclasses);
3229
+ has_init_slots = true;
3223
3230
  return 0;
3224
3231
  }
3225
3232
 
@@ -3765,13 +3772,6 @@ metaclass_weakref_callback(PyObject* self, PyObject* /*weakref*/) noexcept
3765
3772
  }
3766
3773
  uintptr_t id = (uintptr_t)pointer;
3767
3774
 
3768
- // Clean up the class-level AllData owned by this registered metaclass
3769
- // (type_attr_dict / all_type_subclass_attr / object buckets / caches).
3770
- // This replaces the old tp_finalize hook (register_finalize) which has
3771
- // been removed: a weakref callback fires on every death path (refcount and
3772
- // cyclic GC) without making the metaclass "finalizable".
3773
- PrivateAttrType_finalize((PyObject*)id);
3774
-
3775
3775
  std::unique_lock lock(::AllData::all_register_new_metaclass_mutex);
3776
3776
 
3777
3777
  auto it = ::AllData::all_register_type_weak_ref.find(id);
@@ -4308,9 +4308,14 @@ static PyMethodDef clean_storage = {
4308
4308
  "Clean all storages"
4309
4309
  };
4310
4310
 
4311
+ static bool resigtered_clean_func = false;
4312
+
4311
4313
  static int
4312
4314
  atexit_register_clean_func(void) noexcept
4313
4315
  {
4316
+ if (resigtered_clean_func) {
4317
+ return 0;
4318
+ }
4314
4319
  PyObject* atexit = PyImport_ImportModule("atexit");
4315
4320
  if (!atexit) {
4316
4321
  return -1;
@@ -4330,6 +4335,7 @@ atexit_register_clean_func(void) noexcept
4330
4335
  return -1;
4331
4336
  }
4332
4337
  Py_DECREF(result);
4338
+ resigtered_clean_func = true;
4333
4339
  return 0;
4334
4340
  }
4335
4341
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: private_attribute_cpp
3
- Version: 2.1.14
3
+ Version: 2.1.16
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.14',
27
+ version='2.1.16',
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.',