Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: <Paul_Koning@Dell.com>
To: <tromey@redhat.com>
Cc: <pmuldoon@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [patch] [python] Fix Python 3 build and testsuite issues
Date: Wed, 21 Aug 2013 15:37:00 -0000	[thread overview]
Message-ID: <C75A84166056C94F84D238A44AF9F6AD034BBAFB@AUSX10MPC103.AMER.DELL.COM> (raw)
In-Reply-To: <8761uzf5t3.fsf@fleche.redhat.com>


On Aug 21, 2013, at 10:59 AM, Tom Tromey <tromey@redhat.com> wrote:

> Phil> Strings in Python 3 are now always encoded and are encapsulated by the
> Phil> "str" class.
> 
> Phil> In Python 2 you had str() and unicode(), where unicode was encoded and
> Phil> str just represented bytes (IE just an unencoded string).
> 
> Phil> Reading around the suggestion seems to be to do this:
> 
> Phil> try:
> Phil>    # basestring catches both types of Python 2.x strings
> Phil>    if isinstance(sym, basestring)
> Phil>         return True
> Phil> except NameError:
> Phil>    # If we are here, basestring does not exist, so Python 3.x
> Phil>    if isinstance(sym, str)
> Phil>         return True
> Phil> # Continue to process objects that are not a string.
> 
> We can do this check once, at top-level:
> 
> 
> try:
>   if isinstance('hi', basestring):
>      def is_string(x):
>         return isinstance(x, basestring)
> except NameError:
>   def isinstance(x):
>     return isinstance(x, str)
> 
> 
> Maybe duck typing is still preferable though.
> 
> Not sure if this needs a third def in case the 'if' fails without throwing.
> Probably not.

I would write it this way:
try:
    basestring
except NameError:
    basestring = str

Similar techniques can be used for type "long" which isn't in Python 3 either.

 --paul
From gdb-patches-return-104503-listarch-gdb-patches=sources.redhat.com@sourceware.org Wed Aug 21 15:42:46 2013
Return-Path: <gdb-patches-return-104503-listarch-gdb-patches=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-patches@sources.redhat.com
Received: (qmail 21619 invoked by alias); 21 Aug 2013 15:42:46 -0000
Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-patches.sourceware.org>
List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-patches/>
List-Post: <mailto:gdb-patches@sourceware.org>
List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs>
Sender: gdb-patches-owner@sourceware.org
Delivered-To: mailing list gdb-patches@sourceware.org
Received: (qmail 21605 invoked by uid 89); 21 Aug 2013 15:42:45 -0000
X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.2
Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131)    by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 21 Aug 2013 15:42:44 +0000
Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58])	by relay1.mentorg.com with esmtp 	id 1VCAYT-0004G7-8p from joseph_myers@mentor.com ; Wed, 21 Aug 2013 08:42:41 -0700
Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675);	 Wed, 21 Aug 2013 08:42:41 -0700
Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Wed, 21 Aug 2013 16:42:39 +0100
Received: from jsm28 (helo=localhost)	by digraph.polyomino.org.uk with local-esmtp (Exim 4.76)	(envelope-from <joseph@codesourcery.com>)	id 1VCAYQ-0000e0-Gq; Wed, 21 Aug 2013 15:42:38 +0000
Date: Wed, 21 Aug 2013 15:42:00 -0000
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Walfred Tedeschi <walfred.tedeschi@intel.com>
CC: <tromey@redhat.com>, <jan.kratochvil@redhat.com>,	<mark.kettenis@xs4all.nl>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 0/7] Intel(R) MPX registers support.
In-Reply-To: <1377089148-11844-1-git-send-email-walfred.tedeschi@intel.com>
Message-ID: <Pine.LNX.4.64.1308211538340.32351@digraph.polyomino.org.uk>
References: <1377089148-11844-1-git-send-email-walfred.tedeschi@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
X-SW-Source: 2013-08/txt/msg00597.txt.bz2
Content-length: 374

If a user does a function call from GDB, or tells GDB to return from a
function, and BNDPRESERVE is zero, will it act as a BND-prefixed branch
that preserves the bounds registers or as a non-BND-prefixed branch that
clears the bounds registers?  (It's not obvious that there is one answer
that's best in all circumstances.)

--
Joseph S. Myers
joseph@codesourcery.com


  reply	other threads:[~2013-08-21 15:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 14:50 Phil Muldoon
2013-08-19 16:19 ` Tom Tromey
2013-08-19 16:45   ` Phil Muldoon
2013-08-19 18:34     ` Tom Tromey
2013-08-20 19:43       ` Phil Muldoon
2013-08-20 19:59         ` Tom Tromey
2013-08-20 20:32           ` Phil Muldoon
2013-08-21 14:29             ` Phil Muldoon
2013-08-21 14:59               ` Tom Tromey
2013-08-21 15:37                 ` Paul_Koning [this message]
2013-08-21 15:42                   ` Tom Tromey
2013-08-21 14:56             ` Tom Tromey
2013-08-22 10:46               ` Phil Muldoon
2013-08-27 15:41                 ` Tom Tromey
2013-08-29 10:08                   ` Phil Muldoon

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=C75A84166056C94F84D238A44AF9F6AD034BBAFB@AUSX10MPC103.AMER.DELL.COM \
    --to=paul_koning@dell.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pmuldoon@redhat.com \
    --cc=tromey@redhat.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