Skip to content

Commit

Permalink
Use tp_members in SpecificationBase and ClassProvidesBase.
Browse files Browse the repository at this point in the history
Instead of storing 1 and 2 attributes, respectively, in __dict__. This lets us eliminate inst_attr and its use of an undocumented API.

It also helps reign in the size of these objects. Before, on CPython 8, a ClassProvides object that subclasses both SpecificationBase and ClassProvidesBase required 408 bytes: 48 for the object, 360 for the dict.

Now it requires 72 + 232 = 304.

With a bit of work on defining __slots__ in Python, that can be brought much lower still, I think.

zope.security tests pass with this installed.
  • Loading branch information
jamadden committed Jan 23, 2020
1 parent b928f8a commit ddf670a
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 232 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
value forces the Python implementation to be used, ignoring the C
extensions.

- Change the C classes ``SpecificationBase`` and its subclass
``ClassProvidesBase`` to store implementation attributes in their structures
instead of their instance dictionaries. This eliminates the use of
an undocumented private C API function.


4.7.1 (2019-11-11)
==================
Expand Down
Loading

0 comments on commit ddf670a

Please sign in to comment.