MCPcopy Index your code
hub / github.com/ZeroIntensity/pointers.py

github.com/ZeroIntensity/pointers.py @v3.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.1 ↗ · + Follow
1,168 symbols 3,476 edges 36 files 154 documented · 13%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pointers.py

Tests

Bringing the hell of pointers to Python

Why would you ever need this

Examples

from pointers import _

text: str = "hello world"
ptr = _&text  # creates a new pointer object
ptr <<= "world hello"
print(text)  # world hello
from pointers import c_malloc, c_free, strcpy, printf

ptr = c_malloc(3)
strcpy(ptr, "hi")
printf("%s\n", ptr)  # hi
c_free(ptr)
from pointers import malloc, free

my_str = malloc(103)
my_str <<= "hi"
second_str = my_str[51]
second_str <<= "bye"
print(*my_str, *second_str)  # hi bye
free(my_str)

Features

  • Fully type safe
  • Pythonic pointer API
  • Bindings for the entire C standard library and CPython ABI
  • Segfaults

Why does this exist?

The main purpose of pointers.py is to simply break the rules of Python, but has some other use cases:

  • Can help C/C++ developers get adjusted to Python
  • Provides a nice learning environment for programmers learning how pointers work
  • Makes it very easy to manipulate memory in Python
  • Why not?

Installation

Linux/macOS

python3 -m pip install -U pointers.py

Windows

py -3 -m pip install -U pointers.py

Core symbols most depended-on inside this repo

_register
called by 717
src/pointers/_pyapi.py
api_binding_base
called by 657
src/pointers/api_bindings.py
_deref_maybe
called by 545
src/pointers/api_bindings.py
make_string
called by 217
src/pointers/bindings.py
binding_base
called by 114
src/pointers/bindings.py
make_char
called by 19
src/pointers/bindings.py
ensure
called by 17
src/pointers/api_bindings.py
ctc
called by 16
gen.py

Shape

Method 806
Function 206
Class 156

Languages

Python99%
C1%

Modules by API surface

src/pointers/api_bindings.py737 symbols
src/pointers/bindings.py128 symbols
src/pointers/base_pointers.py56 symbols
src/pointers/c_pointer.py43 symbols
src/pointers/structure.py20 symbols
src/pointers/std_structs.py17 symbols
src/pointers/malloc.py15 symbols
src/pointers/calloc.py15 symbols
src/pointers/_pyapi.py14 symbols
src/pointers/stack_pointer.py12 symbols
src/mod.c12 symbols
src/pointers/var_pointer.py11 symbols

For agents

$ claude mcp add pointers.py \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact