Description
A library allows to insert one piece of code into another piece of code secretly, without changing line numbers.
The current version supports only Python 3.6. Also it allows to insert only functions without arguments.
Usage
A library has a useful function insert_code, which inserts which takes the original code, the code to insert and line number for insertion. The simplest example of usage from the examples directory:
from bytesinsert import insert_code
def hello():
print("1")
print("3")
def new_code():
print("2")
code_orig = hello.__code__
code_to_insert = new_code.__code__
success, result = insert_code(code_orig, code_to_insert, 6)
if success:
exec(result)
The resulting output will be:
1 2 3
The insert_code function inserted code from the function new_code into the function hello by updating its bytecode.
Install
This library can be easily installed with pip:
pip install bytesinsert
Metadata
Release files for bytesinsert 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bytesinsert-0.2.2.tar.gz | 6.9 kB | Without provenance | Details |
Release files / bytesinsert-0.2.2.tar.gz
| Download URL | bytesinsert-0.2.2.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
662f07cacf042f1232bb92db475aabdfd2750fcb3fe01ee5315ce7c02a6de83e
|
|
BLAKE2b-256 checksum How to use checksums |
a32768870afeb98bdfe35bf47606c25ee2ef50b39ab86c3817ce90095487e6d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for bytesinsert 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.