private-attribute-cpp 1.4.7__tar.gz → 1.4.8__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 (21) hide show
  1. {private_attribute_cpp-1.4.7/private_attribute_cpp.egg-info → private_attribute_cpp-1.4.8}/PKG-INFO +1 -1
  2. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/private_attribute.cpp +128 -125
  3. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8/private_attribute_cpp.egg-info}/PKG-INFO +1 -1
  4. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/setup.py +1 -1
  5. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/LICENSE +0 -0
  6. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/MANIFEST.in +0 -0
  7. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/README.md +0 -0
  8. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/picosha2.h +0 -0
  9. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/private_attribute.pyi +0 -0
  10. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/private_attribute_cpp.egg-info/SOURCES.txt +0 -0
  11. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
  12. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
  13. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/private_attribute_cpp.egg-info/top_level.txt +0 -0
  14. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/setup.cfg +0 -0
  15. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_class_private_attrs.py +0 -0
  16. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_private_abc.py +0 -0
  17. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_private_attrs.py +0 -0
  18. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_private_func.py +0 -0
  19. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_private_inheritance.py +0 -0
  20. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_private_method.py +0 -0
  21. {private_attribute_cpp-1.4.7 → private_attribute_cpp-1.4.8}/tests/test_private_wrap.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: private_attribute_cpp
3
- Version: 1.4.7
3
+ Version: 1.4.8
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 @@
24
24
  // python under 3.13 doesn't have PyDict_ContainsString, so we implement it ourselves
25
25
  #if PY_VERSION_HEX < 0x030D0000
26
26
  static int
27
- PyDict_ContainsString(PyObject *op, const char *key)
27
+ PyDict_ContainsString(PyObject *op, const char *key) noexcept
28
28
  {
29
29
  PyObject *key_obj = PyUnicode_FromString(key);
30
30
  if (key_obj == NULL) {
@@ -39,7 +39,7 @@ PyDict_ContainsString(PyObject *op, const char *key)
39
39
  static const auto module_running_time = std::chrono::system_clock::now();
40
40
 
41
41
  static std::string
42
- time_to_string()
42
+ time_to_string() noexcept
43
43
  {
44
44
  std::time_t original_time = std::chrono::system_clock::to_time_t(module_running_time);
45
45
  std::tm original_tm = *std::localtime(&original_time);
@@ -50,6 +50,8 @@ time_to_string()
50
50
 
51
51
  static const auto module_running_time_string = time_to_string();
52
52
 
53
+ static const std::string compile_time = __DATE__ " " __TIME__;
54
+
53
55
  class AllPyobjectAttrCacheKey
54
56
  {
55
57
  private:
@@ -57,21 +59,21 @@ private:
57
59
  std::string attr_onehash;
58
60
  std::string another_string_hash;
59
61
  public:
60
- AllPyobjectAttrCacheKey(uintptr_t obj_id, const std::string& attr_name) : obj_id(obj_id) {
61
- std::string one_name = "_" + std::to_string(obj_id) + "_" + attr_name;
62
+ AllPyobjectAttrCacheKey(uintptr_t obj_id, const std::string& attr_name) noexcept : obj_id(obj_id) {
63
+ std::string one_name = "_" + std::to_string(obj_id) + "_" + compile_time + attr_name;
62
64
  std::string another_name = "_" + module_running_time_string + attr_name;
63
65
  picosha2::hash256_hex_string(one_name, attr_onehash);
64
66
  picosha2::hash256_hex_string(another_name, another_string_hash);
65
67
  }
66
68
 
67
- std::size_t gethash() const {
69
+ std::size_t gethash() const noexcept {
68
70
  std::size_t h1 = std::hash<uintptr_t>{}(obj_id);
69
71
  std::size_t h2 = std::hash<std::string>{}(attr_onehash);
70
72
  std::size_t h3 = std::hash<std::string>{}(another_string_hash);
71
73
  return h1 ^ (h2 << 1) ^ (h3 << 2);
72
74
  }
73
75
 
74
- bool operator==(const AllPyobjectAttrCacheKey& other) const {
76
+ bool operator==(const AllPyobjectAttrCacheKey& other) const noexcept {
75
77
  return this->obj_id == other.obj_id && this->attr_onehash == other.attr_onehash && this->another_string_hash == other.another_string_hash;
76
78
  }
77
79
  };
@@ -82,12 +84,12 @@ private:
82
84
  std::string first;
83
85
  std::string second;
84
86
  public:
85
- TwoStringTuple(const std::string& first, const std::string& second) : first(first), second(second) {}
86
- bool operator==(const TwoStringTuple& other) const {
87
+ TwoStringTuple(const std::string& first, const std::string& second) noexcept : first(first), second(second) {}
88
+ bool operator==(const TwoStringTuple& other) const noexcept {
87
89
  return this->first == other.first && this->second == other.second;
88
90
  }
89
91
 
90
- std::size_t gethash() const {
92
+ std::size_t gethash() const noexcept {
91
93
  std::size_t h1 = std::hash<std::string>{}(first);
92
94
  std::size_t h2 = std::hash<std::string>{}(second);
93
95
  return h1 ^ (h2 << 1);
@@ -97,14 +99,14 @@ public:
97
99
  namespace std {
98
100
  template<>
99
101
  struct hash<AllPyobjectAttrCacheKey> {
100
- std::size_t operator()(const AllPyobjectAttrCacheKey& key) const {
102
+ std::size_t operator()(const AllPyobjectAttrCacheKey& key) const noexcept {
101
103
  return key.gethash();
102
104
  }
103
105
  };
104
106
 
105
107
  template<>
106
108
  struct hash<TwoStringTuple> {
107
- std::size_t operator()(const TwoStringTuple& key) const {
109
+ std::size_t operator()(const TwoStringTuple& key) const noexcept {
108
110
  return key.gethash();
109
111
  }
110
112
  };
@@ -152,24 +154,24 @@ struct FinalObject
152
154
  {
153
155
  PyObject* result = NULL;
154
156
  int status = 0;
155
- FinalObject(PyObject* result)
157
+ FinalObject(PyObject* result) noexcept
156
158
  : result(result) {
157
159
  Py_XINCREF(result);
158
160
  }
159
- FinalObject(int status): status(status) {}
160
- ~FinalObject() {
161
+ FinalObject(int status) noexcept: status(status) {}
162
+ ~FinalObject() noexcept {
161
163
  Py_XDECREF(result);
162
164
  }
163
165
  };
164
166
 
165
- static TwoStringTuple get_string_hash_tuple2(const std::string& name);
166
- static PyCodeObject* get_now_code();
167
- static uintptr_t type_set_attr_long_long_guidance(uintptr_t type, const std::string& name);
168
- static bool type_private_attr(uintptr_t type, const std::string& name);
169
- static FinalObject type_get_final_attr(uintptr_t type_id, const std::string& name);
167
+ static TwoStringTuple get_string_hash_tuple2(const std::string& name) noexcept;
168
+ static PyCodeObject* get_now_code() noexcept;
169
+ static uintptr_t type_set_attr_long_long_guidance(uintptr_t type, const std::string& name) noexcept;
170
+ static bool type_private_attr(uintptr_t type, const std::string& name) noexcept;
171
+ static FinalObject type_get_final_attr(uintptr_t type_id, const std::string& name) noexcept;
170
172
 
171
173
  static bool
172
- is_class_code(uintptr_t typ_id, PyCodeObject* code)
174
+ is_class_code(uintptr_t typ_id, PyCodeObject* code) noexcept
173
175
  {
174
176
  if (::AllData::type_allowed_code_map.find(typ_id) != ::AllData::type_allowed_code_map.end()){
175
177
  auto& code_map = ::AllData::type_allowed_code_map[typ_id];
@@ -182,7 +184,7 @@ is_class_code(uintptr_t typ_id, PyCodeObject* code)
182
184
  }
183
185
 
184
186
  static bool
185
- is_type_private(uintptr_t typ_id, const std::string& name)
187
+ is_type_private(uintptr_t typ_id, const std::string& name) noexcept
186
188
  {
187
189
  if (::AllData::all_type_attr_set.find(typ_id) != ::AllData::all_type_attr_set.end()){
188
190
  auto& attr_set = ::AllData::all_type_attr_set[typ_id];
@@ -195,7 +197,7 @@ is_type_private(uintptr_t typ_id, const std::string& name)
195
197
  }
196
198
 
197
199
  static bool
198
- attr_classify(uintptr_t typ_id, const std::string& name, PyCodeObject* code)
200
+ attr_classify(uintptr_t typ_id, const std::string& name, PyCodeObject* code) noexcept
199
201
  {
200
202
  if (is_class_code(typ_id, code)) {
201
203
  return true;
@@ -218,9 +220,9 @@ attr_classify(uintptr_t typ_id, const std::string& name, PyCodeObject* code)
218
220
  }
219
221
 
220
222
  static std::string
221
- generate_private_attr_name(uintptr_t obj_id, const std::string& attr_name)
223
+ generate_private_attr_name(uintptr_t obj_id, const std::string& attr_name) noexcept
222
224
  {
223
- std::string combined = std::to_string(obj_id) + "_" + attr_name;
225
+ std::string combined = std::to_string(obj_id) + "_" + compile_time + "_" + attr_name;
224
226
  std::string hash_str = picosha2::hash256_hex_string(combined);
225
227
 
226
228
  unsigned long long seed = std::stoul(hash_str.substr(0, 8), nullptr, 16);
@@ -248,7 +250,7 @@ generate_private_attr_name(uintptr_t obj_id, const std::string& attr_name)
248
250
  }
249
251
 
250
252
  static std::string
251
- default_random_string(uintptr_t obj_id, const std::string& attr_name)
253
+ default_random_string(uintptr_t obj_id, const std::string& attr_name) noexcept
252
254
  {
253
255
  AllPyobjectAttrCacheKey key(obj_id, attr_name);
254
256
  std::string result;
@@ -290,7 +292,7 @@ default_random_string(uintptr_t obj_id, const std::string& attr_name)
290
292
  class RestorePythonException : public std::exception
291
293
  {
292
294
  public:
293
- RestorePythonException(PyObject* type, PyObject* value, PyObject* traceback)
295
+ RestorePythonException(PyObject* type, PyObject* value, PyObject* traceback) noexcept
294
296
  : type(type), value(value), traceback(traceback) {
295
297
  }
296
298
 
@@ -321,7 +323,7 @@ public:
321
323
  other.traceback = nullptr;
322
324
  }
323
325
 
324
- void restore() {
326
+ void restore() noexcept {
325
327
  PyErr_Restore(type, value, traceback);
326
328
  type = value = traceback = nullptr;
327
329
  }
@@ -394,7 +396,7 @@ custom_random_string(uintptr_t obj_id, const std::string& attr_name, PyObject* f
394
396
  }
395
397
 
396
398
  static void
397
- clear_obj(uintptr_t obj_id)
399
+ clear_obj(uintptr_t obj_id) noexcept
398
400
  {
399
401
  std::unique_lock<std::shared_mutex> lock(::AllData::cache_mutex);
400
402
  auto it = ::AllData::obj_attr_keys.find(obj_id);
@@ -409,7 +411,7 @@ clear_obj(uintptr_t obj_id)
409
411
  }
410
412
 
411
413
  static const char*
412
- get_name_from_tp_name(PyTypeObject* typ)
414
+ get_name_from_tp_name(PyTypeObject* typ) noexcept
413
415
  {
414
416
  const char* name = typ->tp_name;
415
417
  if (name == NULL) {
@@ -422,11 +424,11 @@ get_name_from_tp_name(PyTypeObject* typ)
422
424
  return final_name;
423
425
  }
424
426
 
425
- static void ensure_tp(PyTypeObject* type_instance);
426
- static void ensure_subclass_tp(PyTypeObject* type_instance);
427
+ static void ensure_tp(PyTypeObject* type_instance) noexcept;
428
+ static void ensure_subclass_tp(PyTypeObject* type_instance) noexcept;
427
429
 
428
430
  static PyObject*
429
- id_getattr(const std::string& attr_name, PyObject* obj, PyObject* typ)
431
+ id_getattr(const std::string& attr_name, PyObject* obj, PyObject* typ) noexcept
430
432
  {
431
433
  uintptr_t obj_id, typ_id, final_id;
432
434
  obj_id = (uintptr_t) obj;
@@ -533,7 +535,7 @@ id_getattr(const std::string& attr_name, PyObject* obj, PyObject* typ)
533
535
  }
534
536
 
535
537
  static PyObject*
536
- type_getattr(PyObject* typ, const std::string& attr_name)
538
+ type_getattr(PyObject* typ, const std::string& attr_name) noexcept
537
539
  {
538
540
  uintptr_t typ_id = (uintptr_t)typ;
539
541
  FinalObject final_object = type_get_final_attr(typ_id, attr_name);
@@ -567,7 +569,7 @@ type_getattr(PyObject* typ, const std::string& attr_name)
567
569
  }
568
570
 
569
571
  static int
570
- id_setattr(const std::string& attr_name, PyObject* obj, PyObject* typ, PyObject* value)
572
+ id_setattr(const std::string& attr_name, PyObject* obj, PyObject* typ, PyObject* value) noexcept
571
573
  {
572
574
  uintptr_t obj_id, typ_id, final_id;
573
575
  obj_id = (uintptr_t) obj;
@@ -636,10 +638,10 @@ id_setattr(const std::string& attr_name, PyObject* obj, PyObject* typ, PyObject*
636
638
  return 0;
637
639
  }
638
640
 
639
- static int type_delattr(PyObject* typ, const std::string& attr_name);
641
+ static int type_delattr(PyObject* typ, const std::string& attr_name) noexcept;
640
642
 
641
643
  static int
642
- type_setattr(PyObject* typ, const std::string& attr_name, PyObject* value)
644
+ type_setattr(PyObject* typ, const std::string& attr_name, PyObject* value) noexcept
643
645
  {
644
646
  if (!value) {
645
647
  return type_delattr(typ, attr_name);
@@ -711,7 +713,7 @@ type_setattr(PyObject* typ, const std::string& attr_name, PyObject* value)
711
713
  }
712
714
 
713
715
  static int
714
- id_delattr(const std::string& attr_name, PyObject* obj, PyObject* typ)
716
+ id_delattr(const std::string& attr_name, PyObject* obj, PyObject* typ) noexcept
715
717
  {
716
718
  uintptr_t obj_id, typ_id, final_id;
717
719
  obj_id = (uintptr_t) obj;
@@ -789,7 +791,7 @@ id_delattr(const std::string& attr_name, PyObject* obj, PyObject* typ)
789
791
  }
790
792
 
791
793
  static int
792
- type_delattr(PyObject* typ, const std::string& attr_name)
794
+ type_delattr(PyObject* typ, const std::string& attr_name) noexcept
793
795
  {
794
796
  uintptr_t typ_id = (uintptr_t) typ;
795
797
  uintptr_t final_id = type_set_attr_long_long_guidance(typ_id, attr_name);
@@ -877,12 +879,12 @@ typedef struct {
877
879
  PyObject *func_list;
878
880
  } PrivateWrapObject;
879
881
 
880
- static PrivateWrapObject* PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list);
881
- static void PrivateWrap_dealloc(PrivateWrapObject *self);
882
- static PyObject* PrivateWrap_call(PrivateWrapObject *self, PyObject *args, PyObject *kw);
882
+ static PrivateWrapObject* PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list) noexcept;
883
+ static void PrivateWrap_dealloc(PrivateWrapObject *self) noexcept;
884
+ static PyObject* PrivateWrap_call(PrivateWrapObject *self, PyObject *args, PyObject *kw) noexcept;
883
885
 
884
886
  static PyObject *
885
- PrivateWrap_result(PyObject *obj, void* /*closure*/)
887
+ PrivateWrap_result(PyObject *obj, void* /*closure*/) noexcept
886
888
  {
887
889
  if (!obj) {
888
890
  Py_RETURN_NONE;
@@ -894,7 +896,7 @@ PrivateWrap_result(PyObject *obj, void* /*closure*/)
894
896
  }
895
897
 
896
898
  static PyObject *
897
- PrivateWrap_funcs(PyObject *obj, void* /*closure*/)
899
+ PrivateWrap_funcs(PyObject *obj, void* /*closure*/) noexcept
898
900
  {
899
901
  if (!obj) {
900
902
  Py_RETURN_NONE;
@@ -904,7 +906,7 @@ PrivateWrap_funcs(PyObject *obj, void* /*closure*/)
904
906
  }
905
907
 
906
908
  static PyObject*
907
- PrivateWrap_doc(PyObject *obj, void* /*closure*/)
909
+ PrivateWrap_doc(PyObject *obj, void* /*closure*/) noexcept
908
910
  {
909
911
  if (!obj) {
910
912
  return PyUnicode_FromString("PrivateWrap");
@@ -918,7 +920,7 @@ PrivateWrap_doc(PyObject *obj, void* /*closure*/)
918
920
  }
919
921
 
920
922
  static PyObject*
921
- PrivateWrap_module(PyObject *obj, void* /*closure*/)
923
+ PrivateWrap_module(PyObject *obj, void* /*closure*/) noexcept
922
924
  {
923
925
  if (!obj) {
924
926
  return PyUnicode_FromString("private_attribute");
@@ -932,7 +934,7 @@ PrivateWrap_module(PyObject *obj, void* /*closure*/)
932
934
  }
933
935
 
934
936
  static PyObject*
935
- PrivateWarp_name(PyObject* obj, void* /*closure*/)
937
+ PrivateWarp_name(PyObject* obj, void* /*closure*/) noexcept
936
938
  {
937
939
  if (!obj) {
938
940
  return PyUnicode_FromString("_PrivateWrap");
@@ -961,7 +963,7 @@ PrivateWrap_qualname(PyObject* obj, void* /*closure*/)
961
963
 
962
964
  // __annotate__
963
965
  static PyObject*
964
- PrivateWrap_annotate(PyObject* obj, void* /*closure*/)
966
+ PrivateWrap_annotate(PyObject* obj, void* /*closure*/) noexcept
965
967
  {
966
968
  if (!obj) {
967
969
  Py_RETURN_NONE;
@@ -976,7 +978,7 @@ PrivateWrap_annotate(PyObject* obj, void* /*closure*/)
976
978
 
977
979
  // __type_params__
978
980
  static PyObject*
979
- PrivateWrap_type_params(PyObject* obj, void* /*closure*/)
981
+ PrivateWrap_type_params(PyObject* obj, void* /*closure*/) noexcept
980
982
  {
981
983
  if (!obj) {
982
984
  Py_RETURN_NONE;
@@ -1006,7 +1008,7 @@ static PyGetSetDef PrivateWrap_getset[] = {
1006
1008
  };
1007
1009
 
1008
1010
  static PyObject *
1009
- PrivateWrap_getattro(PyObject *obj, PyObject *name)
1011
+ PrivateWrap_getattro(PyObject *obj, PyObject *name) noexcept
1010
1012
  {
1011
1013
  PyObject *res = PyObject_GenericGetAttr(obj, name);
1012
1014
  if (res != NULL) {
@@ -1053,7 +1055,7 @@ static PyTypeObject PrivateWrapType = {
1053
1055
  };
1054
1056
 
1055
1057
  static PrivateWrapObject*
1056
- PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list)
1058
+ PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list) noexcept
1057
1059
  {
1058
1060
  PrivateWrapObject *self =
1059
1061
  PyObject_New(PrivateWrapObject, &PrivateWrapType);
@@ -1072,7 +1074,7 @@ PrivateWrap_New(PyObject *decorator, PyObject *func, PyObject *list)
1072
1074
  }
1073
1075
 
1074
1076
  static void
1075
- PrivateWrap_dealloc(PrivateWrapObject *self)
1077
+ PrivateWrap_dealloc(PrivateWrapObject *self) noexcept
1076
1078
  {
1077
1079
  Py_XDECREF(self->result);
1078
1080
  Py_XDECREF(self->func_list);
@@ -1080,7 +1082,7 @@ PrivateWrap_dealloc(PrivateWrapObject *self)
1080
1082
  }
1081
1083
 
1082
1084
  static PyObject*
1083
- PrivateWrap_call(PrivateWrapObject *self, PyObject *args, PyObject *kw)
1085
+ PrivateWrap_call(PrivateWrapObject *self, PyObject *args, PyObject *kw) noexcept
1084
1086
  {
1085
1087
  return PyObject_Call(self->result, args, kw);
1086
1088
  }
@@ -1095,7 +1097,7 @@ typedef struct {
1095
1097
  } PrivateWrapProxyObject;
1096
1098
 
1097
1099
  static PyObject*
1098
- PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject* /*kwgs */)
1100
+ PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject* /*kwgs */) noexcept
1099
1101
  {
1100
1102
  PyObject *func;
1101
1103
  if (!PyArg_ParseTuple(args, "O", &func)) return NULL;
@@ -1121,8 +1123,8 @@ PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject* /*
1121
1123
  );
1122
1124
  }
1123
1125
 
1124
- static void PrivateWrapProxy_dealloc(PrivateWrapProxyObject *self);
1125
- static PyObject* PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject *kwds);
1126
+ static void PrivateWrapProxy_dealloc(PrivateWrapProxyObject *self) noexcept;
1127
+ static PyObject* PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject *kwds) noexcept;
1126
1128
  static const char* PrivateWrapProxy_doc = R"(
1127
1129
  PrivateWrapProxy is a proxy for private attributes.
1128
1130
  Usage:
@@ -1195,7 +1197,7 @@ static PyTypeObject PrivateWrapProxyType = {
1195
1197
  };
1196
1198
 
1197
1199
  static PyObject*
1198
- PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject* /*kwds*/)
1200
+ PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject* /*kwds*/) noexcept
1199
1201
  {
1200
1202
  PrivateWrapProxyObject *self;
1201
1203
  PyObject *decorator;
@@ -1227,7 +1229,7 @@ PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject* /*kwds*/)
1227
1229
  }
1228
1230
 
1229
1231
  static void
1230
- PrivateWrapProxy_dealloc(PrivateWrapProxyObject *self)
1232
+ PrivateWrapProxy_dealloc(PrivateWrapProxyObject *self) noexcept
1231
1233
  {
1232
1234
  Py_XDECREF(self->decorator);
1233
1235
  Py_XDECREF(self->func_list);
@@ -1241,12 +1243,12 @@ typedef struct {
1241
1243
  PyHeapTypeObject base; // PyObject_HEAD_INIT(NULL)
1242
1244
  } PrivateAttrTypeObject;
1243
1245
 
1244
- static void PrivateAttr_object_init_private_dict(uintptr_t obj_id, uintptr_t type_id);
1245
- static int PrivateAttr_tp_setattro(PyObject* self, PyObject* name, PyObject* value);
1246
- static void PrivateAttr_tp_finalize(PyObject* self);
1246
+ static void PrivateAttr_object_init_private_dict(uintptr_t obj_id, uintptr_t type_id) noexcept;
1247
+ static int PrivateAttr_tp_setattro(PyObject* self, PyObject* name, PyObject* value) noexcept;
1248
+ static void PrivateAttr_tp_finalize(PyObject* self) noexcept;
1247
1249
 
1248
1250
  static PyObject*
1249
- PrivateAttr_tp_getattro(PyObject* self, PyObject* name)
1251
+ PrivateAttr_tp_getattro(PyObject* self, PyObject* name) noexcept
1250
1252
  {
1251
1253
  PyTypeObject* typ = Py_TYPE(self);
1252
1254
  uintptr_t type_id = (uintptr_t)typ;
@@ -1275,7 +1277,7 @@ PrivateAttr_tp_getattro(PyObject* self, PyObject* name)
1275
1277
  }
1276
1278
 
1277
1279
  static int
1278
- PrivateAttr_tp_setattro(PyObject* self, PyObject* name, PyObject* value)
1280
+ PrivateAttr_tp_setattro(PyObject* self, PyObject* name, PyObject* value) noexcept
1279
1281
  {
1280
1282
  PyTypeObject* typ = Py_TYPE(self);
1281
1283
  uintptr_t typ_id = (uintptr_t)typ;
@@ -1308,7 +1310,7 @@ PrivateAttr_tp_setattro(PyObject* self, PyObject* name, PyObject* value)
1308
1310
  }
1309
1311
 
1310
1312
  static void
1311
- PrivateAttr_tp_finalize(PyObject* self)
1313
+ PrivateAttr_tp_finalize(PyObject* self) noexcept
1312
1314
  {
1313
1315
  uintptr_t id_self = (uintptr_t)self;
1314
1316
  PyTypeObject* typ = Py_TYPE(self);
@@ -1370,7 +1372,7 @@ PrivateAttr_tp_finalize(PyObject* self)
1370
1372
  }
1371
1373
 
1372
1374
  static void
1373
- PrivateAttr_object_init_private_dict(uintptr_t obj_id, uintptr_t type_id)
1375
+ PrivateAttr_object_init_private_dict(uintptr_t obj_id, uintptr_t type_id) noexcept
1374
1376
  {
1375
1377
  if (::AllData::all_object_mutex.find(type_id) == ::AllData::all_object_mutex.end()) {
1376
1378
  ::AllData::all_object_mutex[type_id] = {};
@@ -1391,10 +1393,10 @@ PrivateAttr_object_init_private_dict(uintptr_t obj_id, uintptr_t type_id)
1391
1393
  }
1392
1394
  }
1393
1395
 
1394
- static PyObject* PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds);
1395
- static PyObject* PrivateAttrType_getattr(PyObject* cls, PyObject* name);
1396
- static int PrivateAttrType_setattr(PyObject* cls, PyObject* name, PyObject* value);
1397
- static void PrivateAttrType_del(PyObject* cls);
1396
+ static PyObject* PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept;
1397
+ static PyObject* PrivateAttrType_getattr(PyObject* cls, PyObject* name) noexcept;
1398
+ static int PrivateAttrType_setattr(PyObject* cls, PyObject* name, PyObject* value) noexcept;
1399
+ static void PrivateAttrType_del(PyObject* cls) noexcept;
1398
1400
 
1399
1401
  static PyTypeObject PrivateAttrType = {
1400
1402
  PyVarObject_HEAD_INIT(NULL, 0)
@@ -1438,13 +1440,13 @@ static PyTypeObject PrivateAttrType = {
1438
1440
  };
1439
1441
 
1440
1442
  static PyObject*
1441
- get_string_hash_tuple(const std::string& name)
1443
+ get_string_hash_tuple(const std::string& name) noexcept
1442
1444
  {
1443
1445
  std::string name1;
1444
1446
  std::string name2;
1445
1447
  name1 = module_running_time_string + "_" + name;
1446
1448
  uintptr_t type_id = reinterpret_cast<uintptr_t>(&PrivateAttrType);
1447
- name2 = std::to_string(type_id) + "_" + name1;
1449
+ name2 = std::to_string(type_id) + "_" + compile_time + "_" + name1;
1448
1450
  std::string name1hash, name2hash;
1449
1451
  picosha2::hash256_hex_string(name1, name1hash);
1450
1452
  picosha2::hash256_hex_string(name2, name2hash);
@@ -1452,13 +1454,13 @@ get_string_hash_tuple(const std::string& name)
1452
1454
  }
1453
1455
 
1454
1456
  static TwoStringTuple
1455
- get_string_hash_tuple2(const std::string& name)
1457
+ get_string_hash_tuple2(const std::string& name) noexcept
1456
1458
  {
1457
1459
  std::string name1;
1458
1460
  std::string name2;
1459
1461
  name1 = module_running_time_string + "_" + name;
1460
1462
  uintptr_t type_id = reinterpret_cast<uintptr_t>(&PrivateAttrType);
1461
- name2 = std::to_string(type_id) + "_" + name1;
1463
+ name2 = std::to_string(type_id) + "_" + compile_time + "_" + name1;
1462
1464
  std::string name1hash, name2hash;
1463
1465
  picosha2::hash256_hex_string(name1, name1hash);
1464
1466
  picosha2::hash256_hex_string(name2, name2hash);
@@ -1466,7 +1468,7 @@ get_string_hash_tuple2(const std::string& name)
1466
1468
  }
1467
1469
 
1468
1470
  static FinalObject
1469
- type_get_final_attr(uintptr_t type_id, const std::string& name)
1471
+ type_get_final_attr(uintptr_t type_id, const std::string& name) noexcept
1470
1472
  {
1471
1473
  TwoStringTuple hash_tuple = get_string_hash_tuple2(name);
1472
1474
  if (::AllData::all_type_attr_set.find(type_id) != ::AllData::all_type_attr_set.end()) {
@@ -1580,7 +1582,7 @@ type_get_final_attr(uintptr_t type_id, const std::string& name)
1580
1582
  }
1581
1583
 
1582
1584
  static uintptr_t
1583
- type_set_attr_long_long_guidance(uintptr_t type_id, const std::string& name)
1585
+ type_set_attr_long_long_guidance(uintptr_t type_id, const std::string& name) noexcept
1584
1586
  {
1585
1587
  TwoStringTuple hash_tuple = get_string_hash_tuple2(name);
1586
1588
  if (::AllData::all_type_attr_set.find(type_id) != ::AllData::all_type_attr_set.end()) {
@@ -1602,7 +1604,7 @@ type_set_attr_long_long_guidance(uintptr_t type_id, const std::string& name)
1602
1604
  }
1603
1605
 
1604
1606
  static bool
1605
- type_private_attr(uintptr_t type_id, const std::string& name)
1607
+ type_private_attr(uintptr_t type_id, const std::string& name) noexcept
1606
1608
  {
1607
1609
  TwoStringTuple hash_tuple = get_string_hash_tuple2(name);
1608
1610
  if (::AllData::all_type_attr_set.find(type_id) != ::AllData::all_type_attr_set.end()) {
@@ -1624,7 +1626,7 @@ type_private_attr(uintptr_t type_id, const std::string& name)
1624
1626
  }
1625
1627
 
1626
1628
  static PyCodeObject*
1627
- get_now_code()
1629
+ get_now_code() noexcept
1628
1630
  {
1629
1631
  PyFrameObject* f = PyEval_GetFrame();
1630
1632
  if (!f) {
@@ -1635,7 +1637,7 @@ get_now_code()
1635
1637
  }
1636
1638
 
1637
1639
  static void
1638
- analyse_all_code(PyObject* obj, std::unordered_map<uintptr_t, PyCodeObject*>& map, std::unordered_set<uintptr_t>& _seen)
1640
+ analyse_all_code(PyObject* obj, std::unordered_map<uintptr_t, PyCodeObject*>& map, std::unordered_set<uintptr_t>& _seen) noexcept
1639
1641
  {
1640
1642
  uintptr_t obj_id = (uintptr_t)obj;
1641
1643
  if (_seen.find(obj_id) != _seen.end()) {
@@ -1748,7 +1750,7 @@ struct PrivateAttrCreationData
1748
1750
  PyObject* attrs = nullptr;
1749
1751
  bool cleared = false;
1750
1752
 
1751
- void clear() {
1753
+ void clear() noexcept {
1752
1754
  if (cleared) {
1753
1755
  return;
1754
1756
  }
@@ -1795,13 +1797,13 @@ struct PrivateAttrCreationData
1795
1797
  cleared = true;
1796
1798
  }
1797
1799
 
1798
- ~PrivateAttrCreationData() {
1800
+ ~PrivateAttrCreationData() noexcept {
1799
1801
  clear();
1800
1802
  }
1801
1803
  };
1802
1804
 
1803
1805
  static bool
1804
- need_analyse_type(PyObject* type)
1806
+ need_analyse_type(PyObject* type) noexcept
1805
1807
  {
1806
1808
  if (PyObject_IsInstance(type, (PyObject*)&PrivateAttrType)) {
1807
1809
  return true;
@@ -1831,7 +1833,7 @@ need_analyse_type(PyObject* type)
1831
1833
  }
1832
1834
 
1833
1835
  static void
1834
- get_getattribute_and_getattr(PyTypeObject* cls, PyObject** getattribute, PyObject** getattr)
1836
+ get_getattribute_and_getattr(PyTypeObject* cls, PyObject** getattribute, PyObject** getattr) noexcept
1835
1837
  {
1836
1838
  bool has_getattribute = false;
1837
1839
  bool has_getattr = false;
@@ -1862,7 +1864,7 @@ get_getattribute_and_getattr(PyTypeObject* cls, PyObject** getattribute, PyObjec
1862
1864
  }
1863
1865
 
1864
1866
  static void
1865
- get_setattr_and_delattr(PyTypeObject* cls, PyObject** setattr, PyObject** delattr)
1867
+ get_setattr_and_delattr(PyTypeObject* cls, PyObject** setattr, PyObject** delattr) noexcept
1866
1868
  {
1867
1869
  bool has_setattr = false;
1868
1870
  bool has_delattr = false;
@@ -1893,7 +1895,7 @@ get_setattr_and_delattr(PyTypeObject* cls, PyObject** setattr, PyObject** delatt
1893
1895
  }
1894
1896
 
1895
1897
  static void
1896
- get_del(PyTypeObject* cls, PyObject** del)
1898
+ get_del(PyTypeObject* cls, PyObject** del) noexcept
1897
1899
  {
1898
1900
  if (PyDict_ContainsString(cls->tp_dict, "__del__")) {
1899
1901
  *del = PyDict_GetItemString(cls->tp_dict, "__del__");
@@ -1908,7 +1910,7 @@ get_del(PyTypeObject* cls, PyObject** del)
1908
1910
  }
1909
1911
 
1910
1912
  static PyObject*
1911
- python_original_tp_getattro(PyObject* self, PyObject* name)
1913
+ python_original_tp_getattro(PyObject* self, PyObject* name) noexcept
1912
1914
  {
1913
1915
  PyObject* getattriute = NULL;
1914
1916
  PyObject* getattr = NULL;
@@ -1931,7 +1933,7 @@ python_original_tp_getattro(PyObject* self, PyObject* name)
1931
1933
  }
1932
1934
 
1933
1935
  static int
1934
- python_original_tp_setattro(PyObject* self, PyObject* name, PyObject* value)
1936
+ python_original_tp_setattro(PyObject* self, PyObject* name, PyObject* value) noexcept
1935
1937
  {
1936
1938
  PyObject* setattr = NULL;
1937
1939
  PyObject* delattr = NULL;
@@ -1955,7 +1957,7 @@ python_original_tp_setattro(PyObject* self, PyObject* name, PyObject* value)
1955
1957
  }
1956
1958
 
1957
1959
  static void
1958
- python_original_tp_finalize(PyObject* self)
1960
+ python_original_tp_finalize(PyObject* self) noexcept
1959
1961
  {
1960
1962
  PyObject* del = NULL;
1961
1963
  get_del((PyTypeObject*)self->ob_type, &del);
@@ -1982,7 +1984,7 @@ python_original_tp_finalize(PyObject* self)
1982
1984
  }
1983
1985
 
1984
1986
  static bool
1985
- PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationData& data)
1987
+ PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationData& data) noexcept
1986
1988
  {
1987
1989
  static const char* invalid_name[] = {"__private_attrs__", "__slots__", "__getattribute__", "__getattr__", "__init__",
1988
1990
  "__setattr__", "__delattr__", "__name__", "__module__", "__doc__", "__getstate__", "__setstate__",
@@ -2187,7 +2189,7 @@ PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationDa
2187
2189
  }
2188
2190
 
2189
2191
  static PyObject*
2190
- PrivateAttrType_create(PyTypeObject* type, PrivateAttrCreationData& data)
2192
+ PrivateAttrType_create(PyTypeObject* type, PrivateAttrCreationData& data) noexcept
2191
2193
  {
2192
2194
  PyObject* type_args = PyTuple_Pack(3, data.name, data.bases, data.attrs_copy);
2193
2195
  if (!type_args) {
@@ -2212,12 +2214,12 @@ PrivateAttrType_create(PyTypeObject* type, PrivateAttrCreationData& data)
2212
2214
  return new_type;
2213
2215
  }
2214
2216
 
2215
- static getattrofunc get_need_tp_getattro(PyTypeObject* cls);
2216
- static setattrofunc get_need_tp_setattro(PyTypeObject* cls);
2217
- static destructor get_need_tp_finalize(PyTypeObject* cls);
2217
+ static getattrofunc get_need_tp_getattro(PyTypeObject* cls) noexcept;
2218
+ static setattrofunc get_need_tp_setattro(PyTypeObject* cls) noexcept;
2219
+ static destructor get_need_tp_finalize(PyTypeObject* cls) noexcept;
2218
2220
 
2219
2221
  static void
2220
- ensure_tp(PyTypeObject* type_instance)
2222
+ ensure_tp(PyTypeObject* type_instance) noexcept
2221
2223
  {
2222
2224
  uintptr_t type_id = (uintptr_t)(type_instance);
2223
2225
  {
@@ -2289,7 +2291,7 @@ ensure_tp(PyTypeObject* type_instance)
2289
2291
  }
2290
2292
 
2291
2293
  static void
2292
- ensure_subclass_tp(PyTypeObject* type_instance)
2294
+ ensure_subclass_tp(PyTypeObject* type_instance) noexcept
2293
2295
  {
2294
2296
  // type.__subclasses__
2295
2297
  PyObject* type_subclasses = (PyObject*)type_instance->tp_subclasses;
@@ -2328,7 +2330,7 @@ ensure_subclass_tp(PyTypeObject* type_instance)
2328
2330
  }
2329
2331
 
2330
2332
  static bool
2331
- PrivateAttrType_postprocess(PyObject* new_type, PrivateAttrCreationData& data)
2333
+ PrivateAttrType_postprocess(PyObject* new_type, PrivateAttrCreationData& data) noexcept
2332
2334
  {
2333
2335
  if (!new_type) {
2334
2336
  return false;
@@ -2341,7 +2343,8 @@ PrivateAttrType_postprocess(PyObject* new_type, PrivateAttrCreationData& data)
2341
2343
  PyTypeObject* type_instance = (PyTypeObject*)new_type;
2342
2344
  uintptr_t type_id = (uintptr_t)(type_instance);
2343
2345
  if (PyDict_ContainsString(type_instance->tp_dict, "__static_attributes__")) {
2344
- PyErr_SetString(PyExc_SystemError, "'__static_attributes__' will expose private attribute names and cannot be used in private attribute types");
2346
+ PyErr_Format(PyExc_SystemError,
2347
+ "%s: %d: '__static_attributes__' will expose private attribute names and cannot be used in private attribute types", __FILE__, __LINE__);
2345
2348
  return false;
2346
2349
  }
2347
2350
 
@@ -2454,7 +2457,7 @@ PrivateAttrType_postprocess(PyObject* new_type, PrivateAttrCreationData& data)
2454
2457
  }
2455
2458
 
2456
2459
  static PyObject*
2457
- PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
2460
+ PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
2458
2461
  {
2459
2462
  PrivateAttrCreationData data;
2460
2463
  PyObject* new_type = nullptr;
@@ -2477,7 +2480,7 @@ PrivateAttrType_new(PyTypeObject* type, PyObject* args, PyObject* kwds)
2477
2480
  }
2478
2481
 
2479
2482
  static PyObject*
2480
- PrivateAttrType_getattr(PyObject* cls, PyObject* name)
2483
+ PrivateAttrType_getattr(PyObject* cls, PyObject* name) noexcept
2481
2484
  {
2482
2485
  if (!PyType_Check(cls)) {
2483
2486
  PyErr_SetString(PyExc_TypeError, "cls must be a type");
@@ -2509,7 +2512,7 @@ PrivateAttrType_getattr(PyObject* cls, PyObject* name)
2509
2512
  }
2510
2513
 
2511
2514
  static int
2512
- init_all_slots()
2515
+ init_all_slots() noexcept
2513
2516
  {
2514
2517
  AllSlots::original_getattro = python_original_tp_getattro;
2515
2518
  AllSlots::original_setattro = python_original_tp_setattro;
@@ -2518,7 +2521,7 @@ init_all_slots()
2518
2521
  }
2519
2522
 
2520
2523
  static getattrofunc
2521
- get_need_tp_getattro(PyTypeObject* cls)
2524
+ get_need_tp_getattro(PyTypeObject* cls) noexcept
2522
2525
  {
2523
2526
  if (PyDict_ContainsString(cls->tp_dict, "__getattribute__") || PyDict_ContainsString(cls->tp_dict, "__getattr__")) {
2524
2527
  return AllSlots::original_getattro;
@@ -2540,7 +2543,7 @@ get_need_tp_getattro(PyTypeObject* cls)
2540
2543
  }
2541
2544
 
2542
2545
  static setattrofunc
2543
- get_need_tp_setattro(PyTypeObject* cls)
2546
+ get_need_tp_setattro(PyTypeObject* cls) noexcept
2544
2547
  {
2545
2548
  if (PyDict_ContainsString(cls->tp_dict, "__setattr__") || PyDict_ContainsString(cls->tp_dict, "__delattr__")) {
2546
2549
  return AllSlots::original_setattro;
@@ -2562,7 +2565,7 @@ get_need_tp_setattro(PyTypeObject* cls)
2562
2565
  }
2563
2566
 
2564
2567
  static destructor
2565
- get_need_tp_finalize(PyTypeObject* cls)
2568
+ get_need_tp_finalize(PyTypeObject* cls) noexcept
2566
2569
  {
2567
2570
  if (PyDict_ContainsString(cls->tp_dict, "__del__")) {
2568
2571
  return AllSlots::original_finalize;
@@ -2584,7 +2587,7 @@ get_need_tp_finalize(PyTypeObject* cls)
2584
2587
  }
2585
2588
 
2586
2589
  static void
2587
- type_change_all_slots(PyTypeObject* cls, const char* name)
2590
+ type_change_all_slots(PyTypeObject* cls, const char* name) noexcept
2588
2591
  {
2589
2592
  if (strcmp(name, "__getattribute__") == 0 || strcmp(name, "__getattr__") == 0) {
2590
2593
  cls->tp_getattro = PrivateAttr_tp_getattro;
@@ -2599,7 +2602,7 @@ type_change_all_slots(PyTypeObject* cls, const char* name)
2599
2602
  }
2600
2603
 
2601
2604
  static void
2602
- subtype_change_all_slots(PyTypeObject* cls, const char* name)
2605
+ subtype_change_all_slots(PyTypeObject* cls, const char* name) noexcept
2603
2606
  {
2604
2607
  // tp_subclasses: {id(type): weakref.ref(type)}
2605
2608
  PyObject* tp_subclasses = (PyObject*)cls->tp_subclasses;
@@ -2642,7 +2645,7 @@ subtype_change_all_slots(PyTypeObject* cls, const char* name)
2642
2645
  }
2643
2646
 
2644
2647
  static int
2645
- PrivateAttrType_setattr(PyObject* cls, PyObject* name, PyObject* value)
2648
+ PrivateAttrType_setattr(PyObject* cls, PyObject* name, PyObject* value) noexcept
2646
2649
  {
2647
2650
  if (!PyType_Check(cls)) {
2648
2651
  PyErr_SetString(PyExc_TypeError, "cls must be a type");
@@ -2711,7 +2714,7 @@ PrivateAttrType_setattr(PyObject* cls, PyObject* name, PyObject* value)
2711
2714
  }
2712
2715
 
2713
2716
  static void
2714
- PrivateAttrType_finalize(PyObject* cls)
2717
+ PrivateAttrType_finalize(PyObject* cls) noexcept
2715
2718
  {
2716
2719
  uintptr_t typ_id = (uintptr_t) cls;
2717
2720
  if (::AllData::all_type_attr_set.find(typ_id) != ::AllData::all_type_attr_set.end()) {
@@ -2776,7 +2779,7 @@ PrivateAttrType_finalize(PyObject* cls)
2776
2779
  }
2777
2780
 
2778
2781
  static void
2779
- PrivateAttrType_del(PyObject* cls)
2782
+ PrivateAttrType_del(PyObject* cls) noexcept
2780
2783
  {
2781
2784
  PrivateAttrType_finalize(cls);
2782
2785
  PyType_Type.tp_dealloc(cls);
@@ -2786,7 +2789,7 @@ static const char* PrivateAttrBase_doc = "The class to help to create private at
2786
2789
 
2787
2790
  // PrivateAttrBase
2788
2791
  static PyObject*
2789
- create_private_attr_base_simple(void)
2792
+ create_private_attr_base_simple(void) noexcept
2790
2793
  {
2791
2794
  PyObject* name = PyUnicode_FromString("PrivateAttrBase");
2792
2795
  if (!name) return NULL;
@@ -2839,7 +2842,7 @@ typedef struct {
2839
2842
  } PrivateTempObject;
2840
2843
 
2841
2844
  static PyObject*
2842
- PrivateTempObject_name(PyObject* self, void* /*closure*/)
2845
+ PrivateTempObject_name(PyObject* self, void* /*closure*/) noexcept
2843
2846
  {
2844
2847
  PyObject* name = ((PrivateTempObject*)self)->tmp->name;
2845
2848
  if (!name) {
@@ -2851,7 +2854,7 @@ PrivateTempObject_name(PyObject* self, void* /*closure*/)
2851
2854
  }
2852
2855
 
2853
2856
  static PyObject*
2854
- PrivateTempObject_base(PyObject* self, void* /*closure*/)
2857
+ PrivateTempObject_base(PyObject* self, void* /*closure*/) noexcept
2855
2858
  {
2856
2859
  PyObject* base = ((PrivateTempObject*)self)->tmp->bases;
2857
2860
  if (!base) {
@@ -2863,7 +2866,7 @@ PrivateTempObject_base(PyObject* self, void* /*closure*/)
2863
2866
  }
2864
2867
 
2865
2868
  static PyObject*
2866
- PrivateTempObject_attrs(PyObject* self, void* /*closure*/)
2869
+ PrivateTempObject_attrs(PyObject* self, void* /*closure*/) noexcept
2867
2870
  {
2868
2871
  PyObject* attrs = ((PrivateTempObject*)self)->tmp->attrs_copy;
2869
2872
  if (!attrs) {
@@ -2875,7 +2878,7 @@ PrivateTempObject_attrs(PyObject* self, void* /*closure*/)
2875
2878
  }
2876
2879
 
2877
2880
  static PyObject*
2878
- PrivateTempObject_kwds(PyObject* self, void* /*closure*/)
2881
+ PrivateTempObject_kwds(PyObject* self, void* /*closure*/) noexcept
2879
2882
  {
2880
2883
  PyObject* kwds = ((PrivateTempObject*)self)->tmp->base_kwds;
2881
2884
  if (!kwds) {
@@ -2895,7 +2898,7 @@ static PyGetSetDef PrivateTempObject_getsets[] = {
2895
2898
  };
2896
2899
 
2897
2900
  static void
2898
- PrivateTempObject_dealloc(PyObject* self)
2901
+ PrivateTempObject_dealloc(PyObject* self) noexcept
2899
2902
  {
2900
2903
  ((PrivateTempObject*)self)->tmp->clear();
2901
2904
  delete ((PrivateTempObject*)self)->tmp;
@@ -2936,7 +2939,7 @@ static PyTypeObject PrivateTempType = {
2936
2939
  };
2937
2940
 
2938
2941
  static PyObject*
2939
- prepare_for_PrivateAttr(PyObject* /*self*/, PyObject* args, PyObject* kwargs)
2942
+ prepare_for_PrivateAttr(PyObject* /*self*/, PyObject* args, PyObject* kwargs) noexcept
2940
2943
  {
2941
2944
  PrivateAttrCreationData* tmp_data = new PrivateAttrCreationData();
2942
2945
  if (!PrivateAttrType_preprocess(args, kwargs, *tmp_data)) {
@@ -2955,7 +2958,7 @@ prepare_for_PrivateAttr(PyObject* /*self*/, PyObject* args, PyObject* kwargs)
2955
2958
  }
2956
2959
 
2957
2960
  static PyObject*
2958
- postprocess_for_PrivateAttr(PyObject* /*self*/, PyObject* args)
2961
+ postprocess_for_PrivateAttr(PyObject* /*self*/, PyObject* args) noexcept
2959
2962
  {
2960
2963
  PyObject* type;
2961
2964
  PyObject* tmp;
@@ -2978,7 +2981,7 @@ postprocess_for_PrivateAttr(PyObject* /*self*/, PyObject* args)
2978
2981
  }
2979
2982
 
2980
2983
  static void
2981
- register_finalize(PyObject* cls)
2984
+ register_finalize(PyObject* cls) noexcept
2982
2985
  {
2983
2986
  Py_ssize_t original_ref = Py_REFCNT(cls);
2984
2987
  PyTypeObject* base = Py_TYPE(cls)->tp_base;
@@ -2994,7 +2997,7 @@ register_finalize(PyObject* cls)
2994
2997
 
2995
2998
 
2996
2999
  static PyObject*
2997
- metaclass_weakref_callback(PyObject* self, PyObject* /*weakref*/)
3000
+ metaclass_weakref_callback(PyObject* self, PyObject* /*weakref*/) noexcept
2998
3001
  {
2999
3002
  void* pointer = PyCapsule_GetPointer(self, "metaclass_id");
3000
3003
  if (!pointer) {
@@ -3021,7 +3024,7 @@ static PyMethodDef weakref_callback_def = {
3021
3024
  };
3022
3025
 
3023
3026
  static PyObject*
3024
- register_metaclass(PyObject* /*self*/, PyObject* metaclass)
3027
+ register_metaclass(PyObject* /*self*/, PyObject* metaclass) noexcept
3025
3028
  {
3026
3029
  if (!PyType_Check(metaclass)) {
3027
3030
  PyErr_SetString(PyExc_TypeError, "metaclass must be a type");
@@ -3062,7 +3065,7 @@ register_metaclass(PyObject* /*self*/, PyObject* metaclass)
3062
3065
  }
3063
3066
 
3064
3067
  static PyObject*
3065
- ensure_type_tp(PyObject* /*self*/, PyObject* type)
3068
+ ensure_type_tp(PyObject* /*self*/, PyObject* type) noexcept
3066
3069
  {
3067
3070
  if (!PyType_Check(type)) {
3068
3071
  PyErr_SetString(PyExc_TypeError, "type must be a type");
@@ -3077,7 +3080,7 @@ ensure_type_tp(PyObject* /*self*/, PyObject* type)
3077
3080
  }
3078
3081
 
3079
3082
  static PyObject*
3080
- ensure_metaclass_tp(PyObject* /*self*/, PyObject* metaclass)
3083
+ ensure_metaclass_tp(PyObject* /*self*/, PyObject* metaclass) noexcept
3081
3084
  {
3082
3085
  uintptr_t id = (uintptr_t)metaclass;
3083
3086
  if (::AllData::all_register_type_weak_ref.find(id) != ::AllData::all_register_type_weak_ref.end()) {
@@ -3089,7 +3092,7 @@ ensure_metaclass_tp(PyObject* /*self*/, PyObject* metaclass)
3089
3092
  }
3090
3093
 
3091
3094
  static PyObject*
3092
- PrivateModule_get_PrivateWrapProxy(PyObject* /*self*/, void* /*closure*/)
3095
+ PrivateModule_get_PrivateWrapProxy(PyObject* /*self*/, void* /*closure*/) noexcept
3093
3096
  {
3094
3097
  PyObject* PythonPrivateWrapProxy = (PyObject*)&PrivateWrapProxyType;
3095
3098
  Py_INCREF(PythonPrivateWrapProxy);
@@ -3098,7 +3101,7 @@ PrivateModule_get_PrivateWrapProxy(PyObject* /*self*/, void* /*closure*/)
3098
3101
 
3099
3102
  // type PrivateAttrType
3100
3103
  static PyObject*
3101
- PrivateModule_get_PrivateAttrType(PyObject* /*self*/, void* /*closure*/)
3104
+ PrivateModule_get_PrivateAttrType(PyObject* /*self*/, void* /*closure*/) noexcept
3102
3105
  {
3103
3106
  PyObject* PythonPrivateAttrType = (PyObject*)&PrivateAttrType;
3104
3107
  Py_INCREF(PythonPrivateAttrType);
@@ -3106,7 +3109,7 @@ PrivateModule_get_PrivateAttrType(PyObject* /*self*/, void* /*closure*/)
3106
3109
  }
3107
3110
 
3108
3111
  static PyObject*
3109
- PrivateModule_get_PrivateAttrBase(PyObject* /*self*/, void* /*closure*/)
3112
+ PrivateModule_get_PrivateAttrBase(PyObject* /*self*/, void* /*closure*/) noexcept
3110
3113
  {
3111
3114
  static PyObject* PrivateAttrBase = create_private_attr_base_simple();
3112
3115
  if (!PrivateAttrBase) {
@@ -3120,7 +3123,7 @@ PrivateModule_get_PrivateAttrBase(PyObject* /*self*/, void* /*closure*/)
3120
3123
  }
3121
3124
 
3122
3125
  static PyObject*
3123
- PrivateModule_dir(PyObject* self, PyObject* /*args*/)
3126
+ PrivateModule_dir(PyObject* self, PyObject* /*args*/) noexcept
3124
3127
  {
3125
3128
  PyObject* parent_dir = PyObject_CallMethod((PyObject*)&PyModule_Type, "__dir__", "O", self);
3126
3129
  if (!parent_dir) return NULL;
@@ -3144,7 +3147,7 @@ PrivateModule_dir(PyObject* self, PyObject* /*args*/)
3144
3147
  }
3145
3148
 
3146
3149
  static int
3147
- PrivateModule_setattro(PyObject* cls, PyObject* name, PyObject* value)
3150
+ PrivateModule_setattro(PyObject* cls, PyObject* name, PyObject* value) noexcept
3148
3151
  {
3149
3152
  // if name is "__class__" it do nothing and return success
3150
3153
  if (PyUnicode_Check(name)) {
@@ -3277,7 +3280,7 @@ static PyModuleDef def = {
3277
3280
  };
3278
3281
 
3279
3282
  PyMODINIT_FUNC
3280
- PyInit_private_attribute(void)
3283
+ PyInit_private_attribute(void) noexcept
3281
3284
  {
3282
3285
  if (init_all_slots() <0 ||
3283
3286
  PyType_Ready(&PrivateWrapType) < 0 ||
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: private_attribute_cpp
3
- Version: 1.4.7
3
+ Version: 1.4.8
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
@@ -18,7 +18,7 @@ readme = open('README.md').read()
18
18
 
19
19
  setup(
20
20
  name='private_attribute_cpp',
21
- version='1.4.7',
21
+ version='1.4.8',
22
22
  author="HuangHaoHua",
23
23
  author_email="13140752715@example.com",
24
24
  description='A Python package that provides a way to define private attributes in C++ implementation.',