Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [PATCH 2/4] Define gdb.Value(bufobj, type) constructor
Date: Tue, 19 Feb 2019 00:57:00 -0000	[thread overview]
Message-ID: <20190218175720.6cf45742@f29-4.lan> (raw)
In-Reply-To: <87h8d0lnq2.fsf@tromey.com>

On Mon, 18 Feb 2019 15:45:57 -0700
Tom Tromey <tom@tromey.com> wrote:

> >>>>> "Kevin" == Kevin Buettner <kevinb@redhat.com> writes:  
> 
> FWIW I think this whole series looks quite reasonable and would be a
> good addition.

Thanks for looking it over.

> Kevin> +  Py_buffer py_buf;  
> 
> Elsewhere in the Python code, Py_buffer is only used conditionally on
> "#ifdef IS_PY3K".  I don't know exactly why, though.  Py_buffer seems to
> be in Python 2.7, maybe it wasn't in some earlier version that gdb still
> supports?

FWIW, I've tested my patch using both Python 2.7 and Python 3.7, which
are what I have on my F29 machine.

> I don't know whether anyone still relies on older versions of Python
> (2.7 was released in 2010 so it seems plenty old at this point; after
> all we require compilers released after this).
> 
> However, this seems like a decision to make consciously.
> I'm not completely sure how to proceed, though one idea might be to find
> the most recent Python 2.[456] compatibility patch and then asking the
> author whether this support is still relevant.

I didn't know of that compatibility patch, though I'll try to track it
down.  (A pointer would be appreciated if you have one handy.)

I decided that I had better educate myself about the old buffer
protocol.  I came across this page, which describes Python's old
buffer protocol:

https://docs.python.org/2/c-api/objbuffer.html

The old buffer protocol includes the functions PyObject_CheckReadBuffer()
and PyObject_AsReadBuffer() which are used in the non-IS_PY3K code in
GDB.

According to that page, the old buffer protocol was introduced in
Python 1.6, but is deprecated in the 2.X series.  It also indicates
that support for the new buffer protocol, which is what I used in my
patch, has been backported to Python 2.6.  2.6 was released in Oct
of 2008.  (I'm thinking that indicating that the old buffer protocol is
deprecated in 2.X is a typo.  I think they meant 3.X.)

I'll try removing use of the old buffer protocol from GDB and then
see if anything breaks with Python 2.7 (and maybe even 2.6 if I can
figure out how to make that happen).  If we get rid of the IS_PY3K
ifdefs from GDB, we'll definitely be making this decision consciously.

Kevin


  reply	other threads:[~2019-02-19  0:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190218075816.6f67f3d9@f29-4.lan>
2019-02-18 15:03 ` [PATCH 1/4] Define unique_ptr specialization for Py_buffer Kevin Buettner
2019-02-18 15:06 ` [PATCH 2/4] Define gdb.Value(bufobj, type) constructor Kevin Buettner
2019-02-18 22:46   ` Tom Tromey
2019-02-19  0:57     ` Kevin Buettner [this message]
2019-02-19 15:19       ` Tom Tromey
2019-02-19 15:28         ` Ulrich Weigand
2019-02-19  2:41   ` Simon Marchi
2019-02-18 15:07 ` [PATCH 3/4] Add tests for " Kevin Buettner
2019-02-19  2:46   ` Simon Marchi
2019-02-18 15:09 ` [PATCH 4/4] Document two argument form of gdb.Value constructor Kevin Buettner
2019-02-18 16:13   ` Eli Zaretskii
2019-02-18 17:25     ` Kevin Buettner
2019-02-18 17:45       ` Eli Zaretskii
2019-02-19  2:48 ` [PATCH 0/4] Define gdb.Value(val, type) constructor Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190218175720.6cf45742@f29-4.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox