Skip to content

Commit 1c27889

Browse files
committed
oh how i love merge conflicts
2 parents 0237c87 + 468f099 commit 1c27889

File tree

9 files changed

+64
-21
lines changed

9 files changed

+64
-21
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 ZeroIntensity
3+
Copyright (c) 2023 ZeroIntensity
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/pointers/api_bindings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
from ._pyapi import API_FUNCS, Func
44
from .base_pointers import BaseObjectPointer
55
from .bindings import (
6-
CharLike, PointerLike, StringLike, binding_base, make_char, make_string
6+
CharLike,
7+
PointerLike,
8+
StringLike,
9+
binding_base,
10+
make_char,
11+
make_string,
712
)
813
from .std_structs import *
914
from .structure import StructPointer

src/pointers/bindings.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
import warnings
44
from types import FunctionType
55
from typing import (
6-
TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator, Optional, Sequence,
7-
Type, TypeVar, Union
6+
TYPE_CHECKING,
7+
Any,
8+
Callable,
9+
Dict,
10+
Iterable,
11+
Iterator,
12+
Optional,
13+
Sequence,
14+
Type,
15+
TypeVar,
16+
Union,
817
)
918

1019
from _pointers import add_ref

src/pointers/c_pointer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import ctypes
22
from abc import ABC, abstractmethod
3-
from typing import (
4-
TYPE_CHECKING, Any, Callable, Iterator, List, Optional, Type, TypeVar
5-
)
3+
from typing import TYPE_CHECKING, Any, Callable, Iterator, List, Optional, Type, TypeVar
64

75
from typing_extensions import ParamSpec
86

src/pointers/decay.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
from functools import wraps
44
from typing import Any, Callable, Dict, Tuple, TypeVar
55

6-
from typing_extensions import (
7-
Annotated, ParamSpec, get_args, get_origin, get_type_hints
8-
)
6+
from typing_extensions import Annotated, ParamSpec, get_args, get_origin, get_type_hints
97

108
from .object_pointer import Pointer, to_ptr
119

src/pointers/std_structs.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@
33

44
from ._cstd import div_t, lconv, ldiv_t, tm
55
from ._pyapi import (
6-
Py_buffer, Py_tss_t, PyCodeObject, PyFrameObject, PyGetSetDef,
7-
PyInterpreterState, PyMethodDef, PyModuleDef, PyThreadState, PyType_Slot,
8-
PyType_Spec, PyTypeObject, PyVarObject
6+
Py_buffer,
7+
Py_tss_t,
8+
PyCodeObject,
9+
PyFrameObject,
10+
PyGetSetDef,
11+
PyInterpreterState,
12+
PyMethodDef,
13+
PyModuleDef,
14+
PyThreadState,
15+
PyType_Slot,
16+
PyType_Spec,
17+
PyTypeObject,
18+
PyVarObject,
919
)
1020
from .c_pointer import TypedCPointer, VoidPointer
1121
from .structure import Struct, StructPointer

src/pointers/util.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
from contextlib import suppress
44
from functools import wraps
55
from io import UnsupportedOperation
6-
from typing import (
7-
TYPE_CHECKING, Any, Callable, NamedTuple, Type, TypeVar, Union
8-
)
6+
from typing import TYPE_CHECKING, Any, Callable, NamedTuple, Type, TypeVar, Union
97

108
from typing_extensions import ParamSpec
119

tests/test_allocation.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
from ward import raises, test
44

55
from pointers import (
6-
DereferenceError, FreedMemoryError, InvalidSizeError,
7-
StackAllocatedPointer, acquire_stack_alloc, calloc, free, malloc, realloc
6+
DereferenceError,
7+
FreedMemoryError,
8+
InvalidSizeError,
9+
StackAllocatedPointer,
10+
acquire_stack_alloc,
11+
calloc,
12+
free,
13+
malloc,
14+
realloc,
815
)
916

1017

@@ -114,6 +121,7 @@ def __init__(self, value: str) -> None:
114121
free(ptr)
115122
assert obj.value == "hello"
116123

124+
117125
@test("stack allocation")
118126
def _():
119127
@acquire_stack_alloc(24)

tests/test_bindings.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
from ward import raises, test
22

33
from pointers import (
4-
InvalidBindingParameter, Struct, StructPointer, TypedCPointer, VoidPointer
4+
InvalidBindingParameter,
5+
Struct,
6+
StructPointer,
7+
TypedCPointer,
8+
VoidPointer,
59
)
610
from pointers import _cstd as std
711
from pointers import (
8-
binds, c_free, c_malloc, cast, div, isspace, signal, sprintf, strcpy,
9-
strlen, to_c_ptr, to_struct_ptr, to_voidp, toupper
12+
binds,
13+
c_free,
14+
c_malloc,
15+
cast,
16+
div,
17+
isspace,
18+
signal,
19+
sprintf,
20+
strcpy,
21+
strlen,
22+
to_c_ptr,
23+
to_struct_ptr,
24+
to_voidp,
25+
toupper,
1026
)
1127
from pointers.std_structs import DivT
1228

@@ -93,6 +109,7 @@ class MyStruct(Struct):
93109
assert ~cast(s.e, str) == "hello"
94110

95111
with raises(TypeError):
112+
96113
class Foo(Struct):
97114
bar: TypedCPointer
98115

0 commit comments

Comments
 (0)