fishhook 0.3.5__tar.gz → 0.3.6__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: fishhook
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Allows for runtime hooking of static class functions
5
5
  Author-email: chilaxan <chilaxan@gmail.com>
6
6
  License: MIT
@@ -12,6 +12,9 @@ def sizeof(obj):
12
12
 
13
13
  TYPE_BASICSIZE = sizeof(type)
14
14
 
15
+ # mapping historyically is always directly after object header
16
+ MAPPING_PROXY_OFFSET = sizeof(object())
17
+
15
18
  def getmem(obj_or_addr, size=None, fmt='P'):
16
19
  if size is None:
17
20
  if isinstance(obj_or_addr, type):
@@ -91,13 +94,9 @@ def build_unlock_lock():
91
94
 
92
95
  unlock, lock = build_unlock_lock()
93
96
 
94
- def getdict(cls, E=type('',(),{'__eq__':lambda s,o:o})()):
95
- '''
96
- Obtains a writeable dictionary of a classes namespace
97
- Note that any modifications to this dictionary should be followed by a
98
- call to PyType_Modified(cls)
99
- '''
100
- return cls.__dict__ == E
97
+ def getdict(cls):
98
+ mapping = cls.__dict__
99
+ return py_object.from_address(id(mapping) + MAPPING_PROXY_OFFSET).value
101
100
 
102
101
  def newref(obj):
103
102
  getmem(obj)[0] += 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fishhook
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Allows for runtime hooking of static class functions
5
5
  Author-email: chilaxan <chilaxan@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fishhook"
3
- version = "0.3.5"
3
+ version = "0.3.6"
4
4
  description = "Allows for runtime hooking of static class functions"
5
5
  authors = [
6
6
  { name = "chilaxan", email = "chilaxan@gmail.com" },
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