Skip to content

Commit

Permalink
Merge branch 'UltraStudioLTD-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroIntensity committed Nov 8, 2022
2 parents d9c6527 + 9c48624 commit 6c3026d
Show file tree
Hide file tree
Showing 13 changed files with 3,279 additions and 680 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
dependencies = [
"typing_extensions",
]
version = "2.2.0"
version = "2.3.0-alpha"

[project.urls]
Documentation = "https://pointers.zintensity.dev"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
if __name__ == "__main__":
setup(
name="pointers.py",
version="2.2.0",
version="2.3.0-alpha",
packages=["pointers"],
license="MIT",
project_urls={
Expand Down
3 changes: 3 additions & 0 deletions src/_pointers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ from typing import Any, Callable, TypeVar

_T = TypeVar("_T")


def add_ref(obj: Any) -> None: ...
def remove_ref(obj: Any) -> None: ...
def force_set_attr(typ: type[Any], key: str, value: Any) -> None: ...
def set_ref(obj: Any, count: int) -> None: ...


def handle(
func: Callable[..., _T],
args: tuple[Any, ...] | None = None,
Expand Down
4 changes: 0 additions & 4 deletions src/mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
#include <stdio.h>
#include <frameobject.h> // needed to get members of PyFrameObject
#define GETOBJ PyObject* obj; if (!PyArg_ParseTuple(args, "O", &obj)) return NULL
#define INIT_HANDLER(sig, handle, msg) if (signal(sig, handle) == SIG_ERR) { \
PyErr_SetString(PyExc_ImportError, msg); \
return NULL; \
}

static jmp_buf buf;

Expand Down
19 changes: 11 additions & 8 deletions src/pointers/_cstd.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import ctypes
from ctypes.util import find_library
from platform import system

platforms = {
"linux": "libc.so.6",
"darwin": "libc.dylib",
"windows": "msvcrt",
}
from sys import platform

__all__ = (
"c_malloc",
Expand All @@ -20,7 +14,16 @@
"ldiv_t",
)

dll = ctypes.CDLL(platforms.get(system().lower()) or find_library("c"))
_c_library_name: str

if platform in ("win32", "cygwin"):
_c_library_name = "msvcrt"
elif platform == "darwin":
_c_library_name = "libc.dylib"
else:
_c_library_name = find_library("c") or "libc.so.6"

dll = ctypes.CDLL(_c_library_name)


class tm(ctypes.Structure):
Expand Down
Loading

0 comments on commit 6c3026d

Please sign in to comment.