Skip to content

Instantly share code, notes, and snippets.

View Paebbels's full-sized avatar

Patrick Lehmann Paebbels

View GitHub Profile
@Paebbels
Paebbels / BindingDecorator.py
Created January 13, 2021 12:00
Bind Python Functions via ctype to Shared Libraries
class __Environment():
"""
Create a Python root environment with local and global symbols and a builtins
namespace
"""
globals: Dict #: global symbols
locals: Dict #: local symbols
builtins: Dict #: builtins namespace (``__builtins__``)
@Paebbels
Paebbels / Reproducer.py
Created June 13, 2023 20:52
Python __new__ and __init__ with meta-classes
class AbstractClassError(Exception):
pass
class M(type):
# staticmethod
def __new__(cls, className, baseClasses, members, abstract):
newClass = type.__new__(cls, className, baseClasses, members)
if abstract:
def newnew(cls, *_, **__):