private-attribute-cpp 2.1.23__tar.gz → 2.2.0__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.23/private_attribute_cpp.egg-info → private_attribute_cpp-2.2.0}/PKG-INFO +4 -2
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/README.md +3 -1
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/private_attribute.cpp +378 -365
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/private_attribute.pyi +9 -1
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0/private_attribute_cpp.egg-info}/PKG-INFO +4 -2
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/private_attribute_cpp.egg-info/SOURCES.txt +3 -1
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/setup.py +1 -1
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_attr_classify_owner.py +6 -6
- private_attribute_cpp-2.2.0/tests/test_init_subclass.py +85 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_private_inheritance.py +42 -20
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_private_wrap.py +10 -2
- private_attribute_cpp-2.2.0/tests/test_use_parents.py +129 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/LICENSE +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/MANIFEST.in +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/picosha2.h +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/private_attribute_cpp.egg-info/dependency_links.txt +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/private_attribute_cpp.egg-info/not-zip-safe +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/private_attribute_cpp.egg-info/top_level.txt +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/setup.cfg +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_class_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_gc_collect.py +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_private_abc.py +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_private_attrs.py +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_private_func.py +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_private_method.py +0 -0
- {private_attribute_cpp-2.1.23 → private_attribute_cpp-2.2.0}/tests/test_slots_cycle.py +0 -0
{private_attribute_cpp-2.1.23/private_attribute_cpp.egg-info → private_attribute_cpp-2.2.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: private_attribute_cpp
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
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
|
|
@@ -253,7 +253,9 @@ TypeError: Can't instantiate abstract class MyClass without an implementation fo
|
|
|
253
253
|
- One class defined in another class cannot use another class's private attribute.
|
|
254
254
|
- One parent class defined an attribute which not in `__private_attrs__` or not a `PrivateAttrType` instance, the child class shouldn't contain the attribute in its `__private_attrs__`.
|
|
255
255
|
- Since 2.1.0: the code of a subclass can no longer access the private attributes of its parent classes - a parent's private attribute is only reachable from the parent's own code, or from a class that declares the same name in its own `__private_attrs__`.
|
|
256
|
-
- Since 2.1.0: if a subclass
|
|
256
|
+
- Since 2.1.0: if a subclass declares a name in its own `__private_attrs__` that is also private to a parent, the two are stored separately (instance attributes per declaring class, class-level attributes per class). Class-level resolution is per-subject through the parent's code: reading the name on a subclass subject returns the subclass's own value, and the parent's own value is untouched.
|
|
257
|
+
- Since 2.2.0: a subclass must NOT define an attribute in its namespace (class body) whose name is private to a parent class, unless that name is declared in its own `__private_attrs__` or the class opts in with `use_parents=True`.
|
|
258
|
+
- Since 2.2.0: pass `use_parents=True` in the class definition to inherit all parent classes' private attribute names into the subclass's own private-attribute set. The subclass's code can then read/write those names, but the values are stored in the subclass's own storage (they never overwrite the parent's own values). The Python-level `__private_attrs__` tuple is left unchanged; only the internal private-attribute name set is merged. Default is `False`.
|
|
257
259
|
- CPython may change "tp_getattro", "tp_setattro" and so on when you change the attribute "\_\_getattribute\_\_", "\_\_setattr\_\_" and so on. If you are fear about it, you can use `ensure_type` to reset those tp slots. For the other metaclasses, you can use `ensure_metaclass` to reset those tp slots. Also, don't set those methods on these classes in your code.
|
|
258
260
|
- `private_attribute.register_metaclass` must be called with the metaclass which supports weakref.
|
|
259
261
|
- Don't set `__static_attributes__` in private attribute class, or it will be removed.
|
|
@@ -232,7 +232,9 @@ TypeError: Can't instantiate abstract class MyClass without an implementation fo
|
|
|
232
232
|
- One class defined in another class cannot use another class's private attribute.
|
|
233
233
|
- One parent class defined an attribute which not in `__private_attrs__` or not a `PrivateAttrType` instance, the child class shouldn't contain the attribute in its `__private_attrs__`.
|
|
234
234
|
- Since 2.1.0: the code of a subclass can no longer access the private attributes of its parent classes - a parent's private attribute is only reachable from the parent's own code, or from a class that declares the same name in its own `__private_attrs__`.
|
|
235
|
-
- Since 2.1.0: if a subclass
|
|
235
|
+
- Since 2.1.0: if a subclass declares a name in its own `__private_attrs__` that is also private to a parent, the two are stored separately (instance attributes per declaring class, class-level attributes per class). Class-level resolution is per-subject through the parent's code: reading the name on a subclass subject returns the subclass's own value, and the parent's own value is untouched.
|
|
236
|
+
- Since 2.2.0: a subclass must NOT define an attribute in its namespace (class body) whose name is private to a parent class, unless that name is declared in its own `__private_attrs__` or the class opts in with `use_parents=True`.
|
|
237
|
+
- Since 2.2.0: pass `use_parents=True` in the class definition to inherit all parent classes' private attribute names into the subclass's own private-attribute set. The subclass's code can then read/write those names, but the values are stored in the subclass's own storage (they never overwrite the parent's own values). The Python-level `__private_attrs__` tuple is left unchanged; only the internal private-attribute name set is merged. Default is `False`.
|
|
236
238
|
- CPython may change "tp_getattro", "tp_setattro" and so on when you change the attribute "\_\_getattribute\_\_", "\_\_setattr\_\_" and so on. If you are fear about it, you can use `ensure_type` to reset those tp slots. For the other metaclasses, you can use `ensure_metaclass` to reset those tp slots. Also, don't set those methods on these classes in your code.
|
|
237
239
|
- `private_attribute.register_metaclass` must be called with the metaclass which supports weakref.
|
|
238
240
|
- Don't set `__static_attributes__` in private attribute class, or it will be removed.
|