Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pygobject pygobject
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 199
    • Issues 199
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 25
    • Merge requests 25
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • pygobjectpygobject
  • Issues
  • #242

Python 2 build-time tests fail when built srcdir != builddir with Meson

When building PyGObject 3.29.2 with Meson for Python 2 in a srcdir != builddir layout, the build-time tests fail with an assertion failure. On investigating with gdb, it appears that I get the just-built copy of _gi.so, but my system-wide copy of _gi_cairo.so, loaded into the same interpreter; obviously those don't match.

% meson build -Dpython=python2
% ninja -C build
% meson test -C build --verbose
...
../tests/test_cairo.py .1/1 pygobject-test-suite                    FAIL     1.32 s (killed by signal 6 SIGABRT)

Backtrace:

#0  0x00007fc2bd05cf3b in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007fc2bd05e2f1 in __GI_abort () at abort.c:79
#2  0x00007fc2bb190dd3 in g_assertion_message (domain=0x0, file=0x7fc2ba79e278 "../../gi/pygi-foreign-cairo.c", line=55, func=0x7fc2ba79e310 <__func__.25655> "cairo_context_to_arg", message=0x55f1e7c90e40 "assertion failed: (transfer == GI_TRANSFER_NOTHING)") at ../../../../glib/gtestutils.c:2574
#3  0x00007fc2bb1ea35a in g_assertion_message_expr (domain=0x0, file=0x7fc2ba79e278 "../../gi/pygi-foreign-cairo.c", line=55, func=0x7fc2ba79e310 <__func__.25655> "cairo_context_to_arg", expr=<optimized out>)
    at ../../../../glib/gtestutils.c:2597
#4  0x00007fc2ba79d649 in cairo_context_to_arg (value=<optimized out>, interface_info=<optimized out>, transfer=<optimized out>, arg=<optimized out>) at ../../gi/pygi-foreign-cairo.c:55
#5  0x00007fc2bb666ff6 in pygi_arg_struct_from_py_marshal (py_arg=<cairo.Context at remote 0x7fc2bb97b9b0>, arg=0x55f1e9660c90, arg_name=0x7fc2ba2dcf14 <error: Cannot access memory at address 0x7fc2ba2dcf14>, interface_info=<optimized out>, g_type=0x55f1e9793f10 [CairoContext], py_type=<StructMeta(__module__='gi.repository.cairo', __info__=<StructInfo at remote 0x7fc2ba9a1b98>, __dict__=<getset_descriptor at remote 0x7fc2b405e9e0>, __gtype__=<gobject.GType at remote 0x7fc2b4069240>, __weakref__=<getset_descriptor at remote 0x7fc2b405ea70>, __doc__=None) at remote 0x55f1e9849300>, transfer=GI_TRANSFER_EVERYTHING, copy_reference=1, is_foreign=1, is_pointer=1)
    at ../gi/pygi-struct-marshal.c:253
#6  0x00007fc2bb66734d in arg_struct_from_py_marshal_adapter (state=<optimized out>, callable_cache=<optimized out>, arg_cache=<optimized out>, py_arg=<optimized out>, arg=0x55f1e9660c90, cleanup_data=0x7ffc5a079318)
    at ../gi/pygi-struct-marshal.c:335
#7  0x00007fc2bb65dc20 in _invoke_marshal_in_args (function_cache=0x55f1e7c51170, state=0x7ffc5a079360)
    at ../gi/pygi-invoke.c:535
#8  0x00007fc2bb65dc20 in pygi_invoke_c_callable (function_cache=0x55f1e7c51170, state=<optimized out>, py_args=<optimized out>, py_kwargs=<optimized out>) at ../gi/pygi-invoke.c:685

gi/pygi-foreign-cairo.c:55 is not an assertion in my current PyGObject 3.29.2, but it is an assertion transfer == GI_TRANSFER_NOTHING in my system-wide-installed PyGObject 3.28.3-1.

info files says:

	0x00007fc2bb642050 - 0x00007fc2bb667ecf is .text in /srv/tmp/smcv/build-area/pygobject/build/gi/_gi.so
...
	0x00007fc2ba79d230 - 0x00007fc2ba79de75 is .text in /usr/lib/python2.7/dist-packages/gi/_gi_cairo.x86_64-linux-gnu.so

so it appears the just-built PyGObject is not isolating itself from the system copy sufficiently well?

build/gi does contain both _gi.so and _gi_cairo.so.

I wonder whether this is related to the fact that Python 2 will not import modules from a directory if it does not contain __init__.py, whereas Python 3 will? I don't get a similar failure when building with setup.py, which copies *.py into the build directory alongside the built extensions.

Assignee
Assign to
Time tracking