Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87435
| Path | csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'literal': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'bug': 0.12; '%d,': 0.16; '(pdb)': 0.16; '2:28': 0.16; 'garbage': 0.16; 'pdb': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sorts': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'module': 0.19; 'normally': 0.19; 'things.': 0.19; 'seems': 0.21; 'import': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; '15,': 0.26; 'compare': 0.26; 'extension': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'getting': 0.31; 'checking.': 0.31; 'os,': 0.31; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'two': 0.37; 'to:addr:python-list': 0.38; 'generating': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'eventually': 0.60; 'then,': 0.60; 'wonderful': 0.60; 'break': 0.61; "you're": 0.61; 'happen': 0.63; 'taking': 0.65; 'worth': 0.66; 'mar': 0.68; 'invalid': 0.68; 'completion': 0.78; '10:': 0.84; '2015': 0.84; 'condition.': 0.84; 'received:pacbell.net': 0.84; 'absolutely': 0.87; 'crucial': 0.91; '***': 0.95 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | emile <emile@fenx.com> |
| Subject | Re: Odd ValueError using float |
| Date | Sat, 14 Mar 2015 10:17:57 -0700 |
| References | <mailman.336.1426284641.21433.python-list@python.org> <877fuk71fz.fsf@nightsong.com> <CAPTjJmoxL0ux3mHAd8UCZmdbTHe_Yz5i9Y8XrzJ7NAuy8WZ4sA@mail.gmail.com> <me1k2i$ljt$1@ger.gmane.org> <CAPTjJmqTmcGx9enEG=nT7vz67qZ=xA0VZW1ppgp0xAGexLSJ3A@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-69-226-129-65.dsl.pltn13.pacbell.net |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
| In-Reply-To | <CAPTjJmqTmcGx9enEG=nT7vz67qZ=xA0VZW1ppgp0xAGexLSJ3A@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.19 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.364.1426353497.21433.python-list@python.org> (permalink) |
| Lines | 55 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1426353497 news.xs4all.nl 2844 [2001:888:2000:d::a6]:34729 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:87435 |
Show key headers only | View raw
On 03/14/2015 08:52 AM, Chris Angelico wrote:
> On Sun, Mar 15, 2015 at 2:28 AM, emile <emile@fenx.com> wrote:
>> It ran almost to completion before generating the error again --
>>
>> (Pdb) decval
>> '4'
>> (Pdb) type(decval)
>> <type 'str'>
>> (Pdb) len(decval)
>> 1
>> (Pdb) int(decval)
>> *** ValueError: invalid literal for int() with base 10: '41.700000000000003'
>>
>> So there's still something amiss.
>
> Compare these two lines' outputs:
>
> print("str %d, int %d" % (id(str), id(int)))
> print("str %d, int %d" % (id(type("")), id(type(0)))
>
(Pdb) print("str %d, int %d" % (id(str), id(int)))
str 505366496, int 505399904
(Pdb) print("str %d, int %d" % (id(type("")), id(type(0))))
str 505366496, int 505399904
> Any difference in id would indicate that the names have been shadowed
> - seems unlikely, but worth checking. And then, just to be absolutely
> sure:
>
> type(decval) is type("")
(Pdb) type(decval) is type("")
True
> There is another, and very nasty, possibility. If you're working with
> a C extension that has a refcount bug in it, all sorts of bizarre
> things can happen - crucial type objects getting garbage collected,
> objects getting disposed of and others taking their places, all kinds
> of weird and wonderful things. Normally that'll eventually cause a
> crash, but who knows...
Here're the imports:
import os, time, re, shutil, subprocess
from fenx.BBxXlate.bbxfile import BBxFile # a pure python module
from fenx import RealPyOdbc2
and of course, pdb when I break for the error condition.
Emile
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Odd ValueError using float emile <emile@fenx.com> - 2015-03-13 15:10 -0700
Re: Odd ValueError using float Paul Rubin <no.email@nospam.invalid> - 2015-03-13 19:33 -0700
Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-14 14:09 +1100
Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 08:28 -0700
Re: Odd ValueError using float Chris Angelico <rosuav@gmail.com> - 2015-03-15 02:52 +1100
Re: Odd ValueError using float Peter Otten <__peter__@web.de> - 2015-03-14 17:08 +0100
Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 10:08 -0700
Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 10:17 -0700
Re: Odd ValueError using float Peter Otten <__peter__@web.de> - 2015-03-14 19:24 +0100
Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-14 13:01 -0700
Re: Odd ValueError using float Peter Otten <__peter__@web.de> - 2015-03-15 15:01 +0100
Re: Odd ValueError using float emile <emile@fenx.com> - 2015-03-17 13:48 -0700
csiph-web