private-attribute-cpp 2.0.2__tar.gz → 2.0.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.
- {private_attribute_cpp-2.0.2/private_attribute_cpp.egg-info → private_attribute_cpp-2.0.3}/PKG-INFO +1 -1
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/private_attribute.cpp +41 -32
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3/private_attribute_cpp.egg-info}/PKG-INFO +1 -1
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/setup.py +1 -1
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/LICENSE +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/MANIFEST.in +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/README.md +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/picosha2.h +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/private_attribute.pyi +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/private_attribute_cpp.egg-info/SOURCES.txt +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/private_attribute_cpp.egg-info/top_level.txt +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/setup.cfg +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_class_private_attrs.py +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_abc.py +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_attrs.py +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_func.py +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_inheritance.py +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_method.py +0 -0
- {private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_wrap.py +0 -0
{private_attribute_cpp-2.0.2/private_attribute_cpp.egg-info → private_attribute_cpp-2.0.3}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.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
|
|
@@ -476,9 +476,7 @@ id_getattr(const std::string& attr_name, PyObject* obj, PyObject* typ) noexcept
|
|
|
476
476
|
if (type_name == NULL) {
|
|
477
477
|
return NULL;
|
|
478
478
|
}
|
|
479
|
-
|
|
480
|
-
std::string exception_information = "'" + string_type_name + "' objects has no attribute '" + attr_name + "'";
|
|
481
|
-
PyErr_SetString(PyExc_AttributeError, exception_information.c_str());
|
|
479
|
+
PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", type_name, attr_name.c_str());
|
|
482
480
|
return NULL;
|
|
483
481
|
}
|
|
484
482
|
|
|
@@ -510,9 +508,7 @@ type_getattr(PyObject* typ, const std::string& attr_name) noexcept
|
|
|
510
508
|
if (type_name == NULL) {
|
|
511
509
|
return NULL;
|
|
512
510
|
}
|
|
513
|
-
|
|
514
|
-
std::string message = "type object '" + string_type_name + "' has no attribute '" + attr_name + "'";
|
|
515
|
-
PyErr_SetString(PyExc_AttributeError, message.c_str());
|
|
511
|
+
PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", type_name, attr_name.c_str());
|
|
516
512
|
return NULL;
|
|
517
513
|
}
|
|
518
514
|
|
|
@@ -723,10 +719,7 @@ id_delattr(const std::string& attr_name, PyObject* obj, PyObject* typ) noexcept
|
|
|
723
719
|
if (type_name == NULL) {
|
|
724
720
|
return -1;
|
|
725
721
|
}
|
|
726
|
-
|
|
727
|
-
std::string exception_information = "'" + string_type_name + "' objects has no attribute '" + attr_name + "'";
|
|
728
|
-
PyErr_SetString(PyExc_AttributeError, exception_information.c_str());
|
|
729
|
-
return -1;
|
|
722
|
+
PyErr_Format(PyExc_AttributeError, "'%s' object has no attribute '%s'", type_name, attr_name.c_str());
|
|
730
723
|
}
|
|
731
724
|
PyObject* delete_obj = ::AllData::all_object_attr[final_id][obj_id][obj_private_name];
|
|
732
725
|
::AllData::all_object_attr[final_id][obj_id].erase(obj_private_name);
|
|
@@ -774,9 +767,7 @@ type_delattr(PyObject* typ, const std::string& attr_name) noexcept
|
|
|
774
767
|
if (type_name == NULL) {
|
|
775
768
|
return -1;
|
|
776
769
|
}
|
|
777
|
-
|
|
778
|
-
std::string message = "type object '" + string_type_name + "' has no attribute '" + attr_name + "'";
|
|
779
|
-
PyErr_SetString(PyExc_AttributeError, message.c_str());
|
|
770
|
+
PyErr_Format(PyExc_AttributeError, "type object '%s' has no attribute '%s'", type_name, attr_name.c_str());
|
|
780
771
|
return -1;
|
|
781
772
|
}
|
|
782
773
|
PyObject* delete_obj = ::AllData::type_attr_dict[typ_id][final_key];
|
|
@@ -802,9 +793,7 @@ type_delattr(PyObject* typ, const std::string& attr_name) noexcept
|
|
|
802
793
|
if (type_name == NULL) {
|
|
803
794
|
return -1;
|
|
804
795
|
}
|
|
805
|
-
|
|
806
|
-
std::string message = "type object '" + string_type_name + "' has no attribute '" + attr_name + "'";
|
|
807
|
-
PyErr_SetString(PyExc_AttributeError, message.c_str());
|
|
796
|
+
PyErr_Format(PyExc_AttributeError, "type object '%s' has no attribute '%s'", type_name, attr_name.c_str());
|
|
808
797
|
return -1;
|
|
809
798
|
}
|
|
810
799
|
PyObject* delete_obj = ::AllData::all_type_subclass_attr[final_id][typ_id][final_key];
|
|
@@ -1937,26 +1926,46 @@ PrivateAttrType_preprocess(PyObject* args, PyObject* kwds, PrivateAttrCreationDa
|
|
|
1937
1926
|
|
|
1938
1927
|
if (has_slots) {
|
|
1939
1928
|
PyObject* all_slots = PyDict_GetItemString(data.attrs_copy, "__slots__");
|
|
1940
|
-
|
|
1941
|
-
if (
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
Py_DECREF(slot_seq);
|
|
1929
|
+
if (!all_slots) {return false;}
|
|
1930
|
+
if (PyUnicode_Check(all_slots)) {
|
|
1931
|
+
const char* slot_cstr = PyUnicode_AsUTF8(all_slots);
|
|
1932
|
+
if (data.private_attrs_vector_string.find((std::string)slot_cstr) != data.private_attrs_vector_string.end()){
|
|
1933
|
+
std::string error_msg = "'__slots__' and '__private_attrs__' cannot have the same attribute name: '" + std::string(slot_cstr) + "'";
|
|
1934
|
+
PyErr_SetString(PyExc_TypeError, error_msg.c_str());
|
|
1935
|
+
return false;
|
|
1936
|
+
}
|
|
1937
|
+
} else {
|
|
1938
|
+
PyObject* slot_seq;
|
|
1939
|
+
if (PyAnyDict_Check(all_slots)) {
|
|
1940
|
+
// use the key of the dict as the slot name
|
|
1941
|
+
PyObject* keys = PyDict_Keys(all_slots);
|
|
1942
|
+
if (!keys) {
|
|
1955
1943
|
return false;
|
|
1956
1944
|
}
|
|
1945
|
+
slot_seq = keys;
|
|
1946
|
+
} else {
|
|
1947
|
+
slot_seq = PySequence_Fast(all_slots, "__slots__ must be a sequence");
|
|
1948
|
+
}
|
|
1949
|
+
if (!slot_seq) {
|
|
1950
|
+
return false;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
Py_ssize_t slot_len = PySequence_Fast_GET_SIZE(slot_seq);
|
|
1954
|
+
|
|
1955
|
+
for (Py_ssize_t j = 0; j < slot_len; j++) {
|
|
1956
|
+
PyObject* slot = PySequence_Fast_GET_ITEM(slot_seq, j);
|
|
1957
|
+
if (PyUnicode_Check(slot)) {
|
|
1958
|
+
const char* slot_cstr = PyUnicode_AsUTF8(slot);
|
|
1959
|
+
if (data.private_attrs_vector_string.find((std::string)slot_cstr) != data.private_attrs_vector_string.end()){
|
|
1960
|
+
std::string error_msg = "'__slots__' and '__private_attrs__' cannot have the same attribute name: '" + std::string(slot_cstr) + "'";
|
|
1961
|
+
PyErr_SetString(PyExc_TypeError, error_msg.c_str());
|
|
1962
|
+
Py_DECREF(slot_seq);
|
|
1963
|
+
return false;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1957
1966
|
}
|
|
1967
|
+
Py_DECREF(slot_seq);
|
|
1958
1968
|
}
|
|
1959
|
-
Py_DECREF(slot_seq);
|
|
1960
1969
|
}
|
|
1961
1970
|
|
|
1962
1971
|
Py_ssize_t bases_len = PyTuple_GET_SIZE(data.bases);
|
{private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3/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.0.
|
|
3
|
+
Version: 2.0.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
|
|
@@ -18,7 +18,7 @@ readme = open('README.md').read()
|
|
|
18
18
|
|
|
19
19
|
setup(
|
|
20
20
|
name='private_attribute_cpp',
|
|
21
|
-
version='2.0.
|
|
21
|
+
version='2.0.3',
|
|
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.',
|
|
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.0.2 → private_attribute_cpp-2.0.3}/tests/test_class_private_attrs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{private_attribute_cpp-2.0.2 → private_attribute_cpp-2.0.3}/tests/test_private_inheritance.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|