Einspect

Latest version: v0.5.16

Safety actively analyzes 623704 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 7

0.5.16

Fixes
* Fix TypeView.restore sentinel handling with no named args by ionite34 in https://github.com/ionite34/einspect/pull/85

**Full Changelog**: https://github.com/ionite34/einspect/compare/v0.5.15...v0.5.16

0.5.15

Fixes
- Fix `PyTypeObject.setattr_safe` not setting non-override slot attributes

Tools
- Add struct source comparisons to tools sub-package


**Full Changelog**: https://github.com/ionite34/einspect/compare/v0.5.13...v0.5.15

0.5.13

Fixes
- Improved stability of `object` PyMethods allocations 0857b06084b11e445872caa096635d80a38951d9
- Convert all remaining structures to use the `Struct` inheritance mode instead of the `struct` decorator, this allows them to have the dynamic casting rules applied a93c5ac9ab929cfa07c9a96d038f366a13698e83

Tooling
- Added `tools` subpackage for verifying compatibility with CPython source. This is not included in pypi user distributions.


**Full Changelog**: https://github.com/ionite34/einspect/compare/v0.5.12...v0.5.13

0.5.12

Adds
- `PyTypeObject.Ready` pythonapi method

Enhancements
- Improved stability for `impl` and `TypeView` setitem with new PyMethods struct allocation mode. This now recursively allocates for subtypes and supports allocating to the `object` type

Fixes
- Fix Struct `__setattr__` cast for ctypes.PYFUNCTION types that would always cast to NULL


**Full Changelog**: https://github.com/ionite34/einspect/compare/v0.5.11...v0.5.12

0.5.11

Added:
- `View.address` property that returns the memory address of an object, like `PyObject.address`
- `TypeView.restore()` restores the previously set or deleted attribute on a type
- Can be called with one or more attribute names `view(int).restore("__add__", "__mul__")` to restore those attributes
- Or can be called with no arguments to restore all implemented attributes `view(int).restore()`
- `TypeView.__delitem__` type view subscripting now supports deletion

python
from einspect import view

del view(int)["__pow__"]

print(2 ** 85)
TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'int'

view(int).restore("__pow__")
print(2 ** 85)
38685626227668133590597632


Enhancements:
- Added `Struct` base metaclass form of `struct` decorator, simplify internal usages in `PyObject` and other structures.

Fixes:
- Skip weakref check when detach=False


**Full Changelog**: https://github.com/ionite34/einspect/compare/v0.5.10...v0.5.11

0.5.10

Added
- `impl` now has optional bool keyword argument `detach`. If True, this will create a weak-reference finalizer for the method being implemented, and detach the method from the type when the method is garbage collected. If an original attribute exists, it will be restored during finalization, otherwise the attribute is deleted.
- This can be useful in cases where methods are not safe to be kept through interpreter shutdown, like `int.__hash__`
python
from einspect import impl, orig

impl(int, detach=True)
def __hash__(self):
print("in hash", self)
return orig(int).__hash__(self)


**Full Changelog**: https://github.com/ionite34/einspect/compare/v0.5.9...v0.5.10

Page 1 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.