Repository navigation
Test 14study.t fails on Ubuntu 20.04, perl version 5.30, python version 3.8.2: Test 7 got: "1" expected "3" #29
Copy link
Copy link
Closed
Description
- OS: Ubuntu 20.04
- perl version 5.30.0
- python version 3.8.2
Commands to reproduce:
$ git clone git@github.com:niner/inline-python-pm.git
$ cd inline-python-pm
$ python --version
Python 3.8.2
$ perl --version
This is perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux
$ perl Makefile.PL
Found these python executables on your PATH:
1. /home/hakon/.pyenv/shims/python3
2. /home/hakon/.pyenv/shims/python
3. /bin/python3
Use which? [1]
Using /home/hakon/.pyenv/shims/python3
Using These Settings:
Extra Libs: -lcrypt -lpthread -ldl -lutil -lm
Python Lib: -L/home/hakon/.pyenv/versions/3.8.2-debug/lib/python3.8/config-3.8d-x86_64-linux-gnu -lpython3.8d
Includes: -I/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d
Extra Flags: -DPY_MAJOR_VERSION=3
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Inline::Python
Writing MYMETA.yml and MYMETA.json
$ make
cp Python.pod blib/lib/Inline/Python.pod
cp Python.pm blib/lib/Inline/Python.pm
Running Mkbootstrap for Python ()
chmod 644 "Python.bs"
"/home/hakon/perlbrew/perls/perl-5.30.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Python.bs blib/arch/auto/Inline/Python/Python.bs 644
"/home/hakon/perlbrew/perls/perl-5.30.0/bin/perl" "/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/ExtUtils/xsubpp" -typemap '/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/ExtUtils/typemap' Python.xs > Python.xsc
mv Python.xsc Python.c
cc -c -I/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.56\" -DXS_VERSION=\"0.56\" -fPIC "-I/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE" -DEXPOSE_PERL -DCREATE_PYTHON -UCREATE_PERL Python.c
In file included from /home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/Python.h:8,
from Python.xs:7:
/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/pyconfig.h:1571: warning: "_GNU_SOURCE" redefined
1571 | #define _GNU_SOURCE 1
|
In file included from /home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/perl.h:28,
from Python.xs:4:
/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/config.h:925: note: this is the location of the previous definition
925 | # define _GNU_SOURCE
|
Python.xs: In function ‘do_pyinit’:
Python.xs:52:5: warning: implicit declaration of function ‘initperl’ [-Wimplicit-function-declaration]
52 | initperl();
| ^~~~~~~~
cc -c -I/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.56\" -DXS_VERSION=\"0.56\" -fPIC "-I/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE" -DEXPOSE_PERL -DCREATE_PYTHON -UCREATE_PERL py2pl.c
In file included from /home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/Python.h:8,
from py2pl.c:5:
/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/pyconfig.h:1571: warning: "_GNU_SOURCE" redefined
1571 | #define _GNU_SOURCE 1
|
In file included from /home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/perl.h:28,
from py2pl.c:2:
/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/config.h:925: note: this is the location of the previous definition
925 | # define _GNU_SOURCE
|
py2pl.c: In function ‘croak_python_exception’:
py2pl.c:571:36: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
571 | croak("%s: %s at line %i\n", ((PyTypeObject *)ex_type)->tp_name, c_ex_message, PyInt_AsLong(tb_lineno));
| ~^
| |
| int
| %li
cc -c -I/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.56\" -DXS_VERSION=\"0.56\" -fPIC "-I/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE" -DEXPOSE_PERL -DCREATE_PYTHON -UCREATE_PERL perlmodule.c
In file included from /home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/Python.h:8,
from perlmodule.c:9:
/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/pyconfig.h:1571: warning: "_GNU_SOURCE" redefined
1571 | #define _GNU_SOURCE 1
|
In file included from /home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/perl.h:28,
from perlmodule.c:6:
/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/config.h:925: note: this is the location of the previous definition
925 | # define _GNU_SOURCE
|
cc -c -I/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.56\" -DXS_VERSION=\"0.56\" -fPIC "-I/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE" -DEXPOSE_PERL -DCREATE_PYTHON -UCREATE_PERL util.c
In file included from /home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/Python.h:8,
from util.c:9:
/home/hakon/.pyenv/versions/3.8.2-debug/include/python3.8d/pyconfig.h:1571: warning: "_GNU_SOURCE" redefined
1571 | #define _GNU_SOURCE 1
|
In file included from /home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/perl.h:28,
from util.c:6:
/home/hakon/perlbrew/perls/perl-5.30.0/lib/5.30.0/x86_64-linux/CORE/config.h:925: note: this is the location of the previous definition
925 | # define _GNU_SOURCE
|
rm -f blib/arch/auto/Inline/Python/Python.so
cc -shared -O2 -L/usr/local/lib -fstack-protector-strong Python.o py2pl.o perlmodule.o util.o -o blib/arch/auto/Inline/Python/Python.so \
-L/home/hakon/.pyenv/versions/3.8.2-debug/lib/python3.8/config-3.8d-x86_64-linux-gnu -lpython3.8d -lcrypt -lpthread -ldl -lutil -lm \
chmod 755 blib/arch/auto/Inline/Python/Python.so
Manifying 1 pod document
$ make test
"/home/hakon/perlbrew/perls/perl-5.30.0/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Python.bs blib/arch/auto/Inline/Python/Python.bs 644
PERL_DL_NONLAZY=1 "/home/hakon/perlbrew/perls/perl-5.30.0/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00init.t ................ ok
t/01testpl.t .............. ok
t/02testpl.t .............. ok
t/03parse.t ............... ok
t/04func.t ................ ok
t/05JAxH.t ................ ok
t/06dict.t ................ Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 66) line 1.
at t/06dict.t line 8.
BEGIN failed--compilation aborted at t/06dict.t line 8.
# Looks like your test exited with 255 before it could output anything.
t/06dict.t ................ Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 6/6 subtests
t/07nherit.t .............. Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 7) line 1.
at t/07nherit.t line 4.
BEGIN failed--compilation aborted at t/07nherit.t line 4.
t/07nherit.t .............. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/5 subtests
t/08ipyobj.t .............. ok
t/09bind.t ................ ok
t/10pyeval.t .............. ok
t/11factor.t .............. ok
t/12evnodd.t .............. ok
t/13fibbon.t .............. ok
t/14study.t ............... 1/14 # Test 7 got: "1" (t/14study.t at line 30)
# Expected: "3"
# t/14study.t line 30 is: ok(scalar keys %{$n{classes}}, 3);
# Test 8 got: "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD" (t/14study.t at line 32)
# Expected: "bone"
# t/14study.t line 32 is: ok($cls[0], 'bone');
# Test 9 got: <UNDEF> (t/14study.t at line 33)
# Expected: "comp"
# t/14study.t line 33 is: ok($cls[1], 'comp');
# Test 10 got: <UNDEF> (t/14study.t at line 34)
# Expected: "zone"
# t/14study.t line 34 is: ok($cls[2], 'zone');
# Test 11 got: "0" (t/14study.t at line 37)
# Expected: "3"
# t/14study.t line 37 is: ok(scalar @{$n{classes}{comp}}, 3);
# Test 12 got: <UNDEF> (t/14study.t at line 39)
# Expected: "__init__"
# t/14study.t line 39 is: ok($fns[0], '__init__');
# Test 13 got: <UNDEF> (t/14study.t at line 40)
# Expected: "bar"
# t/14study.t line 40 is: ok($fns[1], 'bar');
# Test 14 got: <UNDEF> (t/14study.t at line 41)
# Expected: "foo"
# t/14study.t line 41 is: ok($fns[2], 'foo');
t/14study.t ............... Failed 8/14 subtests
t/15anon.t ................ ok
t/16evalpy.t .............. ok
t/17once.t ................ ok
t/18newclass.t ............ Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 7) line 1.
at t/18newclass.t line 4.
BEGIN failed--compilation aborted at t/18newclass.t line 4.
t/18newclass.t ............ Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 5/5 subtests
t/19testref.t ............. ok
t/20unicode.t ............. ok
t/21arrayref.t ............ ok
t/22int.t ................. ok
t/23getattr.t ............. ok
t/24getitem.t ............. ok
t/25py_sub.t .............. Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 71) line 1.
at t/25py_sub.t line 5.
BEGIN failed--compilation aborted at t/25py_sub.t line 5.
# Looks like your test exited with 255 before it could output anything.
t/25py_sub.t .............. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 17/17 subtests
t/26undef.t ............... ok
t/27pyattrs.t ............. Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 63) line 1.
at t/27pyattrs.t line 5.
BEGIN failed--compilation aborted at t/27pyattrs.t line 5.
# Looks like your test exited with 255 before it could output anything.
t/27pyattrs.t ............. Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 14/14 subtests
t/28exception.t ........... Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 69) line 1.
at t/28exception.t line 7.
BEGIN failed--compilation aborted at t/28exception.t line 7.
# Looks like your test exited with 255 before it could output anything.
t/28exception.t ........... Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 9/9 subtests
t/29named_params.t ........ ok
t/30floats.t .............. ok
t/31stringification.t ..... Unrecognized character \xDD; marked by <-- HERE after age main::<-- HERE near column 15 at (eval 64) line 1.
at t/31stringification.t line 7.
BEGIN failed--compilation aborted at t/31stringification.t line 7.
# Looks like your test exited with 255 before it could output anything.
t/31stringification.t ..... Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 3/3 subtests
t/32boolean.t ............. ok
t/33reinit.t .............. ok
t/34env.t ................. ok
t/35dictunicodememleak.t .. ok
t/36utfstring.t ........... ok
t/cmp.t ................... ok
Test Summary Report
-------------------
t/06dict.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 6 tests but ran 0.
t/07nherit.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 5 tests but ran 0.
t/14study.t (Wstat: 0 Tests: 14 Failed: 8)
Failed tests: 7-14
t/18newclass.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 5 tests but ran 0.
t/25py_sub.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 17 tests but ran 0.
t/27pyattrs.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 14 tests but ran 0.
t/28exception.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 9 tests but ran 0.
t/31stringification.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: Bad plan. You planned 3 tests but ran 0.
Files=38, Tests=783, 16 wallclock secs ( 0.09 usr 0.02 sys + 14.84 cusr 0.47 csys = 15.42 CPU)
Result: FAIL
Failed 8/38 test programs. 8/783 subtests failed.
make: *** [Makefile:1069: test_dynamic] Error 255
I choose to focus on the first test failure in this issue:
t/14study.t ............... 1/14 # Test 7 got: "1" (t/14study.t at line 30)
# Expected: "3"
# t/14study.t line 30 is: ok(scalar keys %{$n{classes}}, 3);
By adding debug print statement in 14study.t I can see that py_study_package on line 16 returns the following hash:
{
classes {
������������� [
[0] "__init__",
[1] "foo",
[2] "bar"
]
},
functions [
[0] "Foo",
[1] "bar"
]
}
Where the key of the sub hash classes can be printed using printf "%vX\n", $key. This shows that the key contains the bytes:
DD.DD.DD.DD.DD.DD.DD.DD.DD.DD.DD.DD.DD.DD.DD.DD
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
niner commentedon Jan 8, 2021
This is very odd. Those 0xDD seem to appear in many places in that output (like 06dict.t) but the whole distribution doesn't contain a single one of them:
Can you try a different user or machine? Maybe it's something in your environment.
hakonhagland commentedon Jan 8, 2021
Yes this works fine on a fresh Ubuntu 20.04 VM:
niner commentedon Jan 8, 2021
Ok, then it really is no issue with Inline::Python but some weirdness in the environment that manages to mightily confuse Perl. Closing.
hakonhagland commentedon May 27, 2021
Hi. I investigated this a little bit more. I think it could be related to that I use
pyenv. It seems that the problem is that the generated shared objectPython.sois linked statically withlibpython3.9d.ainstead of dynamically withlibpython3.9d.sowhen I use thepyenvpython. I notice from the output ofmakethatif I use the
pyenvinstalled Python 3.9.3,Python.sois generated by the command:If I instead use the system python 3.9.4,
Python.sois generated using:Now, there is an interesting difference in the above to library paths:
-L/home/hakon/.pyenv/versions/3.9.3-debug/lib/python3.9/config-3.9d-x86_64-linux-gnu, and-L/usr/lib/python3.9/config-3.9-x86_64-linux-gnuIn the first case there is no shared object
libpython3.9d.soin the given path, but for the second case (the system python), there is a shared object/usr/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.soin the path.I think that in the first case, since the
.sois missing, thecccommand is using the static library/home/hakon/.pyenv/versions/3.9.3-debug/lib/python3.9/config-3.9d-x86_64-linux-gnu/libpython3.9d.ainstead.I checked
Makefile.PL, and I see that on line 154 it is using the config variableLIBPLto locate the directory oflibpython.so. However, there is another config variable calledLIBDIR, see this Q&A, which works correctly for me. Comparefor the pyenv python:
and for the system python:
In both cases above, the shared object exists in
LIBDIR. MaybeMakefile.PLneeds to be patched to useLIBDIRinstead ofLIBPL?Fixup in Makefile.PL