Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 788703

Summary: media-gfx/zbar-0.23.1[python] fails to compile with python 3.9 - error: 'PyTypeObject' {aka 'struct _typeobject'} has no member named 'tp_print'
Product: Gentoo Linux Reporter: PhobosK <phobosk>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED FIXED    
Severity: normal CC: ionen, phobosk
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/mchehab/zbar/issues/92
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 725490    
Attachments: python3_fix.patch
build.log + emerge --info.txt

Description PhobosK 2021-05-07 08:32:12 UTC
Since the "tp_print" slot of PyTypeObject has been removed since python 3.9 (and till python 3.9 was silently ignored), we get an error when compiling =media-gfx/zbar-0.23.1:

python/enum.c: In function 'enumitem_print':
python/enum.c:84:31: error: 'PyTypeObject' {aka 'struct _typeobject'} has no member named 'tp_print'
   84 |     return(self->name->ob_type->tp_print(self->name, fp, flags));
      |                               ^~
python/enum.c: At top level:
python/enum.c:118:6: error: 'PyTypeObject' {aka 'struct _typeobject'} has no member named 'tp_print'
  118 |     .tp_print       = (printfunc)enumitem_print,
      |      ^~~~~~~~
python/enum.c:118:23: warning: initialization of 'PyObject * (*)(PyObject *, PyObject *)' {aka 'struct _object * (*)(struct _object *, struct _object *)'} from 'long int' makes pointer from integer without a cast [-Wint-conversion]
  118 |     .tp_print       = (printfunc)enumitem_print,
      |                       ^
python/enum.c:118:23: note: (near initialization for 'zbarEnumItem_Type.tp_getattro')
python/enum.c: In function 'enumitem_print':
python/enum.c:85:1: warning: control reaches end of non-void function [-Wreturn-type]
   85 | }
      | ^

Upstream has patched the problem: https://github.com/mchehab/zbar/issues/92

I am uploading the patch, so someone could upload it to portage tree for the upcominning defaulting of python 3.9 (or use it in his local portage patch tree in /etc/portage/patches/media-gfx/zbar-0.23.1/ )

Thanks

Reproducible: Always
Comment 1 PhobosK 2021-05-07 08:33:32 UTC
Created attachment 706479 [details, diff]
python3_fix.patch

The upstream patch.
Tested and works with python 3.9
Comment 2 Ionen Wolkens gentoo-dev 2021-05-07 15:07:28 UTC
Hm, was 3.9 added to ebuild without testing or did this use to work?

I'll block py3.9 tracker given this doesn't look actually ported.
Comment 3 Ionen Wolkens gentoo-dev 2021-05-07 15:09:39 UTC
Created attachment 706506 [details]
build.log + emerge --info.txt
Comment 4 Larry the Git Cow gentoo-dev 2021-06-04 11:23:54 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7efabb81f9bbfc7ea149285949a27400ea6db736

commit 7efabb81f9bbfc7ea149285949a27400ea6db736
Author:     Marek Szuba <marecki@gentoo.org>
AuthorDate: 2021-06-04 11:21:30 +0000
Commit:     Marek Szuba <marecki@gentoo.org>
CommitDate: 2021-06-04 11:23:44 +0000

    media-gfx/zbar: fix python3_9 compilation failure
    
    Backported upstream fix. Tested against python3_8 and python3_9,
    compiles fine against both.
    
    Reported-by: PhobosK <phobosk@fastmail.fm>
    Closes: https://bugs.gentoo.org/788703
    Signed-off-by: Marek Szuba <marecki@gentoo.org>

 .../zbar/files/zbar-0.23.1_python_tp_print.patch   | 55 ++++++++++++++++++++++
 media-gfx/zbar/zbar-0.23.1.ebuild                  |  1 +
 2 files changed, 56 insertions(+)