private-attribute-cpp 1.3.2__tar.gz → 1.3.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: private_attribute_cpp
3
- Version: 1.3.2
3
+ Version: 1.3.3
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
@@ -477,7 +477,7 @@ id_getattr(std::string attr_name, PyObject* obj, PyObject* typ)
477
477
  return NULL;
478
478
  }
479
479
  std::string string_type_name = type_name;
480
- std::string exception_information = "'" + string_type_name + "' object has no attribute '" + attr_name + "'";
480
+ std::string exception_information = "'" + string_type_name + "' objects has no attribute '" + attr_name + "'";
481
481
  PyErr_SetString(PyExc_AttributeError, exception_information.c_str());
482
482
  return NULL;
483
483
  }
@@ -722,7 +722,7 @@ id_delattr(std::string attr_name, PyObject* obj, PyObject* typ)
722
722
  return -1;
723
723
  }
724
724
  std::string string_type_name = type_name;
725
- std::string exception_information = "'" + string_type_name + "' object has no attribute '" + attr_name + "'";
725
+ std::string exception_information = "'" + string_type_name + "' objects has no attribute '" + attr_name + "'";
726
726
  PyErr_SetString(PyExc_AttributeError, exception_information.c_str());
727
727
  return -1;
728
728
  }
@@ -1041,30 +1041,8 @@ typedef struct {
1041
1041
  PyObject *func_list; // _func_list
1042
1042
  } PrivateWrapProxyObject;
1043
1043
 
1044
- static int
1045
- PrivateWrapProxy_init(PrivateWrapProxyObject *self, PyObject *args, PyObject *kwds)
1046
- {
1047
- PyObject *decorator;
1048
- PyObject *orig = NULL;
1049
-
1050
- if (!PyArg_ParseTuple(args, "O|O", &decorator, &orig))
1051
- return -1;
1052
-
1053
- self->decorator = decorator;
1054
- Py_INCREF(decorator);
1055
-
1056
- if (orig && PyObject_TypeCheck(orig, &PrivateWrapType)) {
1057
- self->func_list = ((PrivateWrapObject*)orig)->func_list;
1058
- Py_INCREF(self->func_list);
1059
- }
1060
- else {
1061
- self->func_list = PyList_New(0);
1062
- }
1063
- return 0;
1064
- }
1065
-
1066
1044
  static PyObject*
1067
- PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject * /*kwgs */)
1045
+ PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject* /*kwgs */)
1068
1046
  {
1069
1047
  PyObject *func;
1070
1048
  if (!PyArg_ParseTuple(args, "O", &func)) return NULL;
@@ -1091,6 +1069,7 @@ PrivateWrapProxy_call(PrivateWrapProxyObject *self, PyObject *args, PyObject * /
1091
1069
  }
1092
1070
 
1093
1071
  static void PrivateWrapProxy_dealloc(PrivateWrapProxyObject *self);
1072
+ static PyObject* PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject *kwds);
1094
1073
 
1095
1074
  static PyTypeObject PrivateWrapProxyType = {
1096
1075
  PyVarObject_HEAD_INIT(NULL, 0)
@@ -1128,11 +1107,43 @@ static PyTypeObject PrivateWrapProxyType = {
1128
1107
  0, // tp_descr_get
1129
1108
  0, // tp_descr_set
1130
1109
  0, // tp_dictoffset
1131
- (initproc)PrivateWrapProxy_init, // tp_init
1110
+ 0, // tp_init
1132
1111
  0, // tp_alloc
1133
- PyType_GenericNew, // tp_new
1112
+ PrivateWrapProxy_New, // tp_new
1134
1113
  };
1135
1114
 
1115
+ static PyObject*
1116
+ PrivateWrapProxy_New(PyTypeObject *type, PyObject *args, PyObject* /*kwds*/)
1117
+ {
1118
+ PrivateWrapProxyObject *self;
1119
+ PyObject *decorator;
1120
+ PyObject *orig = NULL;
1121
+
1122
+ if (!PyArg_ParseTuple(args, "O|O", &decorator, &orig))
1123
+ return NULL;
1124
+
1125
+ self = (PrivateWrapProxyObject*)type->tp_alloc(type, 0);
1126
+ if (self == NULL)
1127
+ return NULL;
1128
+
1129
+ Py_INCREF(decorator);
1130
+ self->decorator = decorator;
1131
+
1132
+ if (orig && PyObject_TypeCheck(orig, &PrivateWrapType)) {
1133
+ self->func_list = ((PrivateWrapObject*)orig)->func_list;
1134
+ Py_INCREF(self->func_list);
1135
+ }
1136
+ else {
1137
+ self->func_list = PyList_New(0);
1138
+ if (self->func_list == NULL) {
1139
+ Py_DECREF(self);
1140
+ return NULL;
1141
+ }
1142
+ }
1143
+
1144
+ return (PyObject*)self;
1145
+ }
1146
+
1136
1147
  static void
1137
1148
  PrivateWrapProxy_dealloc(PrivateWrapProxyObject *self)
1138
1149
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: private_attribute_cpp
3
- Version: 1.3.2
3
+ Version: 1.3.3
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
@@ -19,7 +19,7 @@ readme = open('README.md').read()
19
19
 
20
20
  setup(
21
21
  name='private_attribute_cpp',
22
- version='1.3.2',
22
+ version='1.3.3',
23
23
  author="HuangHaoHua",
24
24
  author_email="13140752715@example.com",
25
25
  description='A Python package that provides a way to define private attributes in C++ implementation.',