[Python-Dev] seg fault in 3.10a4

2021-01-17 Thread Robin Becker
Not sure if this is where I should report, but I have a segfault in reportlab userguide creation with 3.10a4. I am 
getting this info from coredumpctl running archlinux with


Linux hostname 5.10.6-arch1-1 #1 SMP PREEMPT Sat, 09 Jan 2021 18:22:35 + 
x86_64 GNU/Linux


the error is
   Message: Process 1530711 (python) of user 1000 dumped core.

Stack trace of thread 1530711:
#0  0x7f7c9bf72615 raise (libc.so.6 + 0x3d615)
#1  0x7f7c9bf5b862 abort (libc.so.6 + 0x26862)
#2  0x7f7c9bfb45e8 __libc_message (libc.so.6 + 0x7f5e8)
#3  0x7f7c9bfbc27a malloc_printerr (libc.so.6 + 0x8727a)
#4  0x7f7c9bfbd64c _int_free (libc.so.6 + 0x8864c)
#5  0x5631260a01dd n/a 
(/home/robin/devel/reportlab/.py310/bin/python310 + 0x1401dd)

1) I compile this from source using the standard LTO method my script looks like

###
CFLAGS="-march=x86-64 -mtune=generic -O3 -pipe -fno-plt 
-fno-semantic-interposition"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now 
-rpath=$HOME/LOCAL/3.10.0a4/lib -fno-semantic-interposition"


./configure \
--prefix=$HOME/LOCAL/3.10.0a4 \
--with-computed-gotos \
--enable-optimizations \
--with-lto \
--enable-ipv6 \
--with-system-expat \
--with-dbmliborder=gdbm:ndbm \
--with-system-ffi \
--with-system-libmpdec \
--enable-loadable-sqlite-extensions && make EXTRA_CFLAGS="$CFLAGS" 
&& make install
###

1) can I get more information using a different compile setup

2) or can I get more information with the python run. I just used
$ python genuserguide.py 
Built story contains 1843 flowables...

Saved "/home/robin/devel/reportlab/REPOS/reportlab/docs/reportlab-userguide.pdf"
free(): invalid pointer
Aborted (core dumped)


3) I am running in an old style virtual environment generated using a modified virtualenv 16.2.0 (to fix wrong usage of 
sys.version[:3] in path names)


4) All other tests seem fine including tests of image generation and the accelerated strinGWidths etc etc so I am a bit 
mystified.

--
Robin Becker
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/5DCR2R6POCOHTPFUOY4F5G7GTBYX6OPO/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: seg fault in 3.10a4

2021-01-17 Thread Stestagg
Hi Robin

It would be ideal if you could please create a new issue here:
https://bugs.python.org/

Thanks

Steve

On Sun, Jan 17, 2021 at 12:53 PM Robin Becker  wrote:

> Not sure if this is where I should report, but I have a segfault in
> reportlab userguide creation with 3.10a4. I am
> getting this info from coredumpctl running archlinux with
>
> Linux hostname 5.10.6-arch1-1 #1 SMP PREEMPT Sat, 09 Jan 2021 18:22:35
> + x86_64 GNU/Linux
>
>
> the error is
> Message: Process 1530711 (python) of user 1000 dumped core.
>
>  Stack trace of thread 1530711:
>  #0  0x7f7c9bf72615 raise (libc.so.6 + 0x3d615)
>  #1  0x7f7c9bf5b862 abort (libc.so.6 + 0x26862)
>  #2  0x7f7c9bfb45e8 __libc_message (libc.so.6 +
> 0x7f5e8)
>  #3  0x7f7c9bfbc27a malloc_printerr (libc.so.6 +
> 0x8727a)
>  #4  0x7f7c9bfbd64c _int_free (libc.so.6 + 0x8864c)
>  #5  0x5631260a01dd n/a
> (/home/robin/devel/reportlab/.py310/bin/python310 + 0x1401dd)
>
> 1) I compile this from source using the standard LTO method my script
> looks like
>
> ###
> CFLAGS="-march=x86-64 -mtune=generic -O3 -pipe -fno-plt
> -fno-semantic-interposition"
> LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
> -rpath=$HOME/LOCAL/3.10.0a4/lib -fno-semantic-interposition"
>
>
> ./configure \
> --prefix=$HOME/LOCAL/3.10.0a4 \
> --with-computed-gotos \
> --enable-optimizations \
> --with-lto \
> --enable-ipv6 \
> --with-system-expat \
> --with-dbmliborder=gdbm:ndbm \
> --with-system-ffi \
> --with-system-libmpdec \
> --enable-loadable-sqlite-extensions && make
> EXTRA_CFLAGS="$CFLAGS" && make install
> ###
>
> 1) can I get more information using a different compile setup
>
> 2) or can I get more information with the python run. I just used
> > $ python genuserguide.py
> > Built story contains 1843 flowables...
> > Saved
> "/home/robin/devel/reportlab/REPOS/reportlab/docs/reportlab-userguide.pdf"
> > free(): invalid pointer
> > Aborted (core dumped)
>
> 3) I am running in an old style virtual environment generated using a
> modified virtualenv 16.2.0 (to fix wrong usage of
> sys.version[:3] in path names)
>
> 4) All other tests seem fine including tests of image generation and the
> accelerated strinGWidths etc etc so I am a bit
> mystified.
> --
> Robin Becker
> ___
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/5DCR2R6POCOHTPFUOY4F5G7GTBYX6OPO/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/UZSQ6QDZEYSOCLYZVGLP2MC5KG2JM3PH/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: seg fault in 3.10a4

2021-01-17 Thread Terry Reedy

On 1/17/2021 8:05 AM, Stestagg wrote:

Hi Robin

It would be ideal if you could please create a new issue here: 
https://bugs.python.org/ 


If 'reportlab userguide creation' uses any 3rd party compiled C code, 
this may be premature.  bugs.python.org is for patching cpython.  Seg 
faults with 3rd party extensions are often, even usually due to a bug in 
the extension that we cannot fix, or for new python version, a missing 
upgrade.


The questions Robin asked seem like a reasonable start.  He might get 
additional suggestions from python-list from someone who has seen 
something similar.


--
Terry Jan Reedy
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/6SRTWMOHBGKPXTTUBSU477YEPOZSJR46/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: PEP: Deferred Evaluation Of Annotations Using Descriptors

2021-01-17 Thread Larry Hastings


If you never examine __annotations__, then you can refer to symbols that 
are never defined and nothing bad happens.  It's just like writing a 
function that refers to undefined symbols, then never calling that function.


If you examine __annotations__, and the annotations refer to values that 
aren't defined, the evaluation fails.  This too works like you'd expect: 
the __co_annotation__ function raises NameError.  So your IPython use 
case would raise a NameError.


Note that the code is deliberately written to allow you to fix the name 
errors and try again.  (The __co_annotations__ attribute is only cleared 
if calling it succeeds and it returns a legal value.)  So, if you 
examine an annotation in IPython, and it fails with a NameError, you 
could import the missing module--or otherwise do what is needed to fix 
the problem--and try again.


If your imports are complicated, you could always hide them in a 
function.  I just tried this and it seems to work fine:


   def my_imports():
    global other_mod
    import other_mod

So, you could put all your imports in such a function, run it from 
inside a "if typing.TYPE_CHECKING" block, and you'd have a convenient 
way of doing all your imports from inside IPython too.


One final note: with PEP 649, you can still use strings as annotations 
if you prefer.  You just have to write them as strings manually.  So the 
IPython use case could continue to work correctly that way.  I realize 
that this itself causes minor problems--it means no syntax checking is 
done on the annotation, and it causes a little extra work for the 
user--but I assume this is a rare use case and most users won't need to 
bother.



Cheers,


//arry/

//

On 1/16/21 11:43 PM, Inada Naoki wrote:

This PEP doesn't cover about what happened when __co_annotation__()
failed (e.g. NameError).

Forward reference is a major reason, but not a only reason for using
string annotation. There are two other reasons:

* Avoid importing heavy module.
* Avoid circular imports.

In these cases, this pattern is used:

```
from __future__ import annotations
import typing
from dataclasses import dataclass

if typing.TYPE_CHECKING:
 import other_mod  # do not want to import actually

@dataclass
class Foo:
 a: other_mod.spam
 b: other_mod.ham

def fun(a: other_mod.spam, b: other_mod.ham) -> None: ...
```

Of course, mypy works well with string annotation because it is static checker.
IPython shows signature well too:

```
In [3]: sample.Foo?
Init signature: sample.Foo(a: 'other_mod.spam', b: 'other_mod.ham') -> None
Docstring:  Foo(a: 'other_mod.spam', b: 'other_mod.ham')
```

PEP 563 works fine in this scenario. How PEP 649 works?

Regards,
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/YMK24F6FWOTKAUO7ISJYMFYLJQPDWMO6/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: seg fault in 3.10a4

2021-01-17 Thread Robin Becker

On 17/01/2021 13:49, Terry Reedy wrote:

On 1/17/2021 8:05 AM, Stestagg wrote:

Hi Robin

It would be ideal if you could please create a new issue here: 
https://bugs.python.org/ 


If 'reportlab userguide creation' uses any 3rd party compiled C code, this may be premature.  bugs.python.org is for 
patching cpython.  Seg faults with 3rd party extensions are often, even usually due to a bug in the extension that we 
cannot fix, or for new python version, a missing upgrade.


The questions Robin asked seem like a reasonable start.  He might get additional suggestions from python-list from 
someone who has seen something similar.



Thanks, we have two C extensions & pillow so I will do as you suggest and ask 
in the python list for debugging advice.
--
Robin Becker
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/4R72YLNH2LFNCOOEXQAF3Q2MBHEKMAPU/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: seg fault in 3.10a4

2021-01-17 Thread Victor Stinner
See https://github.com/python-pillow/Pillow/issues/5193 and
https://github.com/python-pillow/Pillow/pull/5194 for a Pillow crash
on Python 3.10. A fix is merged in master, but there is no release
containing the fix yet.
https://github.com/python-pillow/Pillow/commit/543fa2ceb78103c7ae098900c315748a9283e4d4

Victor

On Sun, Jan 17, 2021 at 4:55 PM Robin Becker  wrote:
>
> On 17/01/2021 13:49, Terry Reedy wrote:
> > On 1/17/2021 8:05 AM, Stestagg wrote:
> >> Hi Robin
> >>
> >> It would be ideal if you could please create a new issue here: 
> >> https://bugs.python.org/ 
> >
> > If 'reportlab userguide creation' uses any 3rd party compiled C code, this 
> > may be premature.  bugs.python.org is for
> > patching cpython.  Seg faults with 3rd party extensions are often, even 
> > usually due to a bug in the extension that we
> > cannot fix, or for new python version, a missing upgrade.
> >
> > The questions Robin asked seem like a reasonable start.  He might get 
> > additional suggestions from python-list from
> > someone who has seen something similar.
> >
> Thanks, we have two C extensions & pillow so I will do as you suggest and ask 
> in the python list for debugging advice.
> --
> Robin Becker
> ___
> Python-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/[email protected]/message/4R72YLNH2LFNCOOEXQAF3Q2MBHEKMAPU/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Night gathers, and now my watch begins. It shall not end until my death.
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/BHNEMVPHGDGGNMWI5KRLNIKRCLCYH5NT/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: seg fault in 3.10a4

2021-01-17 Thread Robin Becker

On 17/01/2021 16:54, Victor Stinner wrote:

See https://github.com/python-pillow/Pillow/issues/5193 and
https://github.com/python-pillow/Pillow/pull/5194 for a Pillow crash
on Python 3.10. A fix is merged in master, but there is no release
containing the fix yet.
https://github.com/python-pillow/Pillow/commit/543fa2ceb78103c7ae098900c315748a9283e4d4

Victor

Thanks for that. I might try to build pillow from git and see if that helps.

...--
Robin Becker
___
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/JMQ25DF4OW7JRMU5Y6D6UDFXOCTDIRFB/
Code of Conduct: http://python.org/psf/codeofconduct/