Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'subject:bug': 0.07; 'bug.': 0.09; 'strings.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'bug,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'identifiers': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'error': 0.23; 'byte': 0.24; 'string,': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'switch': 0.26; 'pass': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'apparently': 0.31; 'stuff': 0.32; 'core': 0.34; 'maybe': 0.34; "i'd": 0.34; "can't": 0.35; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'subject:?': 0.36; 'being': 0.38; 'depends': 0.38; 'nov': 0.38; 'that,': 0.38; 'itself': 0.39; 'eventually': 0.60; 'solve': 0.60; '26,': 0.68; '2014,': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=grFqiUr5CMmP+KnakjWPiThA6jsR4L1UKErjrva6o3o=; b=JcSAcynGRBDZGWoObLs8HzSOiLNRDb9am04ghcDCaWcQlk/R5yCllrf+shWvCTB7Di TvyjcNpDrvs6D3MJzsOJYMnGny+4sYHhna8li6WZx+XBDDLyJs92iGNBE/LY3k8RDv4T Rfq17hDt3f6JXQu9IkJ/6SlaWQIjpLTcn1pixwUx9nGlquOJn+Cb32920Ntmr8or+975 NUoYWTEMz3j9t8Zj2Oj5aO02BkukfqO+/y1pNet0BvUmAcdpnAYvYkoZYbjk+l4S9MB9 jclfAoCkeHHIx0rlajIpNmTRN/64ZjzAj1+cqMpDFVB+cqqdVLd0/wNdaGD0ZdwvgX/R 7SzQ== MIME-Version: 1.0 X-Received: by 10.107.134.39 with SMTP id i39mr29349207iod.53.1417012828655; Wed, 26 Nov 2014 06:40:28 -0800 (PST) In-Reply-To: <1417010748.2940071.195658861.2859C26B@webmail.messagingengine.com> References: <1b49aa55-ba5f-4e70-8ddb-ae5dea3a40da@googlegroups.com> <1417010748.2940071.195658861.2859C26B@webmail.messagingengine.com> Date: Thu, 27 Nov 2014 01:40:28 +1100 Subject: Re: bug or feature in enum34 py2.7 backport? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417012836 news.xs4all.nl 2943 [2001:888:2000:d::a6]:47426 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81570 On Thu, Nov 27, 2014 at 1:05 AM, wrote: > On Wed, Nov 26, 2014, at 06:29, Mark Summerfield wrote: >> TypeError: type() argument 1 must be string, not unicode > > If this is a bug, maybe it is one in type() itself - I get the same > error with type('X', (object,), dict(a=1)) I'd say that's a limitation, not a bug. A lot of stuff in Python 2 depends on identifiers being ASCII-only byte strings, including - apparently - parts of the core code. Suggestion: Switch to Python 3, or if you can't do that, pass your identifiers through str(). When you do eventually switch to Py3, that won't do anything, but in Py2, it'll force them to be byte strings. As long as they are actually ASCII-only, that'll solve your problem. ChrisA