View Issue Details

IDProjectCategoryView StatusLast Update
0004143FreeCADBugpublic2019-10-20 15:11
Reporterhobbes1069 Assigned Towmayer  
Status closedResolutionfixed 
PlatformLinuxOSFedoraOS Version32 (Rawhide)
Product Version0.18 
Summary0004143: Build error on Fedora with Python 3.8
DescriptionPer the discussion on another Fedora issue:

It looks like something to do with thread management was changed in Python 3.8 which is incompatible with current freecad code.

In file included from /builddir/build/BUILD/FreeCAD-0.18.3/src/Base/swigpyrun.cpp:41:
/builddir/build/BUILD/FreeCAD-0.18.3/src/Base/swigpyrun.inl: In function 'void Swig_python::cleanupSWIG_T(const char*)':
/builddir/build/BUILD/FreeCAD-0.18.3/src/Base/swigpyrun.inl:75:31: error: invalid use of incomplete type 'PyInterpreterState' {aka 'struct _is'}
   75 |     PyObject *modules = interp->modules;
      |                               ^~
In file included from /usr/include/python3.8/genobject.h:11,
                 from /usr/include/python3.8/Python.h:121,
                 from /builddir/build/BUILD/FreeCAD-0.18.3/src/Base/PyExport.h:42,
                 from /builddir/build/BUILD/FreeCAD-0.18.3/src/Base/swigpyrun.cpp:25:
/usr/include/python3.8/pystate.h:20:8: note: forward declaration of 'PyInterpreterState' {aka 'struct _is'}
   20 | struct _is;
      |        ^~~
Steps To ReproduceAttempt to build FreeCAD 0.18.3 with Fedora Rawhide (32) which has Python 3.8
FreeCAD Information



2019-09-24 20:59

reporter   ~0013685

Looks like PyInterpreterState was effectively made private. Temporary workaround suggested here:


2019-10-17 16:23

reporter   ~0013764

I implemented this fix for Fedora...

Replace "interp->modules" with PyImport_GetModuleDict()

Pull request submitted:


2019-10-20 15:09

administrator   ~0013769

Thanks hobbes1069 for the fix!

side note: hmm wonder why merging the PR didn't auto close this issue.
FreeCAD master 6eacb17b
I'll do it manually.

Related Changesets

FreeCAD: master 6eacb17b

2019-10-17 16:20:10


Committer: wwmayer Details Diff
Update for Python 3.8

In Python 3.8 some functions related to thread state were intentionally made private.

This fix (specific to FreeCAD) was suggested here:
Affected Issues
mod - src/Base/swigpyrun.inl Diff File

Issue History

Date Modified Username Field Change
2019-09-24 12:49 hobbes1069 New Issue
2019-09-24 20:59 hobbes1069 Note Added: 0013685
2019-10-10 18:27 Kunda1 Tag Attached: python
2019-10-17 16:23 hobbes1069 Note Added: 0013764
2019-10-20 15:09 Kunda1 Note Added: 0013769
2019-10-20 15:09 Kunda1 Changeset attached => FreeCAD master 6eacb17b
2019-10-20 15:10 Kunda1 Fixed in Version => 0.19
2019-10-20 15:11 Kunda1 Assigned To => wmayer
2019-10-20 15:11 Kunda1 Status new => closed
2019-10-20 15:11 Kunda1 Resolution open => fixed