Comments (5)
I think "negation" of longs needs to be its own helper function, surely it works differently. This is 3.11 code
static PyObject *
long_neg(PyLongObject *v)
{
PyLongObject *z;
if (IS_MEDIUM_VALUE(v))
return _PyLong_FromSTwoDigits(-medium_value(v));
z = (PyLongObject *)_PyLong_Copy(v);
if (z != NULL)
Py_SET_SIZE(z, -(Py_SIZE(v)));
return (PyObject *)z;
}
As you can see, they used to the negation (of an object, they are shortcutting for small numbers) with Py_SIZE negation, playing a dirty trick anymore. If you check out the same in 3.12, you can get a good idea of how it's now.
static PyObject *
long_neg(PyLongObject *v)
{
PyLongObject *z;
if (_PyLong_IsCompact(v))
return _PyLong_FromSTwoDigits(-medium_value(v));
z = (PyLongObject *)_PyLong_Copy(v);
if (z != NULL)
_PyLong_FlipSign(z);
return (PyObject *)z;
}
So, I guess, you would have to add a _NuitkaLong_FlipSign
with the code of 3.11 and 3.12 behind #if
from nuitka.
#if PYTHON_VERSION < 0x3c0
#define _NuitkaLong_FlipSign(x) Py_SET_SIZE(x, -(Py_SIZE(x)));
#else
#define _NuitkaLong_FlipSign _PyLong_FlipSign
#endif
This should be it. Find all the places that do this, and call the new "function" from there. If done correctly, you see no change for Python3.11, and for Python3.12 one C compile error will be gone. The proper spot could be nuitka/build/include/nuitka/helper/ints.h
although maybe I forgot and there is a better one.
Then rinse and repeat. For everything done there, we have a Python longobject code that we need to make portable across versions essentially.
from nuitka.
The 0x3c0
is 3.12
from nuitka.
I did this and it's currently on factory branch.
from nuitka.
Bummer, sorry didn't know you were going to move this fast on this issue. Thanks anyway
from nuitka.
Related Issues (20)
- May I ask, how is the uninstallation of the program done? HOT 1
- [Question] Am I using this flag correctly? (`nofollow-import-to`) HOT 1
- Viewing All Targets to be Compiled Without Actually Compiling HOT 1
- Generated exe does not run when using generated binary package HOT 10
- Compilation problem when using nuitka within container environments? HOT 3
- Nuitka removes local variable assigned in exception handle only HOT 7
- Crash with sklearn HOT 3
- Unable to compile with specific library versions, I tried compiling with nuitka using a speicifc (older) package version of discord.py HOT 1
- pyocd does not work in its entirety HOT 7
- playwright error HOT 1
- playwright can't find the driver after compilation HOT 1
- Error: problem with dependency scan of '/usr/local/lib/libcrypto.dylib' with '/usr/local/opt/openssl@3/lib/libcrypto.3.dylib' please report the bug HOT 5
- PySide6: Error when packaging QtQuick application HOT 6
- playwright can't find the driver after compilation HOT 1
- Is there a packaged configuration file format? HOT 4
- add System general controls class to configure common system configurations HOT 1
- ModuleNotFoundError: No module named 'scipy'
- Streamlit compilation HOT 1
- I have encountered common opencv-python problem: ImportError: ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCV installation. HOT 7
- the problem with compiling tensorflow HOT 13
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 nuitka.