Socket
Book a DemoInstallSign in
Socket

bypassmappingproxy

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bypassmappingproxy

modify immutable types by bypassing mapping proxy

pipPyPI
Version
0.1.0
Maintainers
1

Modifying sometype.__dict__

You can't directly set an attribute of a builtin type

int.real = 69

TypeError: cannot set 'real' attribute of immutable type 'int'

You also can't modify __dict__

int.__dict__["real"] = 69

TypeError: 'mappingproxy' object does not support item assignment

Mappingproxy provides a read-only proxy for mapping, which prevents modification. However, you can now bypass that using the bypassmappingproxy module

(it is written in pure python)

from bypassmappingproxy as bmp

assert (1).real == 1
bmp.type_set(int, "real", 69)
assert (1).real == 69

reference

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.