Skip to content

Compilation error: pyversion( PyUnicode_FromString( PY_KIWI_VERSION ) ) #234

Description

@kiefernforst

I've just wanted to updated from kiwi 1.4.7 to 1.5.0 with the same build recipe I've been using for years.

py/src/kiwisolver.cpp: In function 'bool {anonymous}::add_objects(PyObject*)':
py/src/kiwisolver.cpp:64:48: error: 'PY_KIWI_VERSION' was not declared in this scope; did you mean 'KIWI_VERSION'?
   64 |     cppy::ptr pyversion( PyUnicode_FromString( PY_KIWI_VERSION ) );
      |                                                ^~~~~~~~~~~~~~~
      |                                                KIWI_VERSION

I've fixed this by deleting all the version assertions.

--- ./src/kiwi/py/src/kiwisolver.cpp	2026-05-28 10:56:53.255519760 +0200
+++ ./src/kiwi/py/src/old.cpp	2026-05-28 10:51:53.494208795 +0200
@@ -56,34 +56,12 @@
 {
 	using namespace kiwisolver;
 
-    cppy::ptr kiwiversion( PyUnicode_FromString( KIWI_VERSION ) );
-    if( !kiwiversion )
-    {
-        return false;
-    }
-    cppy::ptr pyversion( PyUnicode_FromString( PY_KIWI_VERSION ) );
-    if( !pyversion )
-    {
-        return false;
-    }
     cppy::ptr pystrength( PyType_GenericNew( strength::TypeObject, 0, 0 ) );
     if( !pystrength )
     {
         return false;
     }
 
-    if( PyModule_AddObject( mod, "__version__", pyversion.get() ) < 0 )
-    {
-		return false;
-	}
-    pyversion.release();
-
-    if( PyModule_AddObject( mod, "__kiwi_version__", kiwiversion.get() ) < 0 )
-    {
-		return false;
-	}
-    kiwiversion.release();
-
     if( PyModule_AddObject( mod, "strength", pystrength.get() ) < 0 )
     {
 		return false;

henceforth from kiwisolver/__init__.py
kiwi_version,
version,

Any idea why e.g. https://gitlab.archlinux.org/archlinux/packaging/packages/python-cppy/-/raw/main/PKGBUILD?ref_type=heads stopped working?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions