3
3
#include < climits>
4
4
#include < cuchar>
5
5
#include < bitset>
6
+ #include < exception>
6
7
7
8
#include < plugify/logger.hpp>
8
9
#include < plugify/provider.hpp>
11
12
#include < plg/any.hpp>
12
13
#include < plg/format.hpp>
13
14
14
- #include < module_export.h>
15
-
16
15
#include " plugify/enum_object.hpp"
17
16
#include " plugify/enum_value.hpp"
18
17
@@ -1460,16 +1459,16 @@ namespace py3lm {
1460
1459
1461
1460
template <typename T>
1462
1461
PyObject* CreatePyObjectList (const plg::vector<T>& arrayArg) {
1463
- const auto size = static_cast <Py_ssize_t>( arrayArg.size () );
1462
+ const auto size = arrayArg.size ();
1464
1463
PyObject* const arrayObject = PyList_New (size);
1465
1464
if (arrayObject) {
1466
- for (Py_ssize_t i = 0 ; i < size; ++i) {
1465
+ for (size_t i = 0 ; i < size; ++i) {
1467
1466
PyObject* const valueObject = CreatePyObject (arrayArg[i]);
1468
1467
if (!valueObject) {
1469
1468
Py_DECREF (arrayObject);
1470
1469
return nullptr ;
1471
1470
}
1472
- PyList_SET_ITEM (arrayObject, i , valueObject);
1471
+ PyList_SET_ITEM (arrayObject, static_cast <Py_ssize_t>(i) , valueObject);
1473
1472
}
1474
1473
}
1475
1474
return arrayObject;
@@ -1482,16 +1481,16 @@ namespace py3lm {
1482
1481
1483
1482
template <typename T>
1484
1483
PyObject* CreatePyEnumObjectList (const EnumObject& enumerator, const plg::vector<T>& arrayArg) {
1485
- const auto size = static_cast <Py_ssize_t>( arrayArg.size () );
1484
+ const auto size = arrayArg.size ();
1486
1485
PyObject* const arrayObject = PyList_New (size);
1487
1486
if (arrayObject) {
1488
- for (Py_ssize_t i = 0 ; i < size; ++i) {
1487
+ for (size_t i = 0 ; i < size; ++i) {
1489
1488
PyObject* const valueObject = CreatePyEnumObject (enumerator, arrayArg[i]);
1490
1489
if (!valueObject) {
1491
1490
Py_DECREF (arrayObject);
1492
1491
return nullptr ;
1493
1492
}
1494
- PyList_SET_ITEM (arrayObject, i , valueObject);
1493
+ PyList_SET_ITEM (arrayObject, static_cast <Py_ssize_t>(i) , valueObject);
1495
1494
}
1496
1495
}
1497
1496
return arrayObject;
@@ -2952,8 +2951,8 @@ namespace py3lm {
2952
2951
2953
2952
const auto & paramTypes = method->GetParamTypes ();
2954
2953
const auto paramCount = paramTypes.size ();
2955
- const Py_ssize_t size = PyTuple_Size (args);
2956
- if (size != static_cast <Py_ssize_t>( paramCount) ) {
2954
+ const size_t size = static_cast < size_t >( PyTuple_Size (args) );
2955
+ if (size != paramCount) {
2957
2956
const std::string error (std::format (" Wrong number of parameters, {} when {} required." , size, paramCount));
2958
2957
PyErr_SetString (PyExc_TypeError, error.c_str ());
2959
2958
ret.Set <void *>(nullptr );
@@ -2971,14 +2970,14 @@ namespace py3lm {
2971
2970
BeginExternalCall (retType.GetType (), a);
2972
2971
}
2973
2972
2974
- for (Py_ssize_t i = 0 ; i < size; ++i) {
2973
+ for (size_t i = 0 ; i < size; ++i) {
2975
2974
const Property& paramType = paramTypes[i];
2976
2975
if (paramType.IsRef ()) {
2977
2976
++refParamsCount;
2978
2977
}
2979
2978
using PushParamFunc = bool (*)(const Property&, PyObject*, ArgsScope&);
2980
2979
PushParamFunc const pushParamFunc = paramType.IsRef () ? &PushObjectAsRefParam : &PushObjectAsParam;
2981
- const bool pushResult = pushParamFunc (paramType, PyTuple_GetItem (args, i ), a);
2980
+ const bool pushResult = pushParamFunc (paramType, PyTuple_GetItem (args, static_cast <Py_ssize_t>(i) ), a);
2982
2981
if (!pushResult) {
2983
2982
// pushParamFunc set error
2984
2983
ret.Set <void *>(nullptr );
@@ -3002,7 +3001,7 @@ namespace py3lm {
3002
3001
3003
3002
PyTuple_SET_ITEM (retTuple, k++, retObj); // retObj ref taken by tuple
3004
3003
3005
- for (Py_ssize_t i = 0 , j = hasHiddenParam; i < size; ++i) {
3004
+ for (size_t i = 0 , j = hasHiddenParam; i < size; ++i) {
3006
3005
const Property& paramType = paramTypes[i];
3007
3006
if (!paramType.IsRef ()) {
3008
3007
continue ;
@@ -4423,9 +4422,9 @@ namespace py3lm {
4423
4422
}
4424
4423
4425
4424
Python3LanguageModule g_py3lm;
4425
+ }
4426
4426
4427
- extern " C"
4428
- PY3LM_EXPORT ILanguageModule* GetLanguageModule () {
4429
- return &g_py3lm;
4430
- }
4427
+ extern " C"
4428
+ PY3LM_EXPORT ILanguageModule* GetLanguageModule () {
4429
+ return &py3lm::g_py3lm;
4431
4430
}
0 commit comments