# Changes immutable data types (in-place)
## pip install evilvars
#### Important: As the module's name suggests, it should not be used in a real project.
```python
go_to_purgatory(v, new):
"""
Copies the bytes of a new value to a buffer of an existing value.
Args:
v (Any): The existing value to copy the bytes to.
new (Any): The new value to copy the bytes from.
Returns:
bool: True if the bytes were successfully copied, False otherwise.
"""
from evilvars import go_to_purgatory
t = ("275", 54000, "0.0", "5000.0", "0.0")
newvar = "200" # the new string needs to be <= the old string
index = 0
print(id(t), t)
go_to_purgatory(v=t[index], new=newvar)
print(id(t), t)
index = 1
newvar = 20.1
go_to_purgatory(v=t[index], new=newvar)
print(id(t), t)
mystring = "hallo"
newvar = "XallY"
print(mystring)
print(id(mystring))
go_to_purgatory(v=mystring, new=newvar)
print(mystring)
print(id(mystring))
mystringb = b"hallo"
newvarb = b"XallY"
print(mystringb)
print(id(mystringb))
go_to_purgatory(v=mystringb, new=newvarb)
print(mystringb)
print(id(mystringb))
2218474368960 ('275', 54000, '0.0', '5000.0', '0.0')
2218474368960 ('200', 54000, '0.0', '5000.0', '0.0')
2218474368960 ('200', 20.1, '0.0', '5000.0', '0.0')
hallo
2218646391856
XallY
2218646391856
b'hallo'
2218646405792
b'XallY'
2218646405792
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/evilvars",
"name": "evilvars",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ctypes,low-level,evil,Change immutable data types",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/29/fe/d5c72316dee8d490c5a59844a776ef34d42e519fc9160f9ac7996afaf520/evilvars-0.10.tar.gz",
"platform": null,
"description": "# Changes immutable data types (in-place)\r\n\r\n## pip install evilvars\r\n\r\n#### Important: As the module's name suggests, it should not be used in a real project. \r\n\r\n\r\n```python\r\n\r\ngo_to_purgatory(v, new):\r\n \"\"\"\r\n Copies the bytes of a new value to a buffer of an existing value.\r\n\r\n Args:\r\n v (Any): The existing value to copy the bytes to.\r\n new (Any): The new value to copy the bytes from.\r\n\r\n Returns:\r\n bool: True if the bytes were successfully copied, False otherwise.\r\n \"\"\"\r\n\t\r\n\t\r\nfrom evilvars import go_to_purgatory\r\nt = (\"275\", 54000, \"0.0\", \"5000.0\", \"0.0\")\r\nnewvar = \"200\" # the new string needs to be <= the old string\r\nindex = 0\r\nprint(id(t), t)\r\ngo_to_purgatory(v=t[index], new=newvar)\r\nprint(id(t), t)\r\nindex = 1\r\nnewvar = 20.1\r\ngo_to_purgatory(v=t[index], new=newvar)\r\nprint(id(t), t)\r\nmystring = \"hallo\"\r\nnewvar = \"XallY\"\r\nprint(mystring)\r\nprint(id(mystring))\r\ngo_to_purgatory(v=mystring, new=newvar)\r\nprint(mystring)\r\nprint(id(mystring))\r\nmystringb = b\"hallo\"\r\nnewvarb = b\"XallY\"\r\nprint(mystringb)\r\nprint(id(mystringb))\r\ngo_to_purgatory(v=mystringb, new=newvarb)\r\nprint(mystringb)\r\nprint(id(mystringb))\r\n2218474368960 ('275', 54000, '0.0', '5000.0', '0.0')\r\n2218474368960 ('200', 54000, '0.0', '5000.0', '0.0')\r\n2218474368960 ('200', 20.1, '0.0', '5000.0', '0.0')\r\nhallo\r\n2218646391856\r\nXallY\r\n2218646391856\r\nb'hallo'\r\n2218646405792\r\nb'XallY'\r\n2218646405792\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Changes immutable data types (in-place)",
"version": "0.10",
"split_keywords": [
"ctypes",
"low-level",
"evil",
"change immutable data types"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "efad096f019f18f117ae384d5d1f3ec0b1662bbe0b3cfcc6fa5aff1bd9c7337e",
"md5": "bf4ca5122755304fa8bc05809c6bbc33",
"sha256": "717e113143799a8d41cfd525235edeb8ef0412d73afebfb80a85e36b040c834f"
},
"downloads": -1,
"filename": "evilvars-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bf4ca5122755304fa8bc05809c6bbc33",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 20925,
"upload_time": "2023-04-21T02:41:05",
"upload_time_iso_8601": "2023-04-21T02:41:05.673901Z",
"url": "https://files.pythonhosted.org/packages/ef/ad/096f019f18f117ae384d5d1f3ec0b1662bbe0b3cfcc6fa5aff1bd9c7337e/evilvars-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "29fed5c72316dee8d490c5a59844a776ef34d42e519fc9160f9ac7996afaf520",
"md5": "9692f03c10114aa8a384840a16a0bdbb",
"sha256": "64f8fb1712709353f18511fc5a2e1d6f3b0bd66c3d41a655847285e3ce980dd2"
},
"downloads": -1,
"filename": "evilvars-0.10.tar.gz",
"has_sig": false,
"md5_digest": "9692f03c10114aa8a384840a16a0bdbb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20015,
"upload_time": "2023-04-21T02:41:08",
"upload_time_iso_8601": "2023-04-21T02:41:08.417593Z",
"url": "https://files.pythonhosted.org/packages/29/fe/d5c72316dee8d490c5a59844a776ef34d42e519fc9160f9ac7996afaf520/evilvars-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-21 02:41:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "evilvars",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "evilvars"
}