Comments (3)
Additional information about this bug:
- I cannot reproduce on Linux with conda-forge.
- transonic 0.6.4 avoids this bug for most cases 🙂
- this bug can also be triggered by exporting a dictionary 🙁 , which is much more annoying because it is used for some extensions by Transonic and it cannot be simply avoided. I'm going to give a minimum example next week when I have access to a Windows machine.
from pythran.
It's difficult for me to debug that one as I don't have access to a windows machine. I confirm I can't reproduce on windows. Could you try the following:
pythran -E a.py
sed -i -e 's/PyModule_AddObject/PyModule_AddObjectRef/g' a.cpp
pythran a.cpp
python -c 'import a; print(a.my_tuple)'
I don't see why this would change the behavior (it should actually introduce a leak), just trying.
from pythran.
Replacing PyModule_AddObject
by PyModule_AddObjectRef
changes nothing.
If I comment PyModule_AddObject(theModule, "my_tuple", my_tuple);
, same thing.
If I comment static PyObject* my_tuple = to_python(__pythran_simple::my_tuple()());
, the extension can be imported (but of course without my_tuple
).
Then, I tried to replace this line with
Py_ssize_t size = 2;
PyObject* my_tuple = PyTuple_New(size);
I again get the same error.
Then, I tried to manually write a minimal cpp file exporting one tuple and I again get the same error, but I really don't know if it is correct.
#include <Python.h>
Py_ssize_t size = 2;
PyObject* my_tuple = PyTuple_New(size);
static PyMethodDef methods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};
static struct PyModuleDef mod_def = {
PyModuleDef_HEAD_INIT,
"my_mod",
"",
-1,
methods,
NULL,
NULL,
NULL,
NULL
};
PyObject *PyInit_my_mod(void)
{
PyObject* theModule = PyModule_Create(&mod_def);
PyModule_AddObject(theModule, "my_tuple", my_tuple);
return theModule;
}
I tried to check on Linux but using pythran
to compile such minimal cpp file does not work on Linux ("ImportError: dynamic module does not define module export function (PyInit_my_mod)").
from pythran.
Related Issues (20)
- Another compile error HOT 2
- Missing `<pythonic/omp/set_num_threads.hpp>` file in Pythran
- bool does not recognize numpy bool
- Compilation error no member named 'baseid' during check of overlap. HOT 1
- support scipy jv? HOT 2
- Help pythran avoid copy operations
- Inquiry about future support for custom NumPy dtypes in Pythran HOT 1
- Implement nanpercentile HOT 3
- Numpy2 support ? HOT 14
- 0.15.0: pytest fails in one unit `pythran/tests/test_euler.py::TestEuler::test_euler11_run0` and pytest wartnings HOT 1
- Eager imports cause crash in partially built environment. HOT 5
- Memory leak when returning a view
- error "cannot find -lopenblas: No such file or directory" on python 3.12 HOT 16
- No support for Python 3.12 HOT 5
- Regression and crash HOT 4
- Build errors for scipy 1.11.4 from pythran 0.15.0 with Intel OneAPI compilers 2024.1.0 HOT 3
- Python 3.13.0b2 doctest failures HOT 5
- MSVC throws errors in Pythran code of SciPy HOT 3
- Extremely slow compilation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythran.