Skip to main content
2 of 2
deleted 36 characters in body
ovs
  • 60.6k
  • 3
  • 47
  • 161

Python 3, pxeger

With direct memory access, nothing is really immutable. Replaces the string in the constant table of the lambda function.

import ctypes

wow = f.__code__.co_consts[2].co_consts[1]
hah = 'hah'
ctypes.memmove(id(wow), id(hah), hah.__sizeof__())

Attempt This Online!

ovs
  • 60.6k
  • 3
  • 47
  • 161