Skip to content

Commit

Permalink
Fix CI on my machine
Browse files Browse the repository at this point in the history
  • Loading branch information
atilaneves committed May 30, 2024
1 parent 0bfa28d commit 45d7201
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 42 deletions.
2 changes: 1 addition & 1 deletion pynih/contract/source/contract/pyclass.d
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ package PyObject* pyclass_string_list_struct(PyObject* self, PyObject *args) {
return null;
}

const length = PyUnicode_GetSize(item);
const length = PyUnicode_GetLength(item);
auto ptr = PyBytes_AsString(unicode);
auto str = ptr is null ? null : ptr[0 .. length];

Expand Down
4 changes: 2 additions & 2 deletions pynih/contract/source/contract/udt.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ package PyObject* simple_struct_func(PyObject* self, PyObject *args) nothrow @no
// either this of PyGetSetDef
static PyMemberDef[3] members;
members[0].name = cast(typeof(PyMemberDef.name)) &"the_int"[0];
members[0].type = T_INT;
members[0].type = Py_T_INT;
members[0].offset = MyType.i.offsetof;
members[1].name = cast(typeof(PyMemberDef.name)) &"the_double"[0];
members[1].type = T_DOUBLE;
members[1].type = Py_T_DOUBLE;
members[1].offset = MyType.d.offsetof;

static PyTypeObject type;
Expand Down
4 changes: 2 additions & 2 deletions pynih/source/autowrap/pynih/python/conv/python_to_d.d
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ T to(T)(PyObject* value) if(isArray!T && !isSomeString!T)

T to(T)(PyObject* value) if(isSomeString!T) {

import python.c: PyUnicode_GetSize, PyUnicode_Check,
import python.c: PyUnicode_GetLength, PyUnicode_Check,
PyBytes_AsString, PyUnicode_AsUTF8String, Py_ssize_t;
import std.conv: to;

const length = PyUnicode_GetSize(value);
const length = PyUnicode_GetLength(value);
if(length == 0) return T.init;

auto str = PyUnicode_AsUTF8String(value);
Expand Down
16 changes: 1 addition & 15 deletions pynih/source/autowrap/pynih/python/cooked.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ auto createModule(Module module_, alias cfunctions, alias aggregates = Aggregate
static PyModuleDef moduleDef;

auto pyMethodDefs = cFunctionsToPyMethodDefs!(cfunctions);
moduleDef = pyModuleDef(module_.name.ptr, null /*doc*/, -1 /*size*/, pyMethodDefs);
moduleDef = PyModuleDef(pyModuleDefHeadInit, module_.name.ptr, null /*doc*/, -1 /*size*/, pyMethodDefs);

auto module_ = PyModule_Create(&moduleDef);
addModuleTypes!(aggregates.Types)(module_);
Expand Down Expand Up @@ -73,20 +73,6 @@ private PyMethodDef* cFunctionsToPyMethodDefs(alias cfunctions)()
}


/**
Helper function to get around the C syntax problem with
PyModuleDef_HEAD_INIT - it doesn't compile in D.
*/
private auto pyModuleDef(A...)(auto ref A args) {
import std.functional: forward;

return PyModuleDef(
// the line below is a manual D version expansion of PyModuleDef_HEAD_INIT
PyModuleDef_Base(PyObject(1 /*ref count*/, null /*type*/), null /*m_init*/, 0/*m_index*/, null/*m_copy*/),
forward!args
);
}

/**
Helper function to create PyMethodDef structs.
The strings are compile-time parameters to avoid passing GC-allocated memory
Expand Down
27 changes: 5 additions & 22 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
attrs==21.2.0
blessings==1.7
bpython==0.21
certifi==2023.7.22
chardet==4.0.0
curtsies==0.3.5
cwcwidth==0.1.4
greenlet==1.1.0
idna==3.7
iniconfig==1.1.1
numpy==1.22.0
packaging==20.9
pluggy==0.13.1
py==1.10.0
Pygments==2.15.0
pyparsing==2.4.7
pytest==6.2.4
pyxdg==0.27
requests==2.32.0
six==1.16.0
toml==0.10.2
urllib3==1.26.18
iniconfig==2.0.0
numpy==1.26.4
packaging==24.0
pluggy==1.5.0
pytest==8.2.1

0 comments on commit 45d7201

Please sign in to comment.