python2.7 throws bus error when issuing `help("modules")'

Jeffrey Walton noloader at gmail.com
Mon Aug 24 15:36:30 UTC 2020


On Mon, Aug 24, 2020 at 5:59 AM Ryan Schmidt <ryandesign at macports.org> wrote:
>
>  ...
> > Logical CPU:     2
> > Error Code:      0x00000007 (invalid protections for user data read)
> > Trap Number:     14
> > ==========cut=================
> >
> > do you see the problem? I don't :|
>
> Fixed!
>
> https://github.com/macports/macports-ports/commit/d28bf24c7f754c2b49ff36eb57eb6aec4e687e5f

I see the fix came from
https://github.com/ronaldoussoren/pyobjc/pull/301/files. I don't think
that fix is correct. I think the use is going to give you more trouble
over time.

You can't cast a const object to non-const and write to it. The
non-const cast is undefined behavior because the object is const. (You
can only cast a non-const object back to non-const).

I think a more correct (?) fix would be to track the const-ness of the
actual object. That is:

    static BOOL is_default_descr(struct _PyObjC_ArgDescr* descr)

needs a way to look at _PyObjC_ArgDescr descr, and determine if it is
a non-const object. I think there are (at least) two ways to do it.
First, add a new field to _PyObjC_ArgDescr. Second, and a new
parameter to is_default_descr. I don't know which is best.

Jeff


More information about the macports-users mailing list